The natural numbers as a linearly ordered commutative semiring #
We also have a variety of lemmas which have been deferred from Data.Nat.Basic
because it is
easier to prove them with this ordered semiring instance available.
TODO #
Move most of the theorems to Data.Nat.Defs
by modifying their proofs.
instances #
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Extra instances to short-circuit type class resolution and ensure computability
Equations
- Nat.linearOrderedSemiring = inferInstance
Equations
- Nat.strictOrderedSemiring = inferInstance
Equations
- Nat.strictOrderedCommSemiring = inferInstance
Equations
- Nat.orderedSemiring = StrictOrderedSemiring.toOrderedSemiring'
Equations
- Nat.orderedCommSemiring = StrictOrderedCommSemiring.toOrderedCommSemiring'
Equations
- Nat.linearOrderedCancelAddCommMonoid = inferInstance
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equalities and inequalities involving zero and one #
succ
#
add
#
pred
#
sub
#
Most lemmas come from the OrderedSub
instance on ℕ
.
mul
#
Recursion and induction principles #
This section is here due to dependencies -- the lemmas here require some of the lemmas proved above, and some of the results in later sections depend on the definitions in this section.
Given a predicate on two naturals P : ℕ → ℕ → Prop
, P a b
is true for all a < b
if
P (a + 1) (a + 1)
is true for all a
, P 0 (b + 1)
is true for all b
and for all
a < b
, P (a + 1) b
is true and P a (b + 1)
is true implies P (a + 1) (b + 1)
is true.
div
#
mod
, dvd
#
find
#
find_greatest
#
decidability of predicates #
Equations
- Nat.decidableLoHi lo hi P = decidable_of_iff (∀ (x : ℕ), x < hi - lo → P (lo + x)) ⋯
Equations
- Nat.decidableLoHiLe lo hi P = decidable_of_iff (∀ (x : ℕ), lo ≤ x → x < hi + 1 → P x) ⋯