7 kyu
Two definitions of Fibonacci words
31 of 68lambda-fairy
Description:
A Fibonacci word is a string of binary digits that follows specific rules.
The rules are:
- The first Fibonacci word .
- Each subsequent word is computed by mapping each symbol with , where:
Here are the first few Fibonacci words:
An interesting fact – which gives us the name "Fibonacci word" – is that each word is the concatenation of the previous two:
Prove that this is the case.
A note about Lean
In Lean, the symbols 0
and 1
are represented by ff
and tt
respectively.
Preloaded
import data.list
import data.stream.defs
def phi : bool → list bool
| ff := [ff, tt]
| tt := [ff]
def fword_aux (s : list bool) := list.bind s phi
def fword : ℕ → list bool := stream.iterate fword_aux [ff]
def SUBMISSION := ∀ n, fword (n + 2) = fword (n + 1) ++ fword n
Theorem Proving
Fundamentals
Similar Kata:
Stats:
Created | Apr 30, 2020 |
Published | May 1, 2020 |
Warriors Trained | 251 |
Total Skips | 17 |
Total Code Submissions | 91 |
Total Times Completed | 68 |
Lean Completions | 31 |
Coq Completions | 42 |
Total Stars | 7 |
% of votes with a positive feedback rating | 96% of 12 |
Total "Very Satisfied" Votes | 11 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 3 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |