Documentation

Mathlib.Data.PNat.Basic

The positive natural numbers #

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.

@[simp]
theorem PNat.one_add_natPred (n : ℕ+) :
1 + n.natPred = n
@[simp]
theorem PNat.natPred_add_one (n : ℕ+) :
n.natPred + 1 = n
@[simp]
theorem PNat.natPred_lt_natPred {m n : ℕ+} :
@[simp]
@[simp]
theorem PNat.natPred_inj {m n : ℕ+} :
@[simp]
theorem PNat.val_ofNat (n : ) [NeZero n] :
@[simp]
theorem PNat.mk_ofNat (n : ) (h : 0 < n) :
@[simp]
@[simp]
@[simp]
theorem Nat.succPNat_inj {n m : } :
@[simp]
theorem PNat.coe_inj {m n : ℕ+} :
m = n m = n

We now define a long list of structures on ℕ+ induced by similar structures on . Most of these behave in a completely obvious way, but there are a few things to be said about subtraction, division and powers.

@[simp]
theorem PNat.add_coe (m n : ℕ+) :
↑(m + n) = m + n

coe promoted to an AddHom, that is, a morphism which preserves addition.

Equations

The order isomorphism between ℕ and ℕ+ given by succ.

Equations
theorem PNat.lt_add_one_iff {a b : ℕ+} :
a < b + 1 a b
theorem PNat.add_one_le_iff {a b : ℕ+} :
a + 1 b a < b
@[simp]
theorem PNat.bot_eq_one :
= 1
def PNat.caseStrongInductionOn {p : ℕ+Sort u_1} (a : ℕ+) (hz : p 1) (hi : (n : ℕ+) → ((m : ℕ+) → m np m)p (n + 1)) :
p a

Strong induction on ℕ+, with n = 1 treated separately.

Equations
  • One or more equations did not get rendered due to their size.
def PNat.recOn (n : ℕ+) {p : ℕ+Sort u_1} (one : p 1) (succ : (n : ℕ+) → p np (n + 1)) :
p n

An induction principle for ℕ+: it takes values in Sort*, so it applies also to Types, not only to Prop.

Equations
  • One or more equations did not get rendered due to their size.
@[simp]
theorem PNat.recOn_one {p : ℕ+Sort u_1} (one : p 1) (succ : (n : ℕ+) → p np (n + 1)) :
recOn 1 one succ = one
@[simp]
theorem PNat.recOn_succ (n : ℕ+) {p : ℕ+Sort u_1} (one : p 1) (succ : (n : ℕ+) → p np (n + 1)) :
(n + 1).recOn one succ = succ n (n.recOn one succ)
@[simp]
theorem PNat.mul_coe (m n : ℕ+) :
↑(m * n) = m * n

PNat.coe promoted to a MonoidHom.

Equations
@[simp]
theorem PNat.le_one_iff {n : ℕ+} :
n 1 n = 1
theorem PNat.lt_add_left (n m : ℕ+) :
n < m + n
theorem PNat.lt_add_right (n m : ℕ+) :
n < n + m
@[simp]
theorem PNat.pow_coe (m : ℕ+) (n : ) :
↑(m ^ n) = m ^ n
theorem PNat.one_lt_of_lt {a b : ℕ+} (hab : a < b) :
1 < b

b is greater one if any a is less than b

theorem PNat.add_one (a : ℕ+) :
a + 1 = (↑a).succPNat
theorem PNat.lt_succ_self (a : ℕ+) :
a < (↑a).succPNat

Subtraction a - b is defined in the obvious way when a > b, and by a - b = 1 if a ≤ b.

Equations
theorem PNat.sub_coe (a b : ℕ+) :
↑(a - b) = if b < a then a - b else 1
theorem PNat.sub_le (a b : ℕ+) :
a - b a
theorem PNat.le_sub_one_of_lt {a b : ℕ+} (hab : a < b) :
a b - 1
theorem PNat.add_sub_of_lt {a b : ℕ+} :
a < ba + (b - a) = b
theorem PNat.sub_add_of_lt {a b : ℕ+} (h : b < a) :
a - b + b = a
@[simp]
theorem PNat.add_sub {a b : ℕ+} :
a + b - b = a
theorem PNat.exists_eq_succ_of_ne_one {n : ℕ+} :
n 1∃ (k : ℕ+), n = k + 1

If n : ℕ+ is different from 1, then it is the successor of some k : ℕ+.

theorem PNat.modDivAux_spec (k : ℕ+) (r q : ) :
¬(r = 0 q = 0) → (k.modDivAux r q).1 + k * (k.modDivAux r q).2 = r + k * q

Lemmas with div, dvd and mod operations

theorem PNat.mod_add_div (m k : ℕ+) :
(m.mod k) + k * m.div k = m
theorem PNat.div_add_mod (m k : ℕ+) :
k * m.div k + (m.mod k) = m
theorem PNat.mod_add_div' (m k : ℕ+) :
(m.mod k) + m.div k * k = m
theorem PNat.div_add_mod' (m k : ℕ+) :
m.div k * k + (m.mod k) = m
theorem PNat.mod_le (m k : ℕ+) :
m.mod k m m.mod k k
theorem PNat.dvd_iff {k m : ℕ+} :
k m k m
theorem PNat.dvd_iff' {k m : ℕ+} :
k m m.mod k = k
theorem PNat.le_of_dvd {m n : ℕ+} :
m nm n
theorem PNat.mul_div_exact {m k : ℕ+} (h : k m) :
k * m.divExact k = m
theorem PNat.dvd_antisymm {m n : ℕ+} :
m nn mm = n
theorem PNat.dvd_one_iff (n : ℕ+) :
n 1 n = 1
theorem PNat.pos_of_div_pos {n : ℕ+} {a : } (h : a n) :
0 < a