Download data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/ParentLiveBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.55 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/ParentLiveBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/ParentLiveBounds.lean
-
curl -L -o ParentLiveBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/ParentLiveBounds.lean
3.55 kB
| import OAI.Combinatorics.LowSpaceSubsetSum.Counting.ParentLiveState | |
| namespace OAI | |
| /-! # Uniform payload bounds for all concrete parent states | |
| The estimates use the stored type invariants, so an interrupted join and an | |
| already overflowing dictionary satisfy the same bounds as a completed run. | |
| Shared input arrays are counted once outside the mutable state. | |
| -/ | |
| namespace LowSpaceSubsetSum.ParentLiveBounds | |
| variable {n : β} | |
| theorem reader_le (I : Instance n) (F : IndexedMask n) (P : β€) (mode : FilteredStream.Mode) | |
| (right : Array (LeafRecord n)) {d : β} (s : CountedParentJoin.State I F P mode right d) | |
| (C : β) (ht : 2 ^ (d + 1) β€ 4 * (C + 1)) : | |
| ParentLiveState.reader s β€ 176 * inputScale I * (C + 1) := by | |
| have hu : n + 1 β€ inputScale I := by unfold inputScale; omega | |
| have hc : 12 * n + 32 β€ 44 * inputScale I := by omega | |
| have hm := Nat.mul_le_mul hc ht | |
| rw [ParentLiveState.reader_exact] | |
| nlinarith only [hm] | |
| theorem frame_le (I : Instance n) (F : IndexedMask n) (P t : β€) (C : β) | |
| (rightβ rightβ : Array (LeafRecord n)) {dβ dβ : β} | |
| (st : StreamJoin.State (CountedParentJoin.State I F P .direct rightβ dβ) | |
| (CountedParentJoin.State I F P (.complementary t) rightβ dβ) (StoredEntry.Dictionary I C)) | |
| (hβ : 2 ^ (dβ + 1) β€ 4 * (C + 1)) (hβ : 2 ^ (dβ + 1) β€ 4 * (C + 1)) : | |
| ParentLiveState.frame st β€ 400 * inputScale I * (C + 1) := by | |
| have hl := reader_le I F P .direct rightβ st.left C hβ | |
| have hr := reader_le I F P (.complementary t) rightβ st.right C hβ | |
| have hd := ParentLiveState.dictionary_scale I C st.user | |
| have hu : 1 β€ inputScale I := by unfold inputScale; omega | |
| have hm : inputScale I β€ inputScale I * (C + 1) := by nlinarith only [hu] | |
| unfold ParentLiveState.frame | |
| nlinarith only [hl, hr, hd, hu, hm] | |
| theorem shared_le (I : Instance n) (C : β) (left right : Array (LeafRecord n)) | |
| (hl : left.size β€ C) (hr : right.size β€ C) : | |
| ParentLiveState.sharedArrays left right β€ 8 * inputScale I * (C + 1) := by | |
| have h := ParentLiveState.sharedArrays_le left right C hl hr | |
| have hu : n + 1 β€ inputScale I := by unfold inputScale; omega | |
| have hc : 3 * n + 4 β€ 4 * inputScale I := by omega | |
| have hm := Nat.mul_le_mul hc (by omega : 2 * C + 1 β€ 2 * (C + 1)) | |
| exact h.trans (by nlinarith only [hm]) | |
| theorem all_inputs_and_state (I : Instance n) (F : IndexedMask n) (P t : β€) (C : β) | |
| (leftβ rightβ leftβ rightβ : Array (LeafRecord n)) {dβ dβ : β} | |
| (st : StreamJoin.State (CountedParentJoin.State I F P .direct rightβ dβ) | |
| (CountedParentJoin.State I F P (.complementary t) rightβ dβ) (StoredEntry.Dictionary I C)) | |
| (hβ : 2 ^ (dβ + 1) β€ 4 * (C + 1)) (hβ : 2 ^ (dβ + 1) β€ 4 * (C + 1)) | |
| (hlβ : leftβ.size β€ C) (hrβ : rightβ.size β€ C) (hlβ : leftβ.size β€ C) (hrβ : rightβ.size β€ C) | |
| (hn : 10000 β€ n) : | |
| ParentLiveState.frame st + ParentLiveState.sharedArrays leftβ rightβ + | |
| ParentLiveState.sharedArrays leftβ rightβ β€ inputScale I ^ 2 * (C + 1) := by | |
| have hs := frame_le I F P t C rightβ rightβ st hβ hβ | |
| have ha := shared_le I C leftβ rightβ hlβ hrβ | |
| have hb := shared_le I C leftβ rightβ hlβ hrβ | |
| have hu : n + 1 β€ inputScale I := by unfold inputScale; omega | |
| have hc : 416 * inputScale I β€ inputScale I ^ 2 := by nlinarith only [hu, hn] | |
| have hm := Nat.mul_le_mul_right (C + 1) hc | |
| nlinarith only [hs, ha, hb, hm] | |
| end LowSpaceSubsetSum.ParentLiveBounds | |
| end OAI | |