Download data/lean/OAI/NumberTheory/TwoPoint/Bounds/ActualPaddingIntegerBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 13 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/TwoPoint/Bounds/ActualPaddingIntegerBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/TwoPoint/Bounds/ActualPaddingIntegerBounds.lean
-
curl -L -o ActualPaddingIntegerBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/TwoPoint/Bounds/ActualPaddingIntegerBounds.lean
13 kB
| import OAI.NumberTheory.TwoPoint.Bounds.PaddingActiveState | |
| import OAI.NumberTheory.TwoPoint.Bounds.ActiveStateComparison | |
| import OAI.NumberTheory.TwoPoint.Bounds.ResidueLawUniform | |
| namespace OAI | |
| /-! Truncated padding weights on actual integer intervals. The finite | |
| active-state comparison is used only after the degree restriction. -/ | |
| namespace TwoPointCorrelations | |
| open Finset Filter | |
| open scoped Classical | |
| lemma uniformAverage_pi_product {ΞΉ : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] | |
| {Ξ² : ΞΉ β Type*} [β i, Fintype (Ξ² i)] (f : (i : ΞΉ) β Ξ² i β β) : | |
| uniformAverage (fun x : β i, Ξ² i => β i, f i (x i)) = | |
| β i, uniformAverage (f i) := by | |
| simp only [uniformAverage, Fintype.card_pi, Nat.cast_prod] | |
| rw [β Fintype.prod_sum, prod_div_distrib] | |
| lemma uniformAverage_padding_factor (p : β) [NeZero p] (site : β€) : | |
| uniformAverage (fun z : ZMod p => if z + (site : ZMod p) = 0 then (5 : β) else 1) = | |
| 1 + 4 / (p : β) := by | |
| have he (z : ZMod p) : z + (site : ZMod p) = 0 β z = -(site : ZMod p) := by | |
| constructor <;> intro h <;> linear_combination h | |
| have hf (z : ZMod p) : | |
| (if z = -(site : ZMod p) then (5 : β) else 1) = | |
| 1 + if z = -(site : ZMod p) then (4 : β) else 0 := by | |
| split_ifs <;> norm_num | |
| simp only [he, hf, uniformAverage, sum_add_distrib, sum_const, | |
| card_univ, nsmul_eq_mul, mul_one, sum_ite_eq', mem_univ, ite_true, ZMod.card] | |
| have hp : (p : β) β 0 := by exact_mod_cast NeZero.ne p | |
| field_simp | |
| noncomputable def primeStateTruncatedWeight {m : β} (s : Fin m β β) [β i, NeZero (s i)] | |
| (M : β) (site : β€) (z : β i, ZMod (s i)) : β := | |
| let S := activeState (fun i => decide (z i + (site : ZMod (s i)) = 0)) | |
| if S.card β€ M then (5 : β) ^ S.card else 0 | |
| lemma activeState_five_pow {m : β} (x : BooleanCube m) : | |
| (5 : β) ^ (activeState x).card = β i, if x i then (5 : β) else 1 := by | |
| rw [β prod_const] | |
| simp only [activeState, prod_filter] | |
| lemma primeStateTruncatedWeight_average_le {m : β} (s : Fin m β β) | |
| [β i, NeZero (s i)] (M : β) (site : β€) : | |
| uniformAverage (primeStateTruncatedWeight s M site) β€ | |
| β i, (1 + 4 / (s i : β)) := by | |
| calc | |
| _ β€ uniformAverage (fun z : β i, ZMod (s i) => | |
| (5 : β) ^ (activeState (fun i => decide (z i + (site : ZMod (s i)) = 0))).card) := by | |
| unfold uniformAverage | |
| apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) | |
| apply sum_le_sum | |
| intro z _ | |
| dsimp only [primeStateTruncatedWeight] | |
| split_ifs | |
| Β· exact le_rfl | |
| Β· positivity | |
| _ = uniformAverage (fun z : β i, ZMod (s i) => | |
| β i, if z i + (site : ZMod (s i)) = 0 then (5 : β) else 1) := by | |
| simp only [activeState_five_pow, decide_eq_true_eq] | |
| _ = _ := by | |
| rw [uniformAverage_pi_product | |
| (fun i (z : ZMod (s i)) => if z + (site : ZMod (s i)) = 0 then (5 : β) else 1)] | |
| simp only [uniformAverage_padding_factor] | |
| lemma padding_state_coefficient_bound (L : β) (r : β) | |
| (hL : 4800 β€ L) (hr : (r : β) β€ 400 * Real.log L) : | |
| (5 : β) ^ r β€ Real.exp (L ^ 4) := by | |
| have hL0 : 0 β€ L := by linarith | |
| have hlog : Real.log L β€ L := | |
| (Real.log_le_sub_one_of_pos (by linarith)).trans (by linarith) | |
| have hpow : 2000 * L β€ L ^ 4 := by | |
| have h1 := mul_nonneg hL0 (show 0 β€ L - 2000 by linarith) | |
| have h2 := mul_nonneg (sq_nonneg L) (show 0 β€ L ^ 2 - 1 by nlinarith) | |
| nlinarith | |
| calc | |
| _ β€ (Real.exp 5) ^ r := pow_le_pow_leftβ (by norm_num) | |
| (by linarith [Real.add_one_le_exp (5 : β)]) r | |
| _ = Real.exp (r * 5) := by rw [Real.exp_nat_mul] | |
| _ β€ _ := Real.exp_le_exp.mpr (by nlinarith) | |
| theorem BravermanDepth22Input.eventually_prime_state_weight (hBr : BravermanDepth22Input) : | |
| β A : β, 1000 β€ A β§ βαΆ L : β in atTop, | |
| β (m : β) (s : Fin m β β) [β i, NeZero (s i)], | |
| 0 < m β (m : β) β€ Real.exp L β | |
| Pairwise (fun i j => (s i).Coprime (s j)) β | |
| (β i, (s i : β) β€ Real.exp L) β | |
| β (site : β€) (a N : β), Real.exp (L ^ A / 2) β€ (N : β) β | |
| uniformAverage (fun x : Fin N => primeStateTruncatedWeight s | |
| β400 * Real.log Lββ site (fun i => (a + x.val : ZMod (s i)))) β€ | |
| (β i, (1 + 4 / (s i : β))) + Real.exp (-(L ^ 9)) := by | |
| obtain β¨A, hA, hcompareβ© := hBr.eventually_active_state_comparison | |
| refine β¨A, hA, ?_β© | |
| filter_upwards [hcompare, eventually_ge_atTop (4800 : β)] with L hcompare hL | |
| intro m s _ hm hmL hcop hs site a N hN | |
| let M : β := β400 * Real.log Lββ | |
| have hlog : 0 β€ 400 * Real.log L := | |
| mul_nonneg (by norm_num) (Real.log_nonneg (by linarith)) | |
| have hM : (M : β) β€ 400 * Real.log L := Nat.floor_le hlog | |
| let f : (Fin 1 β Finset (Fin m)) β β := fun S => (5 : β) ^ (S 0).card | |
| have hf : β b : Fin 1 β boundedActiveStates m M, | |
| |f (fun r => (b r).val)| β€ Real.exp (L ^ 4) := by | |
| intro b | |
| dsimp [f] | |
| rw [abs_of_nonneg (pow_nonneg (by norm_num) _)] | |
| apply padding_state_coefficient_bound L _ hL | |
| exact (Nat.cast_le.mpr (mem_boundedActiveStates.mp (b 0).property)).trans hM | |
| have hc := hcompare m s hm (by linarith) hcop hs 1 m m M hmL hM | |
| (by norm_num; linarith) | |
| (fun i => i) (fun i z => decide (z + (site : ZMod (s i)) = 0)) | |
| (fun _ i => i) f hf a N hN | |
| have he (z : β i, ZMod (s i)) : | |
| (if β r : Fin 1, | |
| (activeState (fun i => residueCircuitInputs s (fun i => i) | |
| (fun i z => decide (z + (site : ZMod (s i)) = 0)) z i)).card β€ M | |
| then f (fun _ => activeState (fun i => residueCircuitInputs s (fun i => i) | |
| (fun i z => decide (z + (site : ZMod (s i)) = 0)) z i)) else 0) = | |
| primeStateTruncatedWeight s M site z := by | |
| simp only [residueCircuitInputs, f, primeStateTruncatedWeight, forall_const] | |
| dsimp only at hc | |
| simp only [he] at hc | |
| have hb := primeStateTruncatedWeight_average_le s M site | |
| linarith [(le_abs_self | |
| (uniformAverage (fun x : Fin N => primeStateTruncatedWeight s M site | |
| (fun i => (a + x.val : ZMod (s i)))) - | |
| uniformAverage (primeStateTruncatedWeight s M site))).trans hc] | |
| lemma primeStateTruncatedWeight_actual {m : β} (Q : Finset β) (e : Fin m β Q) | |
| [β i, NeZero (e i).val] (M : β) (site n : β€) : | |
| primeStateTruncatedWeight (fun i => (e i).val) M site | |
| (fun i => (n : ZMod (e i).val)) = | |
| if actualPaddingDegree Q (n + site) β€ M then actualPaddingWeight Q (n + site) else 0 := by | |
| have hs : activeState (fun i => decide ((n : ZMod (e i).val) + | |
| (site : ZMod (e i).val) = 0)) = paddingActiveState Q e (n + site) := by | |
| apply (paddingActiveState_residue Q e _ (n + site) _).symm | |
| intro i | |
| exact Int.cast_add n site | |
| simp only [primeStateTruncatedWeight, hs, paddingActiveState_card, actualPaddingWeight] | |
| lemma primeSet_card_le_exp (Q : Finset β) (hQ : β p β Q, p.Prime) | |
| (L : β) (hupper : β p β Q, (p : β) β€ Real.exp L) : | |
| (Q.card : β) β€ Real.exp L := by | |
| have hs : Q β Icc 1 βReal.exp Lββ := by | |
| intro p hp | |
| exact mem_Icc.mpr β¨(hQ p hp).one_lt.le, | |
| (Nat.le_floor_iff (Real.exp_pos L).le).mpr (hupper p hp)β© | |
| have hc : Q.card β€ βReal.exp Lββ := by | |
| simpa only [Nat.card_Icc, Nat.add_sub_cancel] using card_le_card hs | |
| exact (Nat.cast_le.mpr hc).trans (Nat.floor_le (Real.exp_pos L).le) | |
| lemma paddingTiltNormalizer_one_le (Q : Finset β) : 1 β€ paddingTiltNormalizer Q := by | |
| calc | |
| 1 = β _p : Q, (1 : β) := by simp | |
| _ β€ paddingTiltNormalizer Q := by | |
| apply prod_le_prodβ | |
| Β· intro p _ | |
| exact zero_le_one | |
| Β· intro p _ | |
| exact le_add_of_nonneg_right (by positivity) | |
| /-- The manuscript's truncated-weight estimate, for literal integer | |
| sites and every permitted interval and offset. -/ | |
| theorem BravermanDepth22Input.eventually_actual_padding_weight (hBr : BravermanDepth22Input) : | |
| β A : β, 1000 β€ A β§ βαΆ L : β in atTop, | |
| β (Q : Finset β), (β p β Q, p.Prime) β | |
| (β p β Q, (p : β) β€ Real.exp L) β | |
| β (site : β€) (a N : β), Real.exp (L ^ A / 2) β€ (N : β) β | |
| let T := uniformAverage (fun x : Fin N => | |
| (actualPaddingVertex Q (((a + x.val : β) : β€) + site)) ^ 2 * | |
| if actualPaddingDegreeCut Q L (((a + x.val : β) : β€) + site) then 1 else 0) | |
| T β€ paddingTiltNormalizer Q + Real.exp (-(L ^ 9)) β§ | |
| T β€ 2 * paddingTiltNormalizer Q := by | |
| obtain β¨A, hA, hbβ© := hBr.eventually_prime_state_weight | |
| refine β¨A, hA, ?_β© | |
| filter_upwards [hb, eventually_ge_atTop (4800 : β)] with L hb hL | |
| intro Q hQ hupper site a N hN | |
| have hL0 : 0 β€ L := by linarith | |
| have hlog : 0 β€ 400 * Real.log L := | |
| mul_nonneg (by norm_num) (Real.log_nonneg (by linarith)) | |
| have hmain : uniformAverage (fun x : Fin N => | |
| (actualPaddingVertex Q (((a + x.val : β) : β€) + site)) ^ 2 * | |
| if actualPaddingDegreeCut Q L (((a + x.val : β) : β€) + site) then 1 else 0) β€ | |
| paddingTiltNormalizer Q + Real.exp (-(L ^ 9)) := by | |
| by_cases hne : Q.Nonempty | |
| Β· let m := Fintype.card Q | |
| let e : Fin m β Q := (Fintype.equivFin Q).symm | |
| let s := fun i : Fin m => (e i).val | |
| let (i : Fin m) : NeZero (s i) := β¨(hQ _ (e i).property).ne_zeroβ© | |
| have hm : 0 < m := Fintype.card_pos_iff.mpr β¨β¨hne.choose, hne.choose_specβ©β© | |
| have hmL : (m : β) β€ Real.exp L := by | |
| simpa only [m, Fintype.card_coe] using primeSet_card_le_exp Q hQ L hupper | |
| have hcop : Pairwise (fun i j => (s i).Coprime (s j)) := by | |
| intro i j hij | |
| apply (Nat.coprime_primes (hQ _ (e i).property) (hQ _ (e j).property)).mpr | |
| intro he | |
| exact hij (e.injective (Subtype.ext he)) | |
| have hs (i : Fin m) : (s i : β) β€ Real.exp L := hupper _ (e i).property | |
| have hh := hb m s hm hmL hcop hs site a N hN | |
| have heval (x : Fin N) : primeStateTruncatedWeight s β400 * Real.log Lββ site | |
| (fun i => (a + x.val : ZMod (s i))) = | |
| (actualPaddingVertex Q (((a + x.val : β) : β€) + site)) ^ 2 * | |
| if actualPaddingDegreeCut Q L (((a + x.val : β) : β€) + site) then 1 else 0 := by | |
| have hx := primeStateTruncatedWeight_actual Q e β400 * Real.log Lββ site | |
| ((a + x.val : β) : β€) | |
| simp only [Nat.cast_add, Int.cast_add, Int.cast_natCast] at hx | |
| rw [hx] | |
| simp only [Nat.le_floor_iff hlog, actualPaddingVertex_sq, | |
| actualPaddingDegreeCut, Nat.cast_add] | |
| split_ifs <;> simp | |
| have hnorm : (β i, (1 + 4 / (s i : β))) = paddingTiltNormalizer Q := | |
| e.prod_comp (fun p : Q => 1 + 4 / (p.val : β)) | |
| simpa only [heval, hnorm] using hh | |
| Β· have hQempty : Q = β := not_nonempty_iff_eq_empty.mp hne | |
| subst Q | |
| have hNpos : 0 < N := by exact_mod_cast (Real.exp_pos _).trans_le hN | |
| let : NeZero N := β¨by omegaβ© | |
| have hf (x : Fin N) : | |
| (actualPaddingVertex β (((a + x.val : β) : β€) + site)) ^ 2 * | |
| (if actualPaddingDegreeCut β L (((a + x.val : β) : β€) + site) | |
| then (1 : β) else 0) = 1 := by | |
| simp only [actualPaddingVertex_sq, actualPaddingWeight, actualPaddingDegree, | |
| filter_empty, card_empty, pow_zero, actualPaddingDegreeCut, Nat.cast_zero, | |
| hlog, ite_true, mul_one] | |
| simp only [hf, uniformAverage_const] | |
| have hnorm : paddingTiltNormalizer β = 1 := by simp [paddingTiltNormalizer] | |
| rw [hnorm] | |
| linarith [Real.exp_pos (-(L ^ 9))] | |
| dsimp only | |
| refine β¨hmain, ?_β© | |
| have he : Real.exp (-(L ^ 9)) β€ 1 := | |
| Real.exp_le_one_iff.mpr (neg_nonpos.mpr (pow_nonneg hL0 _)) | |
| have hS := paddingTiltNormalizer_one_le Q | |
| linarith | |
| /-- Summing over any fixed finite collection of offsets costs its cardinality. -/ | |
| theorem BravermanDepth22Input.eventually_actual_padding_weight_sum | |
| (hBr : BravermanDepth22Input) : | |
| β A : β, 1000 β€ A β§ βαΆ L : β in atTop, | |
| β (Q : Finset β), (β p β Q, p.Prime) β | |
| (β p β Q, (p : β) β€ Real.exp L) β | |
| β {ΞΉ : Type*} [DecidableEq ΞΉ] (offsets : Finset ΞΉ) (site : ΞΉ β β€) | |
| (a N : β), Real.exp (L ^ A / 2) β€ (N : β) β | |
| (β i β offsets, uniformAverage (fun x : Fin N => | |
| (actualPaddingVertex Q (((a + x.val : β) : β€) + site i)) ^ 2 * | |
| if actualPaddingDegreeCut Q L (((a + x.val : β) : β€) + site i) | |
| then 1 else 0)) β€ | |
| 2 * (offsets.card : β) * paddingTiltNormalizer Q := by | |
| obtain β¨A, hA, hbβ© := hBr.eventually_actual_padding_weight | |
| refine β¨A, hA, ?_β© | |
| filter_upwards [hb] with L hb | |
| intro Q hQ hupper ΞΉ _ offsets site a N hN | |
| calc | |
| _ β€ β _i β offsets, 2 * paddingTiltNormalizer Q := by | |
| apply sum_le_sum | |
| intro i _ | |
| exact (hb Q hQ hupper (site i) a N hN).2 | |
| _ = _ := by rw [sum_const, nsmul_eq_mul]; ring | |
| end TwoPointCorrelations | |
| end OAI | |