Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Chapter LogPartitionConvex

Definition
ChapterLogPartitionConvex

by leonardopedro · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

definitionsformalizationtimepiece

Formal definitions for the timepiece Lean 4 formalization (source chapter BookProof/ChapterLogPartitionConvex.lean): generated def bundle for ChapterLogPartitionConvex. See BookProof/ChapterLogPartitionConvex.lean for full context.

Definition code
import Definitions.Def_ChapterSoftmaxDivergence
import Definitions.Def_ChapterAttentionEntropy
import Definitions.Def_ChapterSoftmaxSharpness
import Mathlib

/-!
# Chapter "The Coherent State of Attention" — convexity of the free energy

The log-partition function `log Z(β) = log ∑ⱼ exp (β sⱼ)` of an attention head is
the generating function of the attention statistics: its first derivative is the
mean score and its second derivative is the score variance
(`ChapterSoftmaxFluctuation`).  Because the variance is nonnegative, `log Z` is a
**convex** function of the inverse temperature, and strictly convex as soon as two
alignment scores differ.

* `hasDerivAt_deriv_logPartition` — the second derivative of `log Z` is `Var_β(s)`;
* `convexOn_logPartition` — **the headline**: `β ↦ log Z(β)` is convex on `ℝ`;
* `strictConvexOn_logPartition` — strict convexity when two scores differ;
* `logPartition_isGreatest` — the variational (Legendre) description: `log Z(β)`
  is the *largest* value of `β⟨s⟩_p + H(p)` over probability vectors `p`, attained
  at the Softmax distribution.

Everything here is `sorry`-free and `axiom`-free (only `propext`,
`Classical.choice`, `Quot.sound`).
-/
namespace BookProof.ChapterLogPartitionConvex

end BookProof.ChapterLogPartitionConvex
Source
https://github.com/leonardopedro/timepiece/blob/61595bc/BookProof/ChapterLogPartitionConvex.lean

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me