test(tests/lean/run): define fibonacci using recursive equations
This commit is contained in:
parent
faf78ce3e6
commit
7fca862fc3
1 changed files with 18 additions and 0 deletions
18
tests/lean/run/eq5.lean
Normal file
18
tests/lean/run/eq5.lean
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
open nat
|
||||||
|
|
||||||
|
definition fib : nat → nat,
|
||||||
|
fib 0 := 1,
|
||||||
|
fib 1 := 1,
|
||||||
|
fib (x+2) := fib x + fib (x+1)
|
||||||
|
|
||||||
|
theorem fib0 : fib 0 = 1 :=
|
||||||
|
rfl
|
||||||
|
|
||||||
|
theorem fib1 : fib 1 = 1 :=
|
||||||
|
rfl
|
||||||
|
|
||||||
|
theorem fib_succ_succ (a : nat) : fib (a+2) = fib a + fib (a+1) :=
|
||||||
|
rfl
|
||||||
|
|
||||||
|
example : fib 8 = 34 :=
|
||||||
|
rfl
|
Loading…
Reference in a new issue