Download data/lean/OAI/Geometry/LatticeCovering/PrimeGrids.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 29.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/LatticeCovering/PrimeGrids.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/LatticeCovering/PrimeGrids.lean
-
curl -L -o PrimeGrids.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/LatticeCovering/PrimeGrids.lean
29.1 kB
| import OAI.Geometry.LatticeCovering.BrokenCircuits | |
| namespace OAI | |
| section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| open MeasureTheory Filter Set | |
| open scoped Topology | |
| noncomputable section | |
| open MeasureTheory Filter Set | |
| open scoped Topology ENNReal | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| noncomputable section | |
| namespace SingleLatticeCovering.RogersPreparation | |
| open Filter Topology | |
| lemma eventually_const_mul_rpow_lt {a : β} (ha : a<1) (A : β) : | |
| βαΆ p : β in atTop, A * (p : β)^a < p := by | |
| have ht : Tendsto (fun p : β => A * (p : β)^(a-1)) atTop (π 0) := by | |
| have h : Tendsto (fun p : β => (p : β)^(a-1)) atTop (π 0) := by | |
| have hcast : Tendsto (fun p : β => (p : β)) atTop atTop := tendsto_natCast_atTop_atTop | |
| simpa only [Function.comp_def,neg_sub] using | |
| (tendsto_rpow_neg_atTop (sub_pos.mpr ha)).comp hcast | |
| simpa only [mul_zero] using h.const_mul A | |
| filter_upwards [ht.eventually (gt_mem_nhds (show (0:β)<1 by norm_num)), | |
| eventually_ge_atTop 1] with p hp hp1 | |
| have hpR : (0:β)<p := by exact_mod_cast hp1 | |
| have he : (p : β)^a = (p : β)^(a-1)*(p : β) := by | |
| calc | |
| _ = (p : β)^((a-1)+1) := by congr 1; ring | |
| _ = (p : β)^(a-1)*(p : β)^(1:β) := Real.rpow_add hpR _ _ | |
| _ = _ := by rw [Real.rpow_one] | |
| rw [he,βmul_assoc] | |
| simpa only [one_mul] using mul_lt_mul_of_pos_right hp hpR | |
| lemma eventually_subcritical_minor_bound {d k : β} (hk : k<d) {C : β} (hC : 1β€C) : | |
| βαΆ p : β in atTop, | |
| 1 β€ C * (p : β)^((d : β)β»ΒΉ) β§ | |
| (k.factorial : β) * (C * (p : β)^((d : β)β»ΒΉ))^k < p := by | |
| have hd : (0:β)<d := by exact_mod_cast (Nat.zero_le k).trans_lt hk | |
| have ha : (d : β)β»ΒΉ*k<1 := by | |
| rw [mul_comm,βdiv_eq_mul_inv,div_lt_one hd] | |
| exact_mod_cast hk | |
| filter_upwards [eventually_const_mul_rpow_lt ha ((k.factorial : β)*C^k), | |
| eventually_ge_atTop 1] with p hp hp1 | |
| have hpR : (1:β)β€p := by exact_mod_cast hp1 | |
| constructor | |
| Β· exact one_le_mul_of_one_le_of_one_le hC | |
| (Real.one_le_rpow hpR (inv_nonneg.mpr hd.le)) | |
| Β· rw [mul_pow,βReal.rpow_mul_natCast (by positivity : (0:β)β€p),βmul_assoc] | |
| exact hp | |
| end SingleLatticeCovering.RogersPreparation | |
| namespace SingleLatticeCovering.ConvexGrid | |
| open MeasureTheory Filter Topology RogersPreparation AffineCircuit | |
| open scoped BigOperators | |
| def primeScale (d p : β) : β := (p:β)^((d:β)β»ΒΉ) | |
| lemma primeScale_tendsto {d : β} (hd : 0 < d) : | |
| Tendsto (primeScale d) atTop atTop := | |
| (tendsto_rpow_atTop (inv_pos.mpr (by exact_mod_cast hd))).comp tendsto_natCast_atTop_atTop | |
| lemma primeScale_pos {d p : β} (hp : 0 < p) : 0 < primeScale d p := | |
| Real.rpow_pos_of_pos (by exact_mod_cast hp) _ | |
| lemma primeScale_pow {d p : β} (hd : 0 < d) : (primeScale d p)^d = p := by | |
| rw [primeScale,βReal.rpow_mul_natCast (by positivity : (0:β) β€ p), | |
| inv_mul_cancelβ (by exact_mod_cast hd.ne' : (d:β) β 0),Real.rpow_one] | |
| lemma primeScale_pow_mul {d p r : β} (hd : 0 < d) : (primeScale d p)^(r*d) = (p:β)^r := by | |
| rw [Nat.mul_comm r d,pow_mul,primeScale_pow hd] | |
| lemma prime_grid_density {d : β} (hd : 0 < d) {J : Set (Fin d β β)} | |
| (hJ : IsCompact J) (hconv : Convex β J) (h0 : 0 β J) : | |
| Tendsto (fun p : β => ((integerGrid J hJ (primeScale d p)).card:β)/(p:β)) atTop | |
| (π (volume.real J)) := by | |
| simpa only [Function.comp_def,primeScale_pow hd] using | |
| (normalized_card_limit hJ hconv h0).comp (primeScale_tendsto hd) | |
| lemma eventually_prime_grid_bound {d k : β} (hk : k < d) | |
| {J : Set (Fin d β β)} (hJ : IsCompact J) : | |
| βαΆ p : β in atTop, β B : β, 1 β€ B β§ | |
| (β z β integerGrid J hJ (primeScale d p), β j, |z j| β€ (B:β€)) β§ | |
| k.factorial*B^k < p := by | |
| obtain β¨C,hC,hboundβ© := grid_uniform_bound hJ | |
| have h2C : 1 β€ 2*C := by linarith | |
| filter_upwards [eventually_subcritical_minor_bound hk h2C, | |
| (primeScale_tendsto (by omega : 0 < d)).eventually (eventually_ge_atTop (1:β))] | |
| with p hp ht | |
| let B : β := βC*primeScale d pββ | |
| have hCt : 1 β€ C*primeScale d p := one_le_mul_of_one_le_of_one_le hC ht | |
| have hB : (1:β) β€ B := hCt.trans (Nat.le_ceil _) | |
| have hBC : (B:β) β€ 2*C*primeScale d p := by | |
| have hh := (Nat.ceil_lt_add_one (by linarith : 0 β€ C*primeScale d p)).le | |
| dsimp only [B] | |
| nlinarith | |
| refine β¨B,by exact_mod_cast hB,?_,?_β© | |
| Β· intro z hz j | |
| have hh := (hbound _ ht z hz j).trans (Nat.le_ceil _) | |
| exact_mod_cast hh | |
| Β· have hh : (k.factorial:β)*(B:β)^k < (p:β) := | |
| (mul_le_mul_of_nonneg_left (pow_le_pow_leftβ (Nat.cast_nonneg B) hBC k) | |
| (Nat.cast_nonneg _)).trans_lt hp.2 | |
| exact_mod_cast hh | |
| theorem eventually_prime_circuit_count_le {d r : β} (hr : 0 < r) (hd : 2*(r+1) β€ d) | |
| {J : Set (Fin d β β)} (hJ : IsCompact J) (hconv : Convex β J) (h0 : 0 β J) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) : | |
| βαΆ p : β in atTop, | |
| ((circuits (integerGrid J hJ (primeScale d p)) r).card:β)/(p:β)^r < | |
| (SimplexYoung.affineCircuitVolumeSum (r:=r) J).toReal+Ξ΅ := by | |
| obtain β¨B,hB,hboundβ© := grid_uniform_bound hJ | |
| have hh := eventually_circuit_count_le hr hd hJ hconv h0 (integerGrid J hJ) hB hbound | |
| (fun t ht z hz => (mem_integerGrid hJ (by linarith : t β 0)).mp hz) hΞ΅ | |
| simpa only [primeScale_pow_mul (by omega : 0 < d)] using | |
| (primeScale_tendsto (by omega : 0 < d)).eventually hh | |
| end SingleLatticeCovering.ConvexGrid | |
| noncomputable section | |
| namespace SingleLatticeCovering.GridProbability | |
| open Filter Topology | |
| open scoped BigOperators | |
| lemma cardinality_tendsto_atTop {M : β β β} {V : β} (hV : 0 < V) | |
| (hM : Tendsto (fun p => (M p:β)/(p:β)) atTop (π V)) : | |
| Tendsto (fun p => (M p:β)) atTop atTop := by | |
| have hh := hM.pos_mul_atTop hV (tendsto_natCast_atTop_atTop (R:=β)) | |
| apply hh.congr' | |
| filter_upwards [eventually_ge_atTop 1] with p hp | |
| exact div_mul_cancelβ _ (by exact_mod_cast (show p β 0 by omega)) | |
| lemma normalized_choose_tendsto {M : β β β} {V : β} (hV : 0 < V) | |
| (hM : Tendsto (fun p => (M p:β)/(p:β)) atTop (π V)) (j : β) : | |
| Tendsto (fun p => ((M p).choose j:β)/(p:β)^j) atTop | |
| (π (V^j/(j.factorial:β))) := by | |
| induction j with | |
| | zero => simp | |
| | succ j ih => | |
| have hinv : Tendsto (fun p : β => (j:β)/(p:β)) atTop (π 0) := by | |
| simpa only [mul_zero,div_eq_mul_inv,Pi.inv_apply] using | |
| (tendsto_natCast_atTop_atTop (R:=β)).inv_tendsto_atTop.const_mul (j:β) | |
| have ht := (ih.mul (hM.sub hinv)).div_const (j+1:β) | |
| have hlim : (V^j/(j.factorial:β))*(V-0)/(j+1:β) = V^(j+1)/((j+1).factorial:β) := by | |
| rw [Nat.factorial_succ,Nat.cast_mul,Nat.cast_add,Nat.cast_one,pow_succ,sub_zero] | |
| field_simp | |
| rw [hlim] at ht | |
| apply ht.congr' | |
| filter_upwards [(cardinality_tendsto_atTop hV hM).eventually (eventually_ge_atTop (j:β)), | |
| eventually_ge_atTop 1] with p hpj hp1 | |
| have hjM : j β€ M p := by exact_mod_cast hpj | |
| have hc : | |
| (((M p).choose (j+1):β):β)*(j+1:β) = | |
| (((M p).choose j:β):β)*((M p:β)-(j:β)) := by | |
| exact_mod_cast Nat.choose_succ_right_eq (M p) j | |
| have hp0 : (p:β) β 0 := by exact_mod_cast (show p β 0 by omega) | |
| have hj0 : (j+1:β) β 0 := by positivity | |
| field_simp [hp0,hj0,pow_succ] | |
| rw [βhc,pow_succ] | |
| ring | |
| lemma binomial_polynomial_limit {M : β β β} {V : β} (hV : 0 < V) | |
| (hM : Tendsto (fun p => (M p:β)/(p:β)) atTop (π V)) (k : β) : | |
| Tendsto (fun p => β j β Finset.range (k+1), ((M p).choose j:β)*(-1:β)^j*((p:β)β»ΒΉ)^j) | |
| atTop (π (β j β Finset.range (k+1), (-1:β)^j*V^j/(j.factorial:β))) := by | |
| have hh := tendsto_finsetSum (Finset.range (k+1)) | |
| (fun j hj => (normalized_choose_tendsto hV hM j).const_mul ((-1:β)^j)) | |
| simpa only [inv_pow,div_eq_mul_inv,mul_assoc,mul_left_comm,mul_comm] using hh | |
| lemma binomial_envelope_le_exp (M p : β) : | |
| (1+(p:β)β»ΒΉ)^M β€ Real.exp ((M:β)/(p:β)) := by | |
| calc | |
| _ β€ (Real.exp ((p:β)β»ΒΉ))^M := | |
| pow_le_pow_leftβ (by positivity) (by linarith [Real.add_one_le_exp ((p:β)β»ΒΉ)]) M | |
| _ = _ := by rw [βReal.exp_nat_mul]; congr 1 | |
| lemma upper_envelope_limit {Ξ± : Type*} {l : Filter Ξ±} {f : Ξ± β β} {C : β} | |
| (hf : β Ξ΅ : β, 0 < Ξ΅ β βαΆ x in l, f x < C+Ξ΅) : | |
| Tendsto (fun x => max (f x) C) l (π C) := by | |
| apply tendsto_order.mpr | |
| constructor | |
| Β· intro b hb | |
| exact Filter.Eventually.of_forall (fun x => hb.trans_le (le_max_right _ _)) | |
| Β· intro b hb | |
| filter_upwards [hf (b-C) (sub_pos.mpr hb)] with x hx | |
| exact max_lt (by linarith) hb | |
| end SingleLatticeCovering.GridProbability | |
| namespace SingleLatticeCovering.ConvexGrid | |
| open MeasureTheory Filter Topology AffineCircuit GridProbability BrokenCircuit PrimeCircuit | |
| open scoped BigOperators | |
| def primeGridVoid {d : β} (J : Set (Fin d β β)) (hJ : IsCompact J) | |
| (p : β) [Fact p.Prime] : β := | |
| vectorAverage (fun a : Fin (d+1) β ZMod p => avoidanceIndicator | |
| (fun z : integerGrid J hJ (primeScale d p) => homogeneousRow (p:=p) z.val) | |
| (dotProductBilin (ZMod p) (ZMod p) a)) | |
| def continuumCircuitError {d : β} (J : Set (Fin d β β)) (k : β) : β := | |
| Real.exp (volume.real J) * β r β Finset.Icc 2 k, | |
| (SimplexYoung.affineCircuitVolumeSum (r:=r) J).toReal/(r.factorial:β) | |
| theorem eventually_primeGridVoid_le {d q : β} (hq : 0 < q) | |
| (hd : 2*(2*q+1) β€ d) {J : Set (Fin d β β)} | |
| (hJ : IsCompact J) (hconv : Convex β J) (h0 : 0 β J) | |
| (hV : 0 < volume.real J) {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) : | |
| β N : β, β (p : β) [Fact p.Prime], N β€ p β | |
| primeGridVoid J hJ p β€ | |
| (β j β Finset.range (2*q+1), (-1:β)^j*(volume.real J)^j/(j.factorial:β)) + | |
| continuumCircuitError J (2*q)+Ξ΅ := by | |
| classical | |
| let S (p : β) := integerGrid J hJ (primeScale d p) | |
| let C (r : β) := (SimplexYoung.affineCircuitVolumeSum (r:=r) J).toReal | |
| let U (p r : β) := max (((circuits (S p) r).card:β)/(p:β)^r) (C r) | |
| have hU (r : β) (hr : r β Finset.Icc 2 (2*q)) : | |
| Tendsto (fun p => U p r) atTop (π (C r)) := by | |
| apply upper_envelope_limit | |
| intro Ξ΄ hΞ΄ | |
| exact eventually_prime_circuit_count_le (by have := (Finset.mem_Icc.mp hr).1; omega) | |
| (by have := (Finset.mem_Icc.mp hr).2; omega) hJ hconv h0 hΞ΄ | |
| have hsum := tendsto_finsetSum (Finset.Icc 2 (2*q)) | |
| (fun r hr => (hU r hr).div_const (r.factorial:β)) | |
| have hmass := prime_grid_density (by omega : 0 < d) hJ hconv h0 | |
| have hlim := (binomial_polynomial_limit hV hmass (2*q)).add (((Real.continuous_exp.tendsto _).comp hmass).mul hsum) | |
| have hless : | |
| (β j β Finset.range (2*q+1), (-1:β)^j*(volume.real J)^j/(j.factorial:β)) + | |
| Real.exp (volume.real J) * β r β Finset.Icc 2 (2*q), C r/(r.factorial:β) < | |
| (β j β Finset.range (2*q+1), (-1:β)^j*(volume.real J)^j/(j.factorial:β)) + | |
| continuumCircuitError J (2*q)+Ξ΅ := by | |
| change _ + continuumCircuitError J (2*q) < _ | |
| exact lt_add_of_pos_right _ hΞ΅ | |
| have hevent := hlim.eventually (gt_mem_nhds hless) | |
| have hminor := eventually_prime_grid_bound (k:=2*q+1) (by omega) hJ | |
| obtain β¨N,hNβ© := eventually_atTop.mp (hevent.and hminor) | |
| refine β¨N,?_β© | |
| intro p hpPrime hpN | |
| obtain β¨he,β¨B,hB,hSB,hpBβ©β© := hN p hpN | |
| let : LinearOrder (S p) := (Fintype.equivFin (S p)).linearOrder | |
| have hp2 : 2*B < p := by | |
| have hf : 2 β€ (2*q+1).factorial := by | |
| simpa using (Nat.factorial_le (show 2 β€ 2*q+1 by omega)) | |
| have hb : B β€ B^(2*q+1) := by | |
| simpa only [pow_one] using Nat.pow_le_pow_right hB (show 1 β€ 2*q+1 by omega) | |
| exact (Nat.mul_le_mul hf hb).trans_lt hpB | |
| let v : S p β Fin (d+1) β ZMod p := fun z => homogeneousRow z.val | |
| have hfin := finite_field_void_upper v q | |
| simp only [ZMod.card,Fintype.card_coe] at hfin | |
| have herr := finiteCircuitError_le (k:=2*q) (S p) hB hSB hp2 hpB | |
| have hsn : 0 β€ β r β Finset.Icc 2 (2*q), | |
| ((circuits (S p) r).card:β)/(p:β)^r/(r.factorial:β) := by | |
| apply Finset.sum_nonneg | |
| intro r hr | |
| exact div_nonneg (div_nonneg (Nat.cast_nonneg _) (pow_nonneg (Nat.cast_nonneg _) _)) | |
| (Nat.cast_nonneg _) | |
| have hreplace : β r β Finset.Icc 2 (2*q), | |
| ((circuits (S p) r).card:β)/(p:β)^r/(r.factorial:β) β€ | |
| β r β Finset.Icc 2 (2*q), U p r/(r.factorial:β) := by | |
| apply Finset.sum_le_sum | |
| intro r hr | |
| exact div_le_div_of_nonneg_right (le_max_left _ _) (Nat.cast_nonneg _) | |
| have herr' := herr.trans ((mul_le_mul_of_nonneg_right (binomial_envelope_le_exp (S p).card p) hsn).trans | |
| (mul_le_mul_of_nonneg_left hreplace (Real.exp_pos _).le)) | |
| exact (hfin.trans (add_le_add le_rfl herr')).trans he.le | |
| end SingleLatticeCovering.ConvexGrid | |
| namespace SingleLatticeCovering.SimplexYoung | |
| open scoped BigOperators | |
| lemma simplexConstant_sq_ratio {r : β} (hr : 0 < r) : | |
| (simplexConstant r)^2 = ((r+1:β):β)^r / ((r:β)^r * (r+1:β)) := by | |
| have h : 0 < (r:β) := Nat.cast_pos.mpr hr | |
| unfold simplexConstant | |
| rw [div_pow, βpow_mul, mul_comm r 2, pow_mul, inv_pow, | |
| Real.sq_sqrt (by positivity), Real.sq_sqrt (by positivity), inv_div, div_pow] | |
| ring | |
| lemma simplexConstant_succ_sq {r : β} (hr : 0 < r) : | |
| (simplexConstant (r+1))^2 = (simplexConstant r)^2 * | |
| (1 - 1 / (((r+1:β):β)^2))^r := by | |
| have h : 0 < (r:β) := Nat.cast_pos.mpr hr | |
| have h1 : ((r+1:β):β) β 0 := by positivity | |
| have h2 : ((r+1+1:β):β) β 0 := by positivity | |
| rw [simplexConstant_sq_ratio (by omega), simplexConstant_sq_ratio hr] | |
| have hc : (1 - 1 / (((r+1:β):β)^2)) = (r:β) * (r+2) / (((r+1:β):β)^2) := by | |
| push_cast | |
| field_simp | |
| ring | |
| rw [hc, div_pow, mul_pow, pow_succ, pow_succ, βpow_mul] | |
| push_cast | |
| rw [show 2*r=r+r by omega, pow_add] | |
| field_simp | |
| ring | |
| lemma simplexConstant_succ_le {r : β} (hr : 0 < r) : | |
| simplexConstant (r+1) β€ simplexConstant r * Real.exp (-(r:β)/(2*((r+1:β):β)^2)) := by | |
| have hbase : 0 β€ 1 - 1 / (((r+1:β):β)^2) := by | |
| have h : (1:β) β€ (r+1:β) := by exact_mod_cast (show 1 β€ r+1 by omega) | |
| have hsq : (1:β) β€ ((r+1:β):β)^2 := by nlinarith | |
| have hi := (div_le_one (by positivity : (0:β)<((r+1:β):β)^2)).mpr hsq | |
| linarith | |
| have hexp : (1 - 1 / (((r+1:β):β)^2))^r β€ Real.exp (-(r:β)/((r+1:β):β)^2) := by | |
| calc | |
| _ β€ (Real.exp (-(1 / (((r+1:β):β)^2))))^r := | |
| pow_le_pow_leftβ hbase (by linarith [Real.add_one_le_exp (-(1/(((r+1:β):β)^2)))]) r | |
| _ = _ := by rw [βReal.exp_nat_mul]; congr 1; ring | |
| apply (sq_le_sqβ (simplexConstant_nonneg _) (mul_nonneg (simplexConstant_nonneg _) (Real.exp_pos _).le)).mp | |
| rw [simplexConstant_succ_sq hr, mul_pow, βReal.exp_nat_mul] | |
| have he : (2:β) * (-(r:β)/(2*((r+1:β):β)^2)) = -(r:β)/((r+1:β):β)^2 := by ring | |
| norm_num only [Nat.cast_ofNat] | |
| rw [he] | |
| exact mul_le_mul_of_nonneg_left hexp (sq_nonneg _) | |
| def circuitTerm (d : β) (V : β) (r : β) : β := | |
| (4:β)^r * (simplexConstant r)^d * V^r / (r.factorial:β) | |
| lemma circuitTerm_nonneg (d r : β) {V : β} (hV : 0 β€ V) : | |
| 0 β€ circuitTerm d V r := by | |
| unfold circuitTerm | |
| exact div_nonneg (mul_nonneg (mul_nonneg (by positivity) | |
| (pow_nonneg (simplexConstant_nonneg _) _)) (pow_nonneg hV _)) (by positivity) | |
| lemma circuitTerm_succ_le {d r : β} (hr : 3 β€ r) {V : β} | |
| (hV : 0 β€ V) (hVd : V β€ (d:β)/6) : | |
| circuitTerm d V (r+1) β€ (3/4:β) * circuitTerm d V r := by | |
| have hr0 : 0 < r := by omega | |
| have hden : (0:β) < (r+1:β) := by positivity | |
| have hgeo := pow_le_pow_leftβ (simplexConstant_nonneg _) (simplexConstant_succ_le hr0) d | |
| rw [mul_pow, βReal.exp_nat_mul] at hgeo | |
| have hexp : -(d:β) * (r:β)/(2*((r+1:β):β)^2) β€ | |
| -(3:β)/8 * ((d:β)/(r+1:β)) := by | |
| have hrR : (3:β) β€ r := by exact_mod_cast hr | |
| apply (div_le_iffβ (by positivity : (0:β)<2*((r+1:β):β)^2)).mpr | |
| have he : (-(3:β)/8 * ((d:β)/(r+1:β))) * (2*((r+1:β):β)^2) = | |
| -(3:β)/4 * (d:β) * ((r+1:β):β) := by field_simp; ring | |
| rw [he] | |
| push_cast | |
| nlinarith [mul_nonneg (Nat.cast_nonneg d : (0:β)β€d) (sub_nonneg.mpr hrR)] | |
| have heq : (d:β) * (-(r:β)/(2*((r+1:β):β)^2)) = | |
| -(d:β) * (r:β)/(2*((r+1:β):β)^2) := by ring | |
| rw [heq] at hgeo | |
| have hgeo' := hgeo.trans (mul_le_mul_of_nonneg_left | |
| (Real.exp_le_exp.mpr hexp) (pow_nonneg (simplexConstant_nonneg _) _)) | |
| have hb : (4*V/(r+1:β))*Real.exp (-(3:β)/8*((d:β)/(r+1:β))) β€ 3/4 := by | |
| have ht := Real.mul_exp_neg_le_exp_neg_one ((3:β)/8*((d:β)/(r+1:β))) | |
| have he : Real.exp (-1) β€ (27/64:β) := by | |
| rw [Real.exp_neg, inv_eq_one_div] | |
| apply (div_le_iffβ (Real.exp_pos _)).mpr | |
| nlinarith [Real.exp_one_gt_d9] | |
| calc | |
| _ β€ ((2:β)/3*((d:β)/(r+1:β)))*Real.exp (-(3:β)/8*((d:β)/(r+1:β))) := by | |
| apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le | |
| apply (div_le_iffβ hden).mpr | |
| have heq : ((2:β)/3*((d:β)/(r+1:β)))*((r+1:β):β) = (2:β)/3*d := by field_simp | |
| rw [heq] | |
| linarith | |
| _ = (16/9:β)*(((3:β)/8*((d:β)/(r+1:β)))* | |
| Real.exp (-((3:β)/8*((d:β)/(r+1:β))))) := by | |
| rw [show -(3:β)/8*((d:β)/(r+1:β)) = -((3:β)/8*((d:β)/(r+1:β))) by ring] | |
| ring | |
| _ β€ (16/9:β)*Real.exp (-1) := mul_le_mul_of_nonneg_left ht (by norm_num) | |
| _ β€ 3/4 := by linarith | |
| unfold circuitTerm | |
| rw [pow_succ, pow_succ, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one] | |
| calc | |
| _ β€ ((4:β)^r*4) * ((simplexConstant r)^d * | |
| Real.exp (-(3:β)/8*((d:β)/(r+1:β)))) * (V^r*V) / | |
| (((r:β)+1)*(r.factorial:β)) := by gcongr | |
| _ = ((4*V/(r+1:β))*Real.exp (-(3:β)/8*((d:β)/(r+1:β)))) * | |
| ((4:β)^r*(simplexConstant r)^d*V^r/(r.factorial:β)) := by push_cast; field_simp | |
| _ β€ _ := mul_le_mul_of_nonneg_right hb (circuitTerm_nonneg d r hV) | |
| lemma circuitTerm_add_three_le {d : β} {V : β} (hV : 0 β€ V) | |
| (hVd : V β€ (d:β)/6) (s : β) : | |
| circuitTerm d V (s+3) β€ (3/4:β)^s * circuitTerm d V 3 := by | |
| induction s with | |
| | zero => simp | |
| | succ s ih => | |
| calc | |
| _ β€ (3/4:β) * circuitTerm d V (s+3) := circuitTerm_succ_le (by omega) hV hVd | |
| _ β€ (3/4:β) * ((3/4:β)^s * circuitTerm d V 3) := | |
| mul_le_mul_of_nonneg_left ih (by norm_num) | |
| _ = _ := by rw [pow_succ]; ring | |
| theorem tsum_circuitTerm_le {d : β} {V : β} (hV : 0 β€ V) | |
| (hVd : V β€ (d:β)/6) : | |
| β' s : β, ENNReal.ofReal (circuitTerm d V (s+3)) β€ | |
| ENNReal.ofReal (4 * circuitTerm d V 3) := by | |
| calc | |
| _ β€ β' s : β, ENNReal.ofReal ((3/4:β)^s * circuitTerm d V 3) := | |
| ENNReal.tsum_le_tsum (fun s => ENNReal.ofReal_le_ofReal (circuitTerm_add_three_le hV hVd s)) | |
| _ = ENNReal.ofReal (4 * circuitTerm d V 3) := by | |
| rw [βENNReal.ofReal_tsum_of_nonneg (fun s => mul_nonneg (by positivity) | |
| (circuitTerm_nonneg _ _ hV)) | |
| ((summable_geometric_of_norm_lt_one (by norm_num : β(3/4:β)β < 1)).mul_right _)] | |
| rw [tsum_mul_right, tsum_geometric_of_norm_lt_one (by norm_num : β(3/4:β)β < 1)] | |
| norm_num | |
| end SingleLatticeCovering.SimplexYoung | |
| namespace SingleLatticeCovering.SimplexYoung | |
| lemma sharpParallelogramConstant_pos : 0 < (4 * (Real.sqrt 3)β»ΒΉ^3 : β) := by positivity | |
| lemma sharpParallelogramConstant_sq : (4 * (Real.sqrt 3)β»ΒΉ^3 : β)^2 = 16/27 := by | |
| have hs : (Real.sqrt 3)^2 = (3:β) := Real.sq_sqrt (by norm_num) | |
| calc | |
| _ = 16 / (Real.sqrt 3)^6 := by field_simp; ring | |
| _ = _ := by rw [show 6 = 2*3 from rfl, pow_mul, hs]; norm_num | |
| lemma sharpParallelogramConstant_exp (d : β) : | |
| (4 * (Real.sqrt 3)β»ΒΉ^3 : β)^d = | |
| Real.exp (-(d:β)/2 * Real.log (27/16:β)) := by | |
| have hp := sharpParallelogramConstant_pos | |
| have hlog := congrArg Real.log sharpParallelogramConstant_sq | |
| rw [Real.log_pow] at hlog | |
| have hi : Real.log (16/27:β) = -Real.log (27/16:β) := by | |
| rw [β Real.log_inv]; norm_num | |
| rw [hi] at hlog | |
| rw [β Real.exp_log hp, β Real.exp_nat_mul] | |
| congr 1 | |
| push_cast at hlog | |
| nlinarith | |
| def sourceEta (d : β) : β := (d:β)/4 * Real.log (27/16:β) - 3*Real.log (d:β) | |
| lemma sourceLog_pos : 0 < Real.log (27/16:β) := Real.log_pos (by norm_num) | |
| lemma sourceLog_le_one : Real.log (27/16:β) β€ 1 := by | |
| have h := Real.log_le_sub_one_of_pos (by norm_num : (0:β)<27/16) | |
| linarith | |
| lemma sourceEta_le_dim {d : β} (hd : 1 β€ d) : sourceEta d β€ d := by | |
| have hdR : (1:β) β€ d := by exact_mod_cast hd | |
| have hl : 0 β€ Real.log (d:β) := Real.log_nonneg hdR | |
| have hx := sourceLog_le_one | |
| dsimp [sourceEta] | |
| nlinarith | |
| lemma log_27_16_le : Real.log (27/16 : β)β€8/15 := by | |
| apply (Real.log_le_iff_le_exp (by norm_num : (0 : β)<27/16)).mpr | |
| have h := Real.sum_le_exp_of_nonneg (by norm_num : (0 : β)β€8/15) 4 | |
| norm_num [Finset.sum_range_succ,Nat.factorial] at h | |
| linarith | |
| lemma sourceEta_le_linear (d : β) : sourceEta dβ€(2/15 : β)*d := by | |
| have h := mul_le_mul_of_nonneg_left log_27_16_le (show (0 : β)β€(d : β)/4 by positivity) | |
| have hlog := Real.log_natCast_nonneg d | |
| unfold sourceEta | |
| nlinarith | |
| lemma simplexConstant_three : simplexConstant 3 = 4 * (Real.sqrt 3)β»ΒΉ^3 := by | |
| unfold simplexConstant | |
| norm_num [Real.sqrt_div, div_pow] | |
| ring | |
| lemma circuitTerm_three_source {d : β} (hd : 1 β€ d) {V : β} | |
| (hV : 0 β€ V) (hVeta : V β€ sourceEta d) : | |
| Real.exp V * (4 * circuitTerm d V 3) β€ (128/3:β) * Real.exp (-sourceEta d) := by | |
| have hdR : (0:β) < d := by exact_mod_cast hd | |
| have hVd := hVeta.trans (sourceEta_le_dim hd) | |
| have hpow : V^3 β€ (d:β)^3 := pow_le_pow_leftβ hV hVd _ | |
| have h : Real.exp V * ((4*(Real.sqrt 3)β»ΒΉ^3:β)^d * V^3) β€ Real.exp (-sourceEta d) := by | |
| rw [sharpParallelogramConstant_exp] | |
| calc | |
| _ β€ Real.exp V * (Real.exp (-(d:β)/2*Real.log (27/16:β)) * (d:β)^3) := by gcongr | |
| _ = Real.exp (V-(d:β)/2*Real.log (27/16:β)+3*Real.log (d:β)) := by | |
| have he : (d:β)^3 = Real.exp (3*Real.log (d:β)) := by | |
| simpa only [Nat.cast_ofNat, Real.exp_log hdR] using (Real.exp_nat_mul (Real.log (d:β)) 3).symm | |
| rw [he, βReal.exp_add, βReal.exp_add] | |
| congr 1 | |
| ring | |
| _ β€ _ := by | |
| apply Real.exp_le_exp.mpr | |
| have hl := Real.log_nonneg (show (1:β)β€d by exact_mod_cast hd) | |
| dsimp [sourceEta] at hVeta β’ | |
| linarith | |
| unfold circuitTerm | |
| rw [simplexConstant_three] | |
| norm_num only [show (4:β)^3=64 by norm_num, show ((3:β).factorial:β)=6 by norm_num] | |
| have hh := mul_le_mul_of_nonneg_left h (by norm_num : (0:β)β€128/3) | |
| calc | |
| _ = (128/3:β) * (Real.exp V * ((4*(Real.sqrt 3)β»ΒΉ^3:β)^d * V^3)) := by ring | |
| _ β€ _ := hh | |
| theorem circuit_series_at_sourceEta {d : β} (hd : 1 β€ d) {V : β} | |
| (hV : 0 β€ V) (hVeta : V β€ sourceEta d) : | |
| ENNReal.ofReal (Real.exp V) * | |
| (β' s : β, ENNReal.ofReal (circuitTerm d V (s+3))) β€ | |
| ENNReal.ofReal ((128/3:β)*Real.exp (-sourceEta d)) := by | |
| have hVd : V β€ (d:β)/6 := by | |
| have h := hVeta.trans (sourceEta_le_linear d) | |
| nlinarith [(Nat.cast_nonneg d : (0:β)β€d)] | |
| calc | |
| _ β€ ENNReal.ofReal (Real.exp V) * ENNReal.ofReal (4*circuitTerm d V 3) := | |
| mul_le_mul_right (tsum_circuitTerm_le hV hVd) _ | |
| _ = ENNReal.ofReal (Real.exp V * (4*circuitTerm d V 3)) := | |
| (ENNReal.ofReal_mul (Real.exp_pos _).le).symm | |
| _ β€ _ := ENNReal.ofReal_le_ofReal (circuitTerm_three_source hd hV hVeta) | |
| end SingleLatticeCovering.SimplexYoung | |
| noncomputable section | |
| namespace SingleLatticeCovering.RogersPreparation | |
| open Finset Set | |
| open scoped BigOperators | |
| def poissonPartial (u : β) (k : β) : β := | |
| β j β range (k+1), (-u)^j/(j.factorial : β) | |
| lemma poissonPartial_zero (k : β) : poissonPartial 0 k=1 := by | |
| unfold poissonPartial | |
| rw [sum_range_succ'] | |
| simp | |
| lemma taylor_exp_neg_eq {u : β} (hu : 0 < u) (k : β) : | |
| taylorWithinEval Real.exp k (uIcc 0 (-u)) 0 (-u)=poissonPartial u k := by | |
| have hne : (0 : β)β -u := by linarith | |
| have hd (j : β) : iteratedDerivWithin j Real.exp (uIcc 0 (-u)) 0=1 := by | |
| rw [iteratedDerivWithin_eq_iteratedDeriv (uniqueDiffOn_uIcc hne) | |
| Real.contDiff_exp.contDiffAt (left_mem_uIcc),iteratedDeriv_eq_iterate, | |
| Real.iter_deriv_exp,Real.exp_zero] | |
| rw [taylor_within_apply] | |
| unfold poissonPartial | |
| apply Finset.sum_congr rfl | |
| intro j hj | |
| rw [hd] | |
| simp [smul_eq_mul,div_eq_mul_inv,mul_comm] | |
| theorem poissonPartial_error {u : β} (hu : 0 β€ u) (k : β) : | |
| |poissonPartial u k-Real.exp (-u)| β€ u^(k+1)/(k+1).factorial := by | |
| rcases hu.eq_or_lt with he | hu | |
| Β· subst u | |
| simp [poissonPartial_zero] | |
| have hne : (0 : β)β -u := by linarith | |
| obtain β¨c,hc,heβ© := taylor_mean_remainder_lagrange_iteratedDeriv (n := k) hne | |
| Real.contDiff_exp.contDiffOn | |
| rw [taylor_exp_neg_eq hu k,iteratedDeriv_eq_iterate,Real.iter_deriv_exp,sub_zero] at he | |
| have hc0 : c β€ 0 := by | |
| have h := hc.2 | |
| simpa only [max_eq_left (neg_nonpos.mpr hu.le)] using h.le | |
| have hec : Real.exp c β€ 1 := by simpa using Real.exp_le_exp.mpr hc0 | |
| rw [abs_sub_comm,he,abs_div,abs_mul,abs_pow,abs_neg,abs_of_nonneg hu.le, | |
| abs_of_pos (Real.exp_pos c),abs_of_nonneg (by positivity : (0 : β)β€(k+1).factorial)] | |
| apply div_le_div_of_nonneg_right _ (by positivity) | |
| exact mul_le_of_le_one_left (by positivity) hec | |
| theorem poissonPartial_upper {u : β} (hu : 0 β€ u) (k : β) : | |
| poissonPartial u k β€ Real.exp (-u)+u^(k+1)/(k+1).factorial := by | |
| have := le_trans (le_abs_self (poissonPartial u k-Real.exp (-u))) | |
| (poissonPartial_error hu k) | |
| linarith | |
| end SingleLatticeCovering.RogersPreparation | |
| namespace SingleLatticeCovering.SimplexYoung | |
| open scoped BigOperators | |
| lemma log_four_thirds_ge : (2/7 : β)β€Real.log (4/3 : β) := by | |
| apply (Real.le_log_iff_exp_le (by norm_num : (0 : β)<4/3)).mpr | |
| have h := Real.exp_le_two_add_div_two_sub (by norm_num : (0 : β)β€2/7) | |
| (by norm_num : (2/7 : β)<2) | |
| norm_num at h β’ | |
| exact h | |
| lemma log_three_quarters_le : Real.log (3/4 : β)β€-(2/7 : β) := by | |
| have he : (3/4 : β)=(4/3 : β)β»ΒΉ := by norm_num | |
| rw [he,Real.log_inv] | |
| linarith [log_four_thirds_ge] | |
| lemma factorial_quotient_chernoff {u : β} (hu : 0β€u) {q : β} (hq : 0<q) : | |
| u^q/(q.factorial : β)β€(Real.exp 1*u/(q : β))^q := by | |
| have hqR : (0 : β)<q := by exact_mod_cast hq | |
| have h := Real.pow_div_factorial_le_exp (q : β) (Nat.cast_nonneg q : (0 : β)β€q) q | |
| calc | |
| _ = (u/(q : β))^q*((q : β)^q/(q.factorial : β)) := by | |
| rw [div_pow] | |
| field_simp | |
| _ β€ (u/(q : β))^q*Real.exp (q : β) := | |
| mul_le_mul_of_nonneg_left h (pow_nonneg (div_nonneg hu hqR.le) _) | |
| _ = _ := by | |
| have he : Real.exp (q : β) = Real.exp 1 ^ q := by | |
| simp | |
| rw [he, div_pow, div_pow, mul_pow] | |
| ring | |
| theorem poisson_remainder_circuitCutoff {d : β} (hd : 270β€d) {u : β} | |
| (hu : 0β€u) (huΞ· : u β€ sourceEta d) : | |
| u^(2*(d/4-1)+1)/((2*(d/4-1)+1).factorial : β)β€Real.exp (-sourceEta d) := by | |
| let q := 2*(d/4-1)+1 | |
| have hq : 0<q := by dsimp [q]; omega | |
| have hdR : (270 : β)β€d := by exact_mod_cast hd | |
| have hqR : (0 : β)<q := by exact_mod_cast hq | |
| have hqlo : (d : β)/2-3β€q := by | |
| have hfloor : dβ€4*(d/4)+3 := by omega | |
| have hcast : (d : β)β€4*(d/4 : β)+3 := by exact_mod_cast hfloor | |
| have hf : 1 β€ d/4 := by omega | |
| simp only [q,Nat.cast_add,Nat.cast_mul,Nat.cast_ofNat,Nat.cast_sub hf,Nat.cast_one] | |
| linarith | |
| have hqratio : (22/45 : β)*dβ€q := by linarith | |
| have hqexponent : (7/15 : β)*dβ€q := by linarith | |
| have hue : uβ€(2/15 : β)*d := huΞ·.trans (sourceEta_le_linear d) | |
| have he : Real.exp 1β€(11/4 : β) := by linarith [Real.exp_one_lt_d9] | |
| have hratio : Real.exp 1*u/(q : β)β€(3/4 : β) := by | |
| apply (div_le_iffβ hqR).mpr | |
| have hc := mul_le_mul_of_nonneg_right he hu | |
| nlinarith | |
| have hlog : (q : β)*Real.log (3/4 : β)β€-(2/15 : β)*d := by | |
| have h := mul_le_mul_of_nonneg_left log_three_quarters_le hqR.le | |
| linarith | |
| change u^q/(q.factorial : β)β€_ | |
| calc | |
| _ β€ (Real.exp 1*u/(q : β))^q := factorial_quotient_chernoff hu hq | |
| _ β€ (3/4 : β)^q := pow_le_pow_leftβ (by positivity) hratio q | |
| _ = Real.exp ((q : β)*Real.log (3/4 : β)) := by | |
| rw [Real.exp_nat_mul,Real.exp_log (by norm_num : (0 : β)<3/4)] | |
| _ β€ Real.exp (-(2/15 : β)*d) := Real.exp_le_exp.mpr hlog | |
| _ β€ _ := Real.exp_le_exp.mpr (by linarith [sourceEta_le_linear d]) | |
| end SingleLatticeCovering.SimplexYoung | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |