Documentation

Mathlib.Data.Int.Basic

Basic operations on the integers #

This file contains:

@[simp]
theorem Int.cast_id {n : } :
n = n
@[simp]
theorem Int.cast_mul {α : Type u_1} [NonAssocRing α] (m : ) (n : ) :
↑(m * n) = m * n
@[simp]
theorem Int.ofNat_eq_cast {n : } :
Int.ofNat n = n
theorem Int.cast_Nat_cast {R : Type u_1} {n : } [AddGroupWithOne R] :
n = n
theorem Int.cast_eq_cast_iff_Nat (m : ) (n : ) :
m = n m = n
@[simp]
theorem Int.natAbs_cast (n : ) :
Int.natAbs n = n
theorem Int.coe_nat_sub {n : } {m : } :
n m↑(m - n) = m - n
@[simp]
theorem coe_nat_zsmul {G : Type u_1} [SubNegMonoid G] (a : G) (n : ) :
n a = n a
@[simp]
theorem zpow_coe_nat {G : Type u_1} [DivInvMonoid G] (a : G) (n : ) :
a ^ n = a ^ n

Extra instances to short-circuit type class resolution #

These also prevent non-computable instances like Int.normedCommRing being used to construct these instances non-computably.

Equations
Equations
Equations
theorem Int.coe_nat_inj' {m : } {n : } :
m = n m = n
theorem Int.coe_nat_nonneg (n : ) :
0 n
@[simp]
theorem Int.sign_coe_add_one (n : ) :
Int.sign (n + 1) = 1
@[simp]

succ and pred #

def Int.succ (a : ) :

Immediate successor of an integer: succ n = n + 1

Equations
Instances For
    def Int.pred (a : ) :

    Immediate predecessor of an integer: pred n = n - 1

    Equations
    Instances For
      theorem Int.pred_nat_succ (n : ) :
      Int.pred ↑(Nat.succ n) = n
      theorem Int.neg_nat_succ (n : ) :
      -↑(Nat.succ n) = Int.pred (-n)
      theorem Int.succ_neg_nat_succ (n : ) :
      Int.succ (-↑(Nat.succ n)) = -n
      theorem Int.coe_pred_of_pos {n : } (h : 0 < n) :
      ↑(n - 1) = n - 1
      theorem Int.induction_on {p : Prop} (i : ) (hz : p 0) (hp : (i : ) → p ip (i + 1)) (hn : (i : ) → p (-i)p (-i - 1)) :
      p i

      nat abs #

      @[deprecated Int.natAbs_ne_zero]

      / #

      @[simp]
      theorem Int.coe_nat_div (m : ) (n : ) :
      ↑(m / n) = m / n
      theorem Int.coe_nat_ediv (m : ) (n : ) :
      ↑(m / n) = Int.ediv m n
      theorem Int.ediv_of_neg_of_pos {a : } {b : } (Ha : a < 0) (Hb : 0 < b) :
      Int.ediv a b = -((-a - 1) / b + 1)

      mod #

      @[simp]
      theorem Int.coe_nat_mod (m : ) (n : ) :
      ↑(m % n) = m % n

      properties of / and % #

      theorem Int.sign_coe_nat_of_nonzero {n : } (hn : n 0) :
      Int.sign n = 1

      toNat #

      @[simp]
      theorem Int.toNat_coe_nat (n : ) :
      Int.toNat n = n
      @[simp]
      theorem Int.toNat_coe_nat_add_one {n : } :
      Int.toNat (n + 1) = n + 1