Download data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.64 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean
-
curl -L -o ArithmeticTwoPrimePatternNormRate.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean
9.64 kB
| import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternErrorRate | |
| import OAI.NumberTheory.Ostmann.Arithmetic.PrimePatternFrequencyNormSum | |
| namespace OAI | |
| /-! # The full numerical norm bound with the original equality patterns -/ | |
| namespace Ostmann | |
| open Filter | |
| open scoped Classical BigOperators | |
| /-- The actual pattern sum and paired frequency sum have an absolute bulk | |
| constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`. | |
| Only the genuine comparison errors use the full number of histories. -/ | |
| theorem arithmetic_two_prime_pattern_norm_rate (Ο : SchwartzMap β β) (n k : β) | |
| (hk : 0 < k) (hn : n β€ k) (B Cfreq Cprior Ξ΅ : β) | |
| (hCfreq : 0 β€ Cfreq) (hCprior : 1 β€ Cprior) (hΞ΅ : 0 < Ξ΅) | |
| (hdepth : 8 * (Cprior + 1) β€ (k : β) ^ 3) : | |
| βαΆ L : β in atTop, let m := spectatorBulkCount k L | |
| β D : β, 0 β€ D β§ | |
| (β q : β, q β 0 β (q : β) β€ Real.exp (2 * Cfreq * m) β | |
| (q.divisors.card : β) β€ D) β§ | |
| β (S : Finset β€) (N V : β) (Ξ err : β), | |
| (S.card : β) β€ Real.exp (Cfreq * m) β | |
| (β s β S, s β 0 β§ s.natAbs β€ N) β | |
| (N : β) β€ Real.exp (Cfreq * m) β | |
| (V : β) β€ Real.exp (Ξ + Real.sqrt (4 * m)) β | |
| 0 β€ err β err β€ Real.exp (-Real.exp ((125 / 100000 : β) * L)) + | |
| 3 * Real.exp (-Real.exp ((2 / 1000 : β) * L)) β | |
| let _ := sampleSetoidFintype (Bool Γ MovingSampleIndex n) | |
| let K := ((SchwartzMap.seminorm β 0 0 Ο / Real.sqrt (Real.exp Ξ)) ^ (2 ^ n) * | |
| B ^ (2 ^ n - 1)) ^ 2 * | |
| ((2 : β) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) | |
| β R : Setoid (Bool Γ MovingSampleIndex n) β FrequencyTree (S Γ S) n β β, | |
| (β s t, βR s tβ β€ | |
| ((4 : β) ^ Fintype.card (Quotient s) * | |
| (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * | |
| (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * | |
| ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) β | |
| ββ s, β t, R s tβ β€ | |
| Real.exp ((2 ^ n : β) * Ξ + (Real.log 12 + 1) * (2 ^ n : β) * m + Ξ΅ * m) + | |
| 4 * Real.exp (-Real.exp ((12 / 10000 : β) * L)) := by | |
| have hCplus : 1 β€ Cprior + 1 := by linarith | |
| filter_upwards [arithmetic_prime_pattern_budget_rate Ο n k hk hn B Cfreq (Cprior + 1) Ξ΅ | |
| hCfreq hCplus hΞ΅ hdepth, | |
| movingPattern_four_errors_rate n k hk (Cprior + 1) Cfreq hCplus hCfreq, | |
| eventually_ge_atTop (2 : β)] with L hbudget herrors hL | |
| dsimp only | |
| obtain β¨D, hD, hdiv, hbudgetβ© := hbudget | |
| refine β¨D, hD, hdiv, ?_β© | |
| intro S N V Ξ err hcard hS hN hV herr herrbound R hR | |
| have hdivN : β q : β, q β 0 β q β€ N ^ 2 β (q.divisors.card : β) β€ D := by | |
| intro q hq hqN | |
| apply hdiv q hq | |
| calc | |
| (q : β) β€ (N : β) ^ 2 := by exact_mod_cast hqN | |
| _ β€ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 := | |
| pow_le_pow_leftβ (Nat.cast_nonneg N) hN 2 | |
| _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by | |
| rw [β Real.exp_nat_mul] | |
| congr 1 | |
| ring | |
| have hexp : (4 : β) β€ Real.exp ((Cprior + 1) * L) := by | |
| have hCL := mul_le_mul hCplus hL (by norm_num : (0 : β) β€ 2) (by linarith) | |
| have hCL' := mul_le_mul_of_nonneg_right hCprior (by linarith : 0 β€ L) | |
| linarith [Real.add_one_le_exp ((Cprior + 1) * L)] | |
| have hmono : max 4 (Real.exp (Cprior * L)) β€ max 2 (Real.exp ((Cprior + 1) * L)) := by | |
| apply max_le | |
| Β· exact hexp.trans (le_max_right _ _) | |
| Β· exact (Real.exp_le_exp.mpr (by linarith)).trans (le_max_right _ _) | |
| have hpriorcost : | |
| (2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n) β€ | |
| (2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * (max 2 (Real.exp ((Cprior + 1) * L))) ^ (4 * n * 2 ^ n) := | |
| mul_le_mul_of_nonneg_left (pow_le_pow_leftβ (by positivity) hmono _) (by positivity) | |
| have hsum := prime_pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L)) | |
| (((SchwartzMap.seminorm β 0 0 Ο / Real.sqrt (Real.exp Ξ)) ^ (2 ^ n) * | |
| B ^ (2 ^ n - 1)) ^ 2 * | |
| ((2 : β) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) * | |
| 2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity) | |
| herr hS hdivN R hR | |
| have hcost := (mul_le_mul_of_nonneg_right hpriorcost (by positivity)).trans (hbudget N V Ξ hN hV) | |
| have he := (mul_le_mul_of_nonneg_left herrbound | |
| (show 0 β€ ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) by positivity)).trans | |
| ((mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hpriorcost | |
| (Nat.cast_nonneg _)) (by positivity)).trans (herrors S hcard)) | |
| apply hsum.trans | |
| nlinarith only [hcost, he] | |
| /-- The actual pattern sum and paired frequency sum have an absolute bulk | |
| constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`. | |
| The fifth error is the literal giant comparison; only comparison errors use the full number of histories. -/ | |
| theorem arithmetic_two_prime_original_pattern_norm_rate (Ο : SchwartzMap β β) (n k : β) | |
| (hk : 0 < k) (hn : n β€ k) (B Cfreq Cprior Ξ΅ : β) | |
| (hCfreq : 0 β€ Cfreq) (hCprior : 1 β€ Cprior) (hΞ΅ : 0 < Ξ΅) | |
| (hdepth : 8 * (Cprior + 1) β€ (k : β) ^ 3) : | |
| βαΆ L : β in atTop, let m := spectatorBulkCount k L | |
| β D : β, 0 β€ D β§ | |
| (β q : β, q β 0 β (q : β) β€ Real.exp (2 * Cfreq * m) β | |
| (q.divisors.card : β) β€ D) β§ | |
| β (S : Finset β€) (N V : β) (Ξ err : β), | |
| (S.card : β) β€ Real.exp (Cfreq * m) β | |
| (β s β S, s β 0 β§ s.natAbs β€ N) β | |
| (N : β) β€ Real.exp (Cfreq * m) β | |
| (V : β) β€ Real.exp (Ξ + Real.sqrt (4 * m)) β | |
| 0 β€ err β err β€ Real.exp (-Real.exp ((125 / 100000 : β) * L)) + | |
| 4 * Real.exp (-Real.exp ((2 / 1000 : β) * L)) β | |
| let _ := sampleSetoidFintype (Bool Γ MovingSampleIndex n) | |
| let K := ((SchwartzMap.seminorm β 0 0 Ο / Real.sqrt (Real.exp Ξ)) ^ (2 ^ n) * | |
| B ^ (2 ^ n - 1)) ^ 2 * | |
| ((2 : β) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) | |
| β R : Setoid (Bool Γ MovingSampleIndex n) β FrequencyTree (S Γ S) n β β, | |
| (β s t, βR s tβ β€ | |
| ((4 : β) ^ Fintype.card (Quotient s) * | |
| (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * | |
| (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * | |
| ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) β | |
| ββ s, β t, R s tβ β€ | |
| Real.exp ((2 ^ n : β) * Ξ + (Real.log 12 + 1) * (2 ^ n : β) * m + Ξ΅ * m) + | |
| 5 * Real.exp (-Real.exp ((12 / 10000 : β) * L)) := by | |
| have hCplus : 1 β€ Cprior + 1 := by linarith | |
| filter_upwards [arithmetic_prime_pattern_budget_rate Ο n k hk hn B Cfreq (Cprior + 1) Ξ΅ | |
| hCfreq hCplus hΞ΅ hdepth, | |
| movingPattern_five_errors_rate n k hk (Cprior + 1) Cfreq hCplus hCfreq, | |
| eventually_ge_atTop (2 : β)] with L hbudget herrors hL | |
| dsimp only | |
| obtain β¨D, hD, hdiv, hbudgetβ© := hbudget | |
| refine β¨D, hD, hdiv, ?_β© | |
| intro S N V Ξ err hcard hS hN hV herr herrbound R hR | |
| have hdivN : β q : β, q β 0 β q β€ N ^ 2 β (q.divisors.card : β) β€ D := by | |
| intro q hq hqN | |
| apply hdiv q hq | |
| calc | |
| (q : β) β€ (N : β) ^ 2 := by exact_mod_cast hqN | |
| _ β€ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 := | |
| pow_le_pow_leftβ (Nat.cast_nonneg N) hN 2 | |
| _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by | |
| rw [β Real.exp_nat_mul] | |
| congr 1 | |
| ring | |
| have hexp : (4 : β) β€ Real.exp ((Cprior + 1) * L) := by | |
| have hCL := mul_le_mul hCplus hL (by norm_num : (0 : β) β€ 2) (by linarith) | |
| have hCL' := mul_le_mul_of_nonneg_right hCprior (by linarith : 0 β€ L) | |
| linarith [Real.add_one_le_exp ((Cprior + 1) * L)] | |
| have hmono : max 4 (Real.exp (Cprior * L)) β€ max 2 (Real.exp ((Cprior + 1) * L)) := by | |
| apply max_le | |
| Β· exact hexp.trans (le_max_right _ _) | |
| Β· exact (Real.exp_le_exp.mpr (by linarith)).trans (le_max_right _ _) | |
| have hpriorcost : | |
| (2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n) β€ | |
| (2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * (max 2 (Real.exp ((Cprior + 1) * L))) ^ (4 * n * 2 ^ n) := | |
| mul_le_mul_of_nonneg_left (pow_le_pow_leftβ (by positivity) hmono _) (by positivity) | |
| have hsum := prime_pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L)) | |
| (((SchwartzMap.seminorm β 0 0 Ο / Real.sqrt (Real.exp Ξ)) ^ (2 ^ n) * | |
| B ^ (2 ^ n - 1)) ^ 2 * | |
| ((2 : β) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) * | |
| 2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity) | |
| herr hS hdivN R hR | |
| have hcost := (mul_le_mul_of_nonneg_right hpriorcost (by positivity)).trans (hbudget N V Ξ hN hV) | |
| have he := (mul_le_mul_of_nonneg_left herrbound | |
| (show 0 β€ ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) by positivity)).trans | |
| ((mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hpriorcost | |
| (Nat.cast_nonneg _)) (by positivity)).trans (herrors S hcard)) | |
| apply hsum.trans | |
| nlinarith only [hcost, he] | |
| end Ostmann | |
| end OAI | |