Download data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/CountedReplayPotential.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.51 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/CountedReplayPotential.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/CountedReplayPotential.lean
-
curl -L -o CountedReplayPotential.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/LowSpaceSubsetSum/Counting/CountedReplayPotential.lean
2.51 kB
| import OAI.Combinatorics.LowSpaceSubsetSum.Counting.CountedReplay | |
| namespace OAI | |
| /-! # Telescoping callback costs through a stopped replay | |
| The callback may itself contain a replay. A potential on its returned state | |
| charges that actual inner work; a uniform worst-case inner fuel bound is not | |
| multiplied by the outer stream length. | |
| -/ | |
| namespace LowSpaceSubsetSum.CountedReplay | |
| universe u v w | |
| variable {Ξ± : Type u} {Ο : Type v} {Ο : Type w} | |
| theorem runAcc_work_potential | |
| (read : Ο β Option (Ξ± Γ Ο) Γ β) (key : Ξ± β β€ Γ β) (K : β€) | |
| (report : Ξ± β Ο β (Ο Γ Bool) Γ β) (potential : Ο β β) (R L C : β) | |
| (hr : β s, (read s).2 β€ R) (hk : β x, (key x).2 β€ L) | |
| (hc : β x a, (report x a).2 + potential a β€ potential (report x a).1.1 + C) | |
| (fuel : β) (s : Ο) (a : Ο) (q r : β) : | |
| (runAcc read key K report fuel s a q r).2 + (R + L + C + 8) * q + potential a β€ | |
| (R + L + C + 8) * (runAcc read key K report fuel s a q r).1.queries + | |
| potential (runAcc read key K report fuel s a q r).1.state + 1 := by | |
| induction fuel generalizing s a q r with | |
| | zero => simp only [runAcc]; omega | |
| | succ fuel ih => | |
| have hread := hr s | |
| cases hv : (read s).1 with | |
| | none => simp only [runAcc, hv, Nat.mul_add, Nat.mul_one]; omega | |
| | some z => | |
| rcases z with β¨x, s'β© | |
| have hkey := hk x | |
| simp only [runAcc, hv] | |
| split | |
| Β· have hcallback := hc x a | |
| split | |
| Β· simp only [Nat.mul_add, Nat.mul_one]; omega | |
| Β· have hrest := ih s' (report x a).1.1 (q + 1) (r + 1) | |
| simp only [Nat.mul_add, Nat.mul_one] at hrest | |
| dsimp only | |
| omega | |
| Β· simp only [Nat.mul_add, Nat.mul_one]; omega | |
| theorem run_work_potential | |
| (read : Ο β Option (Ξ± Γ Ο) Γ β) (key : Ξ± β β€ Γ β) (K : β€) | |
| (report : Ξ± β Ο β (Ο Γ Bool) Γ β) (potential : Ο β β) (R L C : β) | |
| (hr : β s, (read s).2 β€ R) (hk : β x, (key x).2 β€ L) | |
| (hc : β x a, (report x a).2 + potential a β€ potential (report x a).1.1 + C) | |
| (fuel : β) (s : Ο) (a : Ο) : | |
| (run read key K report fuel s a).2 + potential a β€ | |
| (R + L + C + 8) * (run read key K report fuel s a).1.queries + | |
| potential (run read key K report fuel s a).1.state + 1 := by | |
| simpa only [run, Nat.mul_zero, Nat.add_zero, Nat.zero_add] using | |
| runAcc_work_potential read key K report potential R L C hr hk hc fuel s a 0 0 | |
| end LowSpaceSubsetSum.CountedReplay | |
| end OAI | |