Buckets:
| import OAI.Geometry.LatticeCovering.Bits | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open scoped BigOperators | |
| open Real | |
| noncomputable section | |
| open scoped BigOperators | |
| open MeasureTheory ProbabilityTheory Set | |
| noncomputable section | |
| open scoped BigOperators | |
| open MeasureTheory Set | |
| noncomputable section | |
| open Module Submodule MeasureTheory | |
| open scoped BigOperators | |
| noncomputable section | |
| open Real Filter Topology | |
| noncomputable section | |
| open scoped BigOperators | |
| noncomputable section | |
| open Filter Topology Asymptotics | |
| noncomputable section | |
| open scoped BigOperators | |
| open Classical | |
| noncomputable section | |
| open scoped BigOperators | |
| open Classical | |
| noncomputable section | |
| open scoped BigOperators | |
| open Classical | |
| namespace SingleLatticeCovering.Folded | |
| open ConstructionA MeasureTheory Filter Topology | |
| open scoped BigOperators | |
| universe u | |
| variable {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] | |
| lemma gridMass_eq_usableMass {p : β} [NeZero p] (h : β) (E : Finset (ΞΉ β ZMod p)) : | |
| gridMass h p E = Blocks.usableMass E (fun z => folded h (anchor p z)) := by | |
| classical | |
| unfold gridMass Blocks.usableMass | |
| rw [Fintype.expect_eq_sum_div_card] | |
| simp only [Fintype.card_fun, ZMod.card, Nat.cast_pow, div_eq_mul_inv, | |
| βFinset.sum_filter, Finset.filter_mem_eq_inter, Finset.univ_inter] | |
| rw [inv_pow] | |
| ring | |
| lemma probability_eq_bitMass {h : β} (hh : 0 < h) (t : β) (e : Bool) : | |
| probability h t e = Bits.bitMass (probability h t true) e := by | |
| cases e | |
| Β· simp only [Bits.bitMass, Bool.false_eq_true, βreduceIte] | |
| linarith [probability_sum hh t] | |
| Β· simp only [Bits.bitMass, βreduceIte] | |
| lemma wordMass_eq_productMass {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] {h : β} (hh : 0 < h) (t : ΞΉ β β) (e : ΞΉ β Bool) : | |
| wordMass h t e = Bits.productMass (fun j => probability h (t j) true) e := by | |
| unfold wordMass Bits.productMass | |
| apply Finset.prod_congr rfl | |
| intro j _ | |
| exact probability_eq_bitMass hh _ _ | |
| lemma mean_fairRate_lower {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] {h r : β} (hh : 0 < h) (t : ΞΉ β β) | |
| (hN : r β€ ((Finset.univ.filter fun j => |t j-1/2| β€ (h^2)β»ΒΉ).card : β)) : | |
| 2*Bits.alpha*r β€ Bits.meanCount (fun j => Bits.fairRate (probability h (t j) true)) := by | |
| classical | |
| let S := Finset.univ.filter fun j => |t j-1/2| β€ (h^2)β»ΒΉ | |
| have hsum : (2*Bits.alpha)*(S.card : β) β€ | |
| β j β S, Bits.fairRate (probability h (t j) true) := by | |
| calc | |
| _ = β _j β S, 2*Bits.alpha := by simp [mul_comm] | |
| _ β€ _ := by | |
| apply Finset.sum_le_sum | |
| intro j hj | |
| have ht := probability_central hh (Finset.mem_filter.mp hj).2 true | |
| unfold Bits.fairRate | |
| apply mul_le_mul_of_nonneg_left (le_min ht.1 (by change alpha β€ _; linarith)) (by norm_num) | |
| have hall : (β j β S, Bits.fairRate (probability h (t j) true)) β€ | |
| Bits.meanCount (fun j => Bits.fairRate (probability h (t j) true)) := by | |
| apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ S) | |
| intro j _ _ | |
| exact Bits.fairRate_nonneg (probability_pos hh _ _).le (probability_le_one hh _ _) | |
| exact (mul_le_mul_of_nonneg_left hN (mul_nonneg (by norm_num) Bits.alpha_pos.le)).trans (hsum.trans hall) | |
| lemma eligible_window {p : β} [NeZero p] {h ΞΌ D r : β} (hh : 0 < h) | |
| {z : ΞΉ β ZMod p} (hz : z β gridEligible h ΞΌ D r p) : | |
| Real.exp ((Fintype.card ΞΉ : β)*ΞΌ-D) β€ folded h (anchor p z) β§ | |
| folded h (anchor p z) β€ Real.exp ((Fintype.card ΞΉ : β)*ΞΌ+D) := by | |
| classical | |
| have he := (Finset.mem_filter.mp hz).2.1 | |
| have hl : (Fintype.card ΞΉ : β)*ΞΌ-D β€ Real.log (folded h (anchor p z)) := by linarith [(abs_le.mp he).1] | |
| have hu : Real.log (folded h (anchor p z)) β€ (Fintype.card ΞΉ : β)*ΞΌ+D := by linarith [(abs_le.mp he).2] | |
| exact β¨(Real.exp_le_exp.mpr hl).trans_eq (Real.exp_log (folded_pos hh _)), | |
| (Real.exp_log (folded_pos hh _)).symm.trans_le (Real.exp_le_exp.mpr hu)β© | |
| end SingleLatticeCovering.Folded | |
| namespace SingleLatticeCovering.Folded | |
| open Filter Topology Real ConstructionA Blocks | |
| open scoped BigOperators | |
| lemma eventually_previous_cap : βαΆ b : β in atTop, β a : β, 1 β€ a β | |
| a β€ b^((1 : β)/(9/10)) β 5*a^(56/100 : β) β€ b^(65/100 : β) := by | |
| filter_upwards [eventually_rpow_ratio_bound (by norm_num : ((1 : β)/(9/10))*(56/100) < 65/100) | |
| (by norm_num : (0 : β) < 1/5), eventually_gt_atTop (0 : β)] with b hb hb0 | |
| intro a ha hab | |
| have ht := Real.rpow_le_rpow (show 0 β€ a by linarith) hab (by norm_num : (0 : β) β€ 56/100) | |
| rw [βReal.rpow_mul hb0.le] at ht | |
| linarith | |
| lemma eventually_line_collision : βαΆ b : β in atTop, | |
| Real.exp (-2*b^(56/100 : β)) β€ b^(-(1/20 : β)) := by | |
| have ht := Sampler.Numeric.tendsto_rpow_mul_exp_neg_rpow (1/20 : β) | |
| (by norm_num : (0 : β) < 56/100) (by norm_num : (0 : β) < 2) | |
| filter_upwards [ht.eventually (gt_mem_nhds (by norm_num : (0 : β) < 1)), | |
| eventually_gt_atTop (0 : β)] with b hb hb0 | |
| rw [Real.rpow_neg hb0.le] | |
| rw [inv_eq_one_div] | |
| apply (le_div_iffβ (Real.rpow_pos_of_pos hb0 (1/20 : β))).mpr | |
| simpa only [mul_comm] using hb.le | |
| lemma window_line_choice {b p : β} (hb : 1 β€ b) [Fact p.Prime] | |
| (U : Finset (Fin b β ZMod p)) (hU : U β gridEligible (height b) (logMean (height b)) | |
| ((b : β)^(56/100 : β)) ((b : β)^(70/100 : β)) p) | |
| (hh : 0 < height b) | |
| (hpl : (b : β)*logMean (height b)-4*(b : β)^(56/100 : β) β€ Real.log p) | |
| (hpu : Real.log p β€ (b : β)*logMean (height b)-3*(b : β)^(56/100 : β)) | |
| (hM : usableMass U (fun z => folded (height b) (anchor p z)) β€ 2) : | |
| β v : Direction (Fin b β ZMod p), | |
| usableMass U (fun z => folded (height b) (anchor p z)) - | |
| 4*usableMass U (fun z => folded (height b) (anchor p z))*Real.exp (-2*(b : β)^(56/100 : β)) β€ | |
| (πΌ x, lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U (fun z => folded (height b) (anchor p z))) v x) β§ | |
| (πΌ x, lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U (fun z => folded (height b) (anchor p z))) v x) β€ | |
| usableMass U (fun z => folded (height b) (anchor p z)) β§ | |
| β x, 0 β€ lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U (fun z => folded (height b) (anchor p z))) v x β§ | |
| lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U (fun z => folded (height b) (anchor p z))) v x β€ | |
| Real.exp (5*(b : β)^(56/100 : β)) := by | |
| classical | |
| let : Nonempty (Fin b) := β¨β¨0,by omegaβ©β© | |
| have hp0 : (0 : β) < p := by exact_mod_cast (Fact.out : p.Prime).pos | |
| apply gaussian_window_sparse_line U (fun z => folded (height b) (anchor p z)) | |
| (fun z => (folded_pos hh _).le) ((b : β)*logMean (height b)) ((b : β)^(56/100 : β)) | |
| (fun z hz => by simpa only [Fintype.card_fin] using (eligible_window hh (hU hz)).1) | |
| (fun z hz => by simpa only [Fintype.card_fin] using (eligible_window hh (hU hz)).2) | |
| _ _ hM | |
| Β· simpa only [ZMod.card, Real.exp_log hp0] using Real.exp_le_exp.mpr hpl | |
| Β· simpa only [ZMod.card, Real.exp_log hp0] using Real.exp_le_exp.mpr hpu | |
| lemma line_mean_error {M g D Ξ΅ Ο : β} (hM : |M-1| β€ D*Ξ΅) (hM2 : M β€ 2) | |
| (hΟ : 0 β€ Ο) (hΟΞ΅ : Ο β€ Ξ΅) (hgl : M-4*M*Ο β€ g) (hgu : g β€ M) : | |
| |g-1| β€ (D+8)*Ξ΅ := by | |
| have hΞ΅ : 0 β€ Ξ΅ := hΟ.trans hΟΞ΅ | |
| have hmul := mul_le_mul_of_nonneg_right hM2 hΟ | |
| apply abs_le.mpr | |
| constructor <;> linarith [(abs_le.mp hM).1,(abs_le.mp hM).2] | |
| lemma usable_mass_error {M U C b : β} (hb : 1 β€ b) (hC : 0 β€ C) | |
| (hM : |M-1| β€ 7*b^(-(1/20 : β))) (hM2 : M β€ 2) | |
| (hu : M-C*b^(-(9/20 : β))*M β€ U) (hu' : U β€ M) : | |
| |U-1| β€ (7+2*C)*b^(-(1/20 : β)) := by | |
| have he := Real.rpow_le_rpow_of_exponent_le hb (by norm_num : (-(9/20 : β)) β€ -(1/20 : β)) | |
| have hp : 0 β€ b^(-(9/20 : β)) := Real.rpow_nonneg (by linarith) _ | |
| have hs := mul_le_mul_of_nonneg_left he hC | |
| have hm := mul_le_mul_of_nonneg_left hM2 (mul_nonneg hC hp) | |
| apply abs_le.mpr | |
| constructor <;> nlinarith [(abs_le.mp hM).1,(abs_le.mp hM).2, | |
| mul_nonneg hC (Real.rpow_nonneg (by linarith : 0 β€ b) (-(1/20 : β)))] | |
| lemma sampler_factor_lower {b A : β} (hb : 1 β€ b) (hA : 4 β€ A) : | |
| 1-A*b^(-(1/100 : β)) β€ (1-b^(-(1/20 : β)))*(1-3*b^(-(1/10 : β))) := by | |
| have h1 := Real.rpow_le_rpow_of_exponent_le hb (by norm_num : (-(1/20 : β)) β€ -(1/100 : β)) | |
| have h2 := Real.rpow_le_rpow_of_exponent_le hb (by norm_num : (-(1/10 : β)) β€ -(1/100 : β)) | |
| have h3 := mul_le_mul_of_nonneg_right hA (Real.rpow_nonneg (by linarith : 0 β€ b) (-(1/100 : β))) | |
| nlinarith [mul_nonneg (Real.rpow_nonneg (by linarith : 0 β€ b) (-(1/20 : β))) | |
| (Real.rpow_nonneg (by linarith : 0 β€ b) (-(1/10 : β)))] | |
| end SingleLatticeCovering.Folded | |
| namespace SingleLatticeCovering.Folded | |
| open Filter Topology Real ConstructionA Blocks | |
| open scoped BigOperators | |
| universe u | |
| def eligible (b p : β) [NeZero p] : Finset (Fin b β ZMod p) := | |
| gridEligible (height b) (logMean (height b)) ((b : β)^(56/100 : β)) ((b : β)^(70/100 : β)) p | |
| def anchorWeight (b p : β) (z : Fin b β ZMod p) : β := folded (height b) (anchor p z) | |
| def blockFunction (b p : β) [Fact p.Prime] (U : Finset (Fin b β ZMod p)) | |
| (v : Fin b β ZMod p) : (Fin b β ZMod p) β β := | |
| lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U (anchorWeight b p)) v | |
| theorem eventually_usable_gaussian : β A : β, 0 < A β§ | |
| βαΆ b : β in atTop, β (p : β) [Fact p.Prime], | |
| (b : β)*logMean (height b)-4*(b : β)^(56/100 : β) β€ Real.log p β | |
| Real.log p β€ (b : β)*logMean (height b)-3*(b : β)^(56/100 : β) β | |
| β (H : Type u) [AddCommGroup H] [Fintype H], Real.log (Fintype.card H) β€ (b : β)^4 β | |
| β a : β, 1 β€ a β a β€ (b : β)^((1 : β)/(9/10)) β | |
| β f : H β β, (β x, 0 β€ f x) β (β x, f x β€ Real.exp (5*a^(56/100 : β))) β | |
| 1/2 β€ (πΌ x, f x) β (πΌ x, f x) β€ 2 β | |
| β w : Fin b β H, β U : Finset (Fin b β ZMod p), β v : Direction (Fin b β ZMod p), | |
| U β eligible b p β§ | |
| (β z β U, β x, (1-A*(b : β)^(-(1/100 : β)))*(πΌ y, f y) β€ | |
| β e, wordMass (height b) (anchor p z) e * f (x-Bits.groupShift w e)) β§ | |
| |usableMass U (anchorWeight b p)-1| β€ A*(b : β)^(-(1/20 : β)) β§ | |
| |(πΌ x, blockFunction b p U v x)-1| β€ A*(b : β)^(-(1/100 : β)) β§ | |
| β x, 0 β€ blockFunction b p U v x β§ blockFunction b p U v x β€ Real.exp (5*(b : β)^(56/100 : β)) := by | |
| classical | |
| obtain β¨Bs,hBs,hselβ© := Bits.usable_anchor_selection_uniform.{0,0,u} | |
| let C : β := 2/Bits.alpha+1 | |
| let D : β := 7+2*C | |
| let A : β := D+8 | |
| have hC : 0 β€ C := by dsimp [C]; exact add_nonneg (div_nonneg (by norm_num) Bits.alpha_pos.le) (by norm_num) | |
| have hD : 0 β€ D := by dsimp [D]; linarith | |
| have hA : 4 β€ A := by dsimp [A,D]; linarith | |
| refine β¨A,by linarith,?_β© | |
| have he : βαΆ b : β in atTop, 7*b^(-(1/20 : β)) β€ 1 := by | |
| filter_upwards [(tendsto_rpow_neg_atTop (by norm_num : (0 : β) < 1/20)).eventually | |
| (eventually_le_nhds (by norm_num : (0 : β) < 1/7))] with b hb | |
| linarith | |
| filter_upwards [eventually_grid_mass, height_tendsto.eventually (eventually_ge_atTop (1 : β)), | |
| tendsto_natCast_atTop_atTop.eventually (eventually_ge_atTop Bs), | |
| tendsto_natCast_atTop_atTop.eventually eventually_previous_cap, | |
| tendsto_natCast_atTop_atTop.eventually eventually_line_collision, | |
| tendsto_natCast_atTop_atTop.eventually he, eventually_ge_atTop (2 : β)] | |
| with b hmass hh hbs hprev hcol he hb | |
| intro p inst hpl hpu H _ _ hH a ha hab f hf hcap hflo hfhi | |
| have hb1 : 1 β€ (b : β) := by exact_mod_cast (show 1 β€ b by omega) | |
| have hh0 : 0 < height b := by linarith | |
| let F := anchorWeight b p | |
| let E := eligible b p | |
| have hF : β z, 0 β€ F z := fun z => (folded_pos hh0 _).le | |
| have herr := (hmass p (Fact.out : p.Prime).pos hpl).2 | |
| rw [gridMass_eq_usableMass] at herr | |
| change |usableMass E F-1| β€ 7*(b : β)^(-(1/20 : β)) at herr | |
| have hM2 : usableMass E F β€ 2 := by linarith [(abs_le.mp herr).2] | |
| have hfcap : β x, f x β€ Real.exp ((b : β)^(65/100 : β)) := fun x => | |
| (hcap x).trans (Real.exp_le_exp.mpr (hprev a ha hab)) | |
| obtain β¨w,U,hUE,hU,hdisc,hMU,hMU'β© := hsel (b : β) hbs (Fin b) (Fin b β ZMod p) H | |
| (by simp only [Fintype.card_fin,le_refl]) hH f hf hfcap hflo hfhi F E | |
| (fun z j => probability (height b) (anchor p z j) true) hF | |
| (fun z j => (probability_pos hh0 _ _).le) (fun z j => probability_le_one hh0 _ _) | |
| (fun z hz => mean_fairRate_lower hh0 _ (Finset.mem_filter.mp hz).2.2) | |
| have hMU0 : usableMass E F-C*(b : β)^(-(9/20 : β))*usableMass E F β€ usableMass U F := by | |
| simpa only [C, WeightedSelection.mass, usableMass, neg_div] using hMU | |
| clear hMU | |
| have hMU := hMU0 | |
| change usableMass U F β€ usableMass E F at hMU' | |
| have hUE' : U β gridEligible (height b) (logMean (height b)) | |
| ((b : β)^(56/100 : β)) ((b : β)^(70/100 : β)) p := hUE | |
| obtain β¨v,hvl,hvu,hvβ© := window_line_choice (show 1 β€ b by omega) U hUE' hh0 hpl hpu (hMU'.trans hM2) | |
| have huerr : |usableMass U F-1| β€ D*(b : β)^(-(1/20 : β)) := | |
| usable_mass_error hb1 hC herr hM2 hMU hMU' | |
| have hverr := line_mean_error huerr (hMU'.trans hM2) (Real.exp_pos _).le hcol hvl hvu | |
| refine β¨w,U,v,hUE,?_,?_,?_,hvβ© | |
| Β· intro z hz x | |
| have h := hU z hz x | |
| have hfactor := mul_le_mul_of_nonneg_right (sampler_factor_lower hb1 hA) | |
| (show 0 β€ πΌ y, f y by linarith) | |
| refine le_trans hfactor ?_ | |
| simp only [mul_assoc, neg_div, Bits.biasedAverage, Bits.integral, βwordMass_eq_productMass hh0] at h | |
| convert h using 1 | |
| all_goals try simp only [mul_assoc] | |
| all_goals | |
| apply Finset.sum_congr | |
| Β· ext e; simp | |
| Β· intro e he; rfl | |
| Β· exact huerr.trans (mul_le_mul_of_nonneg_right (by dsimp [A]; linarith) | |
| (Real.rpow_nonneg (by linarith) _)) | |
| Β· exact hverr.trans (mul_le_mul_of_nonneg_left | |
| (Real.rpow_le_rpow_of_exponent_le hb1 (by norm_num)) (by linarith : 0 β€ A)) | |
| end SingleLatticeCovering.Folded | |
| namespace SingleLatticeCovering.Folded | |
| variable {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] | |
| open Filter Topology | |
| def balanced (h : β) (t : ΞΉ β β) : Finset ΞΉ := | |
| Finset.univ.filter (fun j => |t j-1/2| β€ (h^2)β»ΒΉ) | |
| lemma balanced_probability {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] {h : β} (hh : 0 < h) (t : ΞΉ β β) (e : ΞΉ β Bool) : | |
| wordMass h t e β€ exp (-alpha*(balanced h t).card) := by | |
| apply wordMass_le_exp_card hh t e (balanced h t) | |
| intro j hj | |
| exact (Finset.mem_filter.mp hj).2 | |
| lemma window_atom {h p m r N : β} (hh : 0 < h) (hp : 0 < p) (t : ΞΉ β β) | |
| (hF : folded h t β€ exp (m+r)) (hprime : exp (m-4*r) β€ p) | |
| (hN : N β€ ((balanced h t).card : β)) (e : ΞΉ β Bool) : | |
| folded h t / p * wordMass h t e β€ exp (5*r-alpha*N) := by | |
| have hratio : folded h t / p β€ exp (5*r) := by | |
| calc | |
| _ β€ exp (m+r)/p := div_le_div_of_nonneg_right hF hp.le | |
| _ β€ exp (m+r)/exp (m-4*r) := | |
| div_le_div_of_nonneg_left (Real.exp_pos _).le (Real.exp_pos _) hprime | |
| _ = _ := by rw [β Real.exp_sub]; congr 1; ring | |
| have hprob : wordMass h t e β€ exp (-alpha*N) := by | |
| apply (balanced_probability hh t e).trans | |
| apply Real.exp_le_exp.mpr | |
| nlinarith [alpha_pos] | |
| calc | |
| _ β€ exp (5*r)*exp (-alpha*N) := mul_le_mul hratio hprob | |
| (Finset.prod_nonneg (fun j _ => (probability_pos hh _ _).le)) (Real.exp_pos _).le | |
| _ = _ := by rw [β Real.exp_add]; congr 1; ring | |
| lemma eventually_atom_exponent : | |
| βαΆ b : β in atTop, 5*b^(56/100 : β)+1 β€ (alpha/2)*b^(70/100 : β) := by | |
| have hratio : Tendsto (fun b : β => b^(56/100 : β)/b^(70/100 : β)) atTop (π 0) := by | |
| refine (tendsto_rpow_neg_atTop (by norm_num : (0 : β) < 14/100)).congr' ?_ | |
| filter_upwards [eventually_gt_atTop (0 : β)] with b hb | |
| rw [β Real.rpow_sub hb] | |
| norm_num | |
| have hinv := (tendsto_rpow_atTop (by norm_num : (0 : β) < 70/100)).inv_tendsto_atTop | |
| have ht : Tendsto (fun b : β => (5*b^(56/100 : β)+1)/b^(70/100 : β)) atTop (π 0) := by | |
| convert (hratio.const_mul 5).add hinv using 1 <;> try norm_num | |
| funext b | |
| ring | |
| filter_upwards [ht.eventually (gt_mem_nhds (div_pos alpha_pos (by norm_num) : 0 < alpha/2)), | |
| eventually_gt_atTop (0 : β)] with b hb hb0 | |
| exact ((div_lt_iffβ (Real.rpow_pos_of_pos hb0 _)).mp hb).le | |
| theorem atom_decay : β (B c : β), 0 < c β§ β b : β, B β€ b β | |
| β (h p m Ξ΄ : β), 0 < h β 0 < p β | |
| (Fintype.card ΞΉ : β)*h^2*Ξ΄ β€ 1 β | |
| exp (m-4*b^(56/100 : β)) β€ p β | |
| β s t : ΞΉ β β, (β j, s j β Set.Icc 0 1) β | |
| (β j, t j β Set.Icc 0 1) β (β j, |t j-s j| β€ Ξ΄) β | |
| folded h s β€ exp (m+b^(56/100 : β)) β | |
| b^(70/100 : β) β€ ((balanced h s).card : β) β | |
| β e : ΞΉ β Bool, | |
| folded h s / p * wordMass h s e β€ exp (-c*b^(70/100 : β)) β§ | |
| atom h t e / p β€ exp (-c*b^(70/100 : β)) := by | |
| obtain β¨B,hBβ© := eventually_atTop.mp eventually_atom_exponent | |
| refine β¨B,alpha/2,div_pos alpha_pos (by norm_num),?_β© | |
| intro b hb h p m Ξ΄ hh hp hΞ· hprime s t hs ht hd hF hN e | |
| have he := window_atom hh hp s hF hprime hN e | |
| have hbexp := hB b hb | |
| have hupper : 5*b^(56/100 : β)-alpha*b^(70/100 : β) β€ | |
| -(alpha/2)*b^(70/100 : β) := by linarith | |
| refine β¨he.trans (Real.exp_le_exp.mpr hupper), ?_β© | |
| have hround := (rounding hh s t e hs ht hd).2.2.2 | |
| calc | |
| atom h t e / p β€ exp ((Fintype.card ΞΉ : β)*h^2*Ξ΄) * | |
| (folded h s / p * wordMass h s e) := by | |
| calc | |
| _ β€ (exp ((Fintype.card ΞΉ : β)*h^2*Ξ΄)*(folded h s*wordMass h s e))/p := | |
| div_le_div_of_nonneg_right hround hp.le | |
| _ = _ := by ring | |
| _ β€ exp ((Fintype.card ΞΉ : β)*h^2*Ξ΄) * exp (5*b^(56/100 : β)-alpha*b^(70/100 : β)) := | |
| mul_le_mul_of_nonneg_left he (Real.exp_pos _).le | |
| _ = exp ((Fintype.card ΞΉ : β)*h^2*Ξ΄+5*b^(56/100 : β)-alpha*b^(70/100 : β)) := by | |
| rw [β Real.exp_add]; congr 1; ring | |
| _ β€ _ := Real.exp_le_exp.mpr (by linarith) | |
| end SingleLatticeCovering.Folded | |
| namespace SingleLatticeCovering.ConstructionA | |
| open SingleLatticeCovering.Folded SingleLatticeCovering.Blocks | |
| variable {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] | |
| lemma anchor_mem_cube {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] (p : β) (hp : 0 < p) (z : ΞΉ β ZMod p) (j : ΞΉ) : | |
| anchor p z j β Set.Icc 0 1 := by | |
| let : NeZero p := β¨hp.ne'β© | |
| have hp0 : (0 : β) < p := by exact_mod_cast hp | |
| refine β¨div_nonneg (Nat.cast_nonneg _) hp0.le, ?_β© | |
| apply (div_le_one hp0).mpr | |
| exact_mod_cast (ZMod.val_lt (z j)).le | |
| lemma lineMax_anchor {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] {p : β} [Fact p.Prime] (U : Finset (ΞΉ β ZMod p)) | |
| (F : (ΞΉ β ZMod p) β β) (v x : ΞΉ β ZMod p) | |
| (hg : 0 < lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U F) v x) : | |
| β z β U, x-z β Submodule.span (ZMod p) {v} β§ | |
| lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U F) v x = F z / p := by | |
| classical | |
| obtain β¨a,_,haβ© := Finset.exists_mem_eq_sup' Finset.univ_nonempty | |
| (fun a : ZMod p => sparseWeight (K := ZMod p) U F (x-a β’ v)) | |
| have hae : lineMax (K := ZMod p) (sparseWeight (K := ZMod p) U F) v x = | |
| sparseWeight (K := ZMod p) U F (x-a β’ v) := ha | |
| have hz : x-a β’ v β U := by | |
| by_contra hz | |
| simp only [hae, sparseWeight, hz, βreduceIte] at hg | |
| exact lt_irrefl _ hg | |
| refine β¨x-a β’ v,hz,?_,?_β© | |
| Β· rw [sub_sub_cancel] | |
| exact Submodule.mem_span_singleton.mpr β¨a,rflβ© | |
| Β· simp only [hae, sparseWeight, hz, βreduceIte, ZMod.card] | |
| theorem gaussian_cell {p : β} [Fact p.Prime] {h : β} (hh : 0 < h) | |
| (U : Finset (ΞΉ β ZMod p)) (v : ΞΉ β ZMod p) (Ο : ΞΉ β β) | |
| (hg : 0 < lineMax (K := ZMod p) | |
| (sparseWeight (K := ZMod p) U (fun z => folded h (anchor p z))) v | |
| (residue p (floorVector p Ο))) : | |
| β z β U, β lam : ΞΉ β β, | |
| lam β codeLattice p (Submodule.span (ZMod p) {v}) β§ | |
| Ο-lam β gridCell p z β§ | |
| lineMax (K := ZMod p) | |
| (sparseWeight (K := ZMod p) U (fun z => folded h (anchor p z))) v | |
| (residue p (floorVector p Ο)) = folded h (anchor p z)/(p : β) β§ | |
| β e : ΞΉ β Bool, | |
| lam+(fun j => bitValue (e j)) β codeLattice p (Submodule.span (ZMod p) {v}) β§ | |
| (β j, |h*(Ο j-lam j-bitValue (e j))| β€ h) β§ | |
| exp (-((Fintype.card ΞΉ : β)*h^2/(p : β))) * | |
| (folded h (anchor p z)/(p : β)*wordMass h (anchor p z) e) β€ | |
| atom h (Ο-lam) e/(p : β) := by | |
| classical | |
| have hp : 0 < p := (Fact.out : p.Prime).pos | |
| have hp0 : (0 : β) < p := by exact_mod_cast hp | |
| obtain β¨z,hz,hC,hmaxβ© := lineMax_anchor U (fun z => folded h (anchor p z)) v _ hg | |
| refine β¨z,hz,cellPoint p Ο z,cellPoint_mem p _ Ο z hC, | |
| cell_residual_mem_grid p hp Ο z,hmax,?_β© | |
| intro e | |
| obtain β¨hmem,hresβ© := cell_bits p hp (Submodule.span (ZMod p) {v}) Ο z hC e | |
| refine β¨hmem,?_,?_β© | |
| Β· intro j | |
| rw [abs_mul, abs_of_pos hh] | |
| exact mul_le_of_le_one_right hh.le (abs_le.mpr (hres j)) | |
| Β· have hΟ : β j, (Ο-cellPoint p Ο z) j β Set.Icc 0 1 := fun j => | |
| β¨(gridCell_subset_cube p hp z _ (cell_residual_mem_grid p hp Ο z) j).1, | |
| (gridCell_subset_cube p hp z _ (cell_residual_mem_grid p hp Ο z) j).2.leβ© | |
| have hd : β j, |(Ο-cellPoint p Ο z) j-anchor p z j| β€ (p : β)β»ΒΉ := by | |
| intro j | |
| have hj := cell_residual_mem_grid p hp Ο z j | |
| rw [abs_of_nonneg hj.1] | |
| exact hj.2.le | |
| have hr := (rounding hh (anchor p z) (Ο-cellPoint p Ο z) e | |
| (anchor_mem_cube p hp z) hΟ hd).2.2.1 | |
| have he : (Fintype.card ΞΉ : β)*h^2*(p : β)β»ΒΉ = (Fintype.card ΞΉ : β)*h^2/(p : β) := by ring | |
| rw [he] at hr | |
| calc | |
| _ = (exp (-((Fintype.card ΞΉ : β)*h^2/(p : β))) * | |
| (folded h (anchor p z)*wordMass h (anchor p z) e))/(p : β) := by ring | |
| _ β€ _ := div_le_div_of_nonneg_right hr hp0.le | |
| end SingleLatticeCovering.ConstructionA | |
| namespace SingleLatticeCovering.Folded | |
| open Filter Topology Real ConstructionA | |
| open scoped BigOperators | |
| theorem eventually_eligible_atom : β c : β, 0 < c β§ | |
| βαΆ b : β in atTop, β (p : β) [Fact p.Prime], | |
| (b : β)*logMean (height b)-4*(b : β)^(56/100 : β) β€ Real.log p β | |
| β z β eligible b p, β t : Fin b β β, t β gridCell p z β | |
| β e : Fin b β Bool, | |
| folded (height b) (anchor p z)/p*wordMass (height b) (anchor p z) e β€ | |
| Real.exp (-c*(b : β)^(70/100 : β)) β§ | |
| atom (height b) t e/p β€ Real.exp (-c*(b : β)^(70/100 : β)) := by | |
| classical | |
| refine β¨alpha/2,div_pos alpha_pos (by norm_num),?_β© | |
| filter_upwards [tendsto_natCast_atTop_atTop.eventually eventually_atom_exponent, | |
| tendsto_natCast_atTop_atTop.eventually eventually_rounding_slack, | |
| eventually_ge_atTop (2 : β)] with b hb hs hb2 | |
| intro p _ hpl z hz t ht e | |
| have hb1 : 1 β€ (b : β) := by exact_mod_cast (show 1 β€ b by omega) | |
| have hh : 0 < height b := heightR_pos (by exact_mod_cast (show 1 < b by omega)) | |
| have hp : 0 < p := (Fact.out : p.Prime).pos | |
| have hp0 : (0 : β) < p := by exact_mod_cast hp | |
| have hs' := hs p hp0 hpl | |
| have hΞ· : (b : β)*height b^2/p β€ 1 := hs'.1.trans | |
| (Real.rpow_le_one_of_one_le_of_nonpos hb1 (by norm_num)) | |
| have hF := (eligible_window hh hz).2 | |
| have hN : (b : β)^(70/100 : β) β€ ((balanced (height b) (anchor p z)).card : β) := | |
| (Finset.mem_filter.mp hz).2.2 | |
| have hprime : Real.exp ((b : β)*logMean (height b)-4*(b : β)^(56/100 : β)) β€ p := | |
| (Real.exp_le_exp.mpr hpl).trans_eq (Real.exp_log hp0) | |
| have he := window_atom hh hp0 (anchor p z) (by simpa only [Fintype.card_fin] using hF) hprime hN e | |
| have hbal : 5*(b : β)^(56/100 : β)-alpha*(b : β)^(70/100 : β) β€ | |
| -(alpha/2)*(b : β)^(70/100 : β) := by linarith | |
| refine β¨he.trans (Real.exp_le_exp.mpr hbal),?_β© | |
| have hr := (rounding hh (anchor p z) t e (anchor_mem_cube p hp z) | |
| (fun j => β¨(gridCell_subset_cube p hp z t ht j).1,(gridCell_subset_cube p hp z t ht j).2.leβ©) | |
| (fun j => by rw [abs_of_nonneg (ht j).1]; exact (ht j).2.le)).2.2.2 | |
| have hround : atom (height b) t e/p β€ Real.exp ((b : β)*height b^2/p)* | |
| (folded (height b) (anchor p z)/p*wordMass (height b) (anchor p z) e) := by | |
| have h := div_le_div_of_nonneg_right hr hp0.le | |
| simpa only [Fintype.card_fin,div_eq_mul_inv,mul_assoc,mul_left_comm,mul_comm] using h | |
| calc | |
| _ β€ Real.exp ((b : β)*height b^2/p)* | |
| Real.exp (5*(b : β)^(56/100 : β)-alpha*(b : β)^(70/100 : β)) := | |
| hround.trans (mul_le_mul_of_nonneg_left he (Real.exp_pos _).le) | |
| _ = Real.exp ((b : β)*height b^2/p+5*(b : β)^(56/100 : β)-alpha*(b : β)^(70/100 : β)) := by | |
| rw [βReal.exp_add]; congr 1; ring | |
| _ β€ _ := Real.exp_le_exp.mpr (by linarith) | |
| end SingleLatticeCovering.Folded | |
| namespace SingleLatticeCovering.Folded | |
| open Real Filter Topology | |
| open scoped BigOperators | |
| lemma eventually_logMean_height_le : βαΆ b : β in atTop, logMean (height b) β€ (b : β) := by | |
| have hs : 0 < Real.sqrt (2*Real.pi) := Real.sqrt_pos.mpr (mul_pos (by norm_num) Real.pi_pos) | |
| have he : βαΆ b : β in atTop, logMean (heightR b) β€ b := by | |
| filter_upwards [eventually_height_bound (s := 1) (c := Real.sqrt (2*Real.pi)/2) | |
| (by norm_num) (by positivity), eventually_gt_atTop (1 : β)] with b hb hb1 | |
| have hh := heightR_pos hb1 | |
| have ht : 0 < 2*heightR b/Real.sqrt (2*Real.pi) := by positivity | |
| calc | |
| _ β€ Real.log (2*heightR b/Real.sqrt (2*Real.pi)) := logMean_upper hh | |
| _ β€ 2*heightR b/Real.sqrt (2*Real.pi) := | |
| (Real.log_le_sub_one_of_pos ht).trans (by linarith) | |
| _ β€ b := by | |
| rw [div_le_iffβ hs] | |
| rw [Real.rpow_one] at hb | |
| nlinarith | |
| exact tendsto_natCast_atTop_atTop.eventually he | |
| lemma group_log_bound {a b p : β} [NeZero p] (hb : 1 β€ b) | |
| (ha : logMean (height a) β€ (a : β)) | |
| (hab : (a : β) β€ (b : β)^((1 : β)/(9/10))) | |
| (hp : Real.log p β€ (a : β)*logMean (height a)-3*(a : β)^(56/100 : β)) : | |
| Real.log (Fintype.card (Fin a β ZMod p)) β€ (b : β)^4 := by | |
| have hp' : Real.log p β€ (a : β)^2 := by | |
| have h := mul_le_mul_of_nonneg_left ha (Nat.cast_nonneg a : (0 : β) β€ a) | |
| have ht : 0 β€ (a : β)^(56/100 : β) := Real.rpow_nonneg (Nat.cast_nonneg _) _ | |
| nlinarith | |
| calc | |
| _ = (a : β)*Real.log p := by simp [Real.log_pow] | |
| _ β€ (a : β)^3 := by | |
| have h := mul_le_mul_of_nonneg_left hp' (Nat.cast_nonneg a : (0 : β) β€ a) | |
| nlinarith | |
| _ β€ ((b : β)^((1 : β)/(9/10)))^3 := pow_le_pow_leftβ (Nat.cast_nonneg _) hab _ | |
| _ = (b : β)^(10/3 : β) := by | |
| rw [βReal.rpow_natCast,βReal.rpow_mul (Nat.cast_nonneg b)] | |
| norm_num | |
| _ β€ (b : β)^4 := by | |
| have h := Real.rpow_le_rpow_of_exponent_le (show (1 : β) β€ b by exact_mod_cast hb) | |
| (by norm_num : (10/3 : β) β€ (4 : β)) | |
| simpa using h | |
| end SingleLatticeCovering.Folded | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace SingleLatticeCovering.Vertical | |
| variable {E V W : Type*} [Fintype E] | |
| def join (P : E β Finset V) (point : E β W) : Finset (V Γ W) := by | |
| classical | |
| exact Finset.univ.biUnion (fun e => (P e).image (fun x => (x,point e))) | |
| lemma mem_join (P : E β Finset V) (point : E β W) (x : V Γ W) : | |
| x β join P point β β e, x.1 β P e β§ x.2 = point e := by | |
| classical | |
| simp only [join, Finset.mem_biUnion, Finset.mem_univ, true_and, Finset.mem_image] | |
| constructor | |
| Β· rintro β¨e,v,hv,rflβ© | |
| exact β¨e,hv,rflβ© | |
| Β· rintro β¨e,hv,heβ© | |
| exact β¨e,x.1,hv,Prod.ext rfl he.symmβ© | |
| lemma sum_join (P : E β Finset V) (point : E β W) (hp : Function.Injective point) | |
| (f : V Γ W β β) : | |
| β x β join P point, f x = β e, β x β P e, f (x,point e) := by | |
| classical | |
| rw [join, Finset.sum_biUnion] | |
| Β· apply Finset.sum_congr rfl | |
| intro e _ | |
| rw [Finset.sum_image] | |
| exact fun x hx y hy h => congrArg Prod.fst h | |
| Β· intro e he e' he' hee' | |
| apply Finset.disjoint_left.mpr | |
| intro x hx hx' | |
| obtain β¨v,hv,hv'β© := Finset.mem_image.mp hx | |
| obtain β¨v',hw,hw'β© := Finset.mem_image.mp hx' | |
| exact hee' (hp (congrArg Prod.snd (hv'.trans hw'.symm))) | |
| theorem weighted_join (P : E β Finset V) (point : E β W) (hp : Function.Injective point) | |
| (preWeight : E β V β β) (block : E β β) (weight : V Γ W β β) | |
| (prob g : E β β) (a c d s : β) | |
| (ha : 0 β€ a) (hc : 0 β€ c) (hd : 0 β€ d) | |
| (hprob : β e, 0 β€ prob e) (hg : β e, 0 β€ g e) | |
| (hb : β e, c*d*prob e β€ block e) | |
| (hpreWeight : β e, a*g e β€ β x β P e, preWeight e x) | |
| (hweight : β e, β x β P e, weight (x,point e) = preWeight e x * block e) | |
| (hs : s β€ β e, prob e*g e) : | |
| a*c*d*s β€ β x β join P point, weight x := by | |
| classical | |
| rw [sum_join P point hp] | |
| calc | |
| a*c*d*s β€ a*c*d * β e, prob e*g e := | |
| mul_le_mul_of_nonneg_left hs (mul_nonneg (mul_nonneg ha hc) hd) | |
| _ = β e, (a*g e)*(c*d*prob e) := by | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro e _ | |
| ring | |
| _ β€ β e, (β x β P e, preWeight e x)*block e := by | |
| apply Finset.sum_le_sum | |
| intro e _ | |
| exact mul_le_mul (hpreWeight e) (hb e) (mul_nonneg (mul_nonneg hc hd) (hprob e)) | |
| ((mul_nonneg ha (hg e)).trans (hpreWeight e)) | |
| _ = _ := by | |
| apply Finset.sum_congr rfl | |
| intro e _ | |
| rw [Finset.sum_mul] | |
| exact Finset.sum_congr rfl (fun x hx => (hweight e x hx).symm) | |
| lemma join_subset_product (P : E β Finset V) (point : E β W) | |
| (S : Set V) (T : Set W) (hP : β e, β(P e) β S) (hp : β e, point e β T) : | |
| β(join P point) β S ΓΛ’ T := by | |
| intro x hx | |
| obtain β¨e,he,he'β© := (mem_join P point x).mp hx | |
| exact β¨hP e he,he' βΈ hp eβ© | |
| def SuffixBinary {m : β} (P : Finset (Fin m β β)) : Prop := | |
| β j : Fin m, β y : Fin m β β, β a : β, β x β P, | |
| (β k, j<k β x k=y k) β x j=a β¨ x j=a+1 | |
| def bits (b : β) (lam : Fin b β β) (e : Fin b β Bool) : Fin b β β := | |
| fun j => lam j + if e j then 1 else 0 | |
| lemma bits_injective (b : β) (lam : Fin b β β) : Function.Injective (bits b lam) := by | |
| intro e e' h | |
| funext j | |
| have hj := congrFun h j | |
| dsimp only [bits] at hj | |
| cases he : e j <;> cases he' : e' j <;> simp_all | |
| lemma bits_scalar (b : β) (lam : Fin b β β) (e : Fin b β Bool) (j : Fin b) : | |
| bits b lam e j=lam j β¨ bits b lam e j=lam j+1 := by | |
| cases he : e j <;> simp [bits,he] | |
| end SingleLatticeCovering.Vertical | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 30.9 kB
- Xet hash:
- 9572f24b8d55c2dbc6255876ce2de6aab853c61b46e6c1046f55df19b09c98bc
Β·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.