The positive natural numbers #
This file contains the definitions, and basic results.
Most algebraic facts are deferred to Data.PNat.Basic
, as they need more imports.
Equations
- instPNatLinearOrder = Subtype.instLinearOrder fun (n : ℕ) => 0 < n
Equations
- instOfNatPNatOfNeZeroNat n = { ofNat := ⟨n, ⋯⟩ }
Equations
- PNat.instWellFoundedRelation = measure fun (a : ℕ+) => ↑a
Strong induction on ℕ+
.
Equations
- n.strongInductionOn x✝ = x✝ n fun (a : ℕ+) (x : a < n) => a.strongInductionOn x✝
Instances For
We define m % k
and m / k
in the same way as for ℕ
except that when m = n * k
we take m % k = k
and
m / k = n - 1
. This ensures that m % k
is always positive
and m = (m % k) + k * (m / k)
in all cases. Later we
define a function div_exact
which gives the usual m / k
in the case where k
divides m
.
Instances For
mod_div m k = (m % k, m / k)
.
We define m % k
and m / k
in the same way as for ℕ
except that when m = n * k
we take m % k = k
and
m / k = n - 1
. This ensures that m % k
is always positive
and m = (m % k) + k * (m / k)
in all cases. Later we
define a function div_exact
which gives the usual m / k
in the case where k
divides m
.
Instances For
We define m / k
in the same way as for ℕ
except that when m = n * k
we take
m / k = n - 1
. This ensures that m = (m % k) + k * (m / k)
in all cases. Later we
define a function div_exact
which gives the usual m / k
in the case where k
divides m
.