Download data/lean/OAI/Probability/CriticalPercolation/Entropy/MarkedEntropy.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 22.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/MarkedEntropy.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Entropy/MarkedEntropy.lean
-
curl -L -o MarkedEntropy.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Entropy/MarkedEntropy.lean
22.8 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Modular.PushMass | |
| namespace OAI | |
| section | |
| section | |
| namespace CriticalPercolation.FiniteEntropy | |
| open scoped Classical | |
| variable {X Y Z I M : Type*} [Fintype X] [Fintype Y] [Fintype Z] | |
| omit [Fintype Z] in | |
| lemma pushMass_comp (f : X β Y) (g : Y β Z) (P : X β β) : | |
| pushMass g (pushMass f P) = pushMass (g β f) P := by | |
| funext z | |
| have hh := sum_pushMass_mul f P (fun y => if g y = z then (1:β) else 0) | |
| change (β y, if g y = z then pushMass f P y else 0) = | |
| β x, if g (f x) = z then P x else 0 | |
| simpa only [mul_ite,mul_one,mul_zero] using hh | |
| omit [Fintype Y] in | |
| lemma sum_pushMass_pair (P : X β β) (u : X β Y) (v : X β Z) (y : Y) : | |
| β z, pushMass (fun x => (u x,v x)) P (y,z) = pushMass u P y := by | |
| unfold pushMass | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases h : u x = y | |
| Β· simp [h] | |
| Β· simp [h] | |
| noncomputable def conditionalMass (P : X β β) (u : X β Y) (v : X β Z) | |
| (y : Y) (z : Z) : β := | |
| pushMass (fun x => (u x,v x)) P (y,z) / pushMass u P y | |
| omit [Fintype Y] [Fintype Z] in | |
| lemma conditionalMass_nonneg (P : X β β) (hP : β x, 0 β€ P x) | |
| (u : X β Y) (v : X β Z) (y : Y) (z : Z) : 0 β€ conditionalMass P u v y z := | |
| div_nonneg (pushMass_nonneg _ _ hP _) (pushMass_nonneg _ _ hP _) | |
| omit [Fintype Y] in | |
| lemma sum_conditionalMass_le_one (P : X β β) (_hP : β x, 0 β€ P x) | |
| (u : X β Y) (v : X β Z) (y : Y) : β z, conditionalMass P u v y z β€ 1 := by | |
| unfold conditionalMass | |
| rw [β Finset.sum_div, sum_pushMass_pair] | |
| by_cases h : pushMass u P y = 0 | |
| Β· simp [h] | |
| Β· rw [div_self h] | |
| omit [Fintype Y] [Fintype Z] in | |
| lemma conditionalMass_pos (P : X β β) (hP : β x, 0 β€ P x) | |
| (u : X β Y) (v : X β Z) (x : X) (hx : 0 < P x) : | |
| 0 < conditionalMass P u v (u x) (v x) := | |
| div_pos (hx.trans_le (le_pushMass _ _ hP x)) (hx.trans_le (le_pushMass _ _ hP x)) | |
| lemma divergence_as_log (P R : X β β) (hP : β x, 0 β€ P x) | |
| (hs : β x, 0 < P x β 0 < R x) : | |
| divergence P R = β x, P x * Real.log (P x) - β x, P x * Real.log (R x) := by | |
| rw [β Finset.sum_sub_distrib] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| rw [Real.log_div hx (hs x hp).ne'] | |
| ring | |
| variable [Fintype I] [Fintype M] | |
| omit [Fintype Y] in | |
| theorem conditional_marks_log {Y' : I β Type*} (P : (X Γ (I β M)) β β) (hP : β x, 0 β€ P x) | |
| (hm : β x, P x = 1) (t : (i : I) β X β Y' i) : | |
| (β i, β x, P x * Real.log (conditionalMass P (fun x => t i x.1) | |
| (fun x => x.2 i) (t i x.1) (x.2 i))) β€ | |
| (β x, P x * Real.log (P x)) - | |
| β x, P x * Real.log (pushMass Prod.fst P x.1) := by | |
| let K (i : I) (Ο : X) (m : M) := | |
| conditionalMass P (fun x => t i x.1) (fun x => x.2 i) (t i Ο) m | |
| let R (x : X Γ (I β M)) := pushMass Prod.fst P x.1 * β i, K i x.1 (x.2 i) | |
| have hR : β x, 0 β€ R x := fun x => mul_nonneg (pushMass_nonneg _ _ hP _) | |
| (Finset.prod_nonneg fun i _ => conditionalMass_nonneg _ hP _ _ _ _) | |
| have hmass : β x, R x β€ 1 := by | |
| rw [Fintype.sum_prod_type] | |
| calc | |
| _ = β Ο, pushMass Prod.fst P Ο * (β i, β m, K i Ο m) := by | |
| apply Finset.sum_congr rfl | |
| intro Ο _ | |
| simp only [R,β Finset.mul_sum,β Fintype.prod_sum] | |
| _ β€ β Ο, pushMass Prod.fst P Ο := by | |
| apply Finset.sum_le_sum | |
| intro Ο _ | |
| apply mul_le_of_le_one_right (pushMass_nonneg _ _ hP _) | |
| exact Finset.prod_le_oneβ (fun i _ => Finset.sum_nonneg fun m _ => | |
| conditionalMass_nonneg _ hP _ _ _ _) (fun i _ => sum_conditionalMass_le_one _ hP _ _ _) | |
| _ = 1 := (pushMass_sum _ _).trans hm | |
| have hs (x : X Γ (I β M)) (hx : 0 < P x) : 0 < R x := | |
| mul_pos (hx.trans_le (le_pushMass _ _ hP x)) (Finset.prod_pos fun i _ => | |
| conditionalMass_pos _ hP _ _ x hx) | |
| have hd : 0 β€ divergence P R := by | |
| have hh := mass_sub_le_divergence P R hP hR hs | |
| rw [hm] at hh | |
| linarith | |
| rw [divergence_as_log P R hP hs] at hd | |
| have heq : β x, P x * Real.log (R x) = | |
| (β x, P x * Real.log (pushMass Prod.fst P x.1)) + | |
| β i, β x, P x * Real.log (K i x.1 (x.2 i)) := by | |
| rw [Finset.sum_comm,β Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| have hs0 : 0 < pushMass Prod.fst P x.1 := hp.trans_le (le_pushMass _ _ hP x) | |
| have hK (i : I) : 0 < K i x.1 (x.2 i) := conditionalMass_pos _ hP _ _ x hp | |
| dsimp only [R] | |
| rw [Real.log_mul hs0.ne' (Finset.prod_pos (fun i _ => hK i)).ne', | |
| Real.log_prod (fun i _ => (hK i).ne'),mul_add,Finset.mul_sum] | |
| rw [heq] at hd | |
| dsimp only [K] at hd | |
| linarith | |
| end CriticalPercolation.FiniteEntropy | |
| namespace CriticalPercolation.FiniteEntropy | |
| open scoped Classical | |
| variable {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] | |
| omit [Fintype Z] in | |
| lemma divergence_pushMass_eq (f : X β Y) (P : X β β) (R : Y β β) : | |
| divergence (pushMass f P) R = | |
| β x, P x * Real.log (pushMass f P (f x) / R (f x)) := | |
| sum_pushMass_mul f P (fun y => Real.log (pushMass f P y / R y)) | |
| lemma divergence_mark_chain (P : X β β) (hP : β x, 0 β€ P x) | |
| (u : X β Y) (v : X β Z) (ΞΌ : Y β β) (a : Y β Z β β) | |
| (hΞΌ : β x, 0 < P x β 0 < ΞΌ (u x)) | |
| (ha : β x, 0 < P x β 0 < a (u x) (v x)) : | |
| divergence (pushMass (fun x => (u x,v x)) P) (fun yz => ΞΌ yz.1 * a yz.1 yz.2) = | |
| divergence (pushMass u P) ΞΌ + | |
| β x, P x * Real.log (conditionalMass P u v (u x) (v x) / a (u x) (v x)) := by | |
| rw [divergence_pushMass_eq,divergence_pushMass_eq,β Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| have hu : 0 < pushMass u P (u x) := hp.trans_le (le_pushMass _ _ hP x) | |
| have huv : 0 < pushMass (fun x => (u x,v x)) P (u x,v x) := | |
| hp.trans_le (le_pushMass _ _ hP x) | |
| have hm := hΞΌ x hp | |
| have ham := ha x hp | |
| have hc := conditionalMass_pos P hP u v x hp | |
| rw [Real.log_div huv.ne' (mul_pos hm ham).ne',Real.log_mul hm.ne' ham.ne', | |
| Real.log_div hu.ne' hm.ne',Real.log_div hc.ne' ham.ne',conditionalMass, | |
| Real.log_div huv.ne' hu.ne'] | |
| ring | |
| lemma conditional_cost_ge (P : X β β) (hP : β x, 0 β€ P x) | |
| (u : X β Y) (v : X β Z) (a : Y β Z β β) (ha : β y z, 0 β€ a y z) | |
| (hs : β x, 0 < P x β 0 < a (u x) (v x)) : | |
| -(β x, P x * Real.log (β z, a (u x) z)) β€ | |
| β x, P x * Real.log (conditionalMass P u v (u x) (v x) / a (u x) (v x)) := by | |
| let A (y : Y) := β z, a y z | |
| let U := pushMass (fun x => (u x,v x)) P | |
| let R (yz : Y Γ Z) := pushMass u P yz.1 * (a yz.1 yz.2 / A yz.1) | |
| have hA (y : Y) : 0 β€ A y := Finset.sum_nonneg (fun z _ => ha y z) | |
| have hAP (x : X) (hx : 0 < P x) : 0 < A (u x) := | |
| (hs x hx).trans_le (Finset.single_le_sum (fun z _ => ha (u x) z) (Finset.mem_univ (v x))) | |
| have hR : β yz, 0 β€ R yz := fun yz => mul_nonneg (pushMass_nonneg _ _ hP _) | |
| (div_nonneg (ha _ _) (hA _)) | |
| have hm : β yz, R yz β€ β yz, U yz := by | |
| rw [Fintype.sum_prod_type,pushMass_sum] | |
| calc | |
| _ = β y, pushMass u P y * (A y / A y) := by | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| simp only [R,β Finset.mul_sum,β Finset.sum_div,A] | |
| _ β€ β y, pushMass u P y := by | |
| apply Finset.sum_le_sum | |
| intro y _ | |
| apply mul_le_of_le_one_right (pushMass_nonneg _ _ hP _) | |
| by_cases hy : A y = 0 | |
| Β· simp [hy] | |
| Β· rw [div_self hy] | |
| _ = β x, P x := pushMass_sum _ _ | |
| have hsR (yz : Y Γ Z) (hyz : 0 < U yz) : 0 < R yz := by | |
| obtain β¨x,he,hxβ© : β x, (u x,v x) = yz β§ 0 < P x := by | |
| by_contra! h | |
| have hh : U yz β€ 0 := by | |
| apply Finset.sum_nonpos | |
| intro x _ | |
| split_ifs with he | |
| Β· exact h x he | |
| Β· exact le_rfl | |
| linarith | |
| subst yz | |
| exact mul_pos (hx.trans_le (le_pushMass _ _ hP x)) | |
| (div_pos (hs x hx) (hAP x hx)) | |
| have hd : 0 β€ divergence U R := by | |
| have hh := mass_sub_le_divergence U R (pushMass_nonneg _ _ hP) hR hsR | |
| linarith | |
| have hchain := divergence_mark_chain P hP u v (pushMass u P) (fun y z => a y z / A y) | |
| (fun x hx => hx.trans_le (le_pushMass _ _ hP x)) | |
| (fun x hx => div_pos (hs x hx) (hAP x hx)) | |
| change divergence U R = _ at hchain | |
| have hself : divergence (pushMass u P) (pushMass u P) = 0 := by | |
| unfold divergence | |
| apply Finset.sum_eq_zero | |
| intro y _ | |
| by_cases hy : pushMass u P y = 0 | |
| Β· simp [hy] | |
| Β· simp [hy] | |
| rw [hself,zero_add] at hchain | |
| rw [hchain] at hd | |
| have hlog : β x, P x * Real.log (conditionalMass P u v (u x) (v x) / | |
| (a (u x) (v x) / A (u x))) = | |
| (β x, P x * Real.log (conditionalMass P u v (u x) (v x) / a (u x) (v x))) + | |
| β x, P x * Real.log (A (u x)) := by | |
| rw [β Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| have hc := conditionalMass_pos P hP u v x hp | |
| have ham := hs x hp | |
| have hA' := hAP x hp | |
| rw [Real.log_div hc.ne' (div_pos ham hA').ne',Real.log_div ham.ne' hA'.ne', | |
| Real.log_div hc.ne' ham.ne'] | |
| ring | |
| rw [hlog] at hd | |
| dsimp only [A] at hd | |
| linarith | |
| end CriticalPercolation.FiniteEntropy | |
| namespace CriticalPercolation.FiniteEntropy | |
| open scoped Classical | |
| variable {X I M : Type*} [Fintype X] [Fintype I] [Fintype M] | |
| {Y : I β Type*} [β i, Fintype (Y i)] | |
| omit [β i, Fintype (Y i)] in | |
| theorem conditional_mark_cost_le (P : (X Γ (I β M)) β β) (hP : β x, 0 β€ P x) | |
| (hm : β x, P x = 1) (ΞΌ : X β β) (hΞΌ : β Ο, 0 < ΞΌ Ο) | |
| (t : (i : I) β X β Y i) (a : (i : I) β Y i β M β β) (L : β) | |
| (ha : β i x, 0 < P x β 0 < a i (t i x.1) (x.2 i)) | |
| (hdensity : β x, P x β€ Real.exp L * ΞΌ x.1 * β i, a i (t i x.1) (x.2 i)) : | |
| (β i, β x, P x * Real.log (conditionalMass P (fun x => t i x.1) | |
| (fun x => x.2 i) (t i x.1) (x.2 i) / a i (t i x.1) (x.2 i))) β€ | |
| L - divergence (pushMass Prod.fst P) ΞΌ := by | |
| have hsub := conditional_marks_log P hP hm t | |
| have hden : (β x, P x * Real.log (P x)) - | |
| (β x, P x * Real.log (ΞΌ x.1)) - | |
| (β i, β x, P x * Real.log (a i (t i x.1) (x.2 i))) β€ L := by | |
| have hh (x : X Γ (I β M)) : P x * Real.log (P x) β€ | |
| P x * (L + Real.log (ΞΌ x.1) + β i, Real.log (a i (t i x.1) (x.2 i))) := by | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| have hpr : 0 < β i, a i (t i x.1) (x.2 i) := Finset.prod_pos (fun i _ => ha i x hp) | |
| have hlog := Real.log_le_log hp (hdensity x) | |
| rw [Real.log_mul (mul_pos (Real.exp_pos L) (hΞΌ x.1)).ne' hpr.ne', | |
| Real.log_mul (Real.exp_ne_zero L) (hΞΌ x.1).ne',Real.log_exp, | |
| Real.log_prod (fun i _ => (ha i x hp).ne')] at hlog | |
| exact mul_le_mul_of_nonneg_left hlog (hP x) | |
| have hh := Finset.sum_le_sum (s := Finset.univ) (fun x _ => hh x) | |
| simp only [mul_add,Finset.sum_add_distrib,Finset.mul_sum] at hh | |
| rw [β Finset.sum_mul,hm,one_mul,Finset.sum_comm] at hh | |
| linarith | |
| have hdiv : divergence (pushMass Prod.fst P) ΞΌ = | |
| (β x, P x * Real.log (pushMass Prod.fst P x.1)) - | |
| β x, P x * Real.log (ΞΌ x.1) := by | |
| rw [divergence_pushMass_eq,β Finset.sum_sub_distrib] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| rw [Real.log_div (hp.trans_le (le_pushMass _ _ hP x)).ne' (hΞΌ x.1).ne'] | |
| ring | |
| have hcost (i : I) : (β x, P x * Real.log (conditionalMass P (fun x => t i x.1) | |
| (fun x => x.2 i) (t i x.1) (x.2 i) / a i (t i x.1) (x.2 i))) = | |
| (β x, P x * Real.log (conditionalMass P (fun x => t i x.1) | |
| (fun x => x.2 i) (t i x.1) (x.2 i))) - | |
| β x, P x * Real.log (a i (t i x.1) (x.2 i)) := by | |
| rw [β Finset.sum_sub_distrib] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| rw [Real.log_div (conditionalMass_pos _ hP _ _ x hp).ne' (ha i x hp).ne'] | |
| ring | |
| simp_rw [hcost] | |
| rw [Finset.sum_sub_distrib,hdiv] | |
| linarith | |
| end CriticalPercolation.FiniteEntropy | |
| namespace CriticalPercolation.FiniteEntropy | |
| open scoped Classical | |
| variable {X I M : Type*} [Fintype X] [Fintype I] [Fintype M] | |
| {Y : I β Type*} [β i, Fintype (Y i)] | |
| theorem active_contact_entropy_le (P : (X Γ (I β M)) β β) (hP : β x, 0 β€ P x) | |
| (hm : β x, P x = 1) (ΞΌ : X β β) (hΞΌ : β Ο, 0 < ΞΌ Ο) | |
| (t : (i : I) β X β Y i) (a : (i : I) β Y i β M β β) (L : β) (S : Finset I) | |
| (han : β i y m, 0 β€ a i y m) | |
| (ha : β i x, 0 < P x β 0 < a i (t i x.1) (x.2 i)) | |
| (hdensity : β x, P x β€ Real.exp L * ΞΌ x.1 * β i, a i (t i x.1) (x.2 i)) : | |
| (β i β S, divergence (pushMass (fun x => (t i x.1,x.2 i)) P) | |
| (fun ym => pushMass (t i) ΞΌ ym.1 * a i ym.1 ym.2)) β€ | |
| (β i β S, divergence (pushMass (fun x => t i x.1) P) (pushMass (t i) ΞΌ)) + | |
| L - divergence (pushMass Prod.fst P) ΞΌ + | |
| β i β SαΆ, β x, P x * Real.log (β m, a i (t i x.1) m) := by | |
| let C (i : I) := β x, P x * Real.log (conditionalMass P (fun x => t i x.1) | |
| (fun x => x.2 i) (t i x.1) (x.2 i) / a i (t i x.1) (x.2 i)) | |
| have hall := conditional_mark_cost_le P hP hm ΞΌ hΞΌ t a L ha hdensity | |
| change (β i, C i) β€ L - divergence (pushMass Prod.fst P) ΞΌ at hall | |
| rw [β Finset.sum_add_sum_compl S] at hall | |
| have hinactive : -(β i β SαΆ, β x, P x * Real.log (β m, a i (t i x.1) m)) β€ | |
| β i β SαΆ, C i := by | |
| rw [β Finset.sum_neg_distrib] | |
| exact Finset.sum_le_sum (fun i _ => conditional_cost_ge P hP _ _ (a i) (han i) (ha i)) | |
| have heq (i : I) : divergence (pushMass (fun x => (t i x.1,x.2 i)) P) | |
| (fun ym => pushMass (t i) ΞΌ ym.1 * a i ym.1 ym.2) = | |
| divergence (pushMass (fun x => t i x.1) P) (pushMass (t i) ΞΌ) + C i := by | |
| exact divergence_mark_chain P hP _ _ _ _ | |
| (fun x _ => (hΞΌ x.1).trans_le (le_pushMass _ _ (fun Ο => (hΞΌ Ο).le) x.1)) (ha i) | |
| simp_rw [heq] | |
| rw [Finset.sum_add_distrib] | |
| linarith | |
| end CriticalPercolation.FiniteEntropy | |
| namespace CriticalPercolation.FiniteEntropy | |
| open scoped Classical | |
| variable {X I M : Type*} [Fintype X] [Fintype I] [Fintype M] | |
| lemma pushMass_fst (P : X Γ M β β) (x : X) : | |
| pushMass Prod.fst P x = β m, P (x,m) := by | |
| simp only [pushMass,Fintype.sum_prod_type] | |
| rw [Finset.sum_comm] | |
| simp | |
| theorem marginal_density_le (P : (X Γ (I β M)) β β) (ΞΌ : X β β) | |
| (a : I β X β M β β) (L : β) | |
| (hd : β x, P x β€ Real.exp L * ΞΌ x.1 * β i, a i x.1 (x.2 i)) (Ο : X) : | |
| pushMass Prod.fst P Ο β€ Real.exp L * ΞΌ Ο * β i, β m, a i Ο m := by | |
| rw [pushMass_fst, Fintype.prod_sum, Finset.mul_sum] | |
| exact Finset.sum_le_sum fun m _ => hd (Ο,m) | |
| theorem entropy_exponential_domination (Q ΞΌ : X β β) (hQ : β x, 0 β€ Q x) | |
| (hm : β x, Q x = 1) (hΞΌ : β x, 0 < ΞΌ x) (ΞΎ : X β β) | |
| (L B : β) (hd : β x, Q x β€ Real.exp L * ΞΌ x * Real.exp (ΞΎ x)) | |
| (hmgf : β x, ΞΌ x * Real.exp (2 * ΞΎ x) β€ Real.exp B) : | |
| divergence Q ΞΌ β€ 2*L+B β§ (β x, Q x*ΞΎ x) β€ L+B := by | |
| have hlog : divergence Q ΞΌ β€ L + β x, Q x * ΞΎ x := by | |
| have hh (x : X) : Q x * Real.log (Q x / ΞΌ x) β€ Q x * (L + ΞΎ x) := by | |
| by_cases hx : Q x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < Q x := lt_of_le_of_ne (hQ x) (Ne.symm hx) | |
| have hr : Q x / ΞΌ x β€ Real.exp (L + ΞΎ x) := by | |
| rw [div_le_iffβ (hΞΌ x), Real.exp_add] | |
| simpa only [mul_assoc,mul_left_comm,mul_comm] using hd x | |
| have hl := Real.log_le_log (div_pos hp (hΞΌ x)) hr | |
| rw [Real.log_exp] at hl | |
| exact mul_le_mul_of_nonneg_left hl (hQ x) | |
| have hh := Finset.sum_le_sum (s := Finset.univ) fun x _ => hh x | |
| simpa only [divergence, mul_add, Finset.sum_add_distrib, β Finset.sum_mul, hm, one_mul] using hh | |
| have hent := entropy_inequality Q ΞΌ hQ (fun x => (hΞΌ x).le) hm | |
| (fun x _ => hΞΌ x) (fun x => 2 * ΞΎ x) | |
| have hmgfpos := normalizer_pos Q ΞΌ hQ (fun x => (hΞΌ x).le) hm | |
| (fun x _ => hΞΌ x) (fun x => 2 * ΞΎ x) | |
| have hb := Real.log_le_log hmgfpos hmgf | |
| rw [Real.log_exp] at hb | |
| have he : (β x, Q x * (2 * ΞΎ x)) = 2 * β x, Q x * ΞΎ x := by | |
| simp only [Finset.mul_sum] | |
| congr 1 | |
| ext x | |
| ring | |
| rw [he] at hent | |
| constructor <;> linarith | |
| noncomputable def logContactMass (a : I β X β M β β) (Ο : X) : β := | |
| β i, Real.log (max 1 (β m, a i Ο m)) | |
| omit [Fintype X] in | |
| lemma exp_logContactMass (a : I β X β M β β) (Ο : X) : | |
| Real.exp (logContactMass a Ο) = β i, max 1 (β m, a i Ο m) := by | |
| rw [logContactMass,Real.exp_sum] | |
| apply Finset.prod_congr rfl | |
| intro i _ | |
| exact Real.exp_log (lt_of_lt_of_le zero_lt_one (le_max_left _ _)) | |
| omit [Fintype X] in | |
| lemma logContactMass_nonneg (a : I β X β M β β) (Ο : X) : | |
| 0 β€ logContactMass a Ο := | |
| Finset.sum_nonneg fun _i _ => Real.log_nonneg (le_max_left _ _) | |
| theorem contact_configuration_entropy (P : (X Γ (I β M)) β β) | |
| (hP : β x, 0 β€ P x) (hm : β x, P x = 1) (ΞΌ : X β β) (hΞΌ : β Ο, 0 < ΞΌ Ο) | |
| (a : I β X β M β β) (ha : β i Ο m, 0 β€ a i Ο m) (L B : β) | |
| (hd : β x, P x β€ Real.exp L * ΞΌ x.1 * β i, a i x.1 (x.2 i)) | |
| (hmgf : β Ο, ΞΌ Ο * Real.exp (2 * logContactMass a Ο) β€ Real.exp B) : | |
| divergence (pushMass Prod.fst P) ΞΌ β€ 2*L+B β§ | |
| (β x, P x * logContactMass a x.1) β€ L+B := by | |
| have hd' (Ο : X) : pushMass Prod.fst P Ο β€ | |
| Real.exp L * ΞΌ Ο * Real.exp (logContactMass a Ο) := by | |
| rw [exp_logContactMass] | |
| exact (marginal_density_le P ΞΌ a L hd Ο).trans | |
| (mul_le_mul_of_nonneg_left (Finset.prod_le_prodβ | |
| (fun i _ => Finset.sum_nonneg fun m _ => ha i Ο m) | |
| (fun i _ => le_max_right _ _)) (mul_pos (Real.exp_pos L) (hΞΌ Ο)).le) | |
| have hh := entropy_exponential_domination (pushMass Prod.fst P) ΞΌ | |
| (pushMass_nonneg _ _ hP) (by rw [pushMass_sum,hm]) hΞΌ (logContactMass a) L B hd' hmgf | |
| rw [sum_pushMass_mul] at hh | |
| exact hh | |
| end CriticalPercolation.FiniteEntropy | |
| namespace CriticalPercolation.FiniteEntropy | |
| open scoped Classical | |
| variable {X I M : Type*} [Fintype X] [Fintype I] [Fintype M] | |
| {Y : I β Type*} [β i, Fintype (Y i)] | |
| omit [β i, Fintype (Y i)] in | |
| lemma inactive_contact_log_le (P : (X Γ (I β M)) β β) (hP : β x, 0 β€ P x) | |
| (a : I β X β M β β) (ha : β i Ο m, 0 β€ a i Ο m) | |
| (hs : β i x, 0 < P x β 0 < a i x.1 (x.2 i)) (S : Finset I) : | |
| (β i β S, β x, P x * Real.log (β m, a i x.1 m)) β€ | |
| β x, P x * logContactMass a x.1 := by | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_le_sum | |
| intro x _ | |
| rw [β Finset.mul_sum] | |
| by_cases hx : P x = 0 | |
| Β· simp [hx] | |
| Β· have hp : 0 < P x := lt_of_le_of_ne (hP x) (Ne.symm hx) | |
| apply mul_le_mul_of_nonneg_left _ (hP x) | |
| calc | |
| _ β€ β i β S, Real.log (max 1 (β m, a i x.1 m)) := by | |
| apply Finset.sum_le_sum | |
| intro i _ | |
| exact Real.log_le_log ((hs i x hp).trans_le | |
| (Finset.single_le_sum (fun m _ => ha i x.1 m) (Finset.mem_univ _))) | |
| (le_max_right _ _) | |
| _ β€ logContactMass a x.1 := Finset.sum_le_sum_of_subset_of_nonneg | |
| (Finset.subset_univ _) (fun i _ _ => Real.log_nonneg (le_max_left _ _)) | |
| theorem active_inverse_cost_le (P : (X Γ (I β M)) β β) (hP : β x, 0 β€ P x) | |
| (hm : β x, P x = 1) (ΞΌ : X β β) (hΞΌ : β Ο, 0 < ΞΌ Ο) | |
| (t : (i : I) β X β Y i) (a : (i : I) β Y i β M β β) | |
| (cost : (i : I) β Y i β M β β) (L : β) (S : Finset I) | |
| (han : β i y m, 0 β€ a i y m) | |
| (ha : β i x, 0 < P x β 0 < a i (t i x.1) (x.2 i)) | |
| (hc : β i y m, 0 β€ cost i y m) | |
| (hdensity : β x, P x β€ Real.exp L * ΞΌ x.1 * β i, a i (t i x.1) (x.2 i)) | |
| (hmoment : β i β S, β ym : Y i Γ M, pushMass (t i) ΞΌ ym.1 * | |
| a i ym.1 ym.2 * (1 + cost i ym.1 ym.2) β€ 4) : | |
| (β i β S, β x, P x * Real.log (1 + cost i (t i x.1) (x.2 i))) β€ | |
| (β i β S, divergence (pushMass (fun x => t i x.1) P) (pushMass (t i) ΞΌ)) + | |
| L - divergence (pushMass Prod.fst P) ΞΌ + | |
| (β x, P x * logContactMass (fun i Ο => a i (t i Ο)) x.1) + | |
| (S.card : β) * Real.log 4 := by | |
| have hactive := active_contact_entropy_le P hP hm ΞΌ hΞΌ t a L S han ha hdensity | |
| have hinactive := inactive_contact_log_le P hP (fun i Ο => a i (t i Ο)) | |
| (fun i Ο m => han i (t i Ο) m) ha SαΆ | |
| have hi (i : I) (hi : i β S) : | |
| (β x, P x * Real.log (1 + cost i (t i x.1) (x.2 i))) β€ | |
| divergence (pushMass (fun x => (t i x.1,x.2 i)) P) | |
| (fun ym => pushMass (t i) ΞΌ ym.1 * a i ym.1 ym.2) + Real.log 4 := by | |
| let f : X Γ (I β M) β Y i Γ M := fun x => (t i x.1,x.2 i) | |
| let R : Y i Γ M β β := fun ym => pushMass (t i) ΞΌ ym.1 * a i ym.1 ym.2 | |
| have hR : β ym, 0 β€ R ym := fun ym => mul_nonneg | |
| (pushMass_nonneg _ _ (fun Ο => (hΞΌ Ο).le) _) (han i _ _) | |
| have hs (ym : Y i Γ M) (h : 0 < pushMass f P ym) : 0 < R ym := by | |
| obtain β¨x,hx,hfxβ© : β x, 0 < P x β§ f x = ym := by | |
| by_contra! hn | |
| have hh : pushMass f P ym β€ 0 := by | |
| unfold pushMass | |
| apply Finset.sum_nonpos | |
| intro x _ | |
| split_ifs with he | |
| Β· exact le_of_not_gt (fun hx => hn x hx he) | |
| Β· rfl | |
| linarith | |
| subst ym | |
| exact mul_pos ((hΞΌ x.1).trans_le (le_pushMass _ _ (fun Ο => (hΞΌ Ο).le) x.1)) | |
| (ha i x hx) | |
| have hpos (ym : Y i Γ M) : 0 < 1 + cost i ym.1 ym.2 := by linarith [hc i ym.1 ym.2] | |
| have hh := entropy_inequality (pushMass f P) R (pushMass_nonneg _ _ hP) hR | |
| (by rw [pushMass_sum,hm]) hs (fun ym => Real.log (1 + cost i ym.1 ym.2)) | |
| have hm' : (β ym, R ym * Real.exp (Real.log (1 + cost i ym.1 ym.2))) β€ 4 := by | |
| simp only [Real.exp_log (hpos _)] | |
| exact hmoment i hi | |
| have hz := normalizer_pos (pushMass f P) R (pushMass_nonneg _ _ hP) hR | |
| (by rw [pushMass_sum,hm]) hs (fun ym => Real.log (1 + cost i ym.1 ym.2)) | |
| have hl := Real.log_le_log hz hm' | |
| rw [sum_pushMass_mul] at hh | |
| exact hh.trans (add_le_add_right hl _) | |
| have hsum := Finset.sum_le_sum (fun i hi' => hi i hi') | |
| simp only [Finset.sum_add_distrib,Finset.sum_const, nsmul_eq_mul] at hsum | |
| linarith | |
| end CriticalPercolation.FiniteEntropy | |
| end | |
| end | |
| end OAI | |