Documentation

Mathlib.Data.Int.Defs

Basic operations on the integers #

This file contains some basic lemmas about integers.

@[simp]
theorem Int.ofNat_eq_cast {n : } :
Int.ofNat 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
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
theorem Int.two_mul (n : ) :
2 * n = n + n
@[deprecated]
theorem Int.ofNat_bit0 (n : ) :
(bit0 n) = bit0 n
@[deprecated]
theorem Int.ofNat_bit1 (n : ) :
(bit1 n) = bit1 n

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
      @[simp]
      theorem Int.pow_eq (m : ) (n : ) :
      Int.pow m n = m ^ n