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 : ¬a < b) => h₂ (_ : b ≤ a)
Instances For
Equations
- Nat.ltByCases h₁ h₂ h₃ = Nat.ltGeByCases h₁ fun (h₁ : b ≤ a) => Nat.ltGeByCases h₃ fun (h : a ≤ b) => 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
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_specis the proof thatNat.find hpsatisfiesp.Nat.find_minis the proof that ifm < Nat.find hpthenmdoes not satisfyp.Nat.find_min'is the proof that ifmdoes satisfypthenNat.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.