Download data/lean/OAI/Combinatorics/EditApproximation/Coarse/CoarseEntryCostSum.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.78 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Coarse/CoarseEntryCostSum.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Coarse/CoarseEntryCostSum.lean
-
curl -L -o CoarseEntryCostSum.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Coarse/CoarseEntryCostSum.lean
3.78 kB
| import OAI.Combinatorics.EditApproximation.Refinement.ComputedCoarseInitialWork | |
| import OAI.Combinatorics.EditApproximation.Refinement.PhysicalCoarseSeedLaw | |
| import OAI.Combinatorics.EditApproximation.Probability.FreshCoordinateCost | |
| namespace OAI | |
| namespace EditApproximation | |
| /-- Keep the branch dimensions symbolic when forming the finite source sum. -/ | |
| def coarseEntryBinaryCost (N B d : β) [NeZero B] (x y : List β) | |
| (draws : CoarseGuessIndex (coarseEntryWidth x y) β CoarseThresholdDraws B d) : β := | |
| (BinaryFraction.coarseInitialWithWork (inputHeight N ^ 4) (64 * inputHeight N) N | |
| (Nat.pos_of_neZero B) (pow_pos (Nat.two_pow_pos _) _) | |
| (Nat.mul_pos (by decide) (Nat.two_pow_pos _)) x y draws).2 | |
| theorem coarseEntryBinaryCost_computed_bound : | |
| βαΆ N : β in Filter.atTop, β B d : β, β x y : List β, | |
| B = (integerParameters N).B β d = computedCoarseDepth N (coarseEntryWidth x y) β | |
| coarseEntryWidth x y β€ N β (β a β x ++ y, Nat.size a β€ inputHeight N ^ 3) β | |
| β (_hB : NeZero B) (draw : CoarseGuessIndex (coarseEntryWidth x y) β CoarseThresholdDraws B d), | |
| (coarseEntryBinaryCost N B d x y draw : β) β€ (inputHeight N : β) ^ 36 * | |
| ((coarseInitialArrayWork B d (initialThresholdQ N) (initialLambda N) x y draw : β) + | |
| (x.length + 1 : β)) := by | |
| filter_upwards [BinaryFraction.computedCoarseInitialWithWork_bound] with N hN | |
| intro B d x y hB hd hxy hsymbols hinstance draw | |
| have hb := hN B d x y hB hd hxy hsymbols | |
| (Nat.pos_of_neZero _) (pow_pos (Nat.two_pow_pos _) _) | |
| (Nat.mul_pos (by decide) (Nat.two_pow_pos _)) draw | |
| exact_mod_cast hb | |
| noncomputable def coarseEntryCostSum {M J B : β} [NeZero B] (source target : List β) | |
| (N : β) (depth : PhysicalEntry M J target.length β β) | |
| (draw : PhysicalCoarseDraw source target B depth) | |
| (selected : PhysicalEntry M J target.length β Prop) : β := by | |
| classical | |
| exact β entry : PhysicalEntry M J target.length, selectionIndicator (selected entry) * | |
| (coarseEntryBinaryCost N B (depth entry) (physicalSource source entry.1) | |
| (substring target entry.2.lo entry.2.hi) (draw entry) : β) | |
| theorem coarseEntryCostSum_bound {M J B : β} [NeZero B] (source target : List β) | |
| (N : β) (depth : PhysicalEntry M J target.length β β) | |
| (draw : PhysicalCoarseDraw source target B depth) | |
| (selected : PhysicalEntry M J target.length β Prop) (C : β) | |
| (hc : β entry : PhysicalEntry M J target.length, | |
| (coarseEntryBinaryCost N B (depth entry) (physicalSource source entry.1) | |
| (substring target entry.2.lo entry.2.hi) (draw entry) : β) β€ | |
| C * ((coarseInitialArrayWork B (depth entry) (initialThresholdQ N) (initialLambda N) | |
| (physicalSource source entry.1) (substring target entry.2.lo entry.2.hi) (draw entry) : β) + | |
| ((physicalSource source entry.1).length + 1 : β))) : | |
| coarseEntryCostSum source target N depth draw selected β€ C * | |
| ((β entry : PhysicalEntry M J target.length, selectionIndicator (selected entry) * | |
| (coarseInitialArrayWork B (depth entry) (initialThresholdQ N) (initialLambda N) | |
| (physicalSource source entry.1) (substring target entry.2.lo entry.2.hi) (draw entry) : β)) + | |
| β entry : PhysicalEntry M J target.length, selectionIndicator (selected entry) * | |
| ((physicalSource source entry.1).length + 1 : β)) := by | |
| classical | |
| rw [β Finset.sum_add_distrib, Finset.mul_sum] | |
| unfold coarseEntryCostSum | |
| apply Finset.sum_le_sum | |
| intro entry _ | |
| have hs : 0 β€ selectionIndicator (selected entry) := by | |
| unfold selectionIndicator | |
| split <;> norm_num | |
| exact (mul_le_mul_of_nonneg_left (hc entry) hs).trans_eq (by ring) | |
| end EditApproximation | |
| end OAI | |