partitionFunction
plain-language theorem explainer
The partition function Z for a discrete system is defined at positive temperature T as the finite sum over energy levels of degeneracy times the Boltzmann factor exp(-beta(T) * energy). Researchers working on thermodynamic potentials or variational free energy in Recognition Science would cite this when extracting free energy or entropy from ledger-derived energies. The definition is realized by direct summation over the Fin-indexed levels with real casting of the degeneracy values.
Claim. For a discrete system sys with n levels, energies E_i and degeneracies g_i, the partition function at temperature T > 0 is Z = ∑_{i=0}^{n-1} g_i exp(-β(T) E_i), where β is the inverse-temperature map.
background
Module THERMO-002 derives the partition function from the RS ledger as a sum over configurations weighted by J-cost. DiscreteSystem is the structure carrying numLevels : ℕ (with nonempty proof), energy : Fin numLevels → ℝ, and degeneracy : Fin numLevels → ℕ (each ≥ 1). The supplied beta T hT furnishes the inverse temperature for the exponential weight. This sits inside the standard statistical-mechanics dictionary that recovers free energy F = -kT ln Z, average energy, and entropy from Z.
proof idea
The definition is the explicit sum ∑ i : Fin sys.numLevels, (sys.degeneracy i : ℝ) * exp (-beta T hT * sys.energy i). It is a direct one-line wrapper that iterates the finite index set and assembles the weighted Boltzmann factors.
why it matters
This supplies the central Z object that downstream definitions in BoltzmannDistribution (averageEnergy, entropy, freeEnergy, partition_ge_ground) and the variational-free-energy theorem boltzmann_minimizes_vfe all invoke. It completes the THERMO-002 target by making the ledger-sum concrete, linking J-cost energies to the thermodynamic potentials that follow from the Recognition Composition Law and the eight-tick octave.
Switch to Lean above to see the machine-checked source, dependencies, and usage graph.