addition
multiplication
properties of inequality
Equations
- Nat.instLinearOrder = LinearOrder.mk Nat.le_total inferInstance inferInstance inferInstance Nat.instLinearOrder.proof_1 Nat.instLinearOrder.proof_2 Nat.instLinearOrder.proof_3
Equations
- Nat.ltGeByCases h₁ h₂ = Decidable.byCases h₁ fun (h : ¬a < b) => h₂ ⋯
Instances For
def
Nat.ltByCases
{a : ℕ}
{b : ℕ}
{C : Sort u}
(h₁ : a < b → C)
(h₂ : a = b → C)
(h₃ : b < a → C)
:
C
Equations
- Nat.ltByCases h₁ h₂ h₃ = Nat.ltGeByCases h₁ fun (h₁ : b ≤ a) => Nat.ltGeByCases h₃ fun (h : a ≤ b) => h₂ ⋯
Instances For
bit0/bit1 properties
successor and predecessor
subtraction
Many lemmas are proven more generally in mathlib algebra/order/sub
min
induction principles
def
Nat.twoStepInduction
{P : ℕ → Sort u}
(H1 : P 0)
(H2 : P 1)
(H3 : (n : ℕ) → P n → P (Nat.succ n) → P (Nat.succ (Nat.succ n)))
(a : ℕ)
:
P a
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
def
Nat.subInduction
{P : ℕ → ℕ → Sort u}
(H1 : (m : ℕ) → P 0 m)
(H2 : (n : ℕ) → P (Nat.succ n) 0)
(H3 : (n m : ℕ) → P n m → P (Nat.succ n) (Nat.succ m))
(n : ℕ)
(m : ℕ)
:
P n m
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.