Documentation
Init
.
Data
.
Int
.
DivModLemmas
Search
Google site search
return to top
source
Imports
Init.RCases
Init.TacticsExtra
Init.Data.Int.DivMod
Init.Data.Int.Order
Init.Data.Nat.Dvd
Imported by
Int
.
ofNat_ediv
Int
.
zero_ediv
Int
.
ediv_zero
Int
.
ediv_neg
Int
.
div_def
Int
.
add_mul_ediv_right
Int
.
add_ediv_of_dvd_right
Int
.
add_ediv_of_dvd_left
Int
.
mul_ediv_cancel
Int
.
mul_ediv_cancel_left
Int
.
div_nonneg_iff_of_pos
Int
.
mod_def'
Int
.
ofNat_mod
Int
.
ofNat_mod_ofNat
Int
.
ofNat_emod
Int
.
zero_emod
Int
.
emod_zero
Int
.
emod_add_ediv
Int
.
emod_add_ediv
.
aux
Int
.
ediv_add_emod
Int
.
emod_def
Int
.
emod_nonneg
Int
.
emod_lt_of_pos
Int
.
mul_ediv_self_le
Int
.
lt_mul_ediv_self_add
Int
.
emod_add_ediv'
Int
.
add_mul_emod_self
Int
.
add_mul_emod_self_left
Int
.
add_emod_self
Int
.
add_emod_self_left
Int
.
neg_emod
Int
.
emod_add_emod
Int
.
add_emod_emod
Int
.
add_emod
Int
.
add_emod_eq_add_emod_right
Int
.
emod_add_cancel_right
Int
.
mul_emod_left
Int
.
mul_emod_right
Int
.
mul_emod
Int
.
emod_self
Int
.
emod_emod_of_dvd
Int
.
emod_emod
Int
.
sub_emod
Int
.
mul_ediv_cancel_of_emod_eq_zero
Int
.
ediv_mul_cancel_of_emod_eq_zero
Int
.
dvd_zero
Int
.
dvd_refl
Int
.
one_dvd
Int
.
dvd_trans
Int
.
zero_dvd
Int
.
neg_dvd
Int
.
dvd_neg
Int
.
dvd_mul_right
Int
.
dvd_mul_left
Int
.
dvd_add
Int
.
dvd_sub
Int
.
ofNat_dvd
Int
.
natAbs_dvd_natAbs
Int
.
ofNat_dvd_left
Int
.
dvd_of_emod_eq_zero
Int
.
dvd_emod_sub_self
Int
.
emod_eq_zero_of_dvd
Int
.
dvd_iff_emod_eq_zero
Int
.
emod_pos_of_not_dvd
Int
.
decidableDvd
Int
.
ediv_mul_cancel
Int
.
mul_ediv_cancel'
Int
.
mul_ediv_assoc
Int
.
mul_ediv_assoc'
Int
.
neg_ediv_of_dvd
Int
.
sub_ediv_of_dvd
Int
.
ediv_one
Int
.
emod_one
Int
.
ediv_self
Int
.
Int
.
emod_sub_cancel
Int
.
bmod_emod
Int
.
emod_bmod_congr
Int
.
bmod_def
Int
.
bmod_pos
Int
.
bmod_neg
Int
.
bmod_one_is_zero
Int
.
bmod_add_cancel
Int
.
bmod_add_mul_cancel
Int
.
bmod_sub_cancel
Int
.
emod_add_bmod_congr
Int
.
bmod_add_bmod_congr
Int
.
add_bmod_bmod
Lemmas about integer division needed to bootstrap
omega
.
#
/
#
source
@[simp]
theorem
Int
.
ofNat_ediv
(m :
Nat
)
(n :
Nat
)
:
↑
(
m
/
n
)
=
↑
m
/
↑
n
source
@[simp]
theorem
Int
.
zero_ediv
(b :
Int
)
:
0
/
b
=
0
source
@[simp]
theorem
Int
.
ediv_zero
(a :
Int
)
:
a
/
0
=
0
source
@[simp]
theorem
Int
.
ediv_neg
(a :
Int
)
(b :
Int
)
:
a
/
-
b
=
-
(
a
/
b
)
source
theorem
Int
.
div_def
(a :
Int
)
(b :
Int
)
:
a
/
b
=
Int.ediv
a
b
source
theorem
Int
.
add_mul_ediv_right
(a :
Int
)
(b :
Int
)
{c :
Int
}
(H :
c
≠
0
)
:
(
a
+
b
*
c
)
/
c
=
a
/
c
+
b
source
theorem
Int
.
add_ediv_of_dvd_right
{a :
Int
}
{b :
Int
}
{c :
Int
}
(H :
c
∣
b
)
:
(
a
+
b
)
/
c
=
a
/
c
+
b
/
c
source
theorem
Int
.
add_ediv_of_dvd_left
{a :
Int
}
{b :
Int
}
{c :
Int
}
(H :
c
∣
a
)
:
(
a
+
b
)
/
c
=
a
/
c
+
b
/
c
source
@[simp]
theorem
Int
.
mul_ediv_cancel
(a :
Int
)
{b :
Int
}
(H :
b
≠
0
)
:
a
*
b
/
b
=
a
source
@[simp]
theorem
Int
.
mul_ediv_cancel_left
{a :
Int
}
(b :
Int
)
(H :
a
≠
0
)
:
a
*
b
/
a
=
b
source
theorem
Int
.
div_nonneg_iff_of_pos
{a :
Int
}
{b :
Int
}
(h :
0
<
b
)
:
a
/
b
≥
0
↔
a
≥
0
mod
#
source
theorem
Int
.
mod_def'
(m :
Int
)
(n :
Int
)
:
m
%
n
=
Int.emod
m
n
source
theorem
Int
.
ofNat_mod
(m :
Nat
)
(n :
Nat
)
:
↑
(
m
%
n
)
=
Int.mod
↑
m
↑
n
source
theorem
Int
.
ofNat_mod_ofNat
(m :
Nat
)
(n :
Nat
)
:
↑
m
%
↑
n
=
↑
(
m
%
n
)
source
@[simp]
theorem
Int
.
ofNat_emod
(m :
Nat
)
(n :
Nat
)
:
↑
(
m
%
n
)
=
↑
m
%
↑
n
source
@[simp]
theorem
Int
.
zero_emod
(b :
Int
)
:
0
%
b
=
0
source
@[simp]
theorem
Int
.
emod_zero
(a :
Int
)
:
a
%
0
=
a
source
theorem
Int
.
emod_add_ediv
(a :
Int
)
(b :
Int
)
:
a
%
b
+
b
*
(
a
/
b
)
=
a
source
theorem
Int
.
emod_add_ediv
.
aux
(m :
Nat
)
(n :
Nat
)
:
↑
n
-
(
↑
m
%
↑
n
+
1
)
-
(
↑
n
*
(
↑
m
/
↑
n
)
+
↑
n
)
=
Int.negSucc
m
source
theorem
Int
.
ediv_add_emod
(a :
Int
)
(b :
Int
)
:
b
*
(
a
/
b
)
+
a
%
b
=
a
source
theorem
Int
.
emod_def
(a :
Int
)
(b :
Int
)
:
a
%
b
=
a
-
b
*
(
a
/
b
)
source
theorem
Int
.
emod_nonneg
(a :
Int
)
{b :
Int
}
:
b
≠
0
→
0
≤
a
%
b
source
theorem
Int
.
emod_lt_of_pos
(a :
Int
)
{b :
Int
}
(H :
0
<
b
)
:
a
%
b
<
b
source
theorem
Int
.
mul_ediv_self_le
{x :
Int
}
{k :
Int
}
(h :
k
≠
0
)
:
k
*
(
x
/
k
)
≤
x
source
theorem
Int
.
lt_mul_ediv_self_add
{x :
Int
}
{k :
Int
}
(h :
0
<
k
)
:
x
<
k
*
(
x
/
k
)
+
k
source
theorem
Int
.
emod_add_ediv'
(m :
Int
)
(k :
Int
)
:
m
%
k
+
m
/
k
*
k
=
m
source
@[simp]
theorem
Int
.
add_mul_emod_self
{a :
Int
}
{b :
Int
}
{c :
Int
}
:
(
a
+
b
*
c
)
%
c
=
a
%
c
source
@[simp]
theorem
Int
.
add_mul_emod_self_left
(a :
Int
)
(b :
Int
)
(c :
Int
)
:
(
a
+
b
*
c
)
%
b
=
a
%
b
source
@[simp]
theorem
Int
.
add_emod_self
{a :
Int
}
{b :
Int
}
:
(
a
+
b
)
%
b
=
a
%
b
source
@[simp]
theorem
Int
.
add_emod_self_left
{a :
Int
}
{b :
Int
}
:
(
a
+
b
)
%
a
=
b
%
a
source
theorem
Int
.
neg_emod
{a :
Int
}
{b :
Int
}
:
-
a
%
b
=
(
b
-
a
)
%
b
source
@[simp]
theorem
Int
.
emod_add_emod
(m :
Int
)
(n :
Int
)
(k :
Int
)
:
(
m
%
n
+
k
)
%
n
=
(
m
+
k
)
%
n
source
@[simp]
theorem
Int
.
add_emod_emod
(m :
Int
)
(n :
Int
)
(k :
Int
)
:
(
m
+
n
%
k
)
%
k
=
(
m
+
n
)
%
k
source
theorem
Int
.
add_emod
(a :
Int
)
(b :
Int
)
(n :
Int
)
:
(
a
+
b
)
%
n
=
(
a
%
n
+
b
%
n
)
%
n
source
theorem
Int
.
add_emod_eq_add_emod_right
{m :
Int
}
{n :
Int
}
{k :
Int
}
(i :
Int
)
(H :
m
%
n
=
k
%
n
)
:
(
m
+
i
)
%
n
=
(
k
+
i
)
%
n
source
theorem
Int
.
emod_add_cancel_right
{m :
Int
}
{n :
Int
}
{k :
Int
}
(i :
Int
)
:
(
m
+
i
)
%
n
=
(
k
+
i
)
%
n
↔
m
%
n
=
k
%
n
source
@[simp]
theorem
Int
.
mul_emod_left
(a :
Int
)
(b :
Int
)
:
a
*
b
%
b
=
0
source
@[simp]
theorem
Int
.
mul_emod_right
(a :
Int
)
(b :
Int
)
:
a
*
b
%
a
=
0
source
theorem
Int
.
mul_emod
(a :
Int
)
(b :
Int
)
(n :
Int
)
:
a
*
b
%
n
=
a
%
n
*
(
b
%
n
)
%
n
source
theorem
Int
.
emod_self
{a :
Int
}
:
a
%
a
=
0
source
@[simp]
theorem
Int
.
emod_emod_of_dvd
(n :
Int
)
{m :
Int
}
{k :
Int
}
(h :
m
∣
k
)
:
n
%
k
%
m
=
n
%
m
source
@[simp]
theorem
Int
.
emod_emod
(a :
Int
)
(b :
Int
)
:
a
%
b
%
b
=
a
%
b
source
theorem
Int
.
sub_emod
(a :
Int
)
(b :
Int
)
(n :
Int
)
:
(
a
-
b
)
%
n
=
(
a
%
n
-
b
%
n
)
%
n
properties of
/
and
%
#
source
theorem
Int
.
mul_ediv_cancel_of_emod_eq_zero
{a :
Int
}
{b :
Int
}
(H :
a
%
b
=
0
)
:
b
*
(
a
/
b
)
=
a
source
theorem
Int
.
ediv_mul_cancel_of_emod_eq_zero
{a :
Int
}
{b :
Int
}
(H :
a
%
b
=
0
)
:
a
/
b
*
b
=
a
dvd
#
source
theorem
Int
.
dvd_zero
(n :
Int
)
:
n
∣
0
source
theorem
Int
.
dvd_refl
(n :
Int
)
:
n
∣
n
source
theorem
Int
.
one_dvd
(n :
Int
)
:
1
∣
n
source
theorem
Int
.
dvd_trans
{a :
Int
}
{b :
Int
}
{c :
Int
}
:
a
∣
b
→
b
∣
c
→
a
∣
c
source
@[simp]
theorem
Int
.
zero_dvd
{n :
Int
}
:
0
∣
n
↔
n
=
0
source
theorem
Int
.
neg_dvd
{a :
Int
}
{b :
Int
}
:
-
a
∣
b
↔
a
∣
b
source
theorem
Int
.
dvd_neg
{a :
Int
}
{b :
Int
}
:
a
∣
-
b
↔
a
∣
b
source
theorem
Int
.
dvd_mul_right
(a :
Int
)
(b :
Int
)
:
a
∣
a
*
b
source
theorem
Int
.
dvd_mul_left
(a :
Int
)
(b :
Int
)
:
b
∣
a
*
b
source
theorem
Int
.
dvd_add
{a :
Int
}
{b :
Int
}
{c :
Int
}
:
a
∣
b
→
a
∣
c
→
a
∣
b
+
c
source
theorem
Int
.
dvd_sub
{a :
Int
}
{b :
Int
}
{c :
Int
}
:
a
∣
b
→
a
∣
c
→
a
∣
b
-
c
source
theorem
Int
.
ofNat_dvd
{m :
Nat
}
{n :
Nat
}
:
↑
m
∣
↑
n
↔
m
∣
n
source
@[simp]
theorem
Int
.
natAbs_dvd_natAbs
{a :
Int
}
{b :
Int
}
:
Int.natAbs
a
∣
Int.natAbs
b
↔
a
∣
b
source
theorem
Int
.
ofNat_dvd_left
{n :
Nat
}
{z :
Int
}
:
↑
n
∣
z
↔
n
∣
Int.natAbs
z
source
theorem
Int
.
dvd_of_emod_eq_zero
{a :
Int
}
{b :
Int
}
(H :
b
%
a
=
0
)
:
a
∣
b
source
theorem
Int
.
dvd_emod_sub_self
{x :
Int
}
{m :
Nat
}
:
↑
m
∣
x
%
↑
m
-
x
source
theorem
Int
.
emod_eq_zero_of_dvd
{a :
Int
}
{b :
Int
}
:
a
∣
b
→
b
%
a
=
0
source
theorem
Int
.
dvd_iff_emod_eq_zero
(a :
Int
)
(b :
Int
)
:
a
∣
b
↔
b
%
a
=
0
source
theorem
Int
.
emod_pos_of_not_dvd
{a :
Int
}
{b :
Int
}
(h :
¬
a
∣
b
)
:
a
=
0
∨
0
<
b
%
a
source
instance
Int
.
decidableDvd
:
DecidableRel
fun (
x
x_1 :
Int
) =>
x
∣
x_1
Equations
Int.decidableDvd
x✝
x
=
decidable_of_decidable_of_iff
⋯
source
theorem
Int
.
ediv_mul_cancel
{a :
Int
}
{b :
Int
}
(H :
b
∣
a
)
:
a
/
b
*
b
=
a
source
theorem
Int
.
mul_ediv_cancel'
{a :
Int
}
{b :
Int
}
(H :
a
∣
b
)
:
a
*
(
b
/
a
)
=
b
source
theorem
Int
.
mul_ediv_assoc
(a :
Int
)
{b :
Int
}
{c :
Int
}
:
c
∣
b
→
a
*
b
/
c
=
a
*
(
b
/
c
)
source
theorem
Int
.
mul_ediv_assoc'
(b :
Int
)
{a :
Int
}
{c :
Int
}
(h :
c
∣
a
)
:
a
*
b
/
c
=
a
/
c
*
b
source
theorem
Int
.
neg_ediv_of_dvd
{a :
Int
}
{b :
Int
}
:
b
∣
a
→
-
a
/
b
=
-
(
a
/
b
)
source
theorem
Int
.
sub_ediv_of_dvd
(a :
Int
)
{b :
Int
}
{c :
Int
}
(hcb :
c
∣
b
)
:
(
a
-
b
)
/
c
=
a
/
c
-
b
/
c
source
@[simp]
theorem
Int
.
ediv_one
(a :
Int
)
:
a
/
1
=
a
source
@[simp]
theorem
Int
.
emod_one
(a :
Int
)
:
a
%
1
=
0
source
@[simp]
theorem
Int
.
ediv_self
{a :
Int
}
(H :
a
≠
0
)
:
a
/
a
=
1
source
@[simp]
theorem
Int
.
Int
.
emod_sub_cancel
(x :
Int
)
(y :
Int
)
:
(
x
-
y
)
%
y
=
x
%
y
bmod
source
@[simp]
theorem
Int
.
bmod_emod
{x :
Int
}
{m :
Nat
}
:
Int.bmod
x
m
%
↑
m
=
x
%
↑
m
source
@[simp]
theorem
Int
.
emod_bmod_congr
(x :
Int
)
(n :
Nat
)
:
Int.bmod
(
x
%
↑
n
)
n
=
Int.bmod
x
n
source
theorem
Int
.
bmod_def
(x :
Int
)
(m :
Nat
)
:
Int.bmod
x
m
=
if
x
%
↑
m
<
(
↑
m
+
1
)
/
2
then
x
%
↑
m
else
x
%
↑
m
-
↑
m
source
theorem
Int
.
bmod_pos
(x :
Int
)
(m :
Nat
)
(p :
x
%
↑
m
<
(
↑
m
+
1
)
/
2
)
:
Int.bmod
x
m
=
x
%
↑
m
source
theorem
Int
.
bmod_neg
(x :
Int
)
(m :
Nat
)
(p :
x
%
↑
m
≥
(
↑
m
+
1
)
/
2
)
:
Int.bmod
x
m
=
x
%
↑
m
-
↑
m
source
@[simp]
theorem
Int
.
bmod_one_is_zero
(x :
Int
)
:
Int.bmod
x
1
=
0
source
@[simp]
theorem
Int
.
bmod_add_cancel
(x :
Int
)
(n :
Nat
)
:
Int.bmod
(
x
+
↑
n
)
n
=
Int.bmod
x
n
source
@[simp]
theorem
Int
.
bmod_add_mul_cancel
(x :
Int
)
(n :
Nat
)
(k :
Int
)
:
Int.bmod
(
x
+
↑
n
*
k
)
n
=
Int.bmod
x
n
source
@[simp]
theorem
Int
.
bmod_sub_cancel
(x :
Int
)
(n :
Nat
)
:
Int.bmod
(
x
-
↑
n
)
n
=
Int.bmod
x
n
source
@[simp]
theorem
Int
.
emod_add_bmod_congr
{y :
Int
}
(x :
Int
)
(n :
Nat
)
:
Int.bmod
(
x
%
↑
n
+
y
)
n
=
Int.bmod
(
x
+
y
)
n
source
@[simp]
theorem
Int
.
bmod_add_bmod_congr
{x :
Int
}
{n :
Nat
}
{y :
Int
}
:
Int.bmod
(
Int.bmod
x
n
+
y
)
n
=
Int.bmod
(
x
+
y
)
n
source
@[simp]
theorem
Int
.
add_bmod_bmod
{x :
Int
}
{y :
Int
}
{n :
Nat
}
:
Int.bmod
(
x
+
Int.bmod
y
n
)
n
=
Int.bmod
(
x
+
y
)
n