Commit ab4fbd2
[ add ] inequalities for
* [ add ] inequalities for `2 ^ log₂ n`
This adds the inequalities `2 ^ ⌊log₂ n ⌋ ≤ n` for non-zero `n` and
`n ≤ 2 ^ ⌈log₂ n ⌉` for all natural numbers `n`. Similar to the existing
properties of the logarithm, the main proofs
that keep track of the accumulators are added to
`Data.Nat.Logarithm.Core`. Both use a lemma that `2 * (ℕ.suc n) ≡ 2 + (n + n)`
which is added to `Data.Nat.Logarithm.Core` as well.
The respective simplified versions on `⌊log₂_⌋` and `⌈log₂_⌉` are added
directly to `Data.Nat.Logarithm`.
* move 2*suc[n]≡2+n+n to Data.Nat.Properties
* ℕ.suc -> suc
* Further ℕ.suc -> suc
* replace 1 + with suc
* Switch to equational reasoning
* Update Changelog
* RM unused 'trans'
* Use NonZero instance
* Update Changelog
* Update src/Data/Nat/Logarithm.agda
Co-authored-by: jamesmckinna <31931406+jamesmckinna@users.noreply.github.com>
* Update CHANGELOG.md
Co-authored-by: jamesmckinna <31931406+jamesmckinna@users.noreply.github.com>
---------
Co-authored-by: jamesmckinna <31931406+jamesmckinna@users.noreply.github.com>2 ^ log₂ n (#2925)1 parent dbdebad commit ab4fbd2
File tree
4 files changed
+51
-0
lines changed- src/Data/Nat
- Logarithm
4 files changed
+51
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
239 | 251 | | |
240 | 252 | | |
241 | 253 | | |
| |||
248 | 260 | | |
249 | 261 | | |
250 | 262 | | |
| 263 | + | |
251 | 264 | | |
252 | 265 | | |
253 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
| |||
124 | 136 | | |
125 | 137 | | |
126 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
777 | 783 | | |
778 | 784 | | |
779 | 785 | | |
| |||
0 commit comments