Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Sample entropy H‾(xn)\overline{H}(x^n)H(xn) (Definition 14.2.1)

Definition
WildeQIT_sampleEntropy

by aadarwal · Sep 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

classical-informationinformation-theorytypicalitywilde-qit

Throughout Chapter 14 an information source emits nnn independent, identically distributed copies of a random variable XXX with distribution pXp_XpX​ on a finite alphabet X\mathcal{X}X; a realization is a sequence xn=x1⋯xnx^n = x_1\cdots x_nxn=x1​⋯xn​ (Lean: Fin n → α), with pXn(xn)=∏i=1npX(xi)p_{X^n}(x^n) = \prod_{i=1}^n p_X(x_i)pXn​(xn)=∏i=1n​pX​(xi​). Entropies are in bits.

Definition 14.2.1 (Sample entropy). The sample entropy H‾(xn)\overline{H}(x^n)H(xn) of a sequence xnx^nxn with respect to a probability distribution pX(x)p_X(x)pX​(x) is

H‾(xn)≡−1nlog⁡(pXn(xn)),pXn(xn)=∏i=1npX(xi).\overline{H}(x^n) \equiv -\frac{1}{n}\log\bigl(p_{X^n}(x^n)\bigr), \qquad p_{X^n}(x^n) = \prod_{i=1}^n p_X(x_i).H(xn)≡−n1​log(pXn​(xn)),pXn​(xn)=i=1∏n​pX​(xi​).

The sample entropy is the empirical counterpart of H(X)H(X)H(X): by the law of large numbers it concentrates around H(X)H(X)H(X), which is the origin of typicality.

Formalization Note. WildeQIT.sampleEntropy p x = -(1/n) * Real.logb 2 ((p.iid n).prob x); for n=0n = 0n=0 Lean's 1/0=01/0 = 01/0=0 makes it 000, and for a sequence of probability 000 the value is 000 (Real.logb 2 0 = 0) rather than +∞+\infty+∞.

Definition code
import Definitions.Def_WildeQIT_iid
import Definitions.Def_WildeQIT_entropy

/-!
Wilde, *Quantum Information Theory* (2nd ed.), Definition 14.2.1 (Sample entropy):
`H̄(xⁿ) ≡ -(1/n) log p_{Xⁿ}(xⁿ)`, where `p_{Xⁿ}(xⁿ) = ∏ᵢ p_X(xᵢ)`; logarithm base 2.
-/

namespace WildeQIT

/-- Definition 14.2.1. The sample entropy of the sequence `x` with respect to `p`:
`H̄(x) = -(1/n) log₂ (∏ᵢ p(xᵢ))`. -/
noncomputable def sampleEntropy {α : Type} [Fintype α] (p : FinDist α) {n : ℕ} (x : Fin n → α) : ℝ :=
  -(1 / (n : ℝ)) * Real.logb 2 ((p.iid n).prob x)

end WildeQIT
Source
Wilde, Quantum Information Theory 2nd ed. (Cambridge 2017; arXiv:1106.1445v8), Definition 14.2.1, §Weak Typicality (roster-items.csv line 25003).

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