Documentation
Acmoi
.
Exercise1_11
Search
Google site search
return to top
source
Imports
Init
Mathlib.Tactic.Ring
Mathlib.Data.List.Basic
Imported by
power'
power_length'
nontrivial_power'
c'
primitive'
short_primitive'
List_nil_primitive'
singleton_primitive'
repeat_is_power'
repeat_not_primitive'
List_nil_length
List_ne_nil
middle_of_List_repeat
why_01n_is_primitive
power_manipulations
power_succ
length_manipulations
primitive_words_of_length_two_or_more
succ_succ
primitive_words_of_every_length
source
def
power'
(u :
List
(
Fin
2
)
)
(k :
ℕ
)
:
List
(
Fin
2
)
Equations
power'
u
k
=
Nat.recOn
k
[]
fun (
x
:
ℕ
) (
pow_ind
:
List
(
Fin
2
)
) =>
u
++
pow_ind
Instances For
source
theorem
power_length'
(u :
List
(
Fin
2
)
)
(k :
ℕ
)
:
(
power'
u
k
)
.length
=
k
*
u
.length
source
def
nontrivial_power'
(x :
List
(
Fin
2
)
)
:
Prop
Equations
nontrivial_power'
x
=
∃ (
k
:
ℕ
) (
u
:
List
(
Fin
2
)
),
1
≤
u
.length
∧
x
=
power'
u
k
.succ
.succ
Instances For
source
def
c'
:
List
(
Fin
2
)
Equations
c'
=
[
0
,
0
]
Instances For
source
def
primitive'
(x :
List
(
Fin
2
)
)
:
Prop
Equations
primitive'
x
=
¬
nontrivial_power'
x
Instances For
source
theorem
short_primitive'
(x :
List
(
Fin
2
)
)
(h :
x
.length
≤
1
)
:
primitive'
x
source
theorem
List_nil_primitive'
:
primitive'
[]
source
theorem
singleton_primitive'
:
primitive'
[
0
]
source
theorem
repeat_is_power'
{k :
ℕ
}
:
List.replicate
k
.succ
.succ
0
=
power'
[
0
]
k
.succ
.succ
source
theorem
repeat_not_primitive'
{k :
ℕ
}
:
nontrivial_power'
(
List.replicate
k
.succ
.succ
0
)
source
theorem
List_nil_length
:
[]
.length
=
0
source
theorem
List_ne_nil
(x :
List
(
Fin
2
)
)
(h :
x
.length
≠
0
)
:
x
≠
[]
source
theorem
middle_of_List_repeat
{b :
Fin
2
}
{v :
List
(
Fin
2
)
}
{u :
List
(
Fin
2
)
}
:
List.replicate
(
u
.length
+
v
.length
)
.succ
1
=
u
++
b
::
v
→
b
=
1
source
theorem
why_01n_is_primitive
(u :
List
(
Fin
2
)
)
(v :
List
(
Fin
2
)
)
(a :
Fin
2
)
(b :
Fin
2
)
(h :
0
::
List.replicate
(
u
.length
+
v
.length
)
.succ
1
=
a
::
u
++
b
::
v
)
:
a
=
0
∧
b
=
1
source
theorem
power_manipulations
(l :
ℕ
)
{u :
List
(
Fin
2
)
}
{v :
List
(
Fin
2
)
}
{a :
Fin
2
}
(hv :
u
=
a
::
v
)
:
power'
u
l
.succ
.succ
=
a
::
v
++
a
::
(
v
++
power'
u
l
)
source
theorem
power_succ
(l :
ℕ
)
(u :
List
(
Fin
2
)
)
:
(
power'
u
l
.succ
.succ
)
.length
=
(
power'
u
l
)
.length
+
u
.length
+
u
.length
source
theorem
length_manipulations
{k :
ℕ
}
{l :
ℕ
}
{u :
List
(
Fin
2
)
}
{v :
List
(
Fin
2
)
}
{a :
Fin
2
}
(hv :
u
=
a
::
v
)
(hu2 :
0
::
List.replicate
k
.succ
1
=
power'
u
l
.succ
.succ
)
:
0
::
List.replicate
(
v
.length
+
(
v
++
power'
u
l
)
.length
)
.succ
1
=
a
::
v
++
a
::
(
v
++
power'
u
l
)
source
theorem
primitive_words_of_length_two_or_more
(k :
ℕ
)
:
∃ (
x
:
List
(
Fin
2
)
),
x
.length
=
k
.succ
.succ
∧
primitive'
x
source
theorem
succ_succ
{n :
ℕ
}
(h :
n
≠
0
)
(hn :
n
≠
1
)
:
∃ (
k
:
ℕ
),
n
=
k
.succ
.succ
source
theorem
primitive_words_of_every_length
(n :
ℕ
)
:
∃ (
x
:
List
(
Fin
2
)
),
x
.length
=
n
∧
primitive'
x