Download data/lean/OAI/Algorithms/SubexponentialSAT/CounterWidth.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/CounterWidth.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/CounterWidth.lean
-
curl -L -o CounterWidth.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/CounterWidth.lean
1.3 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.CounterPrograms | |
| namespace OAI.Algorithms | |
| /-! | |
| # Width preservation below a binary overflow boundary | |
| The input word may contain high zero bits. This lemma applies to actual ripple | |
| increment results and does not assume a canonical binary representation. | |
| -/ | |
| namespace SubexponentialSAT.CounterPrograms | |
| /-- Increment stays within an n-bit word when its new value is below 2^n. -/ | |
| theorem increment_length_le_of_lt (bs : List Bool) (n : ℕ) | |
| (hlen : bs.length ≤ n) (hvalue : value bs + 1 < 2 ^ n) : | |
| (ripple true bs).length ≤ n := by | |
| induction n generalizing bs with | |
| | zero => | |
| have he : bs = [] := List.length_eq_zero_iff.mp (by omega) | |
| subst bs | |
| simp at hvalue | |
| | succ n ih => | |
| cases bs with | |
| | nil => simp [ripple] | |
| | cons bit bs => | |
| cases bit with | |
| | false => simpa [ripple] using hlen | |
| | true => | |
| have hl : bs.length ≤ n := by simpa using hlen | |
| have hv : value bs + 1 < 2 ^ n := by | |
| simp only [value, Bool.toNat_true, pow_succ] at hvalue | |
| omega | |
| simpa [ripple] using Nat.succ_le_succ (ih bs hl hv) | |
| end SubexponentialSAT.CounterPrograms | |
| end OAI.Algorithms | |