cfahlgren1/math / lean /OAI /Probability /RadialTransition /PartitionReplication.lean
cfahlgren1's picture
download
raw
9.57 kB
import OAI.Probability.RadialTransition.SpatialProducts
namespace OAI
universe uIndex uI
noncomputable section
open scoped BigOperators NNReal ContDiff ENNReal
open Filter MeasureTheory Set
namespace RadialTransition
theorem rawPartition_setIntegral {ι : Type uIndex} [Fintype ι] (φ : Potential) (A : Set Position) (β : ℝ) :
rawPartition φ A ι β = ∫ x in Set.univ.pi (fun _ : ι => A), Real.exp (-β * orderedEnergy φ x) := by
rw [rawPartition, volume_pi, Measure.restrict_pi_pi]
theorem partitionOn_cube (φ : Potential) (L : ℝ) (N : ℕ) (β : ℝ) :
partitionOn φ (cube L) N β = partition φ L N β := by
rw [partitionOn, rawPartition_setIntegral]
simp_rw [orderedEnergy_fin]
have he : (Set.univ.pi (fun _ : Fin N => cube L)) = configurationCube L N := by
ext x
simp [configurationCube, Set.mem_pi]
rw [he]
rfl
theorem partitionOn_nonneg (φ : Potential) (A : Set Position) (N : ℕ) (β : ℝ) :
0 ≤ partitionOn φ A N β := mul_nonneg (by positivity) (rawPartition_nonneg φ A _ β)
theorem partitionOn_zero (φ : Potential) (A : Set Position) (β : ℝ) :
partitionOn φ A 0 β = 1 := by
simp [partitionOn, rawPartition, orderedEnergy, Measure.real]
theorem rawPartition_mono {ι : Type uIndex} [Fintype ι] {φ : Potential}
(hφ : Continuous φ) (hb : IsBoundedPotential φ) (β : ℝ)
{A B : Set Position} (hAB : A ⊆ B) (hBfin : volume B ≠ ⊤) :
rawPartition φ A ι β ≤ rawPartition φ B ι β := by
let : IsFiniteMeasure (volume.restrict B) := isFiniteMeasure_restrict.mpr hBfin
have hi : Integrable (fun x : ι → Position => Real.exp (-β * orderedEnergy φ x))
(volume.restrict (Set.univ.pi (fun _ : ι => B))) := by
rw [volume_pi, Measure.restrict_pi_pi]
exact integrable_orderedBoltzmann hφ hb β _
rw [rawPartition_setIntegral, rawPartition_setIntegral]
exact integral_mono_measure (Measure.restrict_mono (Set.pi_mono (fun _ _ => hAB)) le_rfl)
(Eventually.of_forall (fun _ => (Real.exp_pos _).le)) hi
theorem partitionOn_mono {φ : Potential} (hφ : Continuous φ) (hb : IsBoundedPotential φ)
(β : ℝ) (N : ℕ) {A B : Set Position} (hAB : A ⊆ B) (hBfin : volume B ≠ ⊤) :
partitionOn φ A N β ≤ partitionOn φ B N β :=
mul_le_mul_of_nonneg_left (rawPartition_mono hφ hb β hAB hBfin) (by positivity)
def translateSet (a : Position) (A : Set Position) : Set Position :=
(fun x => x - a) ⁻¹' A
theorem measurableSet_translate {a : Position} {A : Set Position} (hA : MeasurableSet A) :
MeasurableSet (translateSet a A) := hA.preimage (measurable_id.sub_const a)
theorem orderedEnergy_add {ι : Type uIndex} [Fintype ι] (φ : Potential) (x : ι → Position) (a : Position) :
orderedEnergy φ (fun i => a + x i) = orderedEnergy φ x := by
simp only [orderedEnergy, nndist_add_left]
theorem rawPartition_translate {ι : Type uIndex} [Fintype ι] (φ : Potential)
(A : Set Position) (a : Position) (β : ℝ) :
rawPartition φ (translateSet a A) ι β = rawPartition φ A ι β := by
let τ : (ι → Position) ≃ᵐ (ι → Position) := (Homeomorph.addLeft (fun _ : ι => a)).toMeasurableEquiv
have hp : MeasurePreserving τ volume volume := measurePreserving_add_left volume _
have hpre : τ ⁻¹' (Set.univ.pi (fun _ : ι => translateSet a A)) = Set.univ.pi (fun _ : ι => A) := by
ext x
simp [τ, translateSet, add_sub_cancel_left]
have he (x : ι → Position) : orderedEnergy φ (τ x) = orderedEnergy φ x := orderedEnergy_add φ x a
have hh := hp.setIntegral_preimage_emb τ.measurableEmbedding
(fun x => Real.exp (-β * orderedEnergy φ x)) (Set.univ.pi (fun _ : ι => translateSet a A))
rw [hpre] at hh
simpa only [rawPartition_setIntegral, he] using hh.symm
theorem partitionOn_translate (φ : Potential) (A : Set Position) (a : Position) (N : ℕ) (β : ℝ) :
partitionOn φ (translateSet a A) N β = partitionOn φ A N β := by
simp only [partitionOn, rawPartition_translate]
theorem partitionOn_biUnion_lower {I : Type uI} (S : Finset I) (A : I → Set Position)
{φ : Potential} (hφ : Continuous φ) (hb : IsBoundedPotential φ) {β : ℝ} (hβ : 0 ≤ β)
(hA : ∀ i ∈ S, MeasurableSet (A i)) (hAfin : ∀ i ∈ S, volume (A i) ≠ ⊤)
(hdisj : ∀ i ∈ S, ∀ j ∈ S, i ≠ j → Disjoint (A i) (A j))
(hc : ∀ i ∈ S, ∀ j ∈ S, i ≠ j → ∀ x ∈ A i, ∀ y ∈ A j, φ (nndist x y) ≤ 0)
(n : I → ℕ) :
∏ i ∈ S, partitionOn φ (A i) (n i) β ≤
partitionOn φ (⋃ i ∈ S, A i) (∑ i ∈ S, n i) β := by
classical
induction S using Finset.induction_on with
| empty => simp [partitionOn_zero]
| @insert i S hi ih =>
have hAs (j) (hj : j ∈ S) := hA j (Finset.mem_insert_of_mem hj)
have hfins (j) (hj : j ∈ S) := hAfin j (Finset.mem_insert_of_mem hj)
have hU : MeasurableSet (⋃ j ∈ S, A j) := S.measurableSet_biUnion hAs
have hUfin : volume (⋃ j ∈ S, A j) ≠ ⊤ := by
apply ne_top_of_le_ne_top _ (measure_biUnion_finset_le S A)
exact ENNReal.sum_ne_top.mpr hfins
have hdU : Disjoint (A i) (⋃ j ∈ S, A j) := by
simp only [Set.disjoint_iUnion_right]
intro j hj
exact hdisj i (Finset.mem_insert_self _ _) j (Finset.mem_insert_of_mem hj) (by rintro rfl; exact hi hj)
have hcU : ∀ x ∈ A i, ∀ y ∈ ⋃ j ∈ S, A j, φ (nndist x y) ≤ 0 := by
intro x hx y hy
obtain ⟨j, hj, hy⟩ := Set.mem_iUnion₂.mp hy
exact hc i (Finset.mem_insert_self _ _) j (Finset.mem_insert_of_mem hj)
(by rintro rfl; exact hi hj) x hx y hy
have hi' := ih hAs hfins
(fun j hj k hk hne => hdisj j (Finset.mem_insert_of_mem hj) k (Finset.mem_insert_of_mem hk) hne)
(fun j hj k hk hne => hc j (Finset.mem_insert_of_mem hj) k (Finset.mem_insert_of_mem hk) hne)
rw [Finset.prod_insert hi, Finset.sum_insert hi]
have hprod := mul_le_mul_of_nonneg_left hi' (partitionOn_nonneg φ (A i) (n i) β)
refine hprod.trans ?_
have hu : (⋃ j ∈ insert i S, A j) = A i ∪ ⋃ j ∈ S, A j := by
ext x
simp
rw [hu]
exact partitionOn_union_lower hφ hb hβ
(hA i (Finset.mem_insert_self _ _)) hU hdU (hAfin i (Finset.mem_insert_self _ _)) hUfin hcU
(n i) (∑ j ∈ S, n j)
theorem sum_all_subsets_card (N : ℕ) (F : ℕ → ℝ) :
(∑ T : Finset (Fin N), F T.card) = ∑ m ∈ Finset.range (N + 1), (N.choose m : ℝ) * F m := by
have hh := Finset.sum_powerset (Finset.univ : Finset (Fin N)) (fun T => F T.card)
simpa only [Finset.powerset_univ, Finset.card_univ, Fintype.card_fin,
Finset.sum_powersetCard, nsmul_eq_mul] using hh
theorem factorial_choose_cancel {N m : ℕ} (hm : m ≤ N) :
(N.factorial : ℝ)⁻¹ * (N.choose m : ℝ) =
(m.factorial : ℝ)⁻¹ * ((N - m).factorial : ℝ)⁻¹ := by
have hfac : (N.choose m : ℝ) * m.factorial * (N - m).factorial = N.factorial := by
exact_mod_cast Nat.choose_mul_factorial_mul_factorial hm
have hN : (N.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero N
have hm' : (m.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero m
have hnm : ((N - m).factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero (N - m)
field_simp
nlinarith [hfac]
theorem partitionOn_union_convolution {φ : Potential} (hφ : Continuous φ)
(hb : IsBoundedPotential φ) {β : ℝ} (hβ : 0 ≤ β)
{A B : Set Position} (hA : MeasurableSet A) (hB : MeasurableSet B) (hab : Disjoint A B)
(hAfin : volume A ≠ ⊤) (hBfin : volume B ≠ ⊤)
(hc : ∀ x ∈ A, ∀ y ∈ B, φ (nndist x y) ≤ 0) (N : ℕ) :
(∑ m ∈ Finset.range (N + 1), partitionOn φ A m β * partitionOn φ B (N - m) β) ≤
partitionOn φ (A ∪ B) N β := by
classical
have hterm (T : Finset (Fin N)) :
rawPartition φ A (Fin T.card) β * rawPartition φ B (Fin (N - T.card)) β ≤
∫ x : Fin N → Position, Real.exp (-β * orderedEnergy φ x)
∂Measure.pi (fun i => if i ∈ T then volume.restrict A else volume.restrict B) := by
have hcardA : Fintype.card {i : Fin N // i ∈ T} = T.card := Fintype.card_coe T
have hcardB : Fintype.card {i : Fin N // i ∉ T} = N - T.card := by
rw [Fintype.card_subtype_compl, Fintype.card_fin, hcardA]
have hh := sector_raw_lower (fun i => i ∈ T) hφ hb hβ hA hB hAfin hBfin hc
have heA := rawPartition_equiv (Fintype.equivFinOfCardEq hcardA) φ A β
have heB := rawPartition_equiv (Fintype.equivFinOfCardEq hcardB) φ B β
convert hh using 1
congr 1
· convert heA.symm using 1
congr!
· exact heB.symm
have hh := Finset.sum_le_sum (fun T (_ : T ∈ (Finset.univ : Finset (Finset (Fin N)))) => hterm T)
rw [← rawPartition_union_sum hφ hb β hB hab hAfin hBfin] at hh
rw [sum_all_subsets_card N (fun m =>
rawPartition φ A (Fin m) β * rawPartition φ B (Fin (N - m)) β)] at hh
have hh' := mul_le_mul_of_nonneg_left hh (inv_nonneg.mpr (show (0 : ℝ) ≤ N.factorial by positivity))
change _ ≤ (N.factorial : ℝ)⁻¹ * rawPartition φ (A ∪ B) (Fin N) β
refine le_trans (le_of_eq ?_) hh'
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro m hm
have hcancel := factorial_choose_cancel (Nat.le_of_lt_succ (Finset.mem_range.mp hm))
unfold partitionOn
calc
_ = ((m.factorial : ℝ)⁻¹ * ((N - m).factorial : ℝ)⁻¹) *
(rawPartition φ A (Fin m) β * rawPartition φ B (Fin (N - m)) β) := by ring
_ = _ := by rw [← hcancel]; ring
end RadialTransition
end
end OAI

Xet Storage Details

Size:
9.57 kB
·
Xet hash:
2cdae228ea864b33b2f4634f22d84911386dc7480c6f687900919146d23e8c21

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.