Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Chapter SoftmaxOrder

Definition
ChapterSoftmaxOrder

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

definitionsformalizationtimepiece

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

Definition code
import Definitions.Def_ChapterSoftmaxSharpness
import Definitions.Def_ChapterSoftmaxBorn
import Mathlib

/-!
# Chapter "The Coherent State of Attention": the order structure of Softmax

`ChapterSoftmaxSharpness` describes the two *extremes* of the Softmax family — the
uniform distribution at infinite temperature and the winner-takes-all limit at zero
temperature.  In between, the chapter's reading of Softmax as a *measurement* rests
on two structural facts that this module proves.

* `scoreSoftmax_shift` — **gauge invariance.**  Adding a constant to every score
  leaves the distribution unchanged: only score *differences* are physical.  This
  is the abstract form of the cancellation of the query penalty `exp(-‖q‖²)` in
  `coherentBorn_cancel_q`.
* `scoreSoftmax_le_iff` / `scoreSoftmax_lt_iff` / `scoreSoftmax_inj_iff` — at any
  positive inverse temperature, Softmax is a strictly increasing reparametrization
  of the scores: it *reorders nothing*.  Hence `scoreSoftmax_argmax`: the maximizer
  of the scores is the maximizer of the attention weights, at every temperature.
* `scoreSoftmax_const` — a flat score profile gives the uniform distribution at
  every temperature, so sharpening requires genuine score contrast.

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

end BookProof.ChapterSoftmaxOrder
Source
https://github.com/leonardopedro/timepiece/blob/61595bc/BookProof/ChapterSoftmaxOrder.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