addition
multiplication
properties of inequality
Equations
- Nat.linearOrder = LinearOrder.mk Nat.le_total inferInstance inferInstance inferInstance
Equations
- Nat.ltGeByCases h₁ h₂ = Decidable.byCases h₁ fun h => h₂ (_ : b ≤ a)
Instances For
Equations
- Nat.ltByCases h₁ h₂ h₃ = Nat.ltGeByCases h₁ fun h₁ => Nat.ltGeByCases h₃ fun h => h₂ (_ : a = b)
Instances For
bit0/bit1 properties
successor and predecessor
subtraction
Many lemmas are proven more generally in mathlib algebra/order/sub
min
induction principles
Equations
- Nat.twoStepInduction H1 H2 H3 0 = H1
- Nat.twoStepInduction H1 H2 H3 1 = H2
- Nat.twoStepInduction H1 H2 H3 (Nat.succ (Nat.succ _n)) = H3 _n (Nat.twoStepInduction H1 H2 H3 _n) (Nat.twoStepInduction H1 H2 H3 (Nat.succ _n))
Instances For
Equations
- Nat.subInduction H1 H2 H3 0 x = H1 x
- Nat.subInduction H1 H2 H3 (Nat.succ _n) 0 = H2 _n
- Nat.subInduction H1 H2 H3 (Nat.succ n) (Nat.succ m) = H3 n m (Nat.subInduction H1 H2 H3 n m)
Instances For
mod
div
dvd
Equations
- Nat.decidableDvd _m _n = decidable_of_decidable_of_iff (_ : _n % _m = 0 ↔ _m ∣ _n)
find
If p
is a (decidable) predicate on ℕ
and hp : ∃ (n : ℕ), p n
is a proof that
there exists some natural number satisfying p
, then nat.find hp
is the
smallest natural number satisfying p
. Note that nat.find
is protected,
meaning that you can't just write find
, even if the nat
namespace is open.
The API for nat.find
is:
nat.find_spec
is the proof thatnat.find hp
satisfiesp
.nat.find_min
is the proof that ifm < nat.find hp
thenm
does not satisfyp
.nat.find_min'
is the proof that ifm
does satisfyp
thennat.find hp ≤ m
.
Instances For
The String representation produced by toDigitsCore has the proper length relative to
the number of digits in n < e
for some base b
. Since this works with any base greater
than one, it can be used for binary, decimal, and hex.
The core implementation of Nat.repr
returns a String with length less than or equal to the
number of digits in the decimal number (represented by e
). For example, the decimal string
representation of any number less than 1000 (10 ^ 3) has a length less than or equal to 3.