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.

instance PNat.instIsWellOrder :
IsWellOrder ℕ+ fun (x x_1 : ℕ+) => x < x_1
Equations
@[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 : ℕ+} :
m.natPred < n.natPred m < n
@[simp]
theorem PNat.natPred_le_natPred {m : ℕ+} {n : ℕ+} :
m.natPred n.natPred m n
@[simp]
theorem PNat.natPred_inj {m : ℕ+} {n : ℕ+} :
m.natPred = n.natPred m = n
@[simp]
theorem PNat.val_ofNat (n : ) [NeZero n] :
@[simp]
theorem PNat.mk_ofNat (n : ) (h : 0 < n) :
@[simp]
theorem Nat.succPNat_lt_succPNat {m : } {n : } :
m.succPNat < n.succPNat m < n
@[simp]
theorem Nat.succPNat_le_succPNat {m : } {n : } :
m.succPNat n.succPNat m n
@[simp]
theorem Nat.succPNat_inj {n : } {m : } :
n.succPNat = m.succPNat 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
Instances For
    instance PNat.covariantClass_add_le :
    CovariantClass ℕ+ ℕ+ (fun (x x_1 : ℕ+) => x + x_1) fun (x x_1 : ℕ+) => x x_1
    Equations
    instance PNat.covariantClass_add_lt :
    CovariantClass ℕ+ ℕ+ (fun (x x_1 : ℕ+) => x + x_1) fun (x x_1 : ℕ+) => x < x_1
    Equations
    instance PNat.contravariantClass_add_le :
    ContravariantClass ℕ+ ℕ+ (fun (x x_1 : ℕ+) => x + x_1) fun (x x_1 : ℕ+) => x x_1
    Equations
    instance PNat.contravariantClass_add_lt :
    ContravariantClass ℕ+ ℕ+ (fun (x x_1 : ℕ+) => x + x_1) fun (x x_1 : ℕ+) => x < x_1
    Equations

    An equivalence between ℕ+ and given by PNat.natPred and Nat.succPNat.

    Equations
    Instances For

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

      Equations
      Instances For
        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.
        Instances For
          def PNat.recOn (n : ℕ+) {p : ℕ+Sort u_1} (p1 : p 1) (hp : (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.
          Instances For
            @[simp]
            theorem PNat.recOn_one {p : ℕ+Sort u_1} (p1 : p 1) (hp : (n : ℕ+) → p np (n + 1)) :
            PNat.recOn 1 p1 hp = p1
            @[simp]
            theorem PNat.recOn_succ (n : ℕ+) {p : ℕ+Sort u_1} (p1 : p 1) (hp : (n : ℕ+) → p np (n + 1)) :
            (n + 1).recOn p1 hp = hp n (n.recOn p1 hp)
            @[simp, deprecated]
            theorem PNat.bit0_le_bit0 (n : ℕ+) (m : ℕ+) :
            bit0 n bit0 m bit0 n bit0 m
            @[simp, deprecated]
            theorem PNat.bit0_le_bit1 (n : ℕ+) (m : ℕ+) :
            bit0 n bit1 m bit0 n bit1 m
            @[simp, deprecated]
            theorem PNat.bit1_le_bit0 (n : ℕ+) (m : ℕ+) :
            bit1 n bit0 m bit1 n bit0 m
            @[simp, deprecated]
            theorem PNat.bit1_le_bit1 (n : ℕ+) (m : ℕ+) :
            bit1 n bit1 m bit1 n bit1 m
            @[simp]
            theorem PNat.mul_coe (m : ℕ+) (n : ℕ+) :
            (m * n) = m * n

            PNat.coe promoted to a MonoidHom.

            Equations
            Instances For
              @[simp]
              @[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.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