Basic lemmas about natural numbers #
The primary purpose of the lemmas in this file is to assist with reasoning about sizes of objects, array indices and such.
This file was upstreamed from Std, and later these lemmas should be organised into other files more systematically.
le/lt #
@[inline, reducible]
Equations
@[inline, reducible]
Equations
@[inline, reducible]
@[inline, reducible]
Equations
@[inline, reducible]
Equations
@[inline, reducible]
Equations
zero/one/two #
succ/pred #
add #
sub #
@[inline, reducible]
Equations
min/max #
mul #
div/mod #
pow #
@[inline, reducible]
@[inline, reducible]
log2 #
dvd #
shiftLeft and shiftRight #
Decidability of predicates #
Equations
- Nat.decidableForallFin P = decidable_of_iff (∀ (k : Nat) (h : k < n), P { val := k, isLt := h }) ⋯
instance
Nat.decidableExistsLT
{p : Nat → Prop}
[h : DecidablePred p]
:
DecidablePred fun (n : Nat) => ∃ (m : Nat), m < n ∧ p m
Equations
instance
Nat.decidableExistsLE
{p : Nat → Prop}
[DecidablePred p]
:
DecidablePred fun (n : Nat) => ∃ (m : Nat), m ≤ n ∧ p m
Equations
- Nat.decidableExistsLE n = decidable_of_iff (∃ (m : Nat), m < n + 1 ∧ p m) ⋯