HepLean Documentation

Init.Data.Int.DivModLemmas

Lemmas about integer division needed to bootstrap omega. #

dvd #

theorem Int.dvd_def (a b : Int) :
(a b) = ∃ (c : Int), b = a * c
theorem Int.dvd_zero (n : Int) :
n 0
theorem Int.dvd_refl (n : Int) :
n n
theorem Int.one_dvd (n : Int) :
1 n
theorem Int.dvd_trans {a b c : Int} :
a bb ca c
theorem Int.ofNat_dvd {m n : Nat} :
m n m n
theorem Int.dvd_antisymm {a b : Int} (H1 : 0 a) (H2 : 0 b) :
a bb aa = b
@[simp]
theorem Int.zero_dvd {n : Int} :
0 n n = 0
theorem Int.dvd_mul_right (a b : Int) :
a a * b
theorem Int.dvd_mul_left (a b : Int) :
b a * b
@[simp]
theorem Int.neg_dvd {a b : Int} :
-a b a b
theorem Int.dvd_neg {a b : Int} :
a -b a b
@[simp]
theorem Int.natAbs_dvd_natAbs {a b : Int} :
a.natAbs b.natAbs a b
theorem Int.ofNat_dvd_left {n : Nat} {z : Int} :
n z n z.natAbs
theorem Int.dvd_add {a b c : Int} :
a ba ca b + c
theorem Int.dvd_sub {a b c : Int} :
a ba ca b - c
theorem Int.dvd_add_left {a b c : Int} (H : a c) :
a b + c a b
theorem Int.dvd_add_right {a b c : Int} (H : a b) :
a b + c a c
theorem Int.dvd_iff_dvd_of_dvd_sub {a b c : Int} (H : a b - c) :
a b a c
theorem Int.dvd_iff_dvd_of_dvd_add {a b c : Int} (H : a b + c) :
a b a c
theorem Int.le_of_dvd {a b : Int} (bpos : 0 < b) (H : a b) :
a b
theorem Int.natAbs_dvd {a b : Int} :
a.natAbs b a b
theorem Int.dvd_natAbs {a b : Int} :
a b.natAbs a b
theorem Int.natAbs_dvd_self {a : Int} :
a.natAbs a
theorem Int.dvd_natAbs_self {a : Int} :
a a.natAbs
theorem Int.ofNat_dvd_right {n : Nat} {z : Int} :
z n z.natAbs n
theorem Int.eq_one_of_dvd_one {a : Int} (H : 0 a) (H' : a 1) :
a = 1
theorem Int.eq_one_of_mul_eq_one_right {a b : Int} (H : 0 a) (H' : a * b = 1) :
a = 1
theorem Int.eq_one_of_mul_eq_one_left {a b : Int} (H : 0 b) (H' : a * b = 1) :
b = 1

*div zero #

@[simp]
theorem Int.zero_ediv (b : Int) :
0 / b = 0
@[simp]
theorem Int.ediv_zero (a : Int) :
a / 0 = 0
@[simp]
theorem Int.zero_tdiv (b : Int) :
Int.tdiv 0 b = 0
@[simp]
theorem Int.tdiv_zero (a : Int) :
a.tdiv 0 = 0
@[simp]
theorem Int.zero_fdiv (b : Int) :
Int.fdiv 0 b = 0
@[simp]
theorem Int.fdiv_zero (a : Int) :
a.fdiv 0 = 0

div equivalences #

theorem Int.tdiv_eq_ediv {a b : Int} :
0 a0 ba.tdiv b = a / b
theorem Int.fdiv_eq_ediv (a : Int) {b : Int} :
0 ba.fdiv b = a / b
theorem Int.fdiv_eq_tdiv {a b : Int} (Ha : 0 a) (Hb : 0 b) :
a.fdiv b = a.tdiv b

mod zero #

@[simp]
theorem Int.zero_emod (b : Int) :
0 % b = 0
@[simp]
theorem Int.emod_zero (a : Int) :
a % 0 = a
@[simp]
theorem Int.zero_tmod (b : Int) :
Int.tmod 0 b = 0
@[simp]
theorem Int.tmod_zero (a : Int) :
a.tmod 0 = a
@[simp]
theorem Int.zero_fmod (b : Int) :
Int.fmod 0 b = 0
@[simp]
theorem Int.fmod_zero (a : Int) :
a.fmod 0 = a

ofNat mod #

@[simp]
theorem Int.ofNat_emod (m n : Nat) :
(m % n) = m % n

mod definitions #

theorem Int.emod_add_ediv (a b : Int) :
a % b + b * (a / b) = a
theorem Int.emod_add_ediv.aux (m n : Nat) :
n - (m % n + 1) - (n * (m / n) + n) = Int.negSucc m
theorem Int.emod_add_ediv' (a b : Int) :
a % b + a / b * b = a
theorem Int.ediv_add_emod (a b : Int) :
b * (a / b) + a % b = a
theorem Int.ediv_add_emod' (a b : Int) :
a / b * b + a % b = a
theorem Int.emod_def (a b : Int) :
a % b = a - b * (a / b)
theorem Int.tmod_add_tdiv (a b : Int) :
a.tmod b + b * a.tdiv b = a
theorem Int.tdiv_add_tmod (a b : Int) :
b * a.tdiv b + a.tmod b = a
theorem Int.tmod_add_tdiv' (m k : Int) :
m.tmod k + m.tdiv k * k = m
theorem Int.tdiv_add_tmod' (m k : Int) :
m.tdiv k * k + m.tmod k = m
theorem Int.tmod_def (a b : Int) :
a.tmod b = a - b * a.tdiv b
theorem Int.fmod_add_fdiv (a b : Int) :
a.fmod b + b * a.fdiv b = a
theorem Int.fdiv_add_fmod (a b : Int) :
b * a.fdiv b + a.fmod b = a
theorem Int.fmod_def (a b : Int) :
a.fmod b = a - b * a.fdiv b

mod equivalences #

theorem Int.fmod_eq_emod (a : Int) {b : Int} (hb : 0 b) :
a.fmod b = a % b
theorem Int.tmod_eq_emod {a b : Int} (ha : 0 a) (hb : 0 b) :
a.tmod b = a % b
theorem Int.fmod_eq_tmod {a b : Int} (Ha : 0 a) (Hb : 0 b) :
a.fmod b = a.tmod b

/ ediv #

@[simp]
theorem Int.ediv_neg (a b : Int) :
a / -b = -(a / b)
theorem Int.ediv_neg' {a b : Int} (Ha : a < 0) (Hb : 0 < b) :
a / b < 0
theorem Int.div_def (a b : Int) :
a / b = a.ediv b
theorem Int.negSucc_ediv (m : Nat) {b : Int} (H : 0 < b) :
Int.negSucc m / b = -((↑m).ediv b + 1)
theorem Int.ediv_nonneg {a b : Int} (Ha : 0 a) (Hb : 0 b) :
0 a / b
theorem Int.ediv_nonneg_of_nonpos_of_nonpos {a b : Int} (Ha : a 0) (Hb : b 0) :
0 a / b
theorem Int.ediv_nonpos {a b : Int} (Ha : 0 a) (Hb : b 0) :
a / b 0
theorem Int.add_mul_ediv_right (a b : Int) {c : Int} (H : c 0) :
(a + b * c) / c = a / c + b
theorem Int.add_ediv_of_dvd_right {a b c : Int} (H : c b) :
(a + b) / c = a / c + b / c
theorem Int.add_ediv_of_dvd_left {a b c : Int} (H : c a) :
(a + b) / c = a / c + b / c
@[simp]
theorem Int.mul_ediv_cancel (a : Int) {b : Int} (H : b 0) :
a * b / b = a
@[simp]
theorem Int.mul_ediv_cancel_left {a : Int} (b : Int) (H : a 0) :
a * b / a = b
theorem Int.div_nonneg_iff_of_pos {a b : Int} (h : 0 < b) :
a / b 0 a 0
theorem Int.ediv_eq_zero_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
a / b = 0
theorem Int.add_mul_ediv_left (a : Int) {b : Int} (c : Int) (H : b 0) :
(a + b * c) / b = a / b + c
@[simp]
theorem Int.mul_ediv_mul_of_pos {a : Int} (b c : Int) (H : 0 < a) :
a * b / (a * c) = b / c
@[simp]
theorem Int.mul_ediv_mul_of_pos_left (a : Int) {b : Int} (c : Int) (H : 0 < b) :
a * b / (c * b) = a / c
theorem Int.ediv_eq_of_eq_mul_right {a b c : Int} (H1 : b 0) (H2 : a = b * c) :
a / b = c
theorem Int.eq_ediv_of_mul_eq_right {a b c : Int} (H1 : a 0) (H2 : a * b = c) :
b = c / a
theorem Int.ediv_eq_of_eq_mul_left {a b c : Int} (H1 : b 0) (H2 : a = c * b) :
a / b = c

emod #

theorem Int.mod_def' (m n : Int) :
m % n = m.emod n
theorem Int.negSucc_emod (m : Nat) {b : Int} (bpos : 0 < b) :
Int.negSucc m % b = b - 1 - m % b
theorem Int.emod_negSucc (m : Nat) (n : Int) :
Int.negSucc m % n = Int.subNatNat n.natAbs (m % n.natAbs).succ
theorem Int.ofNat_mod_ofNat (m n : Nat) :
m % n = (m % n)
theorem Int.emod_nonneg (a : Int) {b : Int} :
b 00 a % b
theorem Int.emod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) :
a % b < b
theorem Int.mul_ediv_self_le {x k : Int} (h : k 0) :
k * (x / k) x
theorem Int.lt_mul_ediv_self_add {x k : Int} (h : 0 < k) :
x < k * (x / k) + k
@[simp]
theorem Int.add_mul_emod_self {a b c : Int} :
(a + b * c) % c = a % c
@[simp]
theorem Int.add_mul_emod_self_left (a b c : Int) :
(a + b * c) % b = a % b
@[simp]
theorem Int.add_neg_mul_emod_self {a b c : Int} :
(a + -(b * c)) % c = a % c
@[simp]
theorem Int.add_neg_mul_emod_self_left {a b c : Int} :
(a + -(b * c)) % b = a % b
@[simp]
theorem Int.add_emod_self {a b : Int} :
(a + b) % b = a % b
@[simp]
theorem Int.add_emod_self_left {a b : Int} :
(a + b) % a = b % a
theorem Int.neg_emod {a b : Int} :
-a % b = (b - a) % b
@[simp]
theorem Int.emod_neg (a b : Int) :
a % -b = a % b
@[simp]
theorem Int.emod_add_emod (m n k : Int) :
(m % n + k) % n = (m + k) % n
@[simp]
theorem Int.add_emod_emod (m n k : Int) :
(m + n % k) % k = (m + n) % k
theorem Int.add_emod (a b n : Int) :
(a + b) % n = (a % n + b % n) % n
theorem Int.add_emod_eq_add_emod_right {m n k : Int} (i : Int) (H : m % n = k % n) :
(m + i) % n = (k + i) % n
theorem Int.emod_add_cancel_right {m n k : Int} (i : Int) :
(m + i) % n = (k + i) % n m % n = k % n
@[simp]
theorem Int.mul_emod_left (a b : Int) :
a * b % b = 0
@[simp]
theorem Int.mul_emod_right (a b : Int) :
a * b % a = 0
theorem Int.mul_emod (a b n : Int) :
a * b % n = a % n * (b % n) % n
@[simp]
theorem Int.emod_self {a : Int} :
a % a = 0
@[simp]
theorem Int.neg_emod_self (a : Int) :
-a % a = 0
@[simp]
theorem Int.emod_emod_of_dvd (n : Int) {m k : Int} (h : m k) :
n % k % m = n % m
@[simp]
theorem Int.emod_emod (a b : Int) :
a % b % b = a % b
theorem Int.sub_emod (a b n : Int) :
(a - b) % n = (a % n - b % n) % n
theorem Int.emod_eq_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
a % b = a
@[simp]
theorem Int.emod_self_add_one {x : Int} (h : 0 x) :
x % (x + 1) = x

properties of / and % #

theorem Int.mul_ediv_cancel_of_emod_eq_zero {a b : Int} (H : a % b = 0) :
b * (a / b) = a
theorem Int.ediv_mul_cancel_of_emod_eq_zero {a b : Int} (H : a % b = 0) :
a / b * b = a
theorem Int.emod_two_eq (x : Int) :
x % 2 = 0 x % 2 = 1
theorem Int.add_emod_eq_add_emod_left {m n k : Int} (i : Int) (H : m % n = k % n) :
(i + m) % n = (i + k) % n
theorem Int.emod_add_cancel_left {m n k i : Int} :
(i + m) % n = (i + k) % n m % n = k % n
theorem Int.emod_sub_cancel_right {m n k : Int} (i : Int) :
(m - i) % n = (k - i) % n m % n = k % n
theorem Int.emod_eq_emod_iff_emod_sub_eq_zero {m n k : Int} :
m % n = k % n (m - k) % n = 0
theorem Int.ediv_emod_unique {a b r q : Int} (h : 0 < b) :
a / b = q a % b = r r + b * q = a 0 r r < b
@[simp]
theorem Int.mul_emod_mul_of_pos {a : Int} (b c : Int) (H : 0 < a) :
a * b % (a * c) = a * (b % c)
theorem Int.lt_ediv_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) :
a < (a / b + 1) * b
theorem Int.natAbs_div_le_natAbs (a b : Int) :
(a / b).natAbs a.natAbs
theorem Int.natAbs_div_le_natAbs.aux (a : Int) (n : Nat) :
(a / n).natAbs a.natAbs
theorem Int.ediv_le_self {a : Int} (b : Int) (Ha : 0 a) :
a / b a
theorem Int.dvd_of_emod_eq_zero {a b : Int} (H : b % a = 0) :
a b
theorem Int.dvd_emod_sub_self {x : Int} {m : Nat} :
m x % m - x
theorem Int.emod_eq_zero_of_dvd {a b : Int} :
a bb % a = 0
theorem Int.dvd_iff_emod_eq_zero {a b : Int} :
a b b % a = 0
@[simp]
theorem Int.neg_mul_emod_left (a b : Int) :
-(a * b) % b = 0
@[simp]
theorem Int.neg_mul_emod_right (a b : Int) :
-(a * b) % a = 0
instance Int.decidableDvd :
DecidableRel fun (x1 x2 : Int) => x1 x2
Equations
theorem Int.emod_pos_of_not_dvd {a b : Int} (h : ¬a b) :
a = 0 0 < b % a
theorem Int.mul_ediv_assoc (a : Int) {b c : Int} :
c ba * b / c = a * (b / c)
theorem Int.mul_ediv_assoc' (b : Int) {a c : Int} (h : c a) :
a * b / c = a / c * b
theorem Int.neg_ediv_of_dvd {a b : Int} :
b a-a / b = -(a / b)
@[simp]
theorem Int.neg_mul_ediv_cancel (a b : Int) (h : b 0) :
-(a * b) / b = -a
@[simp]
theorem Int.neg_mul_ediv_cancel_left (a b : Int) (h : a 0) :
-(a * b) / a = -b
theorem Int.sub_ediv_of_dvd (a : Int) {b c : Int} (hcb : c b) :
(a - b) / c = a / c - b / c
@[simp]
theorem Int.ediv_one (a : Int) :
a / 1 = a
@[simp]
theorem Int.emod_one (a : Int) :
a % 1 = 0
@[simp]
theorem Int.ediv_self {a : Int} (H : a 0) :
a / a = 1
@[simp]
theorem Int.neg_ediv_self (a : Int) (h : a 0) :
-a / a = -1
@[simp]
theorem Int.emod_sub_cancel (x y : Int) :
(x - y) % y = x % y
@[simp]
theorem Int.add_neg_emod_self (a b : Int) :
(a + -b) % b = a % b
@[simp]
theorem Int.neg_add_emod_self (a b : Int) :
(-a + b) % a = b % a
theorem Int.dvd_sub_of_emod_eq {a b c : Int} (h : a % b = c) :
b a - c

If a % b = c then b divides a - c.

theorem Int.ediv_mul_cancel {a b : Int} (H : b a) :
a / b * b = a
theorem Int.mul_ediv_cancel' {a b : Int} (H : a b) :
a * (b / a) = b
theorem Int.eq_mul_of_ediv_eq_right {a b c : Int} (H1 : b a) (H2 : a / b = c) :
a = b * c
theorem Int.ediv_eq_iff_eq_mul_right {a b c : Int} (H : b 0) (H' : b a) :
a / b = c a = b * c
theorem Int.ediv_eq_iff_eq_mul_left {a b c : Int} (H : b 0) (H' : b a) :
a / b = c a = c * b
theorem Int.eq_mul_of_ediv_eq_left {a b c : Int} (H1 : b a) (H2 : a / b = c) :
a = c * b
theorem Int.eq_zero_of_ediv_eq_zero {d n : Int} (h : d n) (H : n / d = 0) :
n = 0
theorem Int.sub_ediv_of_dvd_sub {a b c : Int} (hcab : c a - b) :
(a - b) / c = a / c - b / c
@[simp]
theorem Int.ediv_left_inj {a b d : Int} (hda : d a) (hdb : d b) :
a / d = b / d a = b
theorem Int.ediv_sign (a b : Int) :
a / b.sign = a * b.sign

/ and ordering #

theorem Int.ediv_mul_le (a : Int) {b : Int} (H : b 0) :
a / b * b a
theorem Int.le_of_mul_le_mul_left {a b c : Int} (w : a * b a * c) (h : 0 < a) :
b c
theorem Int.le_of_mul_le_mul_right {a b c : Int} (w : b * a c * a) (h : 0 < a) :
b c
theorem Int.ediv_le_of_le_mul {a b c : Int} (H : 0 < c) (H' : a b * c) :
a / c b
theorem Int.mul_lt_of_lt_ediv {a b c : Int} (H : 0 < c) (H3 : a < b / c) :
a * c < b
theorem Int.mul_le_of_le_ediv {a b c : Int} (H1 : 0 < c) (H2 : a b / c) :
a * c b
theorem Int.ediv_lt_of_lt_mul {a b c : Int} (H : 0 < c) (H' : a < b * c) :
a / c < b
theorem Int.lt_of_mul_lt_mul_left {a b c : Int} (w : a * b < a * c) (h : 0 a) :
b < c
theorem Int.lt_of_mul_lt_mul_right {a b c : Int} (w : b * a < c * a) (h : 0 a) :
b < c
theorem Int.le_ediv_of_mul_le {a b c : Int} (H1 : 0 < c) (H2 : a * c b) :
a b / c
theorem Int.le_ediv_iff_mul_le {a b c : Int} (H : 0 < c) :
a b / c a * c b
theorem Int.ediv_le_ediv {a b c : Int} (H : 0 < c) (H' : a b) :
a / c b / c
theorem Int.lt_mul_of_ediv_lt {a b c : Int} (H1 : 0 < c) (H2 : a / c < b) :
a < b * c
theorem Int.ediv_lt_iff_lt_mul {a b c : Int} (H : 0 < c) :
a / c < b a < b * c
theorem Int.le_mul_of_ediv_le {a b c : Int} (H1 : 0 b) (H2 : b a) (H3 : a / b c) :
a c * b
theorem Int.lt_ediv_of_mul_lt {a b c : Int} (H1 : 0 b) (H2 : b c) (H3 : a * b < c) :
a < c / b
theorem Int.lt_ediv_iff_mul_lt {a b c : Int} (H : 0 < c) (H' : c b) :
a < b / c a * c < b
theorem Int.ediv_pos_of_pos_of_dvd {a b : Int} (H1 : 0 < a) (H2 : 0 b) (H3 : b a) :
0 < a / b
theorem Int.ediv_eq_ediv_of_mul_eq_mul {a b c d : Int} (H2 : d c) (H3 : b 0) (H4 : d 0) (H5 : a * d = b * c) :
a / b = c / d

tdiv #

@[simp]
theorem Int.tdiv_one (a : Int) :
a.tdiv 1 = a
@[simp]
theorem Int.tdiv_neg (a b : Int) :
a.tdiv (-b) = -a.tdiv b
@[simp]
theorem Int.neg_tdiv (a b : Int) :
(-a).tdiv b = -a.tdiv b
theorem Int.neg_tdiv_neg (a b : Int) :
(-a).tdiv (-b) = a.tdiv b
theorem Int.tdiv_nonneg {a b : Int} (Ha : 0 a) (Hb : 0 b) :
0 a.tdiv b
theorem Int.tdiv_nonpos {a b : Int} (Ha : 0 a) (Hb : b 0) :
a.tdiv b 0
theorem Int.tdiv_eq_zero_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
a.tdiv b = 0
@[simp]
theorem Int.mul_tdiv_cancel (a : Int) {b : Int} (H : b 0) :
(a * b).tdiv b = a
@[simp]
theorem Int.mul_tdiv_cancel_left {a : Int} (b : Int) (H : a 0) :
(a * b).tdiv a = b
@[simp]
theorem Int.tdiv_self {a : Int} (H : a 0) :
a.tdiv a = 1
theorem Int.mul_tdiv_cancel_of_tmod_eq_zero {a b : Int} (H : a.tmod b = 0) :
b * a.tdiv b = a
theorem Int.tdiv_mul_cancel_of_tmod_eq_zero {a b : Int} (H : a.tmod b = 0) :
a.tdiv b * b = a
theorem Int.dvd_of_tmod_eq_zero {a b : Int} (H : b.tmod a = 0) :
a b
theorem Int.mul_tdiv_assoc (a : Int) {b c : Int} :
c b(a * b).tdiv c = a * b.tdiv c
theorem Int.mul_tdiv_assoc' (b : Int) {a c : Int} (h : c a) :
(a * b).tdiv c = a.tdiv c * b
theorem Int.tdiv_dvd_tdiv {a b c : Int} :
a bb cb.tdiv a c.tdiv a
@[simp]
theorem Int.natAbs_tdiv (a b : Int) :
(a.tdiv b).natAbs = a.natAbs.div b.natAbs
theorem Int.tdiv_eq_of_eq_mul_right {a b c : Int} (H1 : b 0) (H2 : a = b * c) :
a.tdiv b = c
theorem Int.eq_tdiv_of_mul_eq_right {a b c : Int} (H1 : a 0) (H2 : a * b = c) :
b = c.tdiv a

(t-)mod #

theorem Int.ofNat_tmod (m n : Nat) :
(m % n) = (↑m).tmod n
@[simp]
theorem Int.tmod_one (a : Int) :
a.tmod 1 = 0
theorem Int.tmod_eq_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
a.tmod b = a
theorem Int.tmod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) :
a.tmod b < b
theorem Int.tmod_nonneg {a : Int} (b : Int) :
0 a0 a.tmod b
@[simp]
theorem Int.tmod_neg (a b : Int) :
a.tmod (-b) = a.tmod b
@[simp]
theorem Int.mul_tmod_left (a b : Int) :
(a * b).tmod b = 0
@[simp]
theorem Int.mul_tmod_right (a b : Int) :
(a * b).tmod a = 0
theorem Int.tmod_eq_zero_of_dvd {a b : Int} :
a bb.tmod a = 0
theorem Int.dvd_iff_tmod_eq_zero {a b : Int} :
a b b.tmod a = 0
@[simp]
theorem Int.neg_mul_tmod_right (a b : Int) :
(-(a * b)).tmod a = 0
@[simp]
theorem Int.neg_mul_tmod_left (a b : Int) :
(-(a * b)).tmod b = 0
theorem Int.tdiv_mul_cancel {a b : Int} (H : b a) :
a.tdiv b * b = a
theorem Int.mul_tdiv_cancel' {a b : Int} (H : a b) :
a * b.tdiv a = b
theorem Int.eq_mul_of_tdiv_eq_right {a b c : Int} (H1 : b a) (H2 : a.tdiv b = c) :
a = b * c
@[simp]
theorem Int.tmod_self {a : Int} :
a.tmod a = 0
@[simp]
theorem Int.neg_tmod_self (a : Int) :
(-a).tmod a = 0
theorem Int.lt_tdiv_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) :
a < (a.tdiv b + 1) * b
theorem Int.tdiv_eq_iff_eq_mul_right {a b c : Int} (H : b 0) (H' : b a) :
a.tdiv b = c a = b * c
theorem Int.tdiv_eq_iff_eq_mul_left {a b c : Int} (H : b 0) (H' : b a) :
a.tdiv b = c a = c * b
theorem Int.eq_mul_of_tdiv_eq_left {a b c : Int} (H1 : b a) (H2 : a.tdiv b = c) :
a = c * b
theorem Int.tdiv_eq_of_eq_mul_left {a b c : Int} (H1 : b 0) (H2 : a = c * b) :
a.tdiv b = c
theorem Int.eq_zero_of_tdiv_eq_zero {d n : Int} (h : d n) (H : n.tdiv d = 0) :
n = 0
@[simp]
theorem Int.tdiv_left_inj {a b d : Int} (hda : d a) (hdb : d b) :
a.tdiv d = b.tdiv d a = b
theorem Int.tdiv_sign (a b : Int) :
a.tdiv b.sign = a * b.sign
theorem Int.sign_eq_tdiv_abs (a : Int) :
a.sign = a.tdiv a.natAbs

fdiv #

theorem Int.fdiv_nonneg {a b : Int} (Ha : 0 a) (Hb : 0 b) :
0 a.fdiv b
theorem Int.fdiv_nonpos {a b : Int} :
0 ab 0a.fdiv b 0
theorem Int.fdiv_neg' {a b : Int} :
a < 00 < ba.fdiv b < 0
@[simp]
theorem Int.fdiv_one (a : Int) :
a.fdiv 1 = a
@[simp]
theorem Int.mul_fdiv_cancel (a : Int) {b : Int} (H : b 0) :
(a * b).fdiv b = a
@[simp]
theorem Int.mul_fdiv_cancel_left {a : Int} (b : Int) (H : a 0) :
(a * b).fdiv a = b
@[simp]
theorem Int.fdiv_self {a : Int} (H : a 0) :
a.fdiv a = 1
theorem Int.lt_fdiv_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) :
a < (a.fdiv b + 1) * b

fmod #

theorem Int.ofNat_fmod (m n : Nat) :
(m % n) = (↑m).fmod n
@[simp]
theorem Int.fmod_one (a : Int) :
a.fmod 1 = 0
theorem Int.fmod_eq_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
a.fmod b = a
theorem Int.fmod_nonneg {a b : Int} (ha : 0 a) (hb : 0 b) :
0 a.fmod b
theorem Int.fmod_nonneg' (a : Int) {b : Int} (hb : 0 < b) :
0 a.fmod b
theorem Int.fmod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) :
a.fmod b < b
@[simp]
theorem Int.mul_fmod_left (a b : Int) :
(a * b).fmod b = 0
@[simp]
theorem Int.mul_fmod_right (a b : Int) :
(a * b).fmod a = 0
@[simp]
theorem Int.fmod_self {a : Int} :
a.fmod a = 0

Theorems crossing div/mod versions #

theorem Int.tdiv_eq_ediv_of_dvd {a b : Int} (h : b a) :
a.tdiv b = a / b
theorem Int.fdiv_eq_ediv_of_dvd {a b : Int} :
b aa.fdiv b = a / b

bmod #

@[simp]
theorem Int.bmod_emod {x : Int} {m : Nat} :
x.bmod m % m = x % m
@[simp]
theorem Int.emod_bmod_congr (x : Int) (n : Nat) :
(x % n).bmod n = x.bmod n
theorem Int.bmod_def (x : Int) (m : Nat) :
x.bmod m = if x % m < (m + 1) / 2 then x % m else x % m - m
theorem Int.bmod_pos (x : Int) (m : Nat) (p : x % m < (m + 1) / 2) :
x.bmod m = x % m
theorem Int.bmod_neg (x : Int) (m : Nat) (p : x % m (m + 1) / 2) :
x.bmod m = x % m - m
@[simp]
theorem Int.bmod_one_is_zero (x : Int) :
x.bmod 1 = 0
@[simp]
theorem Int.bmod_add_cancel (x : Int) (n : Nat) :
(x + n).bmod n = x.bmod n
@[simp]
theorem Int.bmod_add_mul_cancel (x : Int) (n : Nat) (k : Int) :
(x + n * k).bmod n = x.bmod n
@[simp]
theorem Int.bmod_sub_cancel (x : Int) (n : Nat) :
(x - n).bmod n = x.bmod n
@[simp]
theorem Int.emod_add_bmod_congr {y : Int} (x : Int) (n : Nat) :
(x % n + y).bmod n = (x + y).bmod n
@[simp]
theorem Int.emod_sub_bmod_congr {y : Int} (x : Int) (n : Nat) :
(x % n - y).bmod n = (x - y).bmod n
@[simp]
theorem Int.sub_emod_bmod_congr {y : Int} (x : Int) (n : Nat) :
(x - y % n).bmod n = (x - y).bmod n
@[simp]
theorem Int.emod_mul_bmod_congr {y : Int} (x : Int) (n : Nat) :
(x % n * y).bmod n = (x * y).bmod n
@[simp]
theorem Int.bmod_add_bmod_congr {x : Int} {n : Nat} {y : Int} :
(x.bmod n + y).bmod n = (x + y).bmod n
@[simp]
theorem Int.bmod_sub_bmod_congr {x : Int} {n : Nat} {y : Int} :
(x.bmod n - y).bmod n = (x - y).bmod n
@[simp]
theorem Int.add_bmod_bmod {x y : Int} {n : Nat} :
(x + y.bmod n).bmod n = (x + y).bmod n
@[simp]
theorem Int.sub_bmod_bmod {x y : Int} {n : Nat} :
(x - y.bmod n).bmod n = (x - y).bmod n
@[simp]
theorem Int.bmod_mul_bmod {x : Int} {n : Nat} {y : Int} :
(x.bmod n * y).bmod n = (x * y).bmod n
@[simp]
theorem Int.mul_bmod_bmod {x y : Int} {n : Nat} :
(x * y.bmod n).bmod n = (x * y).bmod n
theorem Int.add_bmod (a b : Int) (n : Nat) :
(a + b).bmod n = (a.bmod n + b.bmod n).bmod n
theorem Int.emod_bmod {x : Int} {m : Nat} :
(x % m).bmod m = x.bmod m
@[simp]
theorem Int.bmod_bmod {x : Int} {m : Nat} :
(x.bmod m).bmod m = x.bmod m
@[simp]
theorem Int.bmod_zero {m : Nat} :
Int.bmod 0 m = 0
theorem Int.dvd_bmod_sub_self {x : Int} {m : Nat} :
m x.bmod m - x
theorem Int.le_bmod {x : Int} {m : Nat} (h : 0 < m) :
-(m / 2) x.bmod m
theorem Int.bmod_lt {x : Int} {m : Nat} (h : 0 < m) :
x.bmod m < (m + 1) / 2
theorem Int.bmod_le {x : Int} {m : Nat} (h : 0 < m) :
x.bmod m (m - 1) / 2
theorem Int.bmod_natAbs_plus_one (x : Int) (w : 1 < x.natAbs) :
x.bmod (x.natAbs + 1) = -x.sign

Deprecations #

@[reducible, inline, deprecated Int.zero_tdiv]
abbrev Int.zero_div (b : Int) :
Int.tdiv 0 b = 0
Equations
Instances For
    @[reducible, inline, deprecated Int.tdiv_zero]
    abbrev Int.div_zero (a : Int) :
    a.tdiv 0 = 0
    Equations
    Instances For
      @[reducible, inline, deprecated Int.tdiv_eq_ediv]
      abbrev Int.div_eq_ediv {a b : Int} :
      0 a0 ba.tdiv b = a / b
      Equations
      Instances For
        @[reducible, inline, deprecated Int.fdiv_eq_tdiv]
        abbrev Int.fdiv_eq_div {a b : Int} (Ha : 0 a) (Hb : 0 b) :
        a.fdiv b = a.tdiv b
        Equations
        Instances For
          @[reducible, inline, deprecated Int.zero_tmod]
          abbrev Int.zero_mod (b : Int) :
          Int.tmod 0 b = 0
          Equations
          Instances For
            @[reducible, inline, deprecated Int.tmod_zero]
            abbrev Int.mod_zero (a : Int) :
            a.tmod 0 = a
            Equations
            Instances For
              @[reducible, inline, deprecated Int.tmod_add_tdiv]
              abbrev Int.mod_add_div (a b : Int) :
              a.tmod b + b * a.tdiv b = a
              Equations
              Instances For
                @[reducible, inline, deprecated Int.tdiv_add_tmod]
                abbrev Int.div_add_mod (a b : Int) :
                b * a.tdiv b + a.tmod b = a
                Equations
                Instances For
                  @[reducible, inline, deprecated Int.tmod_add_tdiv']
                  abbrev Int.mod_add_div' (m k : Int) :
                  m.tmod k + m.tdiv k * k = m
                  Equations
                  Instances For
                    @[reducible, inline, deprecated Int.tdiv_add_tmod']
                    abbrev Int.div_add_mod' (m k : Int) :
                    m.tdiv k * k + m.tmod k = m
                    Equations
                    Instances For
                      @[reducible, inline, deprecated Int.tmod_def]
                      abbrev Int.mod_def (a b : Int) :
                      a.tmod b = a - b * a.tdiv b
                      Equations
                      Instances For
                        @[reducible, inline, deprecated Int.tmod_eq_emod]
                        abbrev Int.mod_eq_emod {a b : Int} (ha : 0 a) (hb : 0 b) :
                        a.tmod b = a % b
                        Equations
                        Instances For
                          @[reducible, inline, deprecated Int.fmod_eq_tmod]
                          abbrev Int.fmod_eq_mod {a b : Int} (Ha : 0 a) (Hb : 0 b) :
                          a.fmod b = a.tmod b
                          Equations
                          Instances For
                            @[reducible, inline, deprecated Int.tdiv_one]
                            abbrev Int.div_one (a : Int) :
                            a.tdiv 1 = a
                            Equations
                            Instances For
                              @[reducible, inline, deprecated Int.tdiv_neg]
                              abbrev Int.div_neg (a b : Int) :
                              a.tdiv (-b) = -a.tdiv b
                              Equations
                              Instances For
                                @[reducible, inline, deprecated Int.neg_tdiv]
                                abbrev Int.neg_div (a b : Int) :
                                (-a).tdiv b = -a.tdiv b
                                Equations
                                Instances For
                                  @[reducible, inline, deprecated Int.neg_tdiv_neg]
                                  abbrev Int.neg_div_neg (a b : Int) :
                                  (-a).tdiv (-b) = a.tdiv b
                                  Equations
                                  Instances For
                                    @[reducible, inline, deprecated Int.tdiv_nonneg]
                                    abbrev Int.div_nonneg {a b : Int} (Ha : 0 a) (Hb : 0 b) :
                                    0 a.tdiv b
                                    Equations
                                    Instances For
                                      @[reducible, inline, deprecated Int.tdiv_nonpos]
                                      abbrev Int.div_nonpos {a b : Int} (Ha : 0 a) (Hb : b 0) :
                                      a.tdiv b 0
                                      Equations
                                      Instances For
                                        @[reducible, inline, deprecated Int.tdiv_eq_zero_of_lt]
                                        abbrev Int.div_eq_zero_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
                                        a.tdiv b = 0
                                        Equations
                                        Instances For
                                          @[reducible, inline, deprecated Int.mul_tdiv_cancel]
                                          abbrev Int.mul_div_cancel (a : Int) {b : Int} (H : b 0) :
                                          (a * b).tdiv b = a
                                          Equations
                                          Instances For
                                            @[reducible, inline, deprecated Int.mul_tdiv_cancel_left]
                                            abbrev Int.mul_div_cancel_left {a : Int} (b : Int) (H : a 0) :
                                            (a * b).tdiv a = b
                                            Equations
                                            Instances For
                                              @[reducible, inline, deprecated Int.tdiv_self]
                                              abbrev Int.div_self {a : Int} (H : a 0) :
                                              a.tdiv a = 1
                                              Equations
                                              Instances For
                                                @[reducible, inline, deprecated Int.mul_tdiv_cancel_of_tmod_eq_zero]
                                                abbrev Int.mul_div_cancel_of_mod_eq_zero {a b : Int} (H : a.tmod b = 0) :
                                                b * a.tdiv b = a
                                                Equations
                                                Instances For
                                                  @[reducible, inline, deprecated Int.tdiv_mul_cancel_of_tmod_eq_zero]
                                                  abbrev Int.div_mul_cancel_of_mod_eq_zero {a b : Int} (H : a.tmod b = 0) :
                                                  a.tdiv b * b = a
                                                  Equations
                                                  Instances For
                                                    @[reducible, inline, deprecated Int.dvd_of_tmod_eq_zero]
                                                    abbrev Int.dvd_of_mod_eq_zero {a b : Int} (H : b.tmod a = 0) :
                                                    a b
                                                    Equations
                                                    Instances For
                                                      @[reducible, inline, deprecated Int.mul_tdiv_assoc]
                                                      abbrev Int.mul_div_assoc (a : Int) {b c : Int} :
                                                      c b(a * b).tdiv c = a * b.tdiv c
                                                      Equations
                                                      Instances For
                                                        @[reducible, inline, deprecated Int.mul_tdiv_assoc']
                                                        abbrev Int.mul_div_assoc' (b : Int) {a c : Int} (h : c a) :
                                                        (a * b).tdiv c = a.tdiv c * b
                                                        Equations
                                                        Instances For
                                                          @[reducible, inline, deprecated Int.tdiv_dvd_tdiv]
                                                          abbrev Int.div_dvd_div {a b c : Int} :
                                                          a bb cb.tdiv a c.tdiv a
                                                          Equations
                                                          Instances For
                                                            @[reducible, inline, deprecated Int.natAbs_tdiv]
                                                            abbrev Int.natAbs_div (a b : Int) :
                                                            (a.tdiv b).natAbs = a.natAbs.div b.natAbs
                                                            Equations
                                                            Instances For
                                                              @[reducible, inline, deprecated Int.tdiv_eq_of_eq_mul_right]
                                                              abbrev Int.div_eq_of_eq_mul_right {a b c : Int} (H1 : b 0) (H2 : a = b * c) :
                                                              a.tdiv b = c
                                                              Equations
                                                              Instances For
                                                                @[reducible, inline, deprecated Int.eq_tdiv_of_mul_eq_right]
                                                                abbrev Int.eq_div_of_mul_eq_right {a b c : Int} (H1 : a 0) (H2 : a * b = c) :
                                                                b = c.tdiv a
                                                                Equations
                                                                Instances For
                                                                  @[reducible, inline, deprecated Int.ofNat_tmod]
                                                                  abbrev Int.ofNat_mod (m n : Nat) :
                                                                  (m % n) = (↑m).tmod n
                                                                  Equations
                                                                  Instances For
                                                                    @[reducible, inline, deprecated Int.tmod_one]
                                                                    abbrev Int.mod_one (a : Int) :
                                                                    a.tmod 1 = 0
                                                                    Equations
                                                                    Instances For
                                                                      @[reducible, inline, deprecated Int.tmod_eq_of_lt]
                                                                      abbrev Int.mod_eq_of_lt {a b : Int} (H1 : 0 a) (H2 : a < b) :
                                                                      a.tmod b = a
                                                                      Equations
                                                                      Instances For
                                                                        @[reducible, inline, deprecated Int.tmod_lt_of_pos]
                                                                        abbrev Int.mod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) :
                                                                        a.tmod b < b
                                                                        Equations
                                                                        Instances For
                                                                          @[reducible, inline, deprecated Int.tmod_nonneg]
                                                                          abbrev Int.mod_nonneg {a : Int} (b : Int) :
                                                                          0 a0 a.tmod b
                                                                          Equations
                                                                          Instances For
                                                                            @[reducible, inline, deprecated Int.tmod_neg]
                                                                            abbrev Int.mod_neg (a b : Int) :
                                                                            a.tmod (-b) = a.tmod b
                                                                            Equations
                                                                            Instances For
                                                                              @[reducible, inline, deprecated Int.mul_tmod_left]
                                                                              abbrev Int.mul_mod_left (a b : Int) :
                                                                              (a * b).tmod b = 0
                                                                              Equations
                                                                              Instances For
                                                                                @[reducible, inline, deprecated Int.mul_tmod_right]
                                                                                abbrev Int.mul_mod_right (a b : Int) :
                                                                                (a * b).tmod a = 0
                                                                                Equations
                                                                                Instances For
                                                                                  @[reducible, inline, deprecated Int.tmod_eq_zero_of_dvd]
                                                                                  abbrev Int.mod_eq_zero_of_dvd {a b : Int} :
                                                                                  a bb.tmod a = 0
                                                                                  Equations
                                                                                  Instances For
                                                                                    @[reducible, inline, deprecated Int.dvd_iff_tmod_eq_zero]
                                                                                    abbrev Int.dvd_iff_mod_eq_zero {a b : Int} :
                                                                                    a b b.tmod a = 0
                                                                                    Equations
                                                                                    Instances For
                                                                                      @[reducible, inline, deprecated Int.neg_mul_tmod_right]
                                                                                      abbrev Int.neg_mul_mod_right (a b : Int) :
                                                                                      (-(a * b)).tmod a = 0
                                                                                      Equations
                                                                                      Instances For
                                                                                        @[reducible, inline, deprecated Int.neg_mul_tmod_left]
                                                                                        abbrev Int.neg_mul_mod_left (a b : Int) :
                                                                                        (-(a * b)).tmod b = 0
                                                                                        Equations
                                                                                        Instances For
                                                                                          @[reducible, inline, deprecated Int.tdiv_mul_cancel]
                                                                                          abbrev Int.div_mul_cancel {a b : Int} (H : b a) :
                                                                                          a.tdiv b * b = a
                                                                                          Equations
                                                                                          Instances For
                                                                                            @[reducible, inline, deprecated Int.mul_tdiv_cancel']
                                                                                            abbrev Int.mul_div_cancel' {a b : Int} (H : a b) :
                                                                                            a * b.tdiv a = b
                                                                                            Equations
                                                                                            Instances For
                                                                                              @[reducible, inline, deprecated Int.eq_mul_of_tdiv_eq_right]
                                                                                              abbrev Int.eq_mul_of_div_eq_right {a b c : Int} (H1 : b a) (H2 : a.tdiv b = c) :
                                                                                              a = b * c
                                                                                              Equations
                                                                                              Instances For
                                                                                                @[reducible, inline, deprecated Int.tmod_self]
                                                                                                abbrev Int.mod_self {a : Int} :
                                                                                                a.tmod a = 0
                                                                                                Equations
                                                                                                Instances For
                                                                                                  @[reducible, inline, deprecated Int.neg_tmod_self]
                                                                                                  abbrev Int.neg_mod_self (a : Int) :
                                                                                                  (-a).tmod a = 0
                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    @[reducible, inline, deprecated Int.lt_tdiv_add_one_mul_self]
                                                                                                    abbrev Int.lt_div_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) :
                                                                                                    a < (a.tdiv b + 1) * b
                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      @[reducible, inline, deprecated Int.tdiv_eq_iff_eq_mul_right]
                                                                                                      abbrev Int.div_eq_iff_eq_mul_right {a b c : Int} (H : b 0) (H' : b a) :
                                                                                                      a.tdiv b = c a = b * c
                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        @[reducible, inline, deprecated Int.tdiv_eq_iff_eq_mul_left]
                                                                                                        abbrev Int.div_eq_iff_eq_mul_left {a b c : Int} (H : b 0) (H' : b a) :
                                                                                                        a.tdiv b = c a = c * b
                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          @[reducible, inline, deprecated Int.eq_mul_of_tdiv_eq_left]
                                                                                                          abbrev Int.eq_mul_of_div_eq_left {a b c : Int} (H1 : b a) (H2 : a.tdiv b = c) :
                                                                                                          a = c * b
                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            @[reducible, inline, deprecated Int.tdiv_eq_of_eq_mul_left]
                                                                                                            abbrev Int.div_eq_of_eq_mul_left {a b c : Int} (H1 : b 0) (H2 : a = c * b) :
                                                                                                            a.tdiv b = c
                                                                                                            Equations
                                                                                                            Instances For
                                                                                                              @[reducible, inline, deprecated Int.eq_zero_of_tdiv_eq_zero]
                                                                                                              abbrev Int.eq_zero_of_div_eq_zero {d n : Int} (h : d n) (H : n.tdiv d = 0) :
                                                                                                              n = 0
                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                @[reducible, inline, deprecated Int.tdiv_left_inj]
                                                                                                                abbrev Int.div_left_inj {a b d : Int} (hda : d a) (hdb : d b) :
                                                                                                                a.tdiv d = b.tdiv d a = b
                                                                                                                Equations
                                                                                                                Instances For
                                                                                                                  @[reducible, inline, deprecated Int.tdiv_sign]
                                                                                                                  abbrev Int.div_sign (a b : Int) :
                                                                                                                  a.tdiv b.sign = a * b.sign
                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    @[reducible, inline, deprecated Int.sign_eq_tdiv_abs]
                                                                                                                    abbrev Int.sign_eq_div_abs (a : Int) :
                                                                                                                    a.sign = a.tdiv a.natAbs
                                                                                                                    Equations
                                                                                                                    Instances For
                                                                                                                      @[reducible, inline, deprecated Int.tdiv_eq_ediv_of_dvd]
                                                                                                                      abbrev Int.div_eq_ediv_of_dvd {a b : Int} (h : b a) :
                                                                                                                      a.tdiv b = a / b
                                                                                                                      Equations
                                                                                                                      Instances For