Documentation
Std
.
Data
.
String
.
ToNat
Search
return to top
source
Imports
Std.Tactic.Do
Init.Data.List.Sublist
Init.Data.Nat.ToString
Init.Data.String.Search
Init.Data.String.Slice
Init.Data.String.Lemmas.Iterate
Imported by
String
.
Slice
.
isNat_iff
String
.
Slice
.
isNat_of_isDigit
String
.
Slice
.
isSome_toNat?
String
.
Slice
.
isNat_of_toNat?_eq_some
String
.
Slice
.
toNat?_eq_none_iff
String
.
Slice
.
toNat?_eq_none
String
.
Slice
.
toNat?_eq_some_ofDigitChars
String
.
Slice
.
isNat_congr
String
.
Slice
.
toNat?_congr
String
.
isNat_toSlice
String
.
isNat_comp_toSlice
String
.
toNat?_toSlice
String
.
toNat?_comp_toSlice
String
.
Slice
.
isNat_copy
String
.
Slice
.
isNat_comp_copy
String
.
Slice
.
toNat?_copy
String
.
Slice
.
toNat?_comp_copy
String
.
isNat_iff
String
.
isNat_of_isDigit
String
.
isSome_toNat?
String
.
isNat_of_toNat?_eq_some
String
.
toNat?_eq_none_iff
String
.
toNat?_eq_none
String
.
toNat?_eq_some_ofDigitChars
String
.
isNat_append_underscore_append
String
.
toNat?_append_underscore_append_eq_some
Nat
.
isNat_repr
Nat
.
toNat?_repr
Nat
.
repr_injective
Nat
.
repr_inj
source
theorem
String
.
Slice
.
isNat_iff
{
s
:
Slice
}
:
s
.
isNat
=
true
↔
s
.
isEmpty
=
false
∧
(∀ (
c
:
Char
),
c
∈
s
.
copy
.
toList
→
c
.
isDigit
=
true
∨
c
=
'_'
)
∧
¬
[
'_'
,
'_'
]
<:+:
s
.
copy
.
toList
∧
s
.
copy
.
toList
.
head?
≠
some
'_'
∧
s
.
copy
.
toList
.
getLast?
≠
some
'_'
source
theorem
String
.
Slice
.
isNat_of_isDigit
{
s
:
Slice
}
(
hne
:
s
.
isEmpty
=
false
)
(
hdigit
:
∀ (
c
:
Char
),
c
∈
s
.
copy
.
toList
→
c
.
isDigit
=
true
)
:
s
.
isNat
=
true
source
@[simp]
theorem
String
.
Slice
.
isSome_toNat?
{
s
:
Slice
}
:
s
.
toNat?
.
isSome
=
s
.
isNat
source
theorem
String
.
Slice
.
isNat_of_toNat?_eq_some
{
n
:
Nat
}
{
s
:
Slice
}
(
h
:
s
.
toNat?
=
some
n
)
:
s
.
isNat
=
true
source
@[simp]
theorem
String
.
Slice
.
toNat?_eq_none_iff
{
s
:
Slice
}
:
s
.
toNat?
=
none
↔
s
.
isNat
=
false
source
theorem
String
.
Slice
.
toNat?_eq_none
{
s
:
Slice
}
(
h
:
s
.
isNat
=
false
)
:
s
.
toNat?
=
none
source
theorem
String
.
Slice
.
toNat?_eq_some_ofDigitChars
{
s
:
Slice
}
(
h
:
s
.
isNat
=
true
)
:
s
.
toNat?
=
some
(
Nat.ofDigitChars
10
(
List.filter
(fun (
x
:
Char
) =>
x
!=
'_'
)
s
.
copy
.
toList
)
0
)
source
theorem
String
.
Slice
.
isNat_congr
{
s
t
:
Slice
}
(
h
:
s
.
copy
=
t
.
copy
)
:
s
.
isNat
=
t
.
isNat
source
theorem
String
.
Slice
.
toNat?_congr
{
s
t
:
Slice
}
(
h
:
s
.
copy
=
t
.
copy
)
:
s
.
toNat?
=
t
.
toNat?
source
@[simp]
theorem
String
.
isNat_toSlice
{
s
:
String
}
:
s
.
toSlice
.
isNat
=
s
.
isNat
source
@[simp]
theorem
String
.
isNat_comp_toSlice
:
Slice.isNat
∘
toSlice
=
isNat
source
@[simp]
theorem
String
.
toNat?_toSlice
{
s
:
String
}
:
s
.
toSlice
.
toNat?
=
s
.
toNat?
source
@[simp]
theorem
String
.
toNat?_comp_toSlice
:
Slice.toNat?
∘
toSlice
=
toNat?
source
@[simp]
theorem
String
.
Slice
.
isNat_copy
{
s
:
Slice
}
:
s
.
copy
.
isNat
=
s
.
isNat
source
@[simp]
theorem
String
.
Slice
.
isNat_comp_copy
:
String.isNat
∘
copy
=
isNat
source
@[simp]
theorem
String
.
Slice
.
toNat?_copy
{
s
:
Slice
}
:
s
.
copy
.
toNat?
=
s
.
toNat?
source
@[simp]
theorem
String
.
Slice
.
toNat?_comp_copy
:
String.toNat?
∘
copy
=
toNat?
source
theorem
String
.
isNat_iff
{
s
:
String
}
:
s
.
isNat
=
true
↔
s
≠
""
∧
(∀ (
c
:
Char
),
c
∈
s
.
toList
→
c
.
isDigit
=
true
∨
c
=
'_'
)
∧
¬
[
'_'
,
'_'
]
<:+:
s
.
toList
∧
s
.
toList
.
head?
≠
some
'_'
∧
s
.
toList
.
getLast?
≠
some
'_'
source
theorem
String
.
isNat_of_isDigit
{
s
:
String
}
(
hne
:
s
≠
""
)
(
hdigit
:
∀ (
c
:
Char
),
c
∈
s
.
toList
→
c
.
isDigit
=
true
)
:
s
.
isNat
=
true
source
@[simp]
theorem
String
.
isSome_toNat?
{
s
:
String
}
:
s
.
toNat?
.
isSome
=
s
.
isNat
source
theorem
String
.
isNat_of_toNat?_eq_some
{
n
:
Nat
}
{
s
:
String
}
(
h
:
s
.
toNat?
=
some
n
)
:
s
.
isNat
=
true
source
@[simp]
theorem
String
.
toNat?_eq_none_iff
{
s
:
String
}
:
s
.
toNat?
=
none
↔
s
.
isNat
=
false
source
theorem
String
.
toNat?_eq_none
{
s
:
String
}
(
h
:
s
.
isNat
=
false
)
:
s
.
toNat?
=
none
source
theorem
String
.
toNat?_eq_some_ofDigitChars
{
s
:
String
}
(
h
:
s
.
isNat
=
true
)
:
s
.
toNat?
=
some
(
Nat.ofDigitChars
10
(
List.filter
(fun (
x
:
Char
) =>
x
!=
'_'
)
s
.
toList
)
0
)
source
theorem
String
.
isNat_append_underscore_append
{
s
t
:
String
}
(
hs
:
s
.
isNat
=
true
)
(
ht
:
t
.
isNat
=
true
)
:
(
s
++
"_"
++
t
).
isNat
=
true
source
theorem
String
.
toNat?_append_underscore_append_eq_some
{
s
t
:
String
}
{
n
m
:
Nat
}
(
hs
:
s
.
toNat?
=
some
n
)
(
ht
:
t
.
toNat?
=
some
m
)
:
(
s
++
"_"
++
t
).
toNat?
=
some
(
10
^
(
List.filter
(fun (
x
:
Char
) =>
x
!=
'_'
)
t
.
toList
)
.
length
*
n
+
m
)
source
@[simp]
theorem
Nat
.
isNat_repr
(
n
:
Nat
)
:
n
.
repr
.
isNat
=
true
source
@[simp]
theorem
Nat
.
toNat?_repr
(
n
:
Nat
)
:
n
.
repr
.
toNat?
=
some
n
source
theorem
Nat
.
repr_injective
{
m
n
:
Nat
}
(
h
:
m
.
repr
=
n
.
repr
)
:
m
=
n
source
@[simp]
theorem
Nat
.
repr_inj
{
m
n
:
Nat
}
:
m
.
repr
=
n
.
repr
↔
m
=
n