Download data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryBandStorage.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.12 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryBandStorage.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryBandStorage.lean
-
curl -L -o BinaryBandStorage.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Binary/BinaryBandStorage.lean
5.12 kB
| import OAI.Combinatorics.EditApproximation.Binary.BinaryOptimizerSpace | |
| import OAI.Combinatorics.EditApproximation.Binary.BinaryReductionSpace | |
| import OAI.Combinatorics.EditApproximation.Binary.BinaryBandInputs | |
| namespace OAI | |
| namespace EditApproximation.BinaryFraction | |
| def bandCoordinateAllocation {M : β} {Ο : Type*} [DecidableEq Ο] | |
| (mass : Vector BinaryFraction M) (total : BinaryFraction) | |
| (action : Fin M β Ο) (coordinate : Fin M Γ Ο) : β := | |
| if coordinate.2 = action coordinate.1 then divAllocation (mass.get coordinate.1) total else 0 | |
| def bandCoordinateInvocations {M : β} {Ο : Type*} [DecidableEq Ο] | |
| (mass : Vector BinaryFraction M) (total : BinaryFraction) | |
| (action : Fin M β Ο) (coordinate : Fin M Γ Ο) : β := | |
| if coordinate.2 = action coordinate.1 then divInvocations (mass.get coordinate.1) total else 1 | |
| theorem bandCoordinateAllocation_le_work {M : β} {Ο : Type*} [DecidableEq Ο] | |
| (mass : Vector BinaryFraction M) (total : BinaryFraction) | |
| (action : Fin M β Ο) (coordinate : Fin M Γ Ο) : | |
| bandCoordinateAllocation mass total action coordinate β€ (bandCoordinateWithWork mass total action coordinate).2 := by | |
| unfold bandCoordinateAllocation bandCoordinateWithWork | |
| split_ifs | |
| Β· exact divAllocation_le_work _ _ | |
| Β· exact Nat.zero_le _ | |
| theorem bandCoordinateInvocations_le_work {M : β} {Ο : Type*} [DecidableEq Ο] | |
| (mass : Vector BinaryFraction M) (total : BinaryFraction) | |
| (action : Fin M β Ο) (coordinate : Fin M Γ Ο) : | |
| bandCoordinateInvocations mass total action coordinate β€ (bandCoordinateWithWork mass total action coordinate).2 := by | |
| unfold bandCoordinateInvocations bandCoordinateWithWork | |
| split_ifs | |
| Β· exact divInvocations_le_work _ _ | |
| Β· exact le_refl _ | |
| def bandVerticesAllocation {M d : β} {Ο : Type*} [DecidableEq Ο] | |
| (coordinates : Vector (Fin M Γ Ο) d) (mass : Vector BinaryFraction M) | |
| (band : List (Fin M β Ο)) : β := | |
| bandMassAllocation mass + | |
| (band.map fun action => vectorMapAllocation d fun i => | |
| bandCoordinateAllocation mass (bandMassTotalWithWork mass).1 action (coordinates.get i)).sum + | |
| 3 * band.length | |
| def bandVerticesInvocations {M d : β} {Ο : Type*} [DecidableEq Ο] | |
| (coordinates : Vector (Fin M Γ Ο) d) (mass : Vector BinaryFraction M) | |
| (band : List (Fin M β Ο)) : β := | |
| bandMassInvocations mass + | |
| (band.map fun action => vectorMapInvocations d fun i => | |
| bandCoordinateInvocations mass (bandMassTotalWithWork mass).1 action (coordinates.get i)).sum + | |
| 3 * band.length + 1 | |
| theorem bandVerticesAllocation_le_work {M d : β} {Ο : Type*} [DecidableEq Ο] | |
| (coordinates : Vector (Fin M Γ Ο) d) (mass : Vector BinaryFraction M) | |
| (band : List (Fin M β Ο)) : | |
| bandVerticesAllocation coordinates mass band β€ (bandVerticesWithWork coordinates mass band).2 := by | |
| have hm := bandMassAllocation_le_work mass | |
| have hs : (band.map fun action => vectorMapAllocation d fun i => | |
| bandCoordinateAllocation mass (bandMassTotalWithWork mass).1 action (coordinates.get i)).sum β€ | |
| (band.map fun action => (vectorMapWithWork d fun i => | |
| bandCoordinateWithWork mass (bandMassTotalWithWork mass).1 action (coordinates.get i)).2).sum := by | |
| induction band with | |
| | nil => simp | |
| | cons a rest ih => | |
| have h := vectorMapAllocation_le_work d | |
| (fun i => bandCoordinateWithWork mass (bandMassTotalWithWork mass).1 a (coordinates.get i)) | |
| (fun i => bandCoordinateAllocation mass (bandMassTotalWithWork mass).1 a (coordinates.get i)) | |
| (fun i => bandCoordinateAllocation_le_work _ _ _ _) | |
| simp only [List.map_cons, List.sum_cons] | |
| omega | |
| unfold bandVerticesAllocation bandVerticesWithWork | |
| simp only [List.map_map, Function.comp_def] | |
| omega | |
| theorem bandVerticesInvocations_le_work_add_one {M d : β} {Ο : Type*} [DecidableEq Ο] | |
| (coordinates : Vector (Fin M Γ Ο) d) (mass : Vector BinaryFraction M) | |
| (band : List (Fin M β Ο)) : | |
| bandVerticesInvocations coordinates mass band β€ (bandVerticesWithWork coordinates mass band).2 + 1 := by | |
| have hm := bandMassInvocations_le_work mass | |
| have hs : (band.map fun action => vectorMapInvocations d fun i => | |
| bandCoordinateInvocations mass (bandMassTotalWithWork mass).1 action (coordinates.get i)).sum β€ | |
| (band.map fun action => (vectorMapWithWork d fun i => | |
| bandCoordinateWithWork mass (bandMassTotalWithWork mass).1 action (coordinates.get i)).2).sum + band.length := by | |
| induction band with | |
| | nil => simp | |
| | cons a rest ih => | |
| have h := vectorMapInvocations_le_work_add_one d | |
| (fun i => bandCoordinateWithWork mass (bandMassTotalWithWork mass).1 a (coordinates.get i)) | |
| (fun i => bandCoordinateInvocations mass (bandMassTotalWithWork mass).1 a (coordinates.get i)) | |
| (fun i => bandCoordinateInvocations_le_work _ _ _ _) | |
| simp only [List.map_cons, List.sum_cons, List.length_cons] | |
| omega | |
| unfold bandVerticesInvocations bandVerticesWithWork | |
| simp only [List.map_map, Function.comp_def] | |
| omega | |
| end EditApproximation.BinaryFraction | |
| end OAI | |