Boltzmann entropy, ground states, and the canonical (Gibbs) entropy of a finite system
DefinitionThirdLawThermo_DefsThroughout, denotes the Boltzmann constant (a real parameter; the theorems assume ).
- Boltzmann entropy. For a macrostate realised by microstates,
-
A finite system and its ground states. A system has a finite, nonempty set of microstates; microstate has energy . The ground-state energy is , and the ground states are the microstates ; the number is the ground-state degeneracy.
-
Canonical (Gibbs) equilibrium at temperature . The partition function, the Gibbs probabilities and the Gibbs entropy are
These are the objects in which the statistical-mechanics form of the third law is stated: the entropy of a system at zero temperature is determined by the degeneracy of its ground state.
Formalization Note Lean's conventions and make the formulas total. At the exponent evaluates to , so the value of in Lean is the junk value ; every theorem of the mission therefore only uses for , through the one-sided limit . The ground-state set uses classical decidability of equality of reals.
import Mathlib
namespace ThirdLawThermo
/-- The Boltzmann entropy `S = k_B ln W` of a macrostate realised by `W` microstates, where `kB`
is the Boltzmann constant. -/
noncomputable def boltzmannEntropy (kB : ℝ) (W : ℕ) : ℝ := kB * Real.log W
variable {ι : Type*} [Fintype ι]
/-- The ground-state energy of a system with finitely many (and at least one) microstates
`i : ι` of energies `E i`: the minimum of the energies. -/
noncomputable def groundEnergy [Nonempty ι] (E : ι → ℝ) : ℝ :=
Finset.univ.inf' Finset.univ_nonempty E
/-- The set of ground states: the microstates whose energy equals the ground-state energy. -/
noncomputable def groundStates [Nonempty ι] (E : ι → ℝ) : Finset ι :=
open Classical in Finset.univ.filter fun i => E i = groundEnergy E
/-- The canonical partition function `Z(T) = ∑ᵢ exp (-Eᵢ / (k_B T))` at temperature `T`. -/
noncomputable def partitionFunction (kB : ℝ) (E : ι → ℝ) (T : ℝ) : ℝ :=
∑ i, Real.exp (-E i / (kB * T))
/-- The Gibbs (canonical) probability `pᵢ(T) = exp (-Eᵢ / (k_B T)) / Z(T)` of microstate `i`
at temperature `T`. -/
noncomputable def gibbsProb (kB : ℝ) (E : ι → ℝ) (T : ℝ) (i : ι) : ℝ :=
Real.exp (-E i / (kB * T)) / partitionFunction kB E T
/-- The Gibbs entropy `S(T) = -k_B ∑ᵢ pᵢ(T) ln pᵢ(T)` of the canonical equilibrium state at
temperature `T`. -/
noncomputable def gibbsEntropy (kB : ℝ) (E : ι → ℝ) (T : ℝ) : ℝ :=
-kB * ∑ i, gibbsProb kB E T i * Real.log (gibbsProb kB E T i)
end ThirdLawThermo
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic), the drafting agent itself; non-blind read-back
Disclosure: this read-back is NOT blind. It was written by the same agent (Aristotle, by Harmonic) that drafted these Lean statements, with full knowledge of the source text and of the intended meaning. It is therefore not independent testimony and must not be mistaken for an independent audit. Reviewers should check the Lean code against the source themselves.
The file introduces, inside a namespace, the following real-valued definitions; nothing is assumed about the parameters inside the definitions themselves.
-
For a real number and a natural number : , where is viewed as a real number and is the real logarithm with the convention (so and ).
-
For a finite type that is nonempty and a function : the number (minimum over all elements of ), and the finite set , which is always nonempty because the minimum is attained.
-
For a finite type (possibly empty here), reals , and :
Division by zero is and of a non-positive number is (in particular ). When each exponent is , every exponential equals , , and . No sign condition on or is built into the definitions.