Note about Mathlib/Init/
#
The files in Mathlib/Init
are leftovers from the port from Mathlib3.
(They contain content moved from lean3 itself that Mathlib needed but was not moved to lean4.)
We intend to move all the content of these files out into the main Mathlib
directory structure.
Contributions assisting with this are appreciated.
#align
statements without corresponding declarations
(i.e. because the declaration is in Batteries or Lean) can be left here.
These will be deleted soon so will not significantly delay deleting otherwise empty Init
files.
addition
multiplication
properties of inequality
Equations
- Nat.ltGeByCases h₁ h₂ = Decidable.byCases h₁ fun (h : ¬a < b) => h₂ ⋯
Instances For
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
Equations
- Nat.twoStepInduction H1 H2 H3 0 = H1
- Nat.twoStepInduction H1 H2 H3 1 = H2
- Nat.twoStepInduction H1 H2 H3 _n.succ.succ = H3 _n (Nat.twoStepInduction H1 H2 H3 _n) (Nat.twoStepInduction H1 H2 H3 _n.succ)
Instances For
Equations
- Nat.subInduction H1 H2 H3 0 x = H1 x
- Nat.subInduction H1 H2 H3 _n.succ 0 = H2 _n
- Nat.subInduction H1 H2 H3 n.succ m.succ = 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_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
.