Imports
/- Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Matteo Cipollina, Joseph Tooby-Smith -/ module public import Mathlib.MeasureTheory.Integral.Prod public import Physlib.Thermodynamics.Temperature.Basic

Canonical Ensemble: Core Definitions

A canonical ensemble describes a system in thermal equilibrium with a heat bath at fixed temperature T. This file gives a measure–theoretic, semi–classical formalization intended to work uniformly for discrete (counting measure) and continuous (Lebesgue–type) models.

1. Semi–Classical Normalization

Classical phase–space integrals produce dimensionful quantities. To obtain dimensionless thermodynamic objects (and an absolute entropy) we introduce:

    phaseSpaceUnit : ℝ (physically Planck's constant h);

    dof : ℕ the number of degrees of freedom.

The physical partition function is obtained from the mathematical one by dividing by phaseSpaceUnit ^ dof. This yields the standard semi–classical correction preventing ambiguities such as the Gibbs paradox.

2. Mathematical vs Physical Quantities

We keep both layers:

    Mathematical / raw:

      mathematicalPartitionFunction (T) : ∫ exp(-β E) dμ

      probability (density w.r.t. μ)

      differentialEntropy (can be negative, unit–dependent)

    Physical / dimensionless:

      partitionFunction : Z = Z_math / h^dof

      physicalProbability : dimensionless density

      helmholtzFreeEnergy : F = -kB T log Z

      thermodynamicEntropy : absolute entropy (U - F)/T = -kB ∫ ρ_phys log ρ_phys

Each physical quantity is expressed explicitly in terms of its mathematical ancestor.

3. Core Structure

We assume phaseSpaceUnit > 0 and μ σ–finite. No probability assumption is imposed: normalization is recovered via the Boltzmann weighted measure.

4. Boltzmann & Probability Measures

    μBolt T : Boltzmann (unnormalized) measure withDensity exp(-β E)

    μProd T : normalized probability measure (rescaled μBolt T)

    probability T i : the density exp(-β E(i)) / Z_math

    physicalProbability : probability * (phase_space_unit ^ dof)

5. Energies & Entropies

    meanEnergy : expectation of energy under μProd.

    differentialEntropy : -kB ∫ log(probability) dμProd

    thermodynamicEntropy : -kB ∫ log(physicalProbability) dμProd (proved later to coincide with the textbook (U - F)/T).

A helper lemma supplies positivity of the partition function under mild assumptions and non–negativity criteria for the entropy when probability ≤ 1 (automatic in finite discrete settings, not in general continuous ones).

6. Algebraic Operations

We construct composite ensembles:

    Addition (𝓒₁ + 𝓒₂) on product microstates: energies add, measures take product, degrees of freedom add, and (physically) the same phaseSpaceUnit is reused.

    Multiplicity nsmul n 𝓒: n distinguishable, non–interacting copies (product of n copies).

    Transport along measurable equivalences via congr.

These operations respect partition functions, free energies, and (under suitable hypotheses) mean energies and integrability.

7. Notational & Implementation Notes

    We work over an arbitrary measurable type ι, allowing both finite and continuous models.

    β is accessed through the Temperature structure (T.β).

    Most positivity / finiteness conditions are hypotheses on lemmas instead of global axioms, enabling reuse in formal derivations of fluctuation and response identities.

8. References

    L. D. Landau & E. M. Lifshitz, Statistical Physics, Part 1.

    D. Tong, Cambridge Lecture Notes (sections on canonical ensemble).

      https://www.damtp.cam.ac.uk/user/tong/statphys/one.pdf

      https://www.damtp.cam.ac.uk/user/tong/statphys/two.pdf

9. Roadmap

Subsequent files (Lemmas.lean) prove:

    Relations among entropies and free energies.

    Fundamental identity F = U - T S.

    Derivative (response) formulas: U = -∂_β log Z.

@[expose] public section

A Canonical ensemble is described by a type ι, corresponding to the type of microstates, and a map ι → ℝ which associates which each microstate an energy and physical constants needed to define dimensionless thermodynamic quantities.

The energy of associated with a microstate of the canonical ensemble.

The number of degrees of freedom, used to make the partition function dimensionless. For a classical system of N particles in 3D, this is 3N. For a system of N spins, this is typically 0 as the state space is already discrete.

The unit of action used to make the phase space volume dimensionless. This constant is necessary to define an absolute (rather than relative) thermodynamic entropy. In the semi-classical approach, this unit is identified with Planck's constant h. For discrete systems with a counting measure, this unit should be set to 1.

Assumption that the phase space unit is positive.

The measure on the indexing set of microstates.

structure CanonicalEnsemble (ι : Type) [MeasurableSpace ι] : Type where energy : ι dof : phaseSpaceunit : := 1 hPos : 0 < phaseSpaceunit := by positivity energy_measurable : Measurable energy μ : MeasureTheory.Measure ι := by volume_tac [μ_sigmaFinite : SigmaFinite μ]
instance : SigmaFinite 𝓒.μ := 𝓒.μ_sigmaFinite@[ext] lemma ext {𝓒 𝓒' : CanonicalEnsemble ι} (h_energy : 𝓒.energy = 𝓒'.energy) (h_dof : 𝓒.dof = 𝓒'.dof) (h_h : 𝓒.phaseSpaceunit = 𝓒'.phaseSpaceunit) (h_μ : 𝓒.μ = 𝓒'.μ) : 𝓒 = 𝓒' := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ι𝓒':CanonicalEnsemble ιh_energy:𝓒.energy = 𝓒'.energyh_dof:𝓒.dof = 𝓒'.dofh_h:𝓒.phaseSpaceunit = 𝓒'.phaseSpaceunith_μ:𝓒.μ = 𝓒'.μ𝓒 = 𝓒' ι:Typeinst✝:MeasurableSpace ι𝓒':CanonicalEnsemble ιenergy✝:ι dof✝:phaseSpaceunit✝:hPos✝:0 < phaseSpaceunit✝energy_measurable✝:Measurable energy✝μ✝:Measure ιμ_sigmaFinite✝:SigmaFinite μ✝h_energy:{ energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.energy = 𝓒'.energyh_dof:{ energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.dof = 𝓒'.dofh_h:{ energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.phaseSpaceunit = 𝓒'.phaseSpaceunith_μ:{ energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.μ = 𝓒'.μ{ energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ } = 𝓒'; ι:Typeinst✝:MeasurableSpace ιenergy✝¹:ι dof✝¹:phaseSpaceunit✝¹:hPos✝¹:0 < phaseSpaceunit✝energy_measurable✝¹:Measurable energy✝μ✝¹:Measure ιμ_sigmaFinite✝¹:SigmaFinite μ✝energy✝:ι dof✝:phaseSpaceunit✝:hPos✝:0 < phaseSpaceunit✝energy_measurable✝:Measurable energy✝μ✝:Measure ιμ_sigmaFinite✝:SigmaFinite μ✝h_energy:{ energy := energy✝¹, dof := dof✝¹, phaseSpaceunit := phaseSpaceunit✝¹, hPos := hPos✝¹, energy_measurable := energy_measurable✝¹, μ := μ✝¹, μ_sigmaFinite := μ_sigmaFinite✝¹ }.energy = { energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.energyh_dof:{ energy := energy✝¹, dof := dof✝¹, phaseSpaceunit := phaseSpaceunit✝¹, hPos := hPos✝¹, energy_measurable := energy_measurable✝¹, μ := μ✝¹, μ_sigmaFinite := μ_sigmaFinite✝¹ }.dof = { energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.dofh_h:{ energy := energy✝¹, dof := dof✝¹, phaseSpaceunit := phaseSpaceunit✝¹, hPos := hPos✝¹, energy_measurable := energy_measurable✝¹, μ := μ✝¹, μ_sigmaFinite := μ_sigmaFinite✝¹ }.phaseSpaceunit = { energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.phaseSpaceunith_μ:{ energy := energy✝¹, dof := dof✝¹, phaseSpaceunit := phaseSpaceunit✝¹, hPos := hPos✝¹, energy_measurable := energy_measurable✝¹, μ := μ✝¹, μ_sigmaFinite := μ_sigmaFinite✝¹ }.μ = { energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }.μ{ energy := energy✝¹, dof := dof✝¹, phaseSpaceunit := phaseSpaceunit✝¹, hPos := hPos✝¹, energy_measurable := energy_measurable✝¹, μ := μ✝¹, μ_sigmaFinite := μ_sigmaFinite✝¹ } = { energy := energy✝, dof := dof✝, phaseSpaceunit := phaseSpaceunit✝, hPos := hPos✝, energy_measurable := energy_measurable✝, μ := μ✝, μ_sigmaFinite := μ_sigmaFinite✝ }; All goals completed! 🐙@[fun_prop] lemma energy_measurable' : Measurable 𝓒.energy := 𝓒.energy_measurable

The canonical ensemble with no microstates.

def empty : CanonicalEnsemble Empty where energy := isEmptyElim dof := 0 μ := 0 energy_measurable := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1Measurable fun a => isEmptyElim a All goals completed! 🐙
@[simp] lemma congr_energy_comp_symmm (e : ι1 ≃ᵐ ι) : (𝓒.congr e).energy e.symm = 𝓒.energy := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ι(𝓒.congr e).energy e.symm = 𝓒.energy All goals completed! 🐙

The microstates of a canonical ensemble.

set_option linter.unusedVariables false in@[nolint unusedArguments] abbrev microstates (𝓒 : CanonicalEnsemble ι) : Type := ι

Properties of physical parameters

@[simp] lemma dof_add (𝓒1 : CanonicalEnsemble ι) (𝓒2 : CanonicalEnsemble ι1) : (𝓒1 + 𝓒2).dof = 𝓒1.dof + 𝓒2.dof := rfl@[simp] lemma phase_space_unit_add (𝓒1 : CanonicalEnsemble ι) (𝓒2 : CanonicalEnsemble ι1) : (𝓒1 + 𝓒2).phaseSpaceunit = 𝓒1.phaseSpaceunit := rfl@[simp] lemma dof_nsmul (n : ) : (nsmul n 𝓒).dof = n * 𝓒.dof := rfl@[simp] lemma phase_space_unit_nsmul (n : ) : (nsmul n 𝓒).phaseSpaceunit = 𝓒.phaseSpaceunit := rfl@[simp] lemma dof_congr (e : ι1 ≃ᵐ ι) : (𝓒.congr e).dof = 𝓒.dof := rfl@[simp] lemma phase_space_unit_congr (e : ι1 ≃ᵐ ι) : (𝓒.congr e).phaseSpaceunit = 𝓒.phaseSpaceunit := rfl

The measure

lemma μ_add : (𝓒 + 𝓒1).μ = 𝓒.μ.prod 𝓒1.μ := rfllemma μ_nsmul (n : ) : (nsmul n 𝓒).μ = MeasureTheory.Measure.pi fun _ => 𝓒.μ := rfllemma μ_nsmul_zero_eq : (nsmul 0 𝓒).μ = Measure.pi (fun _ => 0) := congrArg Measure.pi (Subsingleton.elim _ _)

The energy of the microstates

@[simp] lemma energy_add_apply (i : microstates (𝓒 + 𝓒1)) : (𝓒 + 𝓒1).energy i = 𝓒.energy i.1 + 𝓒1.energy i.2 := rfl@[simp] lemma energy_nsmul_apply (n : ) (f : Fin n microstates 𝓒) : (nsmul n 𝓒).energy f = i, 𝓒.energy (f i) := rfl@[simp] lemma energy_congr_apply (e : ι1 ≃ᵐ ι) (i : ι1) : (𝓒.congr e).energy i = 𝓒.energy (e i) := rfl

Induction for nsmul

lemma nsmul_succ (n : ) [SigmaFinite 𝓒.μ] : nsmul n.succ 𝓒 = (𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun _ => ι) 0) := ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μnsmul n.succ 𝓒 = (𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0) ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).energy = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).energyι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).dof = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).dofι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).phaseSpaceunit = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).phaseSpaceunitι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).μ = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).μ ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).energy = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).energy All goals completed! 🐙 ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).dof = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).dof All goals completed! 🐙 ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).phaseSpaceunit = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).phaseSpaceunit All goals completed! 🐙 ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:inst✝:SigmaFinite 𝓒.μ(nsmul n.succ 𝓒).μ = ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).μ All goals completed! 🐙

Non zero nature of the measure

ι:Typeι1:Typeinst✝³:MeasurableSpace ιinst✝²:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1inst✝¹:NeZero 𝓒.μinst✝:NeZero 𝓒1.μ𝓒.μ Set.univ * 𝓒1.μ Set.univ 0 All goals completed! 🐙instance μ_neZero_congr [NeZero 𝓒.μ] (e : ι1 ≃ᵐ ι) : NeZero (𝓒.congr e).μ := (Measure.map_ne_zero_iff e.symm.measurable.aemeasurable).mpr (NeZero.ne _)ι:Typeι1:Typeinst✝²:MeasurableSpace ιinst✝¹:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1inst✝:NeZero 𝓒.μn: i, 𝓒.μ Set.univ 0 All goals completed! 🐙

The Boltzmann measure

instance (T : Temperature) : SigmaFinite (𝓒.μBolt T) := inferInstanceAs (SigmaFinite (𝓒.μ.withDensity (fun i => ENNReal.ofReal (exp (- β T * 𝓒.energy i)))))ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperaturei:ι × ι1ENNReal.ofReal (rexp (-T.β * (𝓒 + 𝓒1).energy i)) = ENNReal.ofReal (rexp (-T.β * 𝓒.energy i.1 + -T.β * 𝓒1.energy i.2)) All goals completed! 🐙 ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:TemperatureMeasurable fun i => ENNReal.ofReal (rexp (-T.β * 𝓒.energy i)) All goals completed! 🐙 ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:TemperatureMeasurable fun i => ENNReal.ofReal (rexp (-T.β * 𝓒1.energy i)) All goals completed! 🐙ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φ∫⁻ (a : ι), ((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy (e i))))) * φ) (e.symm a) 𝓒.μ = ∫⁻ (a : ι), ((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy i)))) * fun a => φ (e.symm a)) a 𝓒.μι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φAEMeasurable (fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy i)))) 𝓒.μι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φAEMeasurable (fun a => φ (e.symm a)) 𝓒.μι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φMeasurable φι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φMeasurable e.symmι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φMeasurable ((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy (e i))))) * φ)ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φMeasurable e.symmι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φAEMeasurable (fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy (e i))))) (Measure.map (⇑e.symm) 𝓒.μ)ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φAEMeasurable φ (Measure.map (⇑e.symm) 𝓒.μ) ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φ∫⁻ (a : ι), ((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy (e i))))) * φ) (e.symm a) 𝓒.μ = ∫⁻ (a : ι), ((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy i)))) * fun a => φ (e.symm a)) a 𝓒.μ ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperatureφ:ι1 ENNReal:Measurable φi:ι((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy (e i))))) * φ) (e.symm i) = ((fun i => ENNReal.ofReal (rexp (-(T.β * 𝓒.energy i)))) * fun a => φ (e.symm a)) i All goals completed! 🐙 all_goals All goals completed! 🐙ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιinst✝:SigmaFinite 𝓒.μT:Temperaturen:ih:(nsmul n 𝓒).μBolt T = Measure.pi fun x => 𝓒.μBolt TMeasure.map (⇑(MeasurableEquiv.piFinSuccAbove (fun x => ι) 0).symm) ((𝓒.μBolt T).prod (Measure.pi fun x => 𝓒.μBolt T)) = Measure.pi fun x => 𝓒.μBolt T All goals completed! 🐙ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.μ 0hm:AEMeasurable (fun i => ENNReal.ofReal (rexp (-T.β * 𝓒.energy i))) 𝓒.μ¬𝓒.μ {a | ¬ENNReal.ofReal (rexp (-T.β * 𝓒.energy a)) = 0 a} = 0 All goals completed! 🐙instance (T : Temperature) [NeZero 𝓒.μ] : NeZero (𝓒.μBolt T) := ι:Typeι1:Typeinst✝²:MeasurableSpace ιinst✝¹:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝:NeZero 𝓒.μNeZero (𝓒.μBolt T) ι:Typeι1:Typeinst✝²:MeasurableSpace ιinst✝¹:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝:NeZero 𝓒.μ𝓒.μBolt T 0 ι:Typeι1:Typeinst✝²:MeasurableSpace ιinst✝¹:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝:NeZero 𝓒.μ𝓒.μ 0 All goals completed! 🐙instance (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [IsFiniteMeasure (𝓒1.μBolt T)] : IsFiniteMeasure ((𝓒 + 𝓒1).μBolt T) := ι:Typeι1:Typeinst✝³:MeasurableSpace ιinst✝²:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:IsFiniteMeasure (𝓒1.μBolt T)IsFiniteMeasure ((𝓒 + 𝓒1).μBolt T) ι:Typeι1:Typeinst✝³:MeasurableSpace ιinst✝²:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:IsFiniteMeasure (𝓒1.μBolt T)IsFiniteMeasure ((𝓒.μBolt T).prod (𝓒1.μBolt T)); All goals completed! 🐙instance (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] (n : ) : IsFiniteMeasure ((nsmul n 𝓒).μBolt T) := ι:Typeι1:Typeinst✝²:MeasurableSpace ιinst✝¹:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)n:IsFiniteMeasure ((nsmul n 𝓒).μBolt T) ι:Typeι1:Typeinst✝²:MeasurableSpace ιinst✝¹:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)n:IsFiniteMeasure (Measure.pi fun x => 𝓒.μBolt T); All goals completed! 🐙

The Mathematical Partition Function

ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperature (a : ι), (ENNReal.ofReal (rexp (-T.β * 𝓒.energy a))).toReal 𝓒.μ = (i : ι), rexp (-T.β * 𝓒.energy i) 𝓒.μι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:TemperatureAEMeasurable (fun x => ENNReal.ofReal (rexp (-T.β * 𝓒.energy x))) 𝓒.μι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperature∀ᵐ (x : ι) 𝓒.μ, ENNReal.ofReal (rexp (-T.β * 𝓒.energy x)) < ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperature (a : ι), (ENNReal.ofReal (rexp (-T.β * 𝓒.energy a))).toReal 𝓒.μ = (i : ι), rexp (-T.β * 𝓒.energy i) 𝓒.μ All goals completed! 🐙 ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:TemperatureAEMeasurable (fun x => ENNReal.ofReal (rexp (-T.β * 𝓒.energy x))) 𝓒.μ All goals completed! 🐙 ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperature∀ᵐ (x : ι) 𝓒.μ, ENNReal.ofReal (rexp (-T.β * 𝓒.energy x)) < All goals completed! 🐙All goals completed! 🐙@[simp] lemma mathematicalPartitionFunction_congr (e : ι1 ≃ᵐ ι) (T : Temperature) : (𝓒.congr e).mathematicalPartitionFunction T = 𝓒.mathematicalPartitionFunction T := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperature(𝓒.congr e).mathematicalPartitionFunction T = 𝓒.mathematicalPartitionFunction T All goals completed! 🐙

The mathematicalPartitionFunction_nsmul function of n copies of a canonical ensemble.

lemma mathematicalPartitionFunction_nsmul (n : ) (T : Temperature) : (nsmul n 𝓒).mathematicalPartitionFunction T = (𝓒.mathematicalPartitionFunction T) ^ n := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:T:Temperature(nsmul n 𝓒).mathematicalPartitionFunction T = 𝓒.mathematicalPartitionFunction T ^ n All goals completed! 🐙
lemma mathematicalPartitionFunction_nonneg (T : Temperature) : 0 𝓒.mathematicalPartitionFunction T := measureReal_nonnegι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)𝓒.μ ({x | ENNReal.ofReal (rexp (-T.β * 𝓒.energy x)) 0} Set.univ) = 0 𝓒.μ = 0ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)AEMeasurable (fun i => ENNReal.ofReal (rexp (-T.β * 𝓒.energy i))) 𝓒.μ ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)𝓒.μ ({x | ENNReal.ofReal (rexp (-T.β * 𝓒.energy x)) 0} Set.univ) = 0 𝓒.μ = 0 All goals completed! 🐙 ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)AEMeasurable (fun i => ENNReal.ofReal (rexp (-T.β * 𝓒.energy i))) 𝓒.μ All goals completed! 🐙lemma mathematicalPartitionFunction_comp_ofβ_apply (β : ℝ≥0) : 𝓒.mathematicalPartitionFunction (ofβ β) = (𝓒.μ.withDensity (fun i => ENNReal.ofReal (exp (- β * 𝓒.energy i)))).real Set.univ := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιβ:ℝ≥0𝓒.mathematicalPartitionFunction (ofβ β) = (𝓒.μ.withDensity fun i => ENNReal.ofReal (rexp (-β * 𝓒.energy i))).real Set.univ All goals completed! 🐙

The partition function is strictly positive provided the underlying measure is non-zero and the Boltzmann measure is finite.

lemma mathematicalPartitionFunction_pos (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] : 0 < 𝓒.mathematicalPartitionFunction T := ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μ0 < 𝓒.mathematicalPartitionFunction T All goals completed! 🐙

The probability density

The probability measure

lemma probability_add {T : Temperature} (i : ι × ι1) : (𝓒 + 𝓒1).probability T i = 𝓒.probability T i.1 * 𝓒1.probability T i.2 := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperaturei:ι × ι1(𝓒 + 𝓒1).probability T i = 𝓒.probability T i.1 * 𝓒1.probability T i.2 All goals completed! 🐙@[simp] lemma probability_congr (e : ι1 ≃ᵐ ι) (T : Temperature) (i : ι1) : (𝓒.congr e).probability T i = 𝓒.probability T (e i) := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperaturei:ι1(𝓒.congr e).probability T i = 𝓒.probability T (e i) All goals completed! 🐙ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperaturen:ih: (f : Fin n ι), (nsmul n 𝓒).probability T f = i, 𝓒.probability T (f i)f:Fin (n + 1) ι𝓒.probability T ((MeasurableEquiv.piFinSuccAbove (fun x => ι) 0) f).1 * (nsmul n 𝓒).probability T ((MeasurableEquiv.piFinSuccAbove (fun x => ι) 0) f).2 = i, 𝓒.probability T (f i) ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperaturen:ih: (f : Fin n ι), (nsmul n 𝓒).probability T f = i, 𝓒.probability T (f i)f:Fin (n + 1) ι𝓒.probability T (f 0) * i, 𝓒.probability T (Fin.tail f i) = i, 𝓒.probability T (f i) All goals completed! 🐙instance (T : Temperature) : SigmaFinite (𝓒.μProd T) := inferInstanceAs (SigmaFinite ((𝓒.μBolt T Set.univ)⁻¹ 𝓒.μBolt T))instance (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] : IsProbabilityMeasure (𝓒.μProd T) := inferInstanceAs <| IsProbabilityMeasure ((𝓒.μBolt T Set.univ)⁻¹ 𝓒.μBolt T)instance {T} : IsFiniteMeasure (𝓒.μProd T) := inferInstanceAs (IsFiniteMeasure ((𝓒.μBolt T Set.univ)⁻¹ 𝓒.μBolt T))All goals completed! 🐙All goals completed! 🐙ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)n:ih:(nsmul n 𝓒).μProd T = Measure.pi fun x => 𝓒.μProd TMeasure.map (⇑(MeasurableEquiv.piFinSuccAbove (fun x => ι) 0).symm) ((𝓒.μProd T).prod (Measure.pi fun x => 𝓒.μProd T)) = Measure.pi fun x => 𝓒.μProd T All goals completed! 🐙

Integrability of energy

ι:Typeι1:Typeinst✝³:MeasurableSpace ιinst✝²:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:IsFiniteMeasure (𝓒1.μBolt T)h:Integrable 𝓒.energy (𝓒.μProd T)h1:Integrable 𝓒1.energy (𝓒1.μProd T)Integrable (𝓒 + 𝓒1).energy ((𝓒.μProd T).prod (𝓒1.μProd T)) All goals completed! 🐙ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιT:Temperaturee:ι1 ≃ᵐ ιh:Integrable 𝓒.energy (𝓒.μProd T)Integrable (𝓒.congr e).energy (Measure.map (⇑e.symm) (𝓒.μProd T)) exact (integrable_map_equiv e.symm _).mpr (ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιT:Temperaturee:ι1 ≃ᵐ ιh:Integrable 𝓒.energy (𝓒.μProd T)Integrable ((𝓒.congr e).energy e.symm) (𝓒.μProd T) All goals completed! 🐙)ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝:IsFiniteMeasure (𝓒.μBolt T)h:Integrable 𝓒.energy (𝓒.μProd T)n:ih:Integrable (nsmul n 𝓒).energy ((nsmul n 𝓒).μProd T)Integrable ((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).energy (((𝓒 + nsmul n 𝓒).congr (MeasurableEquiv.piFinSuccAbove (fun x => ι) 0)).μProd T) All goals completed! 🐙

The mean energy

ι:Typeι1:Typeinst✝⁵:MeasurableSpace ιinst✝⁴:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝³:IsFiniteMeasure (𝓒1.μBolt T)inst✝²:IsFiniteMeasure (𝓒.μBolt T)inst✝¹:NeZero 𝓒.μinst✝:NeZero 𝓒1.μh1:Integrable 𝓒.energy (𝓒.μProd T)h2:Integrable 𝓒1.energy (𝓒1.μProd T)hI:Integrable (𝓒 + 𝓒1).energy ((𝓒.μProd T).prod (𝓒1.μProd T)) (x : ι), (y : ι1), (𝓒 + 𝓒1).energy (x, y) 𝓒1.μProd T 𝓒.μProd T = 𝓒.meanEnergy T + 𝓒1.meanEnergy T All goals completed! 🐙lemma meanEnergy_congr (e : ι1 ≃ᵐ ι) (T : Temperature) : (𝓒.congr e).meanEnergy T = 𝓒.meanEnergy T := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperature(𝓒.congr e).meanEnergy T = 𝓒.meanEnergy T ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperature (i : ι1), (𝓒.congr e).energy i Measure.map (⇑e.symm) (𝓒.μProd T) = (i : ι), 𝓒.energy i 𝓒.μProd T All goals completed! 🐙ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μh1:Integrable 𝓒.energy (𝓒.μProd T)n:ih:(nsmul n 𝓒).meanEnergy T = n * 𝓒.meanEnergy T𝓒.meanEnergy T + n * 𝓒.meanEnergy T = (n + 1) * 𝓒.meanEnergy T ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μh1:Integrable 𝓒.energy (𝓒.μProd T)n:ih:(nsmul n 𝓒).meanEnergy T = n * 𝓒.meanEnergy T𝓒.meanEnergy T + n * 𝓒.meanEnergy T = (n + 1) * 𝓒.meanEnergy T All goals completed! 🐙

The differential entropy

Probabilities are non-negative, assuming a positive partition function.

-- `unusedArguments` (newly flagged under v4.32.0): the finiteness / non-zero -- instances are part of the intended interface but not needed by this proof. @[nolint unusedArguments] lemma probability_nonneg (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) : 0 𝓒.probability T i := div_nonneg (exp_nonneg _) (𝓒.mathematicalPartitionFunction_nonneg T)

Probabilities are strictly positive.

lemma probability_pos (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) : 0 < 𝓒.probability T i := div_pos (exp_pos _) (𝓒.mathematicalPartitionFunction_pos T)

General entropy non-negativity under a pointwise upper bound probability ≤ 1. This assumption holds automatically in the finite/counting case (since sums bound each term), but can fail in general (continuous) settings; hence we separate it as a hypothesis. Finite case: see CanonicalEnsemble.entropy_nonneg in Finite.

ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μhInt:Integrable (fun i => log (𝓒.probability T i)) (𝓒.μProd T)hP_le_one: (i : ι), 𝓒.probability T i 10 -kB * (i : ι), log (𝓒.probability T i) 𝓒.μProd T ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μhInt:Integrable (fun i => log (𝓒.probability T i)) (𝓒.μProd T)hP_le_one: (i : ι), 𝓒.probability T i 1 (i : ι), log (𝓒.probability T i) 𝓒.μProd T 0 All goals completed! 🐙

Thermodynamic Quantities

These are the dimensionless physical quantities derived from the mathematical definitions by incorporating the phase space volume 𝓒.phaseSpaceUnit ^ 𝓒.dof.

@[simp] lemma partitionFunction_def (𝓒 : CanonicalEnsemble ι) (T : Temperature) : 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T / (𝓒.phaseSpaceunit ^ 𝓒.dof) := rfllemma partitionFunction_pos (𝓒 : CanonicalEnsemble ι) (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] : 0 < 𝓒.partitionFunction T := div_pos (𝓒.mathematicalPartitionFunction_pos T) (pow_pos 𝓒.hPos _)lemma partitionFunction_congr (𝓒 : CanonicalEnsemble ι) (e : ι1 ≃ᵐ ι) (T : Temperature) : (𝓒.congr e).partitionFunction T = 𝓒.partitionFunction T := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperature(𝓒.congr e).partitionFunction T = 𝓒.partitionFunction T All goals completed! 🐙lemma partitionFunction_add (𝓒 : CanonicalEnsemble ι) (𝓒1 : CanonicalEnsemble ι1) (T : Temperature) (h : 𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit) : (𝓒 + 𝓒1).partitionFunction T = 𝓒.partitionFunction T * 𝓒1.partitionFunction T := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureh:𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit(𝓒 + 𝓒1).partitionFunction T = 𝓒.partitionFunction T * 𝓒1.partitionFunction T All goals completed! 🐙lemma partitionFunction_nsmul (𝓒 : CanonicalEnsemble ι) (n : ) (T : Temperature) : (nsmul n 𝓒).partitionFunction T = (𝓒.partitionFunction T) ^ n := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:T:Temperature(nsmul n 𝓒).partitionFunction T = 𝓒.partitionFunction T ^ n All goals completed! 🐙lemma partitionFunction_dof_zero (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.dof = 0) : 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.dof = 0𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T All goals completed! 🐙lemma partitionFunction_phase_space_unit_one (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) : 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.phaseSpaceunit = 1𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T All goals completed! 🐙All goals completed! 🐙

A rewriting form convenient under a coercion to a temperature obtained from an inverse temperature.

lemma log_partitionFunction_ofβ (𝓒 : CanonicalEnsemble ι) (β : ℝ≥0) [IsFiniteMeasure (𝓒.μBolt (ofβ β))] [NeZero 𝓒.μ] : Real.log (𝓒.partitionFunction (ofβ β)) = Real.log (𝓒.mathematicalPartitionFunction (ofβ β)) - (𝓒.dof : ) * Real.log 𝓒.phaseSpaceunit := log_partitionFunction (𝓒:=𝓒) (T:=ofβ β)

The logarithm of the mathematical partition function as an integral.

lemma log_mathematicalPartitionFunction_eq (𝓒 : CanonicalEnsemble ι) (T : Temperature) : Real.log (𝓒.mathematicalPartitionFunction T) = Real.log ( i, Real.exp (- T.β * 𝓒.energy i) 𝓒.μ) := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperaturelog (𝓒.mathematicalPartitionFunction T) = log ( (i : ι), rexp (-T.β * 𝓒.energy i) 𝓒.μ) All goals completed! 🐙
@[simp] lemma helmholtzFreeEnergy_def (𝓒 : CanonicalEnsemble ι) (T : Temperature) : 𝓒.helmholtzFreeEnergy T = - kB * T.val * Real.log (𝓒.partitionFunction T) := rfllemma helmholtzFreeEnergy_congr (𝓒 : CanonicalEnsemble ι) (e : ι1 ≃ᵐ ι) (T : Temperature) : (𝓒.congr e).helmholtzFreeEnergy T = 𝓒.helmholtzFreeEnergy T := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperature(𝓒.congr e).helmholtzFreeEnergy T = 𝓒.helmholtzFreeEnergy T All goals completed! 🐙lemma helmholtzFreeEnergy_dof_zero (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.dof = 0) : 𝓒.helmholtzFreeEnergy T = -kB * T.val * Real.log (𝓒.mathematicalPartitionFunction T) := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.dof = 0𝓒.helmholtzFreeEnergy T = -kB * T.val * log (𝓒.mathematicalPartitionFunction T) All goals completed! 🐙lemma helmholtzFreeEnergy_phase_space_unit_one (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) : 𝓒.helmholtzFreeEnergy T = -kB * T.val * Real.log (𝓒.mathematicalPartitionFunction T) := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.phaseSpaceunit = 1𝓒.helmholtzFreeEnergy T = -kB * T.val * log (𝓒.mathematicalPartitionFunction T) All goals completed! 🐙ι:Typeι1:Typeinst✝⁵:MeasurableSpace ιinst✝⁴:MeasurableSpace ι1𝓒:CanonicalEnsemble ι𝓒1:CanonicalEnsemble ι1T:Temperatureinst✝³:IsFiniteMeasure (𝓒.μBolt T)inst✝²:IsFiniteMeasure (𝓒1.μBolt T)inst✝¹:NeZero 𝓒.μinst✝:NeZero 𝓒1.μh:𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit-kB * T.val * (log (𝓒.partitionFunction T) + log (𝓒1.partitionFunction T)) = -kB * T.val * log (𝓒.partitionFunction T) + -kB * T.val * log (𝓒1.partitionFunction T) All goals completed! 🐙lemma helmholtzFreeEnergy_nsmul (𝓒 : CanonicalEnsemble ι) (n : ) (T : Temperature) : (nsmul n 𝓒).helmholtzFreeEnergy T = n * 𝓒.helmholtzFreeEnergy T := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:T:Temperature(nsmul n 𝓒).helmholtzFreeEnergy T = n * 𝓒.helmholtzFreeEnergy T ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιn:T:Temperature-kB * T.val * (n * log (𝓒.partitionFunction T)) = n * (-kB * T.val * log (𝓒.partitionFunction T)) All goals completed! 🐙@[simp] lemma physicalProbability_def (T : Temperature) (i : ι) : 𝓒.physicalProbability T i = 𝓒.probability T i * (𝓒.phaseSpaceunit ^ 𝓒.dof) := rfllemma physicalProbability_measurable (T : Temperature) : Measurable (𝓒.physicalProbability T) := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:TemperatureMeasurable (𝓒.physicalProbability T) ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:TemperatureMeasurable fun i => rexp (-T.β * 𝓒.energy i) / 𝓒.mathematicalPartitionFunction T * 𝓒.phaseSpaceunit ^ 𝓒.dof All goals completed! 🐙lemma physicalProbability_nonneg (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) : 0 𝓒.physicalProbability T i := mul_nonneg (𝓒.probability_nonneg T i) (pow_nonneg 𝓒.hPos.le _)lemma physicalProbability_pos (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) : 0 < 𝓒.physicalProbability T i := mul_pos (𝓒.probability_pos T i) (pow_pos 𝓒.hPos _)All goals completed! 🐙lemma integral_probability (𝓒 : CanonicalEnsemble ι) (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] : ( i, 𝓒.probability T i 𝓒.μ) = 1 := ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μ (i : ι), 𝓒.probability T i 𝓒.μ = 1 ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μ𝓒.mathematicalPartitionFunction T * (𝓒.mathematicalPartitionFunction T)⁻¹ = 1 All goals completed! 🐙

Normalization of the dimensionless physical probability density over the base measure.

lemma integral_physicalProbability_base (𝓒 : CanonicalEnsemble ι) (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] : ( i, 𝓒.physicalProbability T i 𝓒.μ) = 𝓒.phaseSpaceunit ^ 𝓒.dof := ι:Typeinst✝²:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureinst✝¹:IsFiniteMeasure (𝓒.μBolt T)inst✝:NeZero 𝓒.μ (i : ι), 𝓒.physicalProbability T i 𝓒.μ = 𝓒.phaseSpaceunit ^ 𝓒.dof All goals completed! 🐙
lemma physicalProbability_dof_zero (T : Temperature) (h : 𝓒.dof = 0) (i : ι) : 𝓒.physicalProbability T i = 𝓒.probability T i := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.dof = 0i:ι𝓒.physicalProbability T i = 𝓒.probability T i All goals completed! 🐙lemma physicalProbability_phase_space_unit_one (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) (i : ι) : 𝓒.physicalProbability T i = 𝓒.probability T i := ι:Typeinst✝:MeasurableSpace ι𝓒:CanonicalEnsemble ιT:Temperatureh:𝓒.phaseSpaceunit = 1i:ι𝓒.physicalProbability T i = 𝓒.probability T i All goals completed! 🐙lemma physicalProbability_congr (e : ι1 ≃ᵐ ι) (T : Temperature) (i : ι1) : (𝓒.congr e).physicalProbability T i = 𝓒.physicalProbability T (e i) := ι:Typeι1:Typeinst✝¹:MeasurableSpace ιinst✝:MeasurableSpace ι1𝓒:CanonicalEnsemble ιe:ι1 ≃ᵐ ιT:Temperaturei:ι1(𝓒.congr e).physicalProbability T i = 𝓒.physicalProbability T (e i) All goals completed! 🐙lemma physicalProbability_add {ι1} [MeasurableSpace ι1] (𝓒1 : CanonicalEnsemble ι1) (T : Temperature) (i : ι × ι1) (h : 𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit) : (𝓒 + 𝓒1).physicalProbability T i = 𝓒.physicalProbability T i.1 * 𝓒1.physicalProbability T i.2 := ι:Typeinst✝¹:MeasurableSpace ι𝓒:CanonicalEnsemble ιι1:Typeinst✝:MeasurableSpace ι1𝓒1:CanonicalEnsemble ι1T:Temperaturei:ι × ι1h:𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit(𝓒 + 𝓒1).physicalProbability T i = 𝓒.physicalProbability T i.1 * 𝓒1.physicalProbability T i.2 All goals completed! 🐙@[simp] lemma thermodynamicEntropy_def (T : Temperature) : 𝓒.thermodynamicEntropy T = -kB * i, Real.log (𝓒.physicalProbability T i) 𝓒.μProd T := rfl