Download data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.97 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean
-
curl -L -o ArithmeticPatternErrorRate.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean
5.97 kB
| import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternPriorRate | |
| import OAI.NumberTheory.Ostmann.Construction.FinalHistoryCount | |
| namespace OAI | |
| /-! # The original pattern and frequency counts preserve the arithmetic error -/ | |
| namespace Ostmann | |
| open Filter | |
| theorem pairedFrequencyTree_card (S : Finset β€) (n : β) : | |
| Fintype.card (FrequencyTree (S Γ S) n) = (Fintype.card (FrequencyTree S n)) ^ 2 := by | |
| simp only [card_frequencyTree, Fintype.card_prod, pow_two, mul_pow] | |
| theorem movingPattern_frequency_error_rate (n k : β) (hk : 0 < k) | |
| (Cprior Cfreq Ξ± Ξ² : β) (hCprior : 1 β€ Cprior) (hCfreq : 0 β€ Cfreq) | |
| (hΞ± : 0 < Ξ±) (hΞ²Ξ± : Ξ² < Ξ±) : | |
| βαΆ L : β in atTop, β S : Finset β€, | |
| (S.card : β) β€ Real.exp (Cfreq * spectatorBulkCount k L) β | |
| ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) * Real.exp (-Real.exp (Ξ± * L)) β€ | |
| Real.exp (-Real.exp (Ξ² * L)) := by | |
| let J := 4 * n * 2 ^ n | |
| let A : β := ((J ^ 2 + J : β) : β) * Cprior | |
| let B : β := (2 * (2 ^ (n + 1) - 1 : β) : β) * Cfreq | |
| let H := A + B * (k : β) ^ 4 | |
| have hA : 0 β€ A := by dsimp only [A]; positivity | |
| have hB : 0 β€ B := by dsimp only [B]; positivity | |
| have hH : 0 β€ H := by dsimp only [H]; positivity | |
| filter_upwards [arithmetic_exponent_absorption 0 Ξ± Ξ² H 1 0 hΞ± hΞ± hΞ²Ξ± (by norm_num), | |
| eventually_ge_atTop (1 : β)] with L hrate hL S hS | |
| have hL0 : 0 β€ L := by linarith | |
| have hp := movingPattern_total_cost_le_exp n Cprior L hCprior hL | |
| have hc := frequency_history_pair_card_bound S n Cfreq (spectatorBulkCount k L) hS | |
| have hc' : (Fintype.card (FrequencyTree (S Γ S) n) : β) β€ | |
| Real.exp (B * (k : β) ^ 4 * L) := by | |
| rw [pairedFrequencyTree_card, Nat.cast_pow] | |
| apply hc.trans | |
| apply Real.exp_le_exp.mpr | |
| have hm := mul_le_mul_of_nonneg_left (spectatorBulkCount_upper k L hL0) hB | |
| exact hm.trans_eq (by ring) | |
| have hprod := mul_le_mul hp hc' (Nat.cast_nonneg _) (Real.exp_nonneg _) | |
| have hexp : ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) β€ Real.exp (H * L) := by | |
| apply hprod.trans_eq | |
| rw [β Real.exp_add] | |
| congr 1 | |
| dsimp only [H, A, J] | |
| ring | |
| apply (mul_le_mul_of_nonneg_right hexp (Real.exp_nonneg _)).trans | |
| rw [β Real.exp_add] | |
| apply Real.exp_le_exp.mpr | |
| simp only [pow_zero, mul_one, zero_mul, Real.exp_zero, one_mul] at hrate | |
| linarith | |
| /-- All three errors in the original-prior norm bound fit the final common | |
| scale after the exact equality-pattern and two-history sums. -/ | |
| theorem movingPattern_three_errors_rate (n k : β) (hk : 0 < k) | |
| (Cprior Cfreq : β) (hCprior : 1 β€ Cprior) (hCfreq : 0 β€ Cfreq) : | |
| βαΆ L : β in atTop, β S : Finset β€, | |
| (S.card : β) β€ Real.exp (Cfreq * spectatorBulkCount k L) β | |
| ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) * | |
| (Real.exp (-Real.exp ((125 / 100000 : β) * L)) + | |
| 2 * Real.exp (-Real.exp ((2 / 1000 : β) * L))) β€ | |
| 3 * Real.exp (-Real.exp ((12 / 10000 : β) * L)) := by | |
| filter_upwards [movingPattern_frequency_error_rate n k hk Cprior Cfreq | |
| (125 / 100000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num), | |
| movingPattern_frequency_error_rate n k hk Cprior Cfreq | |
| (2 / 1000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num)] | |
| with L hfirst hsecond S hS | |
| have h := add_le_add (hfirst S hS) (mul_le_mul_of_nonneg_left (hsecond S hS) | |
| (by norm_num : (0 : β) β€ 2)) | |
| nlinarith only [h] | |
| /-- The internal-prime comparison contributes one further error of the same | |
| scale. All four errors survive both finite sums with a common saving. -/ | |
| theorem movingPattern_four_errors_rate (n k : β) (hk : 0 < k) | |
| (Cprior Cfreq : β) (hCprior : 1 β€ Cprior) (hCfreq : 0 β€ Cfreq) : | |
| βαΆ L : β in atTop, β S : Finset β€, | |
| (S.card : β) β€ Real.exp (Cfreq * spectatorBulkCount k L) β | |
| ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) * | |
| (Real.exp (-Real.exp ((125 / 100000 : β) * L)) + | |
| 3 * Real.exp (-Real.exp ((2 / 1000 : β) * L))) β€ | |
| 4 * Real.exp (-Real.exp ((12 / 10000 : β) * L)) := by | |
| filter_upwards [movingPattern_three_errors_rate n k hk Cprior Cfreq hCprior hCfreq, | |
| movingPattern_frequency_error_rate n k hk Cprior Cfreq | |
| (2 / 1000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num)] | |
| with L hthree hone S hS | |
| have h := add_le_add (hthree S hS) (hone S hS) | |
| nlinarith only [h] | |
| /-- The literal giant comparison adds one further error to the two bulk and | |
| one internal comparison errors. All five survive the exact finite sums. -/ | |
| theorem movingPattern_five_errors_rate (n k : β) (hk : 0 < k) | |
| (Cprior Cfreq : β) (hCprior : 1 β€ Cprior) (hCfreq : 0 β€ Cfreq) : | |
| βαΆ L : β in atTop, β S : Finset β€, | |
| (S.card : β) β€ Real.exp (Cfreq * spectatorBulkCount k L) β | |
| ((2 : β) ^ ((4 * n * 2 ^ n) ^ 2) * | |
| (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * | |
| (Fintype.card (FrequencyTree (S Γ S) n) : β) * | |
| (Real.exp (-Real.exp ((125 / 100000 : β) * L)) + | |
| 4 * Real.exp (-Real.exp ((2 / 1000 : β) * L))) β€ | |
| 5 * Real.exp (-Real.exp ((12 / 10000 : β) * L)) := by | |
| filter_upwards [movingPattern_four_errors_rate n k hk Cprior Cfreq hCprior hCfreq, | |
| movingPattern_frequency_error_rate n k hk Cprior Cfreq | |
| (2 / 1000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num)] | |
| with L hfour hone S hS | |
| have h := add_le_add (hfour S hS) (hone S hS) | |
| nlinarith only [h] | |
| end Ostmann | |
| end OAI | |