File size: 7,711 Bytes
9b6e014 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | import OAI.Probability.ContinuumTransition.GrandBlocks
namespace OAI
universe u_1
section
open scoped BigOperators
open MeasureTheory Set
namespace ContinuumTemperature
open Classical
noncomputable def countFamily (F : ConfigFamily) (n : ℕ) : ConfigFamily :=
fun ι _ x => if Fintype.card ι = n then F ι x else 0
noncomputable def fixedOccupationFamily {κ : Type u_1} (A : κ → Set Space) (s : Finset κ)
(n : κ → ℕ) (F : ConfigFamily) : ConfigFamily :=
fun ι _ x => if ∀ k ∈ s, occupation (A k) x = (n k : ℝ) then F ι x else 0
theorem countFamily_relabel (F : ConfigFamily) (hF : RelabelInvariant F) (n : ℕ) :
RelabelInvariant (countFamily F n) := by
intro ι κ _ _ e x
simp only [countFamily, Fintype.card_congr e, hF ι κ e x]
theorem fixedOccupationFamily_relabel {κ : Type u_1} (A : κ → Set Space) (s : Finset κ)
(n : κ → ℕ) (F : ConfigFamily) (hF : RelabelInvariant F) :
RelabelInvariant (fixedOccupationFamily A s n F) := by
intro ι τ _ _ e x
simp only [fixedOccupationFamily, occupation_relabel, hF ι τ e x]
theorem GrandFinite.count {F : ConfigFamily} {D : Set Space} (hF : GrandFinite F D) (n : ℕ) :
GrandFinite (countFamily F n) D := by
refine ⟨fun ι _ => ?_, ?_⟩
· change IntegrableOn (fun x : ι → Space => if Fintype.card ι = n then F ι x else 0) _
split_ifs
· exact hF.integrable ι
· exact integrableOn_zero
· have he (j : ℕ) : familyTerm (countFamily F n) D j = if j = n then familyTerm F D j else 0 := by
unfold familyTerm familyIntegral countFamily
simp only [Fintype.card_fin]
split_ifs <;> simp
change Summable (fun j => familyTerm (countFamily F n) D j)
simp_rw [he]
exact summable_of_ne_finset_zero (s := {n}) (fun j hj => ite_eq_right (by simpa only [Finset.mem_singleton] using hj))
theorem grandIntegral_countFamily (F : ConfigFamily) (D : Set Space) (n : ℕ) :
grandIntegral (countFamily F n) D = familyTerm F D n := by
have he (j : ℕ) : familyTerm (countFamily F n) D j = if j = n then familyTerm F D j else 0 := by
unfold familyTerm familyIntegral countFamily
simp only [Fintype.card_fin]
split_ifs <;> simp
simp only [grandIntegral, he, tsum_ite_eq]
theorem fixedOccupationFamily_nonneg {κ : Type u_1} (A : κ → Set Space) (s : Finset κ)
(n : κ → ℕ) (F : ConfigFamily)
(hF : ∀ (ι : Type) [Fintype ι] (x : ι → Space), 0 ≤ F ι x)
(ι : Type) [Fintype ι] (x : ι → Space) : 0 ≤ fixedOccupationFamily A s n F ι x := by
unfold fixedOccupationFamily
split_ifs
· exact hF ι x
· rfl
theorem GrandFinite.fixedOccupation {κ : Type u_1} {A : κ → Set Space} {s : Finset κ}
(n : κ → ℕ) (hA : ∀ k ∈ s, MeasurableSet (A k)) {F : ConfigFamily} {D : Set Space}
(hF : GrandFinite F D) (hm : ∀ (ι : Type) [Fintype ι], Measurable (F ι))
(h0 : ∀ (ι : Type) [Fintype ι] (x : ι → Space), 0 ≤ F ι x) :
GrandFinite (fixedOccupationFamily A s n F) D := by
refine hF.of_le (fun ι _ => ?_) (fixedOccupationFamily_nonneg A s n F h0) ?_
· apply Measurable.ite ?_ (hm ι) measurable_const
have hh := MeasurableSet.biInter s.finite_toSet.countable (fun k hk =>
measurableSet_eq_fun (measurable_occupation (ι := ι) (hA k hk))
(show Measurable (fun _ : ι → Space => (n k : ℝ)) from measurable_const))
convert hh using 1
ext x
simp only [mem_ofPred_eq, mem_iInter, Finset.mem_coe]
· intro ι _ x
unfold fixedOccupationFamily
split_ifs
· rfl
· exact h0 ι x
theorem occupation_binary_left {ι : Type} [Fintype ι] [DecidableEq ι] {A B : Set Space}
(hd : Disjoint A B) (s : Finset ι) {x : ι → Space} (hx : x ∈ binaryRegion A B s) :
occupation A x = (Fintype.card {i : ι // i ∈ s} : ℝ) := by
rw [occupation_eq_sum]
have he (i : ι) : x i ∈ A ↔ i ∈ s := by
constructor
· intro hi
by_contra his
exact Set.disjoint_left.mp hd hi (by simpa only [ite_eq_right his] using hx i)
· intro hi
simpa only [ite_eq_left hi] using hx i
simp only [he]
simp only [Fintype.card_subtype, ← Finset.sum_boole]
theorem occupation_binary_right {ι : Type} [Fintype ι] [DecidableEq ι] {A B C : Set Space}
(hd : Disjoint A C) (s : Finset ι) {x : ι → Space} (hx : x ∈ binaryRegion A B s) :
occupation C x = occupation C (fun i : {i : ι // i ∉ s} => x i) := by
have hh := (occupation_subtype_compl C s x (fun i hi hc =>
Set.disjoint_left.mp hd (by simpa only [ite_eq_left hi] using hx i) hc)).symm
convert hh using 1
congr! 3
theorem injective_binary_iff {ι : Type} [Fintype ι] [DecidableEq ι] {A B : Set Space}
(hd : Disjoint A B) (s : Finset ι) {x : ι → Space} (hx : x ∈ binaryRegion A B s) :
Function.Injective x ↔ Function.Injective (fun i : {i : ι // i ∈ s} => x i) ∧
Function.Injective (fun i : {i : ι // i ∉ s} => x i) := by
constructor
· intro hh
exact ⟨hh.comp Subtype.val_injective, hh.comp Subtype.val_injective⟩
· rintro ⟨h₁,h₂⟩ i j hij
by_cases hi : i ∈ s <;> by_cases hj : j ∈ s
· exact congrArg Subtype.val (h₁ (a₁ := ⟨i,hi⟩) (a₂ := ⟨j,hj⟩) hij)
· have hia : x i ∈ A := by simpa only [ite_eq_left hi] using hx i
have hjb : x j ∈ B := by simpa only [ite_eq_right hj] using hx j
exact False.elim (Set.disjoint_left.mp hd hia (hij.symm ▸ hjb))
· have hja : x j ∈ A := by simpa only [ite_eq_left hj] using hx j
have hib : x i ∈ B := by simpa only [ite_eq_right hi] using hx i
exact False.elim (Set.disjoint_left.mp hd hja (hij ▸ hib))
· exact congrArg Subtype.val (h₂ (a₁ := ⟨i,hi⟩) (a₂ := ⟨j,hj⟩) hij)
theorem gibbsFamily_binary_eq {U : Space → Space → ℝ} (hU : ∀ x y, U x y = U y x)
(β h : ℝ) {A B : Set Space} (hd : Disjoint A B)
(hcross : ∀ x ∈ A, ∀ y ∈ B, U x y = 0)
{ι : Type} [Fintype ι] [DecidableEq ι] (s : Finset ι) {x : ι → Space} (hx : x ∈ binaryRegion A B s) :
gibbsFamily U β h ι x = gibbsFamily U β h {i : ι // i ∈ s} (fun i => x i)*
gibbsFamily U β h {i : ι // i ∉ s} (fun i => x i) := by
have he : gibbsEnergy U x = gibbsEnergy U (fun i : {i : ι // i ∈ s} => x i)+
gibbsEnergy U (fun i : {i : ι // i ∉ s} => x i) := by
have hh := gibbsEnergy_split U hU (fun i => i ∈ s) x
have hz : (∑ i : {i : ι // i ∈ s}, ∑ j : {j : ι // j ∉ s}, U (x i) (x j)) = 0 := by
apply Finset.sum_eq_zero
intro i _
apply Finset.sum_eq_zero
intro j _
exact hcross (x i) (by simpa only [ite_eq_left i.property] using hx i)
(x j) (by simpa only [ite_eq_right j.property] using hx j)
have he' : gibbsEnergy U x = gibbsEnergy U (fun i : {i : ι // i ∈ s} => x i)+
gibbsEnergy U (fun i : {i : ι // i ∉ s} => x i)+
∑ i : {i : ι // i ∈ s}, ∑ j : {j : ι // j ∉ s}, U (x i) (x j) := by
convert hh using 1
congr! 5
simpa only [hz, add_zero] using he'
have hc : (Fintype.card {i : ι // i ∈ s} : ℝ)+Fintype.card {i : ι // i ∉ s} = Fintype.card ι := by
have hh := Fintype.card_subtype_compl (fun i : ι => i ∈ s)
have hl := Fintype.card_subtype_le (fun i : ι => i ∈ s)
have hh' : Fintype.card {i : ι // i ∈ s}+Fintype.card {i : ι // i ∉ s} = Fintype.card ι := by omega
exact_mod_cast hh'
simp only [gibbsFamily, injective_binary_iff hd s hx]
split_ifs <;> try simp_all only [zero_mul, mul_zero, and_false, false_and, not_false_eq_true, and_self, not_true_eq_false]
rw [← Real.exp_add, ← hc]
congr 1
ring
end ContinuumTemperature
end
end OAI
|