Download data/lean/OAI/Probability/FreeIsing/Critical/Branching.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.48 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Critical/Branching.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Critical/Branching.lean
-
curl -L -o Branching.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Critical/Branching.lean
5.48 kB
| import Mathlib | |
| namespace OAI | |
| noncomputable section | |
| open Filter | |
| open scoped Topology | |
| namespace Problem367 | |
| namespace CriticalBranching | |
| def step (b : β) (p q : β) : β := 1 - (1 - p * q) ^ b | |
| def survival (b : β) (p : β) : β β β | |
| | 0 => 1 | |
| | n + 1 => step b p (survival b p n) | |
| theorem one_sub_pow_quadratic (n : β) {y : β} (_hy0 : 0 β€ y) (hy1 : y β€ 1) : | |
| 1 - (1 - y) ^ (n + 1) β€ (n + 1 : β) * y - (n : β) * y ^ 2 := by | |
| induction n with | |
| | zero => simp | |
| | succ n ih => | |
| have hnon : 0 β€ 1 - y := sub_nonneg.mpr hy1 | |
| calc | |
| 1 - (1 - y) ^ (n + 1 + 1) = | |
| y + (1 - y) * (1 - (1 - y) ^ (n + 1)) := by rw [pow_succ]; ring | |
| _ β€ y + (1 - y) * ((n + 1 : β) * y - (n : β) * y ^ 2) := by | |
| gcongr | |
| _ β€ (n + 1 + 1 : β) * y - (n + 1 : β) * y ^ 2 := by | |
| push_cast | |
| have h := mul_nonneg (Nat.cast_nonneg n : (0 : β) β€ n) | |
| (mul_nonneg (sq_nonneg y) hnon) | |
| nlinarith | |
| theorem step_mem_Icc (b : β) {p q : β} (hp : p β Set.Icc (0 : β) 1) | |
| (hq : q β Set.Icc (0 : β) 1) : step b p q β Set.Icc (0 : β) 1 := by | |
| have hy1 : p * q β€ 1 := | |
| (mul_le_mul_of_nonneg_right hp.2 hq.1).trans (by simpa using hq.2) | |
| have hz0 : 0 β€ 1 - p * q := sub_nonneg.mpr hy1 | |
| have hz1 : 1 - p * q β€ 1 := by nlinarith [mul_nonneg hp.1 hq.1] | |
| constructor | |
| Β· exact sub_nonneg.mpr (pow_le_oneβ hz0 hz1) | |
| Β· exact sub_le_self _ (pow_nonneg hz0 b) | |
| theorem survival_mem_Icc (b : β) {p : β} (hp : p β Set.Icc (0 : β) 1) | |
| (n : β) : survival b p n β Set.Icc (0 : β) 1 := by | |
| induction n with | |
| | zero => simp [survival] | |
| | succ n ih => exact step_mem_Icc b hp ih | |
| theorem step_le_quadratic {b : β} (hb : 1 β€ b) {p q : β} | |
| (hp : p β Set.Icc (0 : β) 1) (hq : q β Set.Icc (0 : β) 1) | |
| (hcritical : (b : β) * p β€ 1) : | |
| step b p q β€ q - ((b : β) - 1) * p ^ 2 * q ^ 2 := by | |
| obtain β¨n, rflβ© := Nat.exists_eq_succ_of_ne_zero (by omega : b β 0) | |
| have hy0 : 0 β€ p * q := mul_nonneg hp.1 hq.1 | |
| have hy1 : p * q β€ 1 := | |
| (mul_le_mul_of_nonneg_right hp.2 hq.1).trans (by simpa using hq.2) | |
| have h := one_sub_pow_quadratic n hy0 hy1 | |
| have hmul := mul_le_mul_of_nonneg_right hcritical hq.1 | |
| unfold step | |
| simp only [Nat.succ_eq_add_one, Nat.cast_add, Nat.cast_one] at hmul β’ | |
| calc | |
| 1 - (1 - p * q) ^ (n + 1) β€ (n + 1 : β) * (p * q) - (n : β) * (p * q) ^ 2 := h | |
| _ = ((n : β) + 1) * p * q - ((n : β) + 1 - 1) * p ^ 2 * q ^ 2 := by push_cast; ring | |
| _ β€ q - ((n : β) + 1 - 1) * p ^ 2 * q ^ 2 := sub_le_sub_right (by simpa using hmul) _ | |
| theorem le_reciprocal_of_quadratic_drift {q : β β β} {c : β} | |
| (hc : 0 β€ c) (hq : β n, 0 β€ q n) (hzero : q 0 β€ 1) | |
| (hstep : β n, q (n + 1) β€ q n - c * (q n) ^ 2) : | |
| β n, q n β€ 1 / (1 + c * n) := by | |
| intro n | |
| induction n with | |
| | zero => simpa using hzero | |
| | succ n ih => | |
| have hqn := hq n | |
| have hd : 0 < 1 + c * q n := by positivity | |
| have hn : 0 < 1 + c * n := by positivity | |
| have hn' : 0 < 1 + c * (n + 1 : β) := by positivity | |
| have hi := (le_div_iffβ hn).mp ih | |
| calc | |
| q (n + 1) β€ q n / (1 + c * q n) := by | |
| apply (le_div_iffβ hd).mpr | |
| have hs := mul_le_mul_of_nonneg_right (hstep n) hd.le | |
| have hnon : 0 β€ c ^ 2 * (q n) ^ 3 := by positivity | |
| nlinarith | |
| _ β€ 1 / (1 + c * (n + 1 : β)) := by | |
| apply (div_le_div_iffβ hd hn').mpr | |
| push_cast | |
| nlinarith | |
| theorem tendsto_zero_of_quadratic_drift {q : β β β} {c : β} | |
| (hc : 0 < c) (hq : β n, 0 β€ q n) (hzero : q 0 β€ 1) | |
| (hstep : β n, q (n + 1) β€ q n - c * (q n) ^ 2) : | |
| Tendsto q atTop (π 0) := by | |
| have hb := le_reciprocal_of_quadratic_drift hc.le hq hzero hstep | |
| have hinf : Tendsto (fun n : β => 1 + c * (n : β)) atTop atTop := | |
| tendsto_const_nhds.add_atTop (tendsto_natCast_atTop_atTop.const_mul_atTop hc) | |
| have hz : Tendsto (fun n : β => 1 / (1 + c * n)) atTop (π (0 : β)) := by | |
| simpa only [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp hinf | |
| exact squeeze_zero hq hb hz | |
| theorem survival_le_reciprocal {b : β} (hb : 1 β€ b) {p : β} | |
| (hp : p β Set.Icc (0 : β) 1) (hcritical : (b : β) * p β€ 1) (n : β) : | |
| survival b p n β€ 1 / (1 + (((b : β) - 1) * p ^ 2) * n) := by | |
| apply le_reciprocal_of_quadratic_drift | |
| Β· have hb' : (1 : β) β€ b := by exact_mod_cast hb | |
| positivity | |
| Β· exact fun k => (survival_mem_Icc b hp k).1 | |
| Β· simp [survival] | |
| Β· intro k | |
| exact step_le_quadratic hb hp (survival_mem_Icc b hp k) hcritical | |
| theorem survival_tendsto_zero {b : β} (hb : 2 β€ b) {p : β} | |
| (hp : p β Set.Icc (0 : β) 1) (hcritical : (b : β) * p β€ 1) : | |
| Tendsto (survival b p) atTop (π 0) := by | |
| by_cases hpzero : p = 0 | |
| Β· subst p | |
| apply tendsto_congr' (Filter.eventually_atTop.mpr β¨1, ?_β©) |>.mpr tendsto_const_nhds | |
| intro n hn | |
| obtain β¨k, rflβ© := Nat.exists_eq_succ_of_ne_zero (by omega : n β 0) | |
| simp [survival, step] | |
| Β· have hp0 : 0 < p := lt_of_le_of_ne hp.1 (Ne.symm hpzero) | |
| apply tendsto_zero_of_quadratic_drift (c := ((b : β) - 1) * p ^ 2) | |
| Β· have hb' : (1 : β) < b := by exact_mod_cast hb | |
| positivity | |
| Β· exact fun n => (survival_mem_Icc b hp n).1 | |
| Β· simp [survival] | |
| Β· intro n | |
| exact step_le_quadratic (by omega) hp (survival_mem_Icc b hp n) hcritical | |
| end CriticalBranching | |
| end Problem367 | |
| end | |
| end OAI | |