The Fibonacci function is defined recursively like this:
fib(n) == if n= .0
n=
1
1 else fib(n-1)+fib(n-2) fi
We prove this by true-for-less induction after eliminating
Thm* .a,b:
. CoPrime(a,b)
(
x,y:
. a
x+b
y = 1)
So under the inductive hypothesis
k:
. k<n
(
x,y:
. fib(k)
x+fib(k+1)
y = 1)
we must show
a,b:
. fib(n)
a+fib(n+1)
b = 1
(we changed binding variable names to avoid confusion).
Consider the two cases of how
If it takes the first branch and computes to
If
, a,b:
. fib(n)
a+(fib(n)+fib(n-1))
b = 1
which reduces by algebraic rearrangement to showing
. a,b:
. fib(n-1)
b+fib(n)
(a+b) = 1
But applying our inductive hyp to
fib(n-1) , for somex+fib(n)
y = 1
x andy ,
so using
fib(n-1) satisfies our goal.x+fib(n)
(y-x+x) = 1
QED
About:
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() |