hilbert
6
Search
☰
About
Tutorial
Roadmap
Get involved
Reference manual
Blueprint
API docs
Papers
About
Tutorial
Roadmap
Get involved
Reference manual
Blueprint
API docs
Papers
GitHub
return to top
source
Imports
Init.ByCases
Init.RCases
Init.Data.Int.Lemmas
Init.Data.Int.Order
Init.Data.Nat.Dvd
Init.Data.Int.DivMod.Basic
Init.Data.Nat.Div.Basic
Imported by
Int
.
dvd_def
Int
.
dvd_zero
Int
.
dvd_refl
Int
.
one_dvd
Int
.
dvd_trans
Int
.
ofNat_dvd
Int
.
zero_dvd
Int
.
dvd_mul_right
Int
.
dvd_mul_left
Int
.
neg_dvd
Int
.
dvd_neg
Int
.
natAbs_dvd_natAbs
Int
.
ofNat_dvd_left
Int
.
zero_ediv
Int
.
ediv_zero
Int
.
zero_emod
Int
.
emod_zero
Int
.
natCast_emod
Int
.
emod_add_mul_ediv
Int
.
emod_add_ediv_mul
Int
.
mul_ediv_add_emod
Int
.
ediv_mul_add_emod
Int
.
emod_def
Int
.
mul_ediv_self
Int
.
ediv_mul_self
Int
.
ediv_neg
Int
.
div_def
Int
.
add_mul_ediv_right
Int
.
add_mul_ediv_left
Int
.
add_ediv_of_dvd_right
Int
.
add_ediv_of_dvd_left
Int
.
mul_ediv_cancel
Int
.
mul_ediv_cancel_left
Int
.
ediv_nonneg_iff_of_pos
Int
.
emod_nonneg
Int
.
emod_lt_of_pos
Int
.
add_mul_emod_self_right
Int
.
add_mul_emod_self_left
Int
.
mul_add_emod_self_right
Int
.
mul_add_emod_self_left
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_of_emod_eq_zero
Int
.
emod_eq_zero_of_dvd
Int
.
dvd_iff_emod_eq_zero
Int
.
mul_ediv_assoc
Int
.
mul_ediv_assoc'
Int
.
neg_ediv_of_dvd
Int
.
sub_ediv_of_dvd
Int
.
ediv_mul_cancel
Int
.
mul_ediv_cancel'
Int
.
emod_pos_of_not_dvd
Int
.
mul_ediv_self_le
Int
.
lt_mul_ediv_self_add
Int
.
bmod_emod
Int
.
bmod_def
Init
.
Data
.
Int
.
DivMod
.
Bootstrap
Lemmas about integer division needed to bootstrap
omega
.
#
dvd
#
source
theorem
Int
.
dvd_def
(
a
b
:
Int
)
:
(
a
∣
b
)
=
∃
(
c
:
Int
)
,
b
=
a
*
c
source
@[simp]
theorem
Int
.
dvd_zero
(
n
:
Int
)
:
n
∣
0
source
@[simp]
theorem
Int
.
dvd_refl
(
n
:
Int
)
:
n
∣
n
source
@[simp]
theorem
Int
.
one_dvd
(
n
:
Int
)
:
1
∣
n
source
theorem
Int
.
dvd_trans
{
a
b
c
:
Int
}
:
a
∣
b
→
b
∣
c
→
a
∣
c
source
theorem
Int
.
ofNat_dvd
{
m
n
:
Nat
}
:
↑
m
∣
↑
n
↔
m
∣
n
source
@[simp]
theorem
Int
.
zero_dvd
{
n
:
Int
}
:
0
∣
n
↔
n
=
0
source
@[simp]
theorem
Int
.
dvd_mul_right
(
a
b
:
Int
)
:
a
∣
a
*
b
source
@[simp]
theorem
Int
.
dvd_mul_left
(
a
b
:
Int
)
:
b
∣
a
*
b
source
@[simp]
theorem
Int
.
neg_dvd
{
a
b
:
Int
}
:
-
a
∣
b
↔
a
∣
b
source
@[simp]
theorem
Int
.
dvd_neg
{
a
b
:
Int
}
:
a
∣
-
b
↔
a
∣
b
source
@[simp]
theorem
Int
.
natAbs_dvd_natAbs
{
a
b
:
Int
}
:
a
.
natAbs
∣
b
.
natAbs
↔
a
∣
b
source
theorem
Int
.
ofNat_dvd_left
{
n
:
Nat
}
{
z
:
Int
}
:
↑
n
∣
z
↔
n
∣
z
.
natAbs
ediv zero
#
source
@[simp]
theorem
Int
.
zero_ediv
(
b
:
Int
)
:
0
/
b
=
0
source
@[simp]
theorem
Int
.
ediv_zero
(
a
:
Int
)
:
a
/
0
=
0
emod zero
#
source
@[simp]
theorem
Int
.
zero_emod
(
b
:
Int
)
:
0
%
b
=
0
source
@[simp]
theorem
Int
.
emod_zero
(
a
:
Int
)
:
a
%
0
=
a
ofNat mod
#
source
@[simp]
theorem
Int
.
natCast_emod
(
m
n
:
Nat
)
:
↑(
m
%
n
)
=
↑
m
%
↑
n
mod definitions
#
source
theorem
Int
.
emod_add_mul_ediv
(
a
b
:
Int
)
:
a
%
b
+
b
*
(
a
/
b
)
=
a
source
theorem
Int
.
emod_add_ediv_mul
(
a
b
:
Int
)
:
a
%
b
+
a
/
b
*
b
=
a
source
theorem
Int
.
mul_ediv_add_emod
(
a
b
:
Int
)
:
b
*
(
a
/
b
)
+
a
%
b
=
a
source
theorem
Int
.
ediv_mul_add_emod
(
a
b
:
Int
)
:
a
/
b
*
b
+
a
%
b
=
a
source
theorem
Int
.
emod_def
(
a
b
:
Int
)
:
a
%
b
=
a
-
b
*
(
a
/
b
)
source
theorem
Int
.
mul_ediv_self
(
a
b
:
Int
)
:
b
*
(
a
/
b
)
=
a
-
a
%
b
source
theorem
Int
.
ediv_mul_self
(
a
b
:
Int
)
:
a
/
b
*
b
=
a
-
a
%
b
/
ediv
#
source
@[simp]
theorem
Int
.
ediv_neg
(
a
b
:
Int
)
:
a
/
-
b
=
-
(
a
/
b
)
source
theorem
Int
.
div_def
(
a
b
:
Int
)
:
a
/
b
=
a
.
ediv
b
source
theorem
Int
.
add_mul_ediv_right
(
a
b
:
Int
)
{
c
:
Int
}
(
H
:
c
≠
0
)
:
(
a
+
b
*
c
)
/
c
=
a
/
c
+
b
source
theorem
Int
.
add_mul_ediv_left
(
a
:
Int
)
{
b
:
Int
}
(
c
:
Int
)
(
H
:
b
≠
0
)
:
(
a
+
b
*
c
)
/
b
=
a
/
b
+
c
source
theorem
Int
.
add_ediv_of_dvd_right
{
a
b
c
:
Int
}
(
H
:
c
∣
b
)
:
(
a
+
b
)
/
c
=
a
/
c
+
b
/
c
source
theorem
Int
.
add_ediv_of_dvd_left
{
a
b
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
.
ediv_nonneg_iff_of_pos
{
a
b
:
Int
}
(
h
:
0
<
b
)
:
0
≤
a
/
b
↔
0
≤
a
emod
#
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
@[simp]
theorem
Int
.
add_mul_emod_self_right
(
a
b
c
:
Int
)
:
(
a
+
b
*
c
)
%
c
=
a
%
c
source
@[simp]
theorem
Int
.
add_mul_emod_self_left
(
a
b
c
:
Int
)
:
(
a
+
b
*
c
)
%
b
=
a
%
b
source
@[simp]
theorem
Int
.
mul_add_emod_self_right
(
a
b
c
:
Int
)
:
(
a
*
b
+
c
)
%
b
=
c
%
b
source
@[simp]
theorem
Int
.
mul_add_emod_self_left
(
a
b
c
:
Int
)
:
(
a
*
b
+
c
)
%
a
=
c
%
a
source
@[simp]
theorem
Int
.
emod_add_emod
(
m
n
k
:
Int
)
:
(
m
%
n
+
k
)
%
n
=
(
m
+
k
)
%
n
source
@[simp]
theorem
Int
.
add_emod_emod
(
m
n
k
:
Int
)
:
(
m
+
n
%
k
)
%
k
=
(
m
+
n
)
%
k
source
theorem
Int
.
add_emod
(
a
b
n
:
Int
)
:
(
a
+
b
)
%
n
=
(
a
%
n
+
b
%
n
)
%
n
source
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
source
theorem
Int
.
emod_add_cancel_right
{
m
n
k
:
Int
}
(
i
:
Int
)
:
(
m
+
i
)
%
n
=
(
k
+
i
)
%
n
↔
m
%
n
=
k
%
n
source
@[simp]
theorem
Int
.
mul_emod_left
(
a
b
:
Int
)
:
a
*
b
%
b
=
0
source
@[simp]
theorem
Int
.
mul_emod_right
(
a
b
:
Int
)
:
a
*
b
%
a
=
0
source
theorem
Int
.
mul_emod
(
a
b
n
:
Int
)
:
a
*
b
%
n
=
a
%
n
*
(
b
%
n
)
%
n
source
@[simp]
theorem
Int
.
emod_self
{
a
:
Int
}
:
a
%
a
=
0
source
@[simp]
theorem
Int
.
emod_emod_of_dvd
(
n
:
Int
)
{
m
k
:
Int
}
(
h
:
m
∣
k
)
:
n
%
k
%
m
=
n
%
m
source
theorem
Int
.
emod_emod
(
a
b
:
Int
)
:
a
%
b
%
b
=
a
%
b
source
theorem
Int
.
sub_emod
(
a
b
n
:
Int
)
:
(
a
-
b
)
%
n
=
(
a
%
n
-
b
%
n
)
%
n
properties of
/
and
%
#
source
theorem
Int
.
mul_ediv_cancel_of_emod_eq_zero
{
a
b
:
Int
}
(
H
:
a
%
b
=
0
)
:
b
*
(
a
/
b
)
=
a
source
theorem
Int
.
ediv_mul_cancel_of_emod_eq_zero
{
a
b
:
Int
}
(
H
:
a
%
b
=
0
)
:
a
/
b
*
b
=
a
source
theorem
Int
.
dvd_of_emod_eq_zero
{
a
b
:
Int
}
(
H
:
b
%
a
=
0
)
:
a
∣
b
source
theorem
Int
.
emod_eq_zero_of_dvd
{
a
b
:
Int
}
:
a
∣
b
→
b
%
a
=
0
source
theorem
Int
.
dvd_iff_emod_eq_zero
{
a
b
:
Int
}
:
a
∣
b
↔
b
%
a
=
0
source
theorem
Int
.
mul_ediv_assoc
(
a
:
Int
)
{
b
c
:
Int
}
:
c
∣
b
→
a
*
b
/
c
=
a
*
(
b
/
c
)
source
theorem
Int
.
mul_ediv_assoc'
(
b
:
Int
)
{
a
c
:
Int
}
(
h
:
c
∣
a
)
:
a
*
b
/
c
=
a
/
c
*
b
source
theorem
Int
.
neg_ediv_of_dvd
{
a
b
:
Int
}
:
b
∣
a
→
-
a
/
b
=
-
(
a
/
b
)
source
theorem
Int
.
sub_ediv_of_dvd
(
a
:
Int
)
{
b
c
:
Int
}
(
hcb
:
c
∣
b
)
:
(
a
-
b
)
/
c
=
a
/
c
-
b
/
c
source
theorem
Int
.
ediv_mul_cancel
{
a
b
:
Int
}
(
H
:
b
∣
a
)
:
a
/
b
*
b
=
a
source
theorem
Int
.
mul_ediv_cancel'
{
a
b
:
Int
}
(
H
:
a
∣
b
)
:
a
*
(
b
/
a
)
=
b
source
theorem
Int
.
emod_pos_of_not_dvd
{
a
b
:
Int
}
(
h
:
¬
a
∣
b
)
:
a
=
0
∨
0
<
b
%
a
/
and ordering
#
source
theorem
Int
.
mul_ediv_self_le
{
x
k
:
Int
}
(
h
:
k
≠
0
)
:
k
*
(
x
/
k
)
≤
x
source
theorem
Int
.
lt_mul_ediv_self_add
{
x
k
:
Int
}
(
h
:
0
<
k
)
:
x
<
k
*
(
x
/
k
)
+
k
bmod
#
source
@[simp]
theorem
Int
.
bmod_emod
{
x
:
Int
}
{
m
:
Nat
}
:
x
.
bmod
m
%
↑
m
=
x
%
↑
m
source
theorem
Int
.
bmod_def
(
x
:
Int
)
(
m
:
Nat
)
:
x
.
bmod
m
=
if
x
%
↑
m
<
(
↑
m
+
1
)
/
2
then
x
%
↑
m
else
x
%
↑
m
-
↑
m