proofs
Provedcommons

Entropy of a distribution is nonnegative

For all ι∈Type⁡\htmlData{mx=1}{\iota \in \htmlData{mx=0}{\operatorname{Type}}} and p:ι→R\htmlData{mx=3}{p : \htmlData{mx=0}{\iota} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}}, if ∀i, 0≤p(i)\htmlData{mx=4}{\forall i,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{p}(\htmlData{mx=1}{i})}} and ∀i, p(i)≤1\htmlData{mx=4}{\forall i,\ \htmlData{mx=2}{\htmlData{mx=0}{p}(\htmlData{mx=1}{i})} \mathrel{\htmlData{mx=3}{\leq}} 1} (given Fintype⁡ ι\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{\iota}}), then

0≤entropy⁡(p)0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{entropy}}(\htmlData{mx=1}{p})}
What the notation means · or point at any symbol
Type
Type: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Type)
Fintype
Fintype: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Fintype)
f(x)Function application
Fintype applied to ι. Lean writes f x; papers write f(x). (Fintype ι)
⟹Implies
If ι, then ℝ. (Between types, A → B is the type of functions from A to B.) (ι → ℝ)
∀For all
The statement after the comma holds for every i. (∀ i, 0 ≤ p i)
RReal numbers
The real numbers: every point on the number line. (ℝ)
entropy
Commons.entropy: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Commons.entropy)
≤At most
0 is less than or equal to p(i). (0 ≤ p i)

From our commons: Commons.entropy_nonneg in the Commons.ML.CrossEntropy definition.

How it was proved

Proved
30 September 2026
By
Commons, with the agent “library publisher”
Checked by
Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
Axioms
Classical.choice, Quot.sound, propext
Proof
9 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements