@[reducible, inline]
Average of two natural numbers rounded toward zero.
Equations
- a.avg b = (a + b) / 2
Instances For
@[irreducible]
def
Nat.bisect
{start stop : Nat}
{p : Nat → Bool}
(h : start < stop)
(hstart : p start = true)
(hstop : p stop = false)
:
Nat
Given natural numbers a < b such that p a = true and p b = false, bisect finds a natural
number a ≤ c < b such that p c = true and p (c+1) = false.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[irreducible]
theorem
Nat.bisect_lt_stop
{start stop : Nat}
{p : Nat → Bool}
(h : start < stop)
(hstart : p start = true)
(hstop : p stop = false)
:
bisect h hstart hstop < stop
@[irreducible]
theorem
Nat.start_le_bisect
{start stop : Nat}
{p : Nat → Bool}
(h : start < stop)
(hstart : p start = true)
(hstop : p stop = false)
:
start ≤ bisect h hstart hstop
@[irreducible]
theorem
Nat.bisect_true
{start stop : Nat}
{p : Nat → Bool}
(h : start < stop)
(hstart : p start = true)
(hstop : p stop = false)
:
p (bisect h hstart hstop) = true
@[irreducible]
theorem
Nat.bisect_add_one_false
{start stop : Nat}
{p : Nat → Bool}
(h : start < stop)
(hstart : p start = true)
(hstop : p stop = false)
:
p (bisect h hstart hstop + 1) = false