The positive natural numbers #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file develops the type ℕ+
or pnat
, the subtype of natural numbers that are positive.
It is defined in data.pnat.defs
, but most of the development is deferred to here so
that data.pnat.defs
can have very few imports.
@[protected, instance]
pnat.coe
promoted to an add_hom
, that is, a morphism which preserves addition.
Equations
@[protected, instance]
@[protected, instance]
@[protected, instance]
@[protected, instance]
@[simp]
An equivalence between ℕ+
and ℕ
given by pnat.nat_pred
and nat.succ_pnat
.
Equations
The order isomorphism between ℕ and ℕ+ given by succ
.
Equations
- order_iso.pnat_iso_nat = {to_equiv := equiv.pnat_equiv_nat, map_rel_iff' := order_iso.pnat_iso_nat._proof_1}
@[simp]
@[protected, instance]
Equations
- pnat.order_bot = {bot := 1, bot_le := pnat.order_bot._proof_1}
pnat.coe
promoted to a monoid_hom
.
Equations
def
pnat.case_strong_induction_on
{p : ℕ+ → Sort u_1}
(a : ℕ+)
(hz : p 1)
(hi : Π (n : ℕ+), (Π (m : ℕ+), m ≤ n → p m) → p (n + 1)) :
p a
Strong induction on ℕ+
, with n = 1
treated separately.
Equations
- a.case_strong_induction_on hz hi = a.strong_induction_on (λ (k : ℕ+) (hk : Π (m : ℕ+), m < k → p m), subtype.cases_on k (λ (k : ℕ) (kprop : 0 < k) (hk : Π (m : ℕ+), m < ⟨k, kprop⟩ → p m), k.cases_on (λ (kprop : 0 < 0) (hk : Π (m : ℕ+), m < ⟨0, kprop⟩ → p m), _.elim) (λ (k : ℕ) (kprop : 0 < k.succ) (hk : Π (m : ℕ+), m < ⟨k.succ, kprop⟩ → p m), k.cases_on (λ (kprop : 0 < 1) (hk : Π (m : ℕ+), m < ⟨1, kprop⟩ → p m), hz) (λ (k : ℕ) (kprop : 0 < k.succ.succ) (hk : Π (m : ℕ+), m < ⟨k.succ.succ, kprop⟩ → p m), hi ⟨k.succ, _⟩ (λ (m : ℕ+) (hm : m ≤ ⟨k.succ, _⟩), hk m _)) kprop hk) kprop hk) hk)
An induction principle for ℕ+
: it takes values in Sort*
, so it applies also to Types,
not only to Prop
.
Equations
- n.rec_on p1 hp = subtype.cases_on n (λ (n : ℕ) (h : 0 < n), nat.rec (λ (h : 0 < 0), absurd h pnat.rec_on._proof_1) (λ (n : ℕ) (IH : Π (h : 0 < n), p ⟨n, h⟩) (h : 0 < n.succ), n.cases_on (λ (IH : Π (h : 0 < 0), p ⟨0, h⟩) (h : 0 < 1), p1) (λ (n : ℕ) (IH : Π (h : 0 < n.succ), p ⟨n.succ, h⟩) (h : 0 < n.succ.succ), hp ⟨n.succ, _⟩ (IH _)) IH h) n h)