Download data/lean/OAI/Probability/BinarySweep/FiniteLaws/LightLineBound.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.05 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/FiniteLaws/LightLineBound.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/BinarySweep/FiniteLaws/LightLineBound.lean
-
curl -L -o LightLineBound.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/FiniteLaws/LightLineBound.lean
8.05 kB
| import Mathlib | |
| import OAI.Probability.BinarySweep.SparseBounds.CenteredLineMoment | |
| namespace OAI | |
| noncomputable section | |
| section | |
| open scoped BigOperators Classical | |
| namespace BinaryCoordinateSweeps.Sparse | |
| lemma fallingMoment_le_two_pow {m h v : β} (hm : 0 < m) | |
| (hl : (h:β)+v β€ (m:β)/2) : fallingMoment m h v β€ (2:β)^v := by | |
| induction v with | |
| | zero => simp | |
| | succ v ih => | |
| have hmr : (0:β) < m := Nat.cast_pos.mpr hm | |
| have hv : h+v < m := by exact_mod_cast (show (h:β)+v < m by push_cast at hl; linarith) | |
| have hi := ih (by push_cast at hl; linarith) | |
| have hn := (fallingMoment_pos hm (Nat.le_of_lt hv)).le | |
| have hn' := (fallingMoment_pos hm (by exact_mod_cast (show (h:β)+(v+1) β€ m by push_cast at hl; linarith))).le | |
| have hs := fallingMoment_succ hv | |
| have hd : (m:β)/2 β€ (m:β)-h-v := by push_cast at hl; linarith | |
| have ha := mul_le_mul_of_nonneg_right hd hn' | |
| have hb := mul_le_mul_of_nonneg_left hi hmr.le | |
| rw [pow_succ] | |
| nlinarith | |
| lemma light_real_lt {m h n : β} {Ξ· : β} (hm : 0 < m) (hΞ· : Ξ· β€ 1/4) | |
| (hl : (h:β)+n β€ m*Ξ·) : h+n < m := by | |
| have hp : (0:β) < m := Nat.cast_pos.mpr hm | |
| exact_mod_cast (show (h:β)+n < m by nlinarith) | |
| theorem centeredLineMoment_light {m h u v : β} {Ξ· : β} | |
| (hm : 0 < m) (hΞ·0 : 0 β€ Ξ·) (hΞ· : Ξ· β€ 1/4) | |
| (hl : (h:β)+u+v β€ m*Ξ·) : | |
| 0 β€ centeredLineMoment m h u v β§ | |
| centeredLineMoment m h u v β€ (2:β)^v * (4*Real.sqrt Ξ·)^u := by | |
| have hmr : (0:β) < m := Nat.cast_pos.mpr hm | |
| have hr0 : 0 β€ 4*Real.sqrt Ξ· := by positivity | |
| have hr2 : 4*Real.sqrt Ξ· β€ 2 := by | |
| have hs := Real.sq_sqrt hΞ·0 | |
| have hs0 := Real.sqrt_nonneg Ξ· | |
| nlinarith | |
| have hrsq : (4*Real.sqrt Ξ·)^2 = 16*Ξ· := by rw [mul_pow,Real.sq_sqrt hΞ·0]; norm_num | |
| have hetr : Ξ· β€ 4*Real.sqrt Ξ· := by nlinarith [Real.sq_sqrt hΞ·0,Real.sqrt_nonneg Ξ·] | |
| induction u using Nat.strong_induction_on with | |
| | h u ih => | |
| cases u with | |
| | zero => | |
| rw [centeredLineMoment_zero,pow_zero,mul_one] | |
| have hv : h+v β€ m := Nat.le_of_lt (light_real_lt hm hΞ· (by simpa using hl)) | |
| exact β¨(fallingMoment_pos hm hv).le,fallingMoment_le_two_pow hm (by nlinarith)β© | |
| | succ u => | |
| cases u with | |
| | zero => | |
| have hb := fallingMoment_le_two_pow hm (show (h:β)+v β€ m/2 by push_cast at hl; nlinarith) | |
| have hv : h+v < m := light_real_lt hm hΞ· (by push_cast at hl; linarith) | |
| have hbn := (fallingMoment_pos hm (Nat.le_of_lt hv)).le | |
| have he := centeredLineMoment_one hv | |
| have hd : 0 < (m:β)-h-v := by | |
| have hv' : (h:β)+v < m := by exact_mod_cast hv | |
| linarith | |
| have hp : 0 β€ centeredLineMoment m h 1 v := by | |
| apply nonneg_of_mul_nonneg_right (by rw [he]; positivity) hd | |
| refine β¨hp,?_β© | |
| rw [pow_one] | |
| have ha : (m:β)/2 β€ (m:β)-h-v := by push_cast at hl; nlinarith | |
| have hc : (h:β)+v β€ m*Ξ· := by push_cast at hl; linarith | |
| have hb' := mul_le_mul_of_nonneg_left hb (show 0 β€ (h:β)+v by positivity) | |
| have hc' := mul_le_mul_of_nonneg_right hc (show (0:β) β€ 2^v by positivity) | |
| have ha' := mul_le_mul_of_nonneg_right ha hp | |
| have hr : 2*Ξ· β€ 4*Real.sqrt Ξ· := by nlinarith [Real.sq_sqrt hΞ·0,Real.sqrt_nonneg Ξ·] | |
| have hr' := mul_le_mul_of_nonneg_left hr (show 0 β€ (m:β)*(2:β)^v by positivity) | |
| nlinarith | |
| | succ u => | |
| have hu1 := ih (u+1) (by omega) (by push_cast at hl β’; linarith) | |
| have hu0 := ih u (by omega) (by push_cast at hl β’; linarith) | |
| have hv : h+v+u+1 < m := by | |
| have hh : (h:β)+(v+u+1) β€ m*Ξ· := by push_cast at hl; linarith | |
| have ht := light_real_lt (h := h) (n := v+u+1) hm hΞ· (by simpa only [Nat.cast_add,Nat.cast_one] using hh) | |
| omega | |
| have he := centeredLineMoment_recurrence hv | |
| have hd : 0 < (m:β)-h-v-u-1 := by | |
| have hv' : (h:β)+v+u+1 < m := by exact_mod_cast hv | |
| linarith | |
| have hp : 0 β€ centeredLineMoment m h (u+2) v := by | |
| apply nonneg_of_mul_nonneg_right (by | |
| rw [he] | |
| exact add_nonneg (mul_nonneg (by positivity) hu1.1) | |
| (mul_nonneg (by positivity) hu0.1)) hd | |
| refine β¨hp,?_β© | |
| have ha : (m:β)/2 β€ (m:β)-h-v-u-1 := by push_cast at hl; nlinarith | |
| have hc : (h:β)+v+2*u+2 β€ 2*m*Ξ· := by | |
| have hhv : (0:β) β€ h+v := by positivity | |
| push_cast at hl | |
| linarith | |
| have hc0 : 0 β€ (h:β)+v+2*u+2 := by positivity | |
| have hb : (u:β)+1 β€ m*Ξ· := by | |
| have hhv : (0:β) β€ h+v := by positivity | |
| push_cast at hl | |
| linarith | |
| have ha' := mul_le_mul_of_nonneg_right ha hp | |
| have hc' := mul_le_mul hc hu1.2 hu1.1 (by positivity : 0 β€ 2*(m:β)*Ξ·) | |
| have hb' := mul_le_mul hb hu0.2 hu0.1 (by positivity : 0 β€ (m:β)*Ξ·) | |
| have hr : 4*Ξ·*(4*Real.sqrt Ξ·)+2*Ξ· β€ (4*Real.sqrt Ξ·)^2 := by | |
| rw [hrsq] | |
| nlinarith | |
| have hr' := mul_le_mul_of_nonneg_left hr | |
| (show 0 β€ (m:β)/2*((2:β)^v*(4*Real.sqrt Ξ·)^u) by positivity) | |
| simp only [pow_succ] at hc' β’ | |
| nlinarith | |
| end BinaryCoordinateSweeps.Sparse | |
| end | |
| open scoped BigOperators Classical | |
| namespace BinaryCoordinateSweeps.Sparse | |
| variable {L : Type*} [Fintype L] | |
| def multilineMoment (m h : L β β) : MvPolynomial L β ββ[β] β := | |
| (MvPolynomial.basisMonomials L β).constr β | |
| (fun n => β l, fallingMoment (m l) (h l) (n l)) | |
| lemma multilineMoment_monomial (m h : L β β) (n : L ββ β) : | |
| multilineMoment m h (MvPolynomial.monomial n 1) = | |
| β l, fallingMoment (m l) (h l) (n l) := by | |
| exact (MvPolynomial.basisMonomials L β).constr_basis β _ n | |
| lemma multiline_prod_X (n : L β β) : | |
| (β l, (MvPolynomial.X l : MvPolynomial L β) ^ n l) = | |
| MvPolynomial.monomial (Finsupp.equivFunOnFinite.symm n) 1 := by | |
| rw [β MvPolynomial.prod_X_pow_eq_monomial] | |
| change (β l, MvPolynomial.X l ^ (Finsupp.equivFunOnFinite.symm n) l) = _ | |
| symm | |
| apply Finset.prod_subset (Finset.subset_univ _) | |
| intro l _ hl | |
| have hz := Finsupp.notMem_support_iff.mp hl | |
| change n l = 0 at hz | |
| change (MvPolynomial.X l : MvPolynomial L β)^n l = 1 | |
| rw [hz,pow_zero] | |
| theorem multilineMoment_factor (m h : L β β) (P : L β Polynomial β) : | |
| multilineMoment m h (β l, Polynomial.aeval (MvPolynomial.X l) (P l)) = | |
| β l, lineMoment (m l) (h l) (P l) := by | |
| let f : MultilinearMap β (fun _ : L => Polynomial β) β := | |
| (multilineMoment m h).compMultilinearMap | |
| ((MultilinearMap.mkPiAlgebra β L (MvPolynomial L β)).compLinearMap | |
| (fun l => (Polynomial.aeval (MvPolynomial.X l)).toLinearMap)) | |
| let g : MultilinearMap β (fun _ : L => Polynomial β) β := | |
| (MultilinearMap.mkPiAlgebra β L β).compLinearMap (fun l => lineMoment (m l) (h l)) | |
| have he : f = g := by | |
| apply Module.Basis.ext_multilinear (fun _ : L => Polynomial.basisMonomials β) | |
| intro n | |
| change multilineMoment m h (β l, Polynomial.aeval (MvPolynomial.X l) | |
| (Polynomial.basisMonomials β (n l))) = | |
| β l, lineMoment (m l) (h l) (Polynomial.basisMonomials β (n l)) | |
| simp only [Polynomial.coe_basisMonomials,Polynomial.aeval_monomial,map_one,one_mul, | |
| lineMoment_monomial] | |
| rw [multiline_prod_X,multilineMoment_monomial] | |
| rfl | |
| exact congrArg (fun a => a P) he | |
| lemma multilineMoment_centered (m h u v : L β β) : | |
| multilineMoment m h (β l, (MvPolynomial.X l : MvPolynomial L β)^v l * | |
| (MvPolynomial.X l-1)^u l) = | |
| β l, centeredLineMoment (m l) (h l) (u l) (v l) := by | |
| change multilineMoment m h _ = β l, lineMoment (m l) (h l) | |
| (Polynomial.X^v l * (Polynomial.X-1)^u l) | |
| rw [β multilineMoment_factor] | |
| apply congrArg (multilineMoment m h) | |
| apply Finset.prod_congr rfl | |
| intro l _ | |
| rw [map_mul,map_pow,map_pow,map_sub,map_one,Polynomial.aeval_X] | |
| end BinaryCoordinateSweeps.Sparse | |
| end | |
| end OAI | |