Polynomial-time numbers and tests — division, powers and logarithms #
The arithmetic behind the division, power and logarithm rules of
Complexitylib.Classes.P.Unary. Each of those functions is computed as a count
of the indices below a bound at which a comparison holds, or, for a capped
power, as a loop; the identities here say that the count or the loop gives the
intended value.
Contents #
card_filter_range_of_iff— a count of the indices below a markdiv_eq_card_filter_range— division as a countmin_mul_iterate— capped multiplication, iterated, is a capped powersize_eq_card_filter_range,clog_eq_card_filter_range,log_eq_card_filter_range— binary length and logarithms as counts
theorem
Complexity.card_filter_range_of_iff
{n m : ℕ}
(hm : m ≤ n)
(p : ℕ → Prop)
[DecidablePred p]
(h : ∀ i < n, p i ↔ i < m)
:
If a test holds at exactly the indices below m ≤ n, then m of the indices
below n pass it.