Download data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryContinuationWork.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.91 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryContinuationWork.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryContinuationWork.lean
-
curl -L -o BinaryContinuationWork.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryContinuationWork.lean
4.91 kB
| import OAI.Combinatorics.EditApproximation.Binary.BinaryBellmanKernel | |
| namespace OAI | |
| /-! Bit costs for the full numerical tail after its finite candidate lists | |
| have been prepared. Both Bellman minima, the online score minimum, and the | |
| final clipped decrement are executed by the counter being bounded. -/ | |
| namespace EditApproximation | |
| namespace BinaryFraction | |
| def localContinuationInputBudget (M B : β) : β := | |
| B + 2 * bellmanActionWordBudget M B + 1 | |
| def localContinuationWordBudget (M B : β) : β := | |
| refinementUpdateWordBudget (localContinuationInputBudget M B) | |
| def localContinuationBitBudget (M nw ng no B C : β) : β := | |
| bellmanBitBudget M nw B B C + | |
| bellmanBitBudget M ng B (B + bellmanActionWordBudget M B) C + | |
| no * (bellmanActionBitBudget M B C + 3) + | |
| (2 + no * (1000 * (bellmanActionWordBudget M B + 1) ^ 2 + 2)) + | |
| refinementUpdateBitBudget (localContinuationInputBudget M B) + 3 | |
| theorem localContinuationWithWork_bounds {Parent Child : Type*} {M : β} | |
| (distance : Parent β Parent β BinaryFraction Γ β) (L delta fallback : BinaryFraction) | |
| (old current : Child β BinaryFraction) (query : Parent) | |
| (wide groups online : List (BinaryBellmanAction Parent Child M)) (B C : β) | |
| (hL : L.width β€ B) (hdelta : delta.width β€ B) (hf : fallback.width β€ B) | |
| (hd : β action β wide ++ groups ++ online, (distance query action.center).1.width β€ B) | |
| (hdc : β action β wide ++ groups ++ online, (distance query action.center).2 β€ C) | |
| (hc : β action β wide ++ groups ++ online, action.connection.width β€ B) | |
| (ho : β action β wide, β i, (old (action.childState i)).width β€ B) | |
| (hn : β action β groups ++ online, β i, (current (action.childState i)).width β€ B) : | |
| (localContinuationWithWork distance L delta fallback old current query wide groups online).1.width β€ | |
| localContinuationWordBudget M B β§ | |
| (localContinuationWithWork distance L delta fallback old current query wide groups online).2 β€ | |
| localContinuationBitBudget M wide.length groups.length online.length B C := by | |
| let warm := bellmanWithWork distance L fallback old query wide | |
| let cone := bellmanWithWork distance L warm.1 current query groups | |
| let scores := arithmeticMapWithWork (bellmanActionWithWork distance L current query) online | |
| let onlineMin := onlineMinimumWithWork scores.1 | |
| have hw := bellmanWithWork_bounds distance L fallback old query wide B B C hL hf | |
| (fun a ha => hd a (by simp [ha])) | |
| (fun a ha => hdc a (by simp [ha])) | |
| (fun a ha => hc a (by simp [ha])) ho | |
| have hg := bellmanWithWork_bounds distance L warm.1 current query groups B | |
| (B + bellmanActionWordBudget M B) C hL hw.1 | |
| (fun a ha => hd a (by simp [ha])) | |
| (fun a ha => hdc a (by simp [ha])) | |
| (fun a ha => hc a (by simp [ha])) | |
| (fun a ha => hn a (List.mem_append_left online ha)) | |
| have hs (a : BinaryBellmanAction Parent Child M) (ha : a β online) := | |
| bellmanActionWithWork_bounds distance L current query a B C hL | |
| (hd a (by simp [ha])) (hdc a (by simp [ha])) | |
| (hc a (by simp [ha])) (hn a (List.mem_append_right groups ha)) | |
| have hsw : β value β scores.1, value.width β€ bellmanActionWordBudget M B := by | |
| intro value hvalue | |
| simp only [scores, arithmeticMapWithWork_value] at hvalue | |
| obtain β¨a, ha, rflβ© := List.mem_map.mp hvalue | |
| exact (hs a ha).1 | |
| have hsc := arithmeticMapWithWork_cost (bellmanActionWithWork distance L current query) online | |
| (bellmanActionBitBudget M B C) (fun a ha => (hs a ha).2) | |
| have hom := onlineMinimumWithWork_bounds scores.1 (bellmanActionWordBudget M B) hsw | |
| have hlen : scores.1.length = online.length := by | |
| simp only [scores, arithmeticMapWithWork_value, List.length_map] | |
| rw [hlen] at hom | |
| have hinput : 1 β€ localContinuationInputBudget M B := by | |
| unfold localContinuationInputBudget | |
| omega | |
| have hdelta' : delta.width β€ localContinuationInputBudget M B := hdelta.trans (by | |
| unfold localContinuationInputBudget; omega) | |
| have hcone : cone.1.width β€ localContinuationInputBudget M B := hg.1.trans (by | |
| unfold localContinuationInputBudget; omega) | |
| have honline : β value β onlineMin.1, value.width β€ localContinuationInputBudget M B := by | |
| intro value hv | |
| exact (hom.1 value hv).trans (by unfold localContinuationInputBudget; omega) | |
| have hresult := refinementUpdateWithWork_bounds delta cone.1 onlineMin.1 | |
| (localContinuationInputBudget M B) hinput hdelta' hcone honline | |
| refine β¨hresult.1, ?_β© | |
| change warm.2 + cone.2 + scores.2 + onlineMin.2 + | |
| (refinementUpdateWithWork delta cone.1 onlineMin.1).2 + 3 β€ _ | |
| have hwc := hw.2 | |
| have hgc := hg.2 | |
| change warm.2 β€ _ at hwc | |
| change cone.2 β€ _ at hgc | |
| change scores.2 β€ _ at hsc | |
| have homc := hom.2 | |
| change onlineMin.2 β€ _ at homc | |
| unfold localContinuationBitBudget | |
| omega | |
| end BinaryFraction | |
| end EditApproximation | |
| end OAI | |