Download data/lean/OAI/Combinatorics/EditApproximation/Refinement/ComputedCoarseHistory.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Refinement/ComputedCoarseHistory.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Refinement/ComputedCoarseHistory.lean
-
curl -L -o ComputedCoarseHistory.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Refinement/ComputedCoarseHistory.lean
5.8 kB
| import OAI.Combinatorics.EditApproximation.Coarse.CoarseRootHistory | |
| import OAI.Combinatorics.EditApproximation.Refinement.ComputedCoarseArrayStorage | |
| namespace OAI | |
| namespace EditApproximation | |
| namespace BinaryFraction | |
| open Filter | |
| theorem computedCoarseRootHistory_bound : | |
| βαΆ N : β in atTop, β B d : β, β x y : List β, | |
| B = (integerParameters N).B β d = computedCoarseDepth N (coarseEntryWidth x y) β | |
| coarseEntryWidth x y β€ N β | |
| β (hB : 0 < B) (hq : 0 < inputHeight N ^ 4) (hL : 0 < 64 * inputHeight N) | |
| (i : CoarseGuessIndex (coarseEntryWidth x y)) (draws : CoarseThresholdDraws B d), | |
| coarseRootArrayHistory (coarseGuess (coarseEntryWidth x y) i) | |
| (inputHeight N ^ 4) (64 * inputHeight N) hB hq hL | |
| (coarseTargetFrame (coarseGuess (coarseEntryWidth x y) i) | |
| (coarsePadTo (coarseEntryWidth x y) y)) (coarseEntryTree B d x y) draws 0 β€ | |
| (32 * (inputHeight N ^ 3 + 1)) * | |
| ((B * (2 * coarseGuess (coarseEntryWidth x y) i + 1) + 1) * coarseCompleteNodes B d) := by | |
| filter_upwards [computedCoarse_bitParameters, eventually_ge_atTop 1, | |
| inputSmallLog_tendsto.eventually (eventually_ge_atTop 200)] with N hbits hN hell | |
| intro B d x y hBdef hddef hsize hB hq hL i draws | |
| let H := inputHeight N | |
| let k := coarseGuess (coarseEntryWidth x y) i | |
| have hk : k β€ 2 * (N + 2) := (coarseGuess_le _ i).trans (by omega) | |
| obtain β¨hden, hbound, hBbits, hqbits, hLbits, hNbits, _hDβ© := | |
| hbits B d (coarseEntryWidth x y) k hBdef hddef hsize hk | |
| have hcap : coarseEntryWidth x y β€ B ^ d := by | |
| rw [hBdef, hddef] | |
| exact (computed_coarse_depth N _ (by omega) hsize hell).1 | |
| have htree : 0 + (coarseEntryTree B d x y).length β€ N := by | |
| rw [coarseEntryTree_word B d x y hcap, coarsePadTo_length _ _ (le_max_left _ _)] | |
| simpa only [Nat.zero_add] using hsize | |
| exact coarseRootArrayHistory_bound k (H ^ 4) (64 * H) N (10 * H ^ 2) (H ^ 3) | |
| hB hq hL _ _ draws 0 hBbits hqbits hLbits hNbits hden hbound htree | |
| theorem computedCoarseRootHistory_polynomial (N B d k n : β) | |
| (hN : 0 < N) (hell : 200 β€ inputSmallLog N) | |
| (hBdef : B = (integerParameters N).B) (hddef : d = computedCoarseDepth N n) | |
| (hn : n β€ N) (hk : k β€ 2 * (N + 2)) : | |
| (32 * (inputHeight N ^ 3 + 1)) * | |
| ((B * (2 * k + 1) + 1) * coarseCompleteNodes B d) β€ (N + 2) ^ 32 := by | |
| let X := N + 2 | |
| have hX : 2 β€ X := by dsimp only [X]; omega | |
| have hH := Nat.pow_le_pow_left (computed_height_polynomial N) 3 | |
| rw [β pow_mul] at hH | |
| change inputHeight N ^ 3 β€ X ^ 12 at hH | |
| have hone : 1 β€ X ^ 12 := one_le_powβ (by omega) | |
| have hc : 64 β€ X ^ 6 := (by decide : 64 β€ (2 : β) ^ 6).trans (Nat.pow_le_pow_left hX 6) | |
| have hu : 32 * (inputHeight N ^ 3 + 1) β€ X ^ 18 := by | |
| calc | |
| _ β€ 64 * X ^ 12 := by omega | |
| _ β€ X ^ 6 * X ^ 12 := Nat.mul_le_mul_right _ hc | |
| _ = _ := by rw [β pow_add] | |
| have hB : 2 β€ B := by | |
| have h := computed_coarse_branching N hN hell | |
| omega | |
| have hBP : B β€ (N + 2) ^ 4 := by | |
| rw [hBdef] | |
| exact computedCoarseBranching_polynomial N hN hell | |
| have hd : d = intervalTreeDepth B n := by | |
| simp only [hddef, computedCoarseDepth, intervalTreeDepth, hBdef] | |
| have hnodes := coarseCompleteNodes_polynomial N B n hB hn hBP | |
| rw [β hd] at hnodes | |
| have hw := coarseRootWidth_polynomial N B k hBP hk | |
| calc | |
| _ β€ X ^ 18 * (X ^ 8 * X ^ 6) := Nat.mul_le_mul hu (Nat.mul_le_mul hw hnodes) | |
| _ = _ := by ring | |
| /-- Total stored bits of all recursive array results from all guesses. | |
| This bound holds for every draw, without a successful-approximation premise. -/ | |
| theorem computedCoarseAllHistories_polynomial : | |
| βαΆ N : β in atTop, β B d : β, β x y : List β, | |
| B = (integerParameters N).B β d = computedCoarseDepth N (coarseEntryWidth x y) β | |
| coarseEntryWidth x y β€ N β | |
| β (hB : 0 < B) (hq : 0 < inputHeight N ^ 4) (hL : 0 < 64 * inputHeight N) | |
| (draws : CoarseGuessIndex (coarseEntryWidth x y) β CoarseThresholdDraws B d), | |
| (β i : CoarseGuessIndex (coarseEntryWidth x y), | |
| coarseRootArrayHistory (coarseGuess (coarseEntryWidth x y) i) | |
| (inputHeight N ^ 4) (64 * inputHeight N) hB hq hL | |
| (coarseTargetFrame (coarseGuess (coarseEntryWidth x y) i) | |
| (coarsePadTo (coarseEntryWidth x y) y)) (coarseEntryTree B d x y) (draws i) 0) β€ | |
| (N + 2) ^ 37 := by | |
| filter_upwards [computedCoarseRootHistory_bound, eventually_ge_atTop 1, | |
| inputSmallLog_tendsto.eventually (eventually_ge_atTop 200)] with N hroot hN hell | |
| intro B d x y hBdef hddef hsize hB hq hL draws | |
| have hclog : Nat.clog 2 (coarseEntryWidth x y) β€ inputHeight N := | |
| (Nat.clog_le_iff_le_pow (by decide : 1 < (2 : β))).mpr | |
| (hsize.trans ((Nat.le_add_right N 2).trans (inputHeight_covers_length N))) | |
| have hcount : Nat.clog 2 (coarseEntryWidth x y) + 1 β€ (N + 2) ^ 5 := by | |
| have hh := computed_height_polynomial N | |
| have hp : 1 β€ (N + 2) ^ 4 := one_le_powβ (by omega) | |
| have hm := Nat.mul_le_mul_right ((N + 2) ^ 4) (show 2 β€ N + 2 by omega) | |
| nlinarith only [hclog, hh, hp, hm] | |
| calc | |
| _ β€ β _i : CoarseGuessIndex (coarseEntryWidth x y), (N + 2) ^ 32 := by | |
| apply Finset.sum_le_sum | |
| intro i _ | |
| exact (hroot B d x y hBdef hddef hsize hB hq hL i (draws i)).trans | |
| (computedCoarseRootHistory_polynomial N B d _ (coarseEntryWidth x y) | |
| (by omega) hell hBdef hddef hsize ((coarseGuess_le _ i).trans (by omega))) | |
| _ = (Nat.clog 2 (coarseEntryWidth x y) + 1) * (N + 2) ^ 32 := by | |
| simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul] | |
| _ β€ (N + 2) ^ 5 * (N + 2) ^ 32 := Nat.mul_le_mul_right _ hcount | |
| _ = _ := by rw [β pow_add] | |
| end BinaryFraction | |
| end EditApproximation | |
| end OAI | |