Download data/lean/OAI/Probability/CriticalPercolation/ProductMeasure/FiniteProductPin.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.46 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/ProductMeasure/FiniteProductPin.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/ProductMeasure/FiniteProductPin.lean
-
curl -L -o FiniteProductPin.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/ProductMeasure/FiniteProductPin.lean
4.46 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.ProductMeasure.Density | |
| namespace OAI | |
| section | |
| section | |
| open Set MeasureTheory ProbabilityTheory | |
| open Set | |
| open scoped BigOperators | |
| open scoped Classical | |
| namespace CriticalPercolation.FiniteProduct | |
| open scoped Classical | |
| variable {E A : Type*} [Fintype E] [Fintype A] | |
| noncomputable def pin (w : E β A β β) (e : E) (b : A) : E β A β β := | |
| Function.update w e (fun a => if a = b then 1 else 0) | |
| omit [Fintype E] [Fintype A] in | |
| lemma pin_nonneg (w : E β A β β) (hw : β e a, 0 β€ w e a) (e : E) (b : A) : | |
| β j a, 0 β€ pin w e b j a := by | |
| intro j a | |
| by_cases h : j = e | |
| Β· subst j; simp [pin]; split_ifs <;> norm_num | |
| Β· simpa [pin,h] using hw j a | |
| omit [Fintype E] in | |
| lemma pin_normalized (w : E β A β β) (hw : β e, β a, w e a = 1) (e : E) (b : A) : | |
| β j, β a, pin w e b j a = 1 := by | |
| intro j | |
| by_cases h : j = e | |
| Β· subst j; simp [pin] | |
| Β· simpa [pin,h] using hw j | |
| omit [Fintype A] in | |
| lemma density_pin (w : E β A β β) (e : E) (b : A) (Ο : E β A) : | |
| density (pin w e b) Ο = | |
| (if Ο e = b then 1 else 0)*β j β (Finset.univ : Finset E).erase e, w j (Ο j) := by | |
| rw [density,β Finset.prod_erase_mul _ _ (Finset.mem_univ e)] | |
| simp only [pin,Function.update_self] | |
| have he : (β j β (Finset.univ : Finset E).erase e, Function.update w e | |
| (fun a => if a = b then 1 else 0) j (Ο j)) = | |
| β j β (Finset.univ : Finset E).erase e, w j (Ο j) := by | |
| apply Finset.prod_congr rfl | |
| intro j hj | |
| rw [Function.update_of_ne (Finset.mem_erase.mp hj).1] | |
| rw [he,mul_comm] | |
| lemma expect_mask_pin (w : E β A β β) (e : E) (b : A) (f : (E β A) β β) : | |
| expect w (fun Ο => if Ο e = b then f Ο else 0) = w e b*expect (pin w e b) f := by | |
| unfold expect | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro Ο _ | |
| rw [density_pin] | |
| dsimp only | |
| by_cases h : Ο e = b | |
| Β· rw [ite_eq_left h,ite_eq_left h,one_mul] | |
| rw [density,β Finset.prod_erase_mul _ _ (Finset.mem_univ e),h] | |
| ring | |
| Β· simp [h] | |
| def prefixEvent : List (E Γ A) β (E β A) β Prop | |
| | [], _ => True | |
| | (e,b)::xs, Ο => Ο e = b β§ prefixEvent xs Ο | |
| noncomputable def prefixWeight (w : E β A β β) : List (E Γ A) β E β A β β | |
| | [] => w | |
| | (e,b)::xs => prefixWeight (pin w e b) xs | |
| noncomputable def prefixFactor (w : E β A β β) : List (E Γ A) β β | |
| | [] => 1 | |
| | (e,b)::xs => w e b*prefixFactor (pin w e b) xs | |
| omit [Fintype E] [Fintype A] in | |
| lemma prefixWeight_nonneg (w : E β A β β) (hw : β e a, 0 β€ w e a) (xs : List (E Γ A)) : | |
| β e a, 0 β€ prefixWeight w xs e a := by | |
| induction xs generalizing w with | |
| | nil => exact hw | |
| | cons x xs ih => exact ih _ (pin_nonneg w hw x.1 x.2) | |
| omit [Fintype E] in | |
| lemma prefixWeight_normalized (w : E β A β β) (hw : β e, β a, w e a = 1) | |
| (xs : List (E Γ A)) : β e, β a, prefixWeight w xs e a = 1 := by | |
| induction xs generalizing w with | |
| | nil => exact hw | |
| | cons x xs ih => exact ih _ (pin_normalized w hw x.1 x.2) | |
| omit [Fintype E] [Fintype A] in | |
| lemma prefixFactor_nonneg (w : E β A β β) (hw : β e a, 0 β€ w e a) (xs : List (E Γ A)) : | |
| 0 β€ prefixFactor w xs := by | |
| induction xs generalizing w with | |
| | nil => exact zero_le_one | |
| | cons x xs ih => exact mul_nonneg (hw _ _) (ih _ (pin_nonneg w hw x.1 x.2)) | |
| theorem expect_prefix (w : E β A β β) (xs : List (E Γ A)) (f : (E β A) β β) : | |
| expect w (fun Ο => if prefixEvent xs Ο then f Ο else 0) = | |
| prefixFactor w xs*expect (prefixWeight w xs) f := by | |
| induction xs generalizing w with | |
| | nil => simp [prefixEvent,prefixFactor,prefixWeight] | |
| | cons x xs ih => | |
| have he : (fun Ο => if prefixEvent (x::xs) Ο then f Ο else 0) = | |
| (fun Ο => if Ο x.1 = x.2 then (if prefixEvent xs Ο then f Ο else 0) else 0) := by | |
| funext Ο | |
| by_cases h : Ο x.1 = x.2 <;> by_cases hp : prefixEvent xs Ο <;> simp [prefixEvent,h,hp] | |
| rw [he,expect_mask_pin,ih] | |
| exact (mul_assoc _ _ _).symm | |
| omit [Fintype E] [Fintype A] in | |
| lemma prefixWeight_fresh (w : E β A β β) (xs : List (E Γ A)) (e : E) | |
| (he : e β xs.map Prod.fst) : prefixWeight w xs e = w e := by | |
| induction xs generalizing w with | |
| | nil => rfl | |
| | cons x xs ih => | |
| simp only [List.map_cons,List.mem_cons,not_or] at he | |
| rw [prefixWeight,ih _ he.2,pin,Function.update_of_ne he.1] | |
| end CriticalPercolation.FiniteProduct | |
| end | |
| end | |
| end OAI | |