Question: lambda calculus Fibonacci series contains numbers 0, 1, 1, 2, 3, 5, ... where each number is the sum of the preceding two. The n
lambda calculus
Fibonacci series contains numbers 0, 1, 1, 2, 3, 5, ... where each number is the sum of the preceding two. The nth fibonacci number can be computed recursively as follows:
fib(1) = 0
fib(2) = 1
fib(n) = fib(n-1) + fib(n-2)
Write a lambda expression for this function, because this is a recursive function, you will have to nest the lambda expression taking argument n within another lambda taking f the function which you will then recursively call within the body. Plus, you will have to precede this definition with the letter Y, which represents a special kind of lambda expression called the Y combinator, which actually makes the recursion happen. So, your solution will look something like:
Y lambda f . [rest of your solution]
expressions for boolean constants and operators:
true = x.y.(x) false = x.y.(y) not = v.w.x.(v x w) or = v.w.(v v w) and = v.w.(v w v)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
