Documentation
Init
.
Data
.
Nat
.
Div
Search
Google site search
Init
.
Data
.
Nat
.
Div
source
Imports
Init.WF
Init.WFTactics
Init.Data.Nat.Basic
Imported by
Nat
.
div_rec_lemma
Nat
.
div
Nat
.
instDivNat
Nat
.
div_eq
Nat
.
div
.
inductionOn
Nat
.
div_le_self
Nat
.
div_lt_self
Nat
.
modCore
Nat
.
mod
Nat
.
instModNat
Nat
.
modCore_eq_mod
Nat
.
mod_eq
Nat
.
mod
.
inductionOn
Nat
.
mod_zero
Nat
.
mod_eq_of_lt
Nat
.
mod_eq_sub_mod
Nat
.
mod_lt
Nat
.
mod_le
Nat
.
zero_mod
Nat
.
mod_self
Nat
.
mod_one
Nat
.
div_add_mod
source
theorem
Nat
.
div_rec_lemma
{x :
Nat
}
{y :
Nat
}
:
0
<
y
∧
y
≤
x
→
x
-
y
<
x
source
@[extern lean_nat_div]
def
Nat
.
div
(x :
Nat
)
(y :
Nat
)
:
Nat
Equations
Nat.div
x
y
=
if
0
<
y
∧
y
≤
x
then
Nat.div
(
x
-
y
)
y
+
1
else
0
Instances For
source
instance
Nat
.
instDivNat
:
Div
Nat
source
theorem
Nat
.
div_eq
(x :
Nat
)
(y :
Nat
)
:
x
/
y
=
if
0
<
y
∧
y
≤
x
then
(
x
-
y
)
/
y
+
1
else
0
source
theorem
Nat
.
div
.
inductionOn
{motive :
Nat
→
Nat
→
Sort
u
}
(x :
Nat
)
(y :
Nat
)
(ind :
(
x
y :
Nat
) →
0
<
y
∧
y
≤
x
→
motive
(
x
-
y
)
y
→
motive
x
y
)
(base :
(
x
y :
Nat
) →
¬
(
0
<
y
∧
y
≤
x
)
→
motive
x
y
)
:
motive
x
y
source
theorem
Nat
.
div_le_self
(n :
Nat
)
(k :
Nat
)
:
n
/
k
≤
n
source
theorem
Nat
.
div_lt_self
{n :
Nat
}
{k :
Nat
}
(hLtN :
0
<
n
)
(hLtK :
1
<
k
)
:
n
/
k
<
n
source
@[extern lean_nat_mod]
def
Nat
.
modCore
(x :
Nat
)
(y :
Nat
)
:
Nat
Equations
Nat.modCore
x
y
=
if
0
<
y
∧
y
≤
x
then
Nat.modCore
(
x
-
y
)
y
else
x
Instances For
source
@[extern lean_nat_mod]
def
Nat
.
mod
:
Nat
→
Nat
→
Nat
Instances For
source
instance
Nat
.
instModNat
:
Mod
Nat
source
theorem
Nat
.
modCore_eq_mod
(x :
Nat
)
(y :
Nat
)
:
Nat.modCore
x
y
=
x
%
y
source
theorem
Nat
.
mod_eq
(x :
Nat
)
(y :
Nat
)
:
x
%
y
=
if
0
<
y
∧
y
≤
x
then
(
x
-
y
)
%
y
else
x
source
theorem
Nat
.
mod
.
inductionOn
{motive :
Nat
→
Nat
→
Sort
u
}
(x :
Nat
)
(y :
Nat
)
(ind :
(
x
y :
Nat
) →
0
<
y
∧
y
≤
x
→
motive
(
x
-
y
)
y
→
motive
x
y
)
(base :
(
x
y :
Nat
) →
¬
(
0
<
y
∧
y
≤
x
)
→
motive
x
y
)
:
motive
x
y
source
@[simp]
theorem
Nat
.
mod_zero
(a :
Nat
)
:
a
%
0
=
a
source
theorem
Nat
.
mod_eq_of_lt
{a :
Nat
}
{b :
Nat
}
(h :
a
<
b
)
:
a
%
b
=
a
source
theorem
Nat
.
mod_eq_sub_mod
{a :
Nat
}
{b :
Nat
}
(h :
a
≥
b
)
:
a
%
b
=
(
a
-
b
)
%
b
source
theorem
Nat
.
mod_lt
(x :
Nat
)
{y :
Nat
}
:
y
>
0
→
x
%
y
<
y
source
theorem
Nat
.
mod_le
(x :
Nat
)
(y :
Nat
)
:
x
%
y
≤
x
source
@[simp]
theorem
Nat
.
zero_mod
(b :
Nat
)
:
0
%
b
=
0
source
@[simp]
theorem
Nat
.
mod_self
(n :
Nat
)
:
n
%
n
=
0
source
theorem
Nat
.
mod_one
(x :
Nat
)
:
x
%
1
=
0
source
theorem
Nat
.
div_add_mod
(m :
Nat
)
(n :
Nat
)
:
n
*
(
m
/
n
)
+
m
%
n
=
m