chars int64 40 24k | content_type stringclasses 9
values | id stringlengths 13 64 | source stringclasses 5
values | subset stringclasses 31
values | text stringlengths 40 24k |
|---|---|---|---|---|---|
291 | leanexplore_declaration | leanexplore:377087 | leanexplore_sqlite | leanexplore_declarations | lemma mathematicalPartitionFunction_add {T : Temperature} :
(𝓒 + 𝓒1).mathematicalPartitionFunction T =
𝓒.mathematicalPartitionFunction T * 𝓒1.mathematicalPartitionFunction T := by
simp_rw [mathematicalPartitionFunction, μBolt_add]
rw [← measureReal_prod_prod, Set.univ_prod_univ] |
318 | leanexplore_declaration | leanexplore:377088 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma mathematicalPartitionFunction_congr (e : ι1 ≃ᵐ ι) (T : Temperature) :
(𝓒.congr e).mathematicalPartitionFunction T = 𝓒.mathematicalPartitionFunction T := by
rw [mathematicalPartitionFunction_eq_integral, mathematicalPartitionFunction_eq_integral]
simp only [congr]
rw [integral_map_equiv]
simp |
358 | leanexplore_declaration | leanexplore:377089 | leanexplore_sqlite | leanexplore_declarations | /-- The `mathematicalPartitionFunction_nsmul` function of `n` copies of a canonical ensemble. -/
lemma mathematicalPartitionFunction_nsmul (n : ℕ) (T : Temperature) :
(nsmul n 𝓒).mathematicalPartitionFunction T = (𝓒.mathematicalPartitionFunction T) ^ n := by
simp_rw [mathematicalPartitionFunction, μBolt_nsmul, ... |
173 | leanexplore_declaration | leanexplore:377090 | leanexplore_sqlite | leanexplore_declarations | lemma mathematicalPartitionFunction_nonneg (T : Temperature) :
0 ≤ 𝓒.mathematicalPartitionFunction T := by
rw [mathematicalPartitionFunction]; exact measureReal_nonneg |
669 | leanexplore_declaration | leanexplore:377091 | leanexplore_sqlite | leanexplore_declarations | lemma mathematicalPartitionFunction_eq_zero_iff (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] :
mathematicalPartitionFunction 𝓒 T = 0 ↔ 𝓒.μ = 0 := by
simp [mathematicalPartitionFunction]
rw [measureReal_def]
rw [ENNReal.toReal_eq_zero_iff]
simp only [measure_ne_top, or_false]
rw [μBolt]
rw [Measure... |
268 | leanexplore_declaration | leanexplore:377092 | leanexplore_sqlite | leanexplore_declarations | lemma mathematicalPartitionFunction_comp_ofβ_apply (β : ℝ≥0) :
𝓒.mathematicalPartitionFunction (ofβ β) =
(𝓒.μ.withDensity (fun i => ENNReal.ofReal (exp (- β * 𝓒.energy i)))).real Set.univ := by
simp only [mathematicalPartitionFunction, μBolt, β_ofβ, neg_mul] |
325 | leanexplore_declaration | leanexplore:377093 | leanexplore_sqlite | leanexplore_declarations | /-- 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 := by
simp [mathematicalPartitionF... |
471 | leanexplore_declaration | leanexplore:377094 | leanexplore_sqlite | leanexplore_declarations | /-- The probability density function of the canonical ensemble.
Note: In the general measure-theoretic case, this is a density with respect to the
underlying measure `𝓒.μ` and is not necessarily less than or equal to 1. In the
case of a finite ensemble with the counting measure, this value corresponds to the
probabili... |
220 | leanexplore_declaration | leanexplore:377095 | leanexplore_sqlite | leanexplore_declarations | lemma probability_add {T : Temperature} (i : ι × ι1) :
(𝓒 + 𝓒1).probability T i = 𝓒.probability T i.1 * 𝓒1.probability T i.2 := by
simp [probability, mathematicalPartitionFunction_add, mul_add, Real.exp_add]
ring |
157 | leanexplore_declaration | leanexplore:377096 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma probability_congr (e : ι1 ≃ᵐ ι) (T : Temperature) (i : ι1) :
(𝓒.congr e).probability T i = 𝓒.probability T (e i) := by
simp [probability] |
515 | leanexplore_declaration | leanexplore:377097 | leanexplore_sqlite | leanexplore_declarations | lemma probability_nsmul (n : ℕ) (T : Temperature) (f : Fin n → ι) :
(nsmul n 𝓒).probability T f = ∏ i, 𝓒.probability T (f i) := by
induction n with
| zero =>
simp [probability, mathematicalPartitionFunction_nsmul]
| succ n ih =>
rw [nsmul_succ]
rw [probability_congr]
rw [probability_add]
... |
208 | leanexplore_declaration | leanexplore:377098 | leanexplore_sqlite | leanexplore_declarations | /-- The probability measure associated with the Boltzmann distribution of a
canonical ensemble. -/
noncomputable def μProd (T : Temperature) : MeasureTheory.Measure ι :=
(𝓒.μBolt T Set.univ)⁻¹ • 𝓒.μBolt T |
124 | leanexplore_declaration | leanexplore:377099 | leanexplore_sqlite | leanexplore_declarations | instance (T : Temperature) : SigmaFinite (𝓒.μProd T) :=
inferInstanceAs (SigmaFinite ((𝓒.μBolt T Set.univ)⁻¹ • 𝓒.μBolt T)) |
188 | leanexplore_declaration | leanexplore:377100 | leanexplore_sqlite | leanexplore_declarations | instance (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)]
[NeZero 𝓒.μ] : IsProbabilityMeasure (𝓒.μProd T) := inferInstanceAs <|
IsProbabilityMeasure ((𝓒.μBolt T Set.univ)⁻¹ • 𝓒.μBolt T) |
78 | leanexplore_declaration | leanexplore:377101 | leanexplore_sqlite | leanexplore_declarations | instance {T} : IsFiniteMeasure (𝓒.μProd T) := by
rw [μProd]
infer_instance |
568 | leanexplore_declaration | leanexplore:377102 | leanexplore_sqlite | leanexplore_declarations | lemma μProd_add {T : Temperature} [IsFiniteMeasure (𝓒.μBolt T)]
[IsFiniteMeasure (𝓒1.μBolt T)] : (𝓒 + 𝓒1).μProd T = (𝓒.μProd T).prod (𝓒1.μProd T) := by
rw [μProd, μProd, μProd, μBolt_add]
rw [MeasureTheory.Measure.prod_smul_left, MeasureTheory.Measure.prod_smul_right]
rw [smul_smul]
congr
trans ((𝓒... |
184 | leanexplore_declaration | leanexplore:377103 | leanexplore_sqlite | leanexplore_declarations | lemma μProd_congr (e : ι1 ≃ᵐ ι) (T : Temperature) :
(𝓒.congr e).μProd T = (𝓒.μProd T).map e.symm := by
simp [μProd, μBolt_congr]
congr 2
rw [MeasurableEquiv.map_apply]
simp |
505 | leanexplore_declaration | leanexplore:377104 | leanexplore_sqlite | leanexplore_declarations | lemma μProd_nsmul (n : ℕ) (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] :
(nsmul n 𝓒).μProd T = MeasureTheory.Measure.pi fun _ => 𝓒.μProd T := by
induction n with
| zero =>
simp [nsmul, μProd, μBolt]
congr
funext x
exact Fin.elim0 x
| succ n ih =>
rw [nsmul_succ]
rw [μProd_congr]
... |
855 | leanexplore_declaration | leanexplore:377105 | leanexplore_sqlite | leanexplore_declarations | @[fun_prop]
lemma integrable_energy_add (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)]
[IsFiniteMeasure (𝓒1.μBolt T)]
(h : Integrable 𝓒.energy (𝓒.μProd T)) (h1 : Integrable 𝓒1.energy (𝓒1.μProd T)) :
Integrable (𝓒 + 𝓒1).energy ((𝓒 + 𝓒1).μProd T) := by
rw [μProd_add]
refine MeasureTheory.Integr... |
313 | leanexplore_declaration | leanexplore:377106 | leanexplore_sqlite | leanexplore_declarations | @[fun_prop]
lemma integrable_energy_congr (T : Temperature) (e : ι1 ≃ᵐ ι)
(h : Integrable 𝓒.energy (𝓒.μProd T)) :
Integrable (𝓒.congr e).energy ((𝓒.congr e).μProd T) := by
simp [μProd_congr]
refine (integrable_map_equiv e.symm (𝓒.congr e).energy).mpr ?_
simp only [congr_energy_comp_symmm]
exact h |
387 | leanexplore_declaration | leanexplore:377107 | leanexplore_sqlite | leanexplore_declarations | @[fun_prop]
lemma integrable_energy_nsmul (n : ℕ) (T : Temperature)
[IsFiniteMeasure (𝓒.μBolt T)]
(h : Integrable 𝓒.energy (𝓒.μProd T)) :
Integrable (nsmul n 𝓒).energy ((nsmul n 𝓒).μProd T) := by
induction n with
| zero =>
simp [nsmul]
| succ n ih =>
rw [nsmul_succ]
apply integrable_e... |
149 | leanexplore_declaration | leanexplore:377108 | leanexplore_sqlite | leanexplore_declarations | /-- The mean energy of the canonical ensemble at temperature `T`. -/
noncomputable def meanEnergy (T : Temperature) : ℝ := ∫ i, 𝓒.energy i ∂𝓒.μProd T |
172 | leanexplore_declaration | leanexplore:377109 | leanexplore_sqlite | leanexplore_declarations | /-- The mean square energy ⟨E²⟩ of the canonical ensemble at temperature T. -/
noncomputable def meanSquareEnergy (T : Temperature) : ℝ :=
∫ i, (𝓒.energy i)^2 ∂ 𝓒.μProd T |
151 | leanexplore_declaration | leanexplore:377110 | leanexplore_sqlite | leanexplore_declarations | /-- Energy variance at temperature `T`. -/
noncomputable def energyVariance (T : Temperature) : ℝ :=
∫ i, (𝓒.energy i - 𝓒.meanEnergy T)^2 ∂ 𝓒.μProd T |
656 | leanexplore_declaration | leanexplore:377111 | leanexplore_sqlite | leanexplore_declarations | lemma meanEnergy_add {T : Temperature}
[IsFiniteMeasure (𝓒1.μBolt T)] [IsFiniteMeasure (𝓒.μBolt T)]
[NeZero 𝓒.μ] [NeZero 𝓒1.μ]
(h1 : Integrable 𝓒.energy (𝓒.μProd T))
(h2 : Integrable 𝓒1.energy (𝓒1.μProd T)) :
(𝓒 + 𝓒1).meanEnergy T = 𝓒.meanEnergy T + 𝓒1.meanEnergy T := by
rw [meanEnergy... |
319 | leanexplore_declaration | leanexplore:377112 | leanexplore_sqlite | leanexplore_declarations | lemma meanEnergy_congr (e : ι1 ≃ᵐ ι) (T : Temperature) :
(𝓒.congr e).meanEnergy T = 𝓒.meanEnergy T := by
simp [meanEnergy, μProd_congr]
refine MeasurePreserving.integral_comp' ?_ 𝓒.energy
refine { measurable := ?_, map_eq := ?_ }
· exact MeasurableEquiv.measurable e
· exact MeasurableEquiv.map_map_symm... |
443 | leanexplore_declaration | leanexplore:377113 | leanexplore_sqlite | leanexplore_declarations | lemma meanEnergy_nsmul (n : ℕ) (T : Temperature)
[IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ]
(h1 : Integrable 𝓒.energy (𝓒.μProd T)) :
(nsmul n 𝓒).meanEnergy T = n * 𝓒.meanEnergy T := by
induction n with
| zero =>
simp [nsmul, meanEnergy]
| succ n ih =>
rw [nsmul_succ, meanEnergy_congr, me... |
361 | leanexplore_declaration | leanexplore:377114 | leanexplore_sqlite | leanexplore_declarations | /-- The (differential) entropy of the canonical ensemble. In the continuous case, this quantity
is not absolute but depends on the choice of units for the measure. It can be negative.
See `thermodynamicEntropy` for the absolute physical quantity. -/
noncomputable def differentialEntropy (T : Temperature) : ℝ :=
- kB ... |
350 | leanexplore_declaration | leanexplore:377115 | leanexplore_sqlite | leanexplore_declarations | /-- Probabilities are non-negative, assuming a positive partition function. -/
lemma probability_nonneg
(T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) :
0 ≤ 𝓒.probability T i := by
have hpos := mathematicalPartitionFunction_pos (𝓒:=𝓒) (T:=T)
simp [CanonicalEnsemble.probability, di... |
278 | leanexplore_declaration | leanexplore:377116 | leanexplore_sqlite | leanexplore_declarations | /-- Probabilities are strictly positive. -/
lemma probability_pos
(T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) :
0 < 𝓒.probability T i := by
have hZpos := mathematicalPartitionFunction_pos (𝓒:=𝓒) (T:=T)
simp [probability, Real.exp_pos, hZpos] |
1,617 | leanexplore_declaration | leanexplore:377117 | leanexplore_sqlite | leanexplore_declarations | /-- 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 `F... |
206 | leanexplore_declaration | leanexplore:377118 | leanexplore_sqlite | leanexplore_declarations | /-- The dimensionless thermodynamic partition function, `Z = Z_math / h^dof`. -/
noncomputable def partitionFunction (T : Temperature) : ℝ :=
𝓒.mathematicalPartitionFunction T / (𝓒.phaseSpaceunit ^ 𝓒.dof) |
185 | leanexplore_declaration | leanexplore:377119 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma partitionFunction_def (𝓒 : CanonicalEnsemble ι) (T : Temperature) :
𝓒.partitionFunction T =
𝓒.mathematicalPartitionFunction T / (𝓒.phaseSpaceunit ^ 𝓒.dof) := rfl |
311 | leanexplore_declaration | leanexplore:377120 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_pos
(𝓒 : CanonicalEnsemble ι) (T : Temperature)
[IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] :
0 < 𝓒.partitionFunction T := by
have hZ := 𝓒.mathematicalPartitionFunction_pos T
have hden : 0 < 𝓒.phaseSpaceunit ^ 𝓒.dof := pow_pos 𝓒.hPos _
simp [partitionFunction, hZ, hden] |
186 | leanexplore_declaration | leanexplore:377121 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_congr
(𝓒 : CanonicalEnsemble ι) (e : ι1 ≃ᵐ ι) (T : Temperature) :
(𝓒.congr e).partitionFunction T = 𝓒.partitionFunction T := by
simp [partitionFunction] |
325 | leanexplore_declaration | leanexplore:377122 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_add
(𝓒 : CanonicalEnsemble ι) (𝓒1 : CanonicalEnsemble ι1)
(T : Temperature)
(h : 𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit) :
(𝓒 + 𝓒1).partitionFunction T
= 𝓒.partitionFunction T * 𝓒1.partitionFunction T := by
simp [partitionFunction, mathematicalPartitionFunction_add,... |
291 | leanexplore_declaration | leanexplore:377123 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_nsmul
(𝓒 : CanonicalEnsemble ι) (n : ℕ) (T : Temperature) :
(nsmul n 𝓒).partitionFunction T
= (𝓒.partitionFunction T) ^ n := by
simp [partitionFunction, mathematicalPartitionFunction_nsmul,
dof_nsmul, phase_space_unit_nsmul, pow_mul]
ring_nf |
196 | leanexplore_declaration | leanexplore:377124 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_dof_zero
(𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.dof = 0) :
𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := by
simp [partitionFunction, h] |
219 | leanexplore_declaration | leanexplore:377125 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_phase_space_unit_one
(𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) :
𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := by
simp [partitionFunction, h] |
598 | leanexplore_declaration | leanexplore:377126 | leanexplore_sqlite | leanexplore_declarations | lemma log_partitionFunction
(𝓒 : CanonicalEnsemble ι) (T : Temperature)
[IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] :
Real.log (𝓒.partitionFunction T)
= Real.log (𝓒.mathematicalPartitionFunction T)
- (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by
have hZ := 𝓒.mathematicalPartitionFunct... |
430 | leanexplore_declaration | leanexplore:377127 | leanexplore_sqlite | leanexplore_declarations | /-- 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 (𝓒.mathematicalPartit... |
334 | leanexplore_declaration | leanexplore:377128 | leanexplore_sqlite | leanexplore_declarations | /-- 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) ∂ 𝓒.μ) := by
simp [mathematicalPartitionFun... |
251 | leanexplore_declaration | leanexplore:377129 | leanexplore_sqlite | leanexplore_declarations | /-- The Helmholtz free energy, `F = -k_B T log(Z)`. This is the central
quantity from which other thermodynamic properties are derived. -/
noncomputable def helmholtzFreeEnergy (T : Temperature) : ℝ :=
- kB * T.val * Real.log (𝓒.partitionFunction T) |
172 | leanexplore_declaration | leanexplore:377130 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma helmholtzFreeEnergy_def
(𝓒 : CanonicalEnsemble ι) (T : Temperature) :
𝓒.helmholtzFreeEnergy T = - kB * T.val * Real.log (𝓒.partitionFunction T) := rfl |
194 | leanexplore_declaration | leanexplore:377131 | leanexplore_sqlite | leanexplore_declarations | lemma helmholtzFreeEnergy_congr
(𝓒 : CanonicalEnsemble ι) (e : ι1 ≃ᵐ ι) (T : Temperature) :
(𝓒.congr e).helmholtzFreeEnergy T = 𝓒.helmholtzFreeEnergy T := by
simp [helmholtzFreeEnergy] |
252 | leanexplore_declaration | leanexplore:377132 | leanexplore_sqlite | leanexplore_declarations | lemma helmholtzFreeEnergy_dof_zero
(𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.dof = 0) :
𝓒.helmholtzFreeEnergy T
= -kB * T.val * Real.log (𝓒.mathematicalPartitionFunction T) := by
simp [helmholtzFreeEnergy, partitionFunction, h] |
275 | leanexplore_declaration | leanexplore:377133 | leanexplore_sqlite | leanexplore_declarations | lemma helmholtzFreeEnergy_phase_space_unit_one
(𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) :
𝓒.helmholtzFreeEnergy T
= -kB * T.val * Real.log (𝓒.mathematicalPartitionFunction T) := by
simp [helmholtzFreeEnergy, partitionFunction, h] |
1,205 | leanexplore_declaration | leanexplore:377134 | leanexplore_sqlite | leanexplore_declarations | lemma helmholtzFreeEnergy_add
(𝓒 : CanonicalEnsemble ι) (𝓒1 : CanonicalEnsemble ι1) (T : Temperature)
[IsFiniteMeasure (𝓒.μBolt T)] [IsFiniteMeasure (𝓒1.μBolt T)]
[NeZero 𝓒.μ] [NeZero 𝓒1.μ]
(h : 𝓒.phaseSpaceunit = 𝓒1.phaseSpaceunit) :
(𝓒 + 𝓒1).helmholtzFreeEnergy T
= 𝓒.helmholtzFree... |
787 | leanexplore_declaration | leanexplore:377135 | leanexplore_sqlite | leanexplore_declarations | lemma helmholtzFreeEnergy_nsmul
(𝓒 : CanonicalEnsemble ι) (n : ℕ) (T : Temperature) :
(nsmul n 𝓒).helmholtzFreeEnergy T
= n * 𝓒.helmholtzFreeEnergy T := by
have hPF := partitionFunction_nsmul (𝓒:=𝓒) (n:=n) (T:=T)
have hlog :
Real.log ((nsmul n 𝓒).partitionFunction T)
= (n : ℝ) * Re... |
379 | leanexplore_declaration | leanexplore:377136 | leanexplore_sqlite | leanexplore_declarations | /-- The dimensionless physical probability density. This is is the probability density w.r.t. the
measure, obtained by dividing the phase space measure by the fundamental unit `h^dof`, making the
probability density `ρ_phys = ρ_math * h^dof` dimensionless. -/
noncomputable def physicalProbability (T : Temperature) (i :... |
157 | leanexplore_declaration | leanexplore:377137 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma physicalProbability_def (T : Temperature) (i : ι) :
𝓒.physicalProbability T i
= 𝓒.probability T i * (𝓒.phaseSpaceunit ^ 𝓒.dof) := rfl |
917 | leanexplore_declaration | leanexplore:377138 | leanexplore_sqlite | leanexplore_declarations | lemma physicalProbability_measurable (T : Temperature) :
Measurable (𝓒.physicalProbability T) := by
let c : ℝ := (𝓒.phaseSpaceunit ^ 𝓒.dof) / 𝓒.mathematicalPartitionFunction T
have h_energy_meas : Measurable fun i => 𝓒.energy i := 𝓒.energy_measurable
have h_mul_meas : Measurable fun i => (-(T.β : ℝ)) * ... |
254 | leanexplore_declaration | leanexplore:377139 | leanexplore_sqlite | leanexplore_declarations | lemma physicalProbability_nonneg
(T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) :
0 ≤ 𝓒.physicalProbability T i := by
have hp := 𝓒.probability_nonneg (T:=T) i
exact mul_nonneg hp (by exact pow_nonneg (le_of_lt 𝓒.hPos) _) |
222 | leanexplore_declaration | leanexplore:377140 | leanexplore_sqlite | leanexplore_declarations | lemma physicalProbability_pos
(T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) :
0 < 𝓒.physicalProbability T i := by
have hp := 𝓒.probability_pos (T:=T) i
exact mul_pos hp (pow_pos 𝓒.hPos _) |
418 | leanexplore_declaration | leanexplore:377141 | leanexplore_sqlite | leanexplore_declarations | lemma log_physicalProbability
(T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] (i : ι) :
Real.log (𝓒.physicalProbability T i)
= Real.log (𝓒.probability T i) + (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by
have hppos := 𝓒.probability_pos (T:=T) i
have hpowpos : 0 < 𝓒.phaseSpaceunit ... |
979 | leanexplore_declaration | leanexplore:377142 | leanexplore_sqlite | leanexplore_declarations | lemma integral_probability
(𝓒 : CanonicalEnsemble ι) (T : Temperature)
[IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] :
(∫ i, 𝓒.probability T i ∂ 𝓒.μ) = 1 := by
classical
have hZ :
𝓒.mathematicalPartitionFunction T
= ∫ i, Real.exp (- T.β * 𝓒.energy i) ∂ 𝓒.μ :=
mathematicalPartition... |
768 | leanexplore_declaration | leanexplore:377143 | leanexplore_sqlite | leanexplore_declarations | /-- 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 := by
... |
170 | leanexplore_declaration | leanexplore:377144 | leanexplore_sqlite | leanexplore_declarations | lemma physicalProbability_dof_zero
(T : Temperature) (h : 𝓒.dof = 0) (i : ι) :
𝓒.physicalProbability T i = 𝓒.probability T i := by
simp [physicalProbability, h] |
193 | leanexplore_declaration | leanexplore:377145 | leanexplore_sqlite | leanexplore_declarations | lemma physicalProbability_phase_space_unit_one
(T : Temperature) (h : 𝓒.phaseSpaceunit = 1) (i : ι) :
𝓒.physicalProbability T i = 𝓒.probability T i := by
simp [physicalProbability, h] |
200 | leanexplore_declaration | leanexplore:377146 | leanexplore_sqlite | leanexplore_declarations | lemma physicalProbability_congr (e : ι1 ≃ᵐ ι) (T : Temperature) (i : ι1) :
(𝓒.congr e).physicalProbability T i
= 𝓒.physicalProbability T (e i) := by
simp [physicalProbability, probability] |
377 | leanexplore_declaration | leanexplore:377147 | leanexplore_sqlite | leanexplore_declarations | 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 := by
simp [physicalProbability, pr... |
379 | leanexplore_declaration | leanexplore:377148 | leanexplore_sqlite | leanexplore_declarations | /-- The absolute thermodynamic entropy, defined from its statistical mechanical foundation as
the Gibbs-Shannon entropy of the dimensionless physical probability distribution.
This corresponds to Landau & Lifshitz, Statistical Physics, §7, Eq. 7.12. -/
noncomputable def thermodynamicEntropy (T : Temperature) : ℝ :=
-... |
156 | leanexplore_declaration | leanexplore:377149 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma thermodynamicEntropy_def (T : Temperature) :
𝓒.thermodynamicEntropy T = -kB * ∫ i, Real.log (𝓒.physicalProbability T i) ∂ 𝓒.μProd T := rfl |
424 | leanexplore_declaration | leanexplore:377150 | leanexplore_sqlite | leanexplore_declarations | /-- A finite `CanonicalEnsemble` is one whose microstates form a finite type
and whose measure is the counting measure. For such systems, the state space is
inherently discrete and dimensionless, so we require `dof = 0` and
`phaseSpaceUnit = 1`. -/
class IsFinite (𝓒 : CanonicalEnsemble ι) [Fintype ι] : Prop where
μ_... |
592 | leanexplore_declaration | leanexplore:377151 | leanexplore_sqlite | leanexplore_declarations | instance [IsFinite 𝓒] [IsFinite 𝓒1] : IsFinite (𝓒 + 𝓒1) where
μ_eq_count := by
rw [μ_add]
rw [IsFinite.μ_eq_count (𝓒:=𝓒), IsFinite.μ_eq_count (𝓒:=𝓒1)]
refine Measure.prod_eq ?_
intro s t hs ht
rw [Measure.count_apply, Measure.count_apply, Measure.count_apply]
rw [← ENat.toENNReal_mul]
... |
773 | leanexplore_declaration | leanexplore:377152 | leanexplore_sqlite | leanexplore_declarations | instance [IsFinite 𝓒] (e : ι1 ≃ᵐ ι) : IsFinite (congr 𝓒 e) where
μ_eq_count := by
simp [congr]
rw [IsFinite.μ_eq_count (𝓒:=𝓒)]
refine Measure.ext_iff.mpr ?_
intro s hs
rw [@MeasurableEquiv.map_apply]
rw [Measure.count_apply, Measure.count_apply]
simp only [ENat.toENNReal_inj]
rw [@... |
1,693 | leanexplore_declaration | leanexplore:377153 | leanexplore_sqlite | leanexplore_declarations | instance [IsFinite 𝓒] (n : ℕ) : IsFinite (nsmul n 𝓒) where
μ_eq_count := by
induction n with
| zero =>
haveI : Subsingleton (Fin 0 → ι) := ⟨by intro f g; funext i; exact Fin.elim0 i⟩
have h_cases :
∀ s : Set (Fin 0 → ι), s = ∅ ∨ s = Set.univ := by
intro s;
by_cases hne ... |
95 | leanexplore_declaration | leanexplore:377154 | leanexplore_sqlite | leanexplore_declarations | instance [IsFinite 𝓒] : IsFiniteMeasure (𝓒.μ) := by
rw [IsFinite.μ_eq_count]
infer_instance |
342 | leanexplore_declaration | leanexplore:377155 | leanexplore_sqlite | leanexplore_declarations | /-- In the finite (counting) case a nonempty index type gives a nonzero measure. -/
instance [IsFinite 𝓒] [Nonempty ι] : NeZero 𝓒.μ := by
refine ⟨?_⟩
intro hμ
obtain ⟨i₀⟩ := (inferInstance : Nonempty ι)
have hone : 𝓒.μ {i₀} = 1 := by
simp [IsFinite.μ_eq_count (𝓒:=𝓒)]
simp_all only [Measure.coe_zero, ... |
366 | leanexplore_declaration | leanexplore:377156 | leanexplore_sqlite | leanexplore_declarations | /-- The Shannon entropy of a finite canonical ensemble.
This is defined by the formula `S = -k_B ∑ pᵢ log pᵢ`. It is proven to be
equivalent to the `differentialEntropy` and the `thermodynamicEntropy` for systems
satisfying the `IsFinite` property. -/
noncomputable def shannonEntropy (T : Temperature) : ℝ :=
-kB * ∑ ... |
331 | leanexplore_declaration | leanexplore:377157 | leanexplore_sqlite | leanexplore_declarations | lemma mathematicalPartitionFunction_of_fintype [IsFinite 𝓒] (T : Temperature) :
𝓒.mathematicalPartitionFunction T = ∑ i, exp (- β T * 𝓒.energy i) := by
rw [mathematicalPartitionFunction_eq_integral]
rw [MeasureTheory.integral_fintype]
simp [IsFinite.μ_eq_count]
· rw [IsFinite.μ_eq_count]
exact Integr... |
264 | leanexplore_declaration | leanexplore:377158 | leanexplore_sqlite | leanexplore_declarations | lemma partitionFunction_of_fintype [IsFinite 𝓒] (T : Temperature) :
𝓒.partitionFunction T = ∑ i, exp (- T.β * 𝓒.energy i) := by
simp [partitionFunction, mathematicalPartitionFunction_of_fintype,
IsFinite.dof_eq_zero, IsFinite.phase_space_unit_eq_one] |
248 | leanexplore_declaration | leanexplore:377159 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma μBolt_of_fintype (T : Temperature) [IsFinite 𝓒] (i : ι) :
(𝓒.μBolt T).real {i} = Real.exp (- β T * 𝓒.energy i) := by
rw [μBolt]
simp only [neg_mul]
rw [@measureReal_def]
simp [IsFinite.μ_eq_count]
exact Real.exp_nonneg _ |
157 | leanexplore_declaration | leanexplore:377160 | leanexplore_sqlite | leanexplore_declarations | instance {T} [IsFinite 𝓒] : IsFiniteMeasure (𝓒.μBolt T) := by
rw [μBolt]
refine isFiniteMeasure_withDensity_ofReal ?_
exact HasFiniteIntegral.of_finite |
188 | leanexplore_declaration | leanexplore:377161 | leanexplore_sqlite | leanexplore_declarations | @[simp]
lemma μProd_of_fintype (T : Temperature) [IsFinite 𝓒] (i : ι) :
(𝓒.μProd T).real {i} = 𝓒.probability T i := by
rw [μProd]
simp [probability]
ring_nf
rw [mul_comm]
rfl |
228 | leanexplore_declaration | leanexplore:377162 | leanexplore_sqlite | leanexplore_declarations | lemma meanEnergy_of_fintype [IsFinite 𝓒] (T : Temperature) :
𝓒.meanEnergy T = ∑ i, 𝓒.energy i * 𝓒.probability T i := by
simp [meanEnergy]
rw [MeasureTheory.integral_fintype]
simp [mul_comm]
exact Integrable.of_finite |
155 | leanexplore_declaration | leanexplore:377163 | leanexplore_sqlite | leanexplore_declarations | lemma entropy_of_fintype (T : Temperature) :
𝓒.shannonEntropy T = - kB * ∑ i, 𝓒.probability T i * log (𝓒.probability T i) := by
simp [shannonEntropy] |
1,236 | leanexplore_declaration | leanexplore:377164 | leanexplore_sqlite | leanexplore_declarations | lemma probability_le_one
[MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) (i : ι) :
𝓒.probability T i ≤ 1 := by
unfold probability
have hnum_le :
Real.exp (- T.β * 𝓒.energy i) ≤ 𝓒.mathematicalPartitionFunction T := by
rw [mathematicalPartitionFunction_of_fintype (𝓒:=𝓒... |
338 | leanexplore_declaration | leanexplore:377165 | leanexplore_sqlite | leanexplore_declarations | /-- Finite specialization: strict positivity of the mathematical partition function. -/
lemma mathematicalPartitionFunction_pos_finite
[MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) :
0 < 𝓒.mathematicalPartitionFunction T := by
simpa using (CanonicalEnsemble.mathematicalPartitionFu... |
416 | leanexplore_declaration | leanexplore:377166 | leanexplore_sqlite | leanexplore_declarations | /-- Finite specialization: strict positivity of the (physical) partition function. -/
lemma partitionFunction_pos_finite
[MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) :
0 < 𝓒.partitionFunction T := by
simpa [partitionFunction, IsFinite.dof_eq_zero (𝓒:=𝓒),
IsFinite.phase_... |
373 | leanexplore_declaration | leanexplore:377167 | leanexplore_sqlite | leanexplore_declarations | /-- Finite specialization: non-negativity (indeed positivity) of probabilities. -/
lemma probability_nonneg_finite
[MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) (i : ι) :
0 ≤ 𝓒.probability T i := by
unfold probability
have hZpos := mathematicalPartitionFunction_pos_finite (𝓒:=�... |
520 | leanexplore_declaration | leanexplore:377168 | leanexplore_sqlite | leanexplore_declarations | /-- The sum of probabilities over all microstates is 1. -/
lemma sum_probability_eq_one
[MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) :
∑ i, 𝓒.probability T i = 1 := by
simp_rw [probability]
rw [← Finset.sum_div]
have hZdef := mathematicalPartitionFunction_of_fintype (𝓒:=𝓒) ... |
1,485 | leanexplore_declaration | leanexplore:377169 | leanexplore_sqlite | leanexplore_declarations | /-- The entropy of a finite canonical ensemble (Shannon entropy) is non-negative. -/
lemma entropy_nonneg [MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) :
0 ≤ 𝓒.shannonEntropy T := by
unfold shannonEntropy
set p : ι → ℝ := fun i => 𝓒.probability T i
have h_term_le_zero :
∀ i... |
245 | leanexplore_declaration | leanexplore:377170 | leanexplore_sqlite | leanexplore_declarations | lemma shannonEntropy_eq_differentialEntropy
[MeasurableSingletonClass ι] [IsFinite 𝓒] (T : Temperature) :
𝓒.shannonEntropy T = 𝓒.differentialEntropy T := by
simp [shannonEntropy, differentialEntropy, integral_fintype, μProd_of_fintype] |
1,210 | leanexplore_declaration | leanexplore:377171 | leanexplore_sqlite | leanexplore_declarations | /-- In the finite, nonempty case the thermodynamic and Shannon entropies coincide.
All semi-classical correction factors vanish (`dof = 0`, `phaseSpaceUnit = 1`),
so the absolute thermodynamic entropy reduces to the discrete Shannon form. -/
theorem thermodynamicEntropy_eq_shannonEntropy [MeasurableSingletonClass ι] [I... |
315 | leanexplore_declaration | leanexplore:377172 | leanexplore_sqlite | leanexplore_declarations | lemma meanSquareEnergy_of_fintype [MeasurableSingletonClass ι] [IsFinite 𝓒] (T : Temperature) :
𝓒.meanSquareEnergy T = ∑ i, (𝓒.energy i)^2 * 𝓒.probability T i := by
simp [CanonicalEnsemble.meanSquareEnergy]
rw [MeasureTheory.integral_fintype]
simp [μProd_of_fintype, mul_comm]
exact Integrable.of_finite |
494 | leanexplore_declaration | leanexplore:377173 | leanexplore_sqlite | leanexplore_declarations | lemma energyVariance_of_fintype
[MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] (T : Temperature) :
𝓒.energyVariance T = (∑ i, (𝓒.energy i)^2 * 𝓒.probability T i) - (𝓒.meanEnergy T)^2 := by
have hE_int := Integrable.of_finite (f := 𝓒.energy) (μ := 𝓒.μProd T)
have hE2_int := Integrable.of_finit... |
247 | leanexplore_declaration | leanexplore:377174 | leanexplore_sqlite | leanexplore_declarations | /-- The finite-sum partition function as a real function of the inverse temperature `b = β`,
defined by `Z(b) = ∑ i exp (-b * 𝓒.energy i)`. -/
noncomputable def mathematicalPartitionFunctionBetaReal (b : ℝ) : ℝ :=
∑ i, Real.exp (-b * 𝓒.energy i) |
216 | leanexplore_declaration | leanexplore:377175 | leanexplore_sqlite | leanexplore_declarations | lemma mathematicalPartitionFunctionBetaReal_pos [Nonempty ι] (b : ℝ) :
0 < 𝓒.mathematicalPartitionFunctionBetaReal b := by
apply Finset.sum_pos
· intro i _; exact Real.exp_pos _
· exact Finset.univ_nonempty |
300 | leanexplore_declaration | leanexplore:377176 | leanexplore_sqlite | leanexplore_declarations | /-- For inverse temperature `b = β`, the (real-valued) Boltzmann probability of microstate `i`,
given by `exp (-b * E i) / Z(b)` where `Z(b) = ∑ i exp (-b * E i)`. -/
noncomputable def probabilityBetaReal (b : ℝ) (i : ι) : ℝ :=
Real.exp (-b * 𝓒.energy i) / 𝓒.mathematicalPartitionFunctionBetaReal b |
293 | leanexplore_declaration | leanexplore:377177 | leanexplore_sqlite | leanexplore_declarations | /-- The mean energy as a function of inverse temperature `b = β` in the finite case,
defined by `U(b) = ∑ i, E i * p_b i` with `p_b i = exp (-b * E i) / Z(b)` and `Z(b) = ∑ i,
exp (-b * E i)`. -/
noncomputable def meanEnergyBetaReal (b : ℝ) : ℝ :=
∑ i, 𝓒.energy i * 𝓒.probabilityBetaReal b i |
547 | leanexplore_declaration | leanexplore:377178 | leanexplore_sqlite | leanexplore_declarations | lemma meanEnergy_Beta_eq_finite [MeasurableSingletonClass ι] [IsFinite 𝓒] (b : ℝ) (hb : 0 < b) :
𝓒.meanEnergyBeta b = 𝓒.meanEnergyBetaReal b := by
let T := Temperature.ofβ (Real.toNNReal b)
have hT_beta : (T.β : ℝ) = b := by
simp [T, Real.toNNReal_of_nonneg hb.le]
rw [meanEnergyBeta, meanEnergy_of_fint... |
495 | leanexplore_declaration | leanexplore:377179 | leanexplore_sqlite | leanexplore_declarations | lemma differentiable_meanEnergyBetaReal
[Nonempty ι] : Differentiable ℝ 𝓒.meanEnergyBetaReal := by
unfold meanEnergyBetaReal probabilityBetaReal mathematicalPartitionFunctionBetaReal
refine Differentiable.fun_sum (by
intro i _
refine (Differentiable.div ?_ ?_ ?_).const_mul (𝓒.energy i)
· apply Dif... |
226 | leanexplore_declaration | leanexplore:377180 | leanexplore_sqlite | leanexplore_declarations | lemma differentiable_mathematicalPartitionFunctionBetaReal :
Differentiable ℝ 𝓒.mathematicalPartitionFunctionBetaReal := by
unfold mathematicalPartitionFunctionBetaReal
refine Differentiable.fun_sum ?_; intro i _; simp |
302 | leanexplore_declaration | leanexplore:377181 | leanexplore_sqlite | leanexplore_declarations | /-- The numerator in the finite-sum expression of the mean energy as a function of the
inverse temperature `b = β`,
namely `∑ i, E i * exp (-b * E i)` (so that `U(b) = meanEnergyNumerator b / Z(b)`). -/
noncomputable def meanEnergyNumerator (b : ℝ) : ℝ :=
∑ i, 𝓒.energy i * Real.exp (-b * 𝓒.energy i) |
204 | leanexplore_declaration | leanexplore:377182 | leanexplore_sqlite | leanexplore_declarations | lemma differentiable_meanEnergyNumerator :
Differentiable ℝ 𝓒.meanEnergyNumerator := by
unfold meanEnergyNumerator
refine Differentiable.fun_sum ?_; intro i _; apply Differentiable.const_mul; simp |
1,119 | leanexplore_declaration | leanexplore:377183 | leanexplore_sqlite | leanexplore_declarations | lemma deriv_mathematicalPartitionFunctionBetaReal (b : ℝ) :
deriv 𝓒.mathematicalPartitionFunctionBetaReal b = -𝓒.meanEnergyNumerator b := by
classical
unfold mathematicalPartitionFunctionBetaReal meanEnergyNumerator
have h_each (i : ι) :
HasDerivAt (fun b => Real.exp (-b * 𝓒.energy i))
(-𝓒.e... |
1,404 | leanexplore_declaration | leanexplore:377184 | leanexplore_sqlite | leanexplore_declarations | lemma deriv_meanEnergyNumerator (b : ℝ) :
deriv 𝓒.meanEnergyNumerator b =
-∑ i, (𝓒.energy i)^2 * Real.exp (-b * 𝓒.energy i) := by
classical
unfold meanEnergyNumerator
have h_each (i : ι) :
HasDerivAt (fun b => 𝓒.energy i * Real.exp (-b * 𝓒.energy i))
(-(𝓒.energy i)^2 * Real.exp (-b *... |
2,821 | leanexplore_declaration | leanexplore:377185 | leanexplore_sqlite | leanexplore_declarations | lemma deriv_meanEnergyBetaReal (b : ℝ) :
deriv 𝓒.meanEnergyBetaReal b =
(𝓒.meanEnergyBetaReal b)^2 - ∑ i, (𝓒.energy i)^2 * 𝓒.probabilityBetaReal b i := by
let Z := 𝓒.mathematicalPartitionFunctionBetaReal
let Num := 𝓒.meanEnergyNumerator
have hZ_diff := (differentiable_mathematicalPartitionFunctionBe... |
1,256 | leanexplore_declaration | leanexplore:377186 | leanexplore_sqlite | leanexplore_declarations | /-- (∂U/∂β) = -Var(E) for finite systems. -/
lemma derivWithin_meanEnergy_Beta_eq_neg_variance
[MeasurableSingletonClass ι][𝓒.IsFinite] (T : Temperature) (hT_pos : 0 < T.val) :
derivWithin 𝓒.meanEnergyBeta (Set.Ioi 0) (T.β : ℝ) = - 𝓒.energyVariance T := by
let β₀ := (T.β : ℝ)
have hβ₀_pos : 0 < β₀ := bet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.