Documentation
Projects
.
Util
.
Nat
.
Defs
Search
return to top
source
Imports
Init
Projects.Util.Function
Imported by
Nat
.
find?
Nat
.
find!
Nat
.
powTwo
Nat
.
chkLe
Nat
.
chkLt
Nat
.
ofProp
source
noncomputable def
Nat
.
find?
(
p
:
ℕ
→
Prop
)
:
Option
ℕ
Equations
Nat.find?
p
=
if h :
∃ (
n
:
ℕ
),
p
n
then
some
(
Nat.find
h
)
else
none
Instances For
source
noncomputable def
Nat
.
find!
(
p
:
ℕ
→
Prop
)
:
ℕ
Equations
Nat.find!
p
=
if h :
∃ (
n
:
ℕ
),
p
n
∧
∀
k
<
n
,
¬
p
k
then
h
.
choose
else
0
Instances For
source
@[irreducible]
def
Nat
.
powTwo
(
n
:
ℕ
)
:
Bool
Equations
n
.
powTwo
=
if
n
=
1
then
true
else
if
n
=
0
∨
Odd
n
then
false
else
(
n
/
2
).
powTwo
Instances For
source
def
Nat
.
chkLe
(
n
:
ℕ
)
(
p
:
ℕ
→
Bool
)
:
Bool
Equations
Nat.chkLe
0
p
=
(
p
0
&&
true
)
n_2
.
succ
.
chkLe
p
=
(
p
n_2
.
succ
&&
n_2
.
chkLe
p
)
Instances For
source
def
Nat
.
chkLt
(
n
:
ℕ
)
(
p
:
ℕ
→
Bool
)
:
Bool
Equations
Nat.chkLt
0
p
=
true
n_2
.
succ
.
chkLt
p
=
n_2
.
chkLe
p
Instances For
source
noncomputable def
Nat
.
ofProp
(
p
:
Prop
)
:
ℕ
Equations
Nat.ofProp
p
=
if
p
then
1
else
0
Instances For