Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 [10 Points). Using the definitions of boolean constants and operators presented in class, show that the following evaluates to true. Show all your

image text in transcribed

Problem 2 [10 Points). Using the definitions of boolean constants and operators presented in class, show that the following evaluates to true. Show all your steps for a perfect mark. Always evaluate the "outer" applications first i.e., use lazy evaluation), but continue to evaluate further until you obtain true. or false (and true (not false)) Problem 3 [5 + 5 Points). Consider a function if which takes three arguments: a boolean, an expression to evaluate if the boolean is true, and a second expression to evaluate if the boolean is false. a) Given the lambda expressions for boolean constants and operators presented in class, write the lambda expression for this if function. b) Write the lambda expression for a function ifthenelse which takes five arguments: a boolean, an expression to evaluate if the boolean is true, another boolean, an expression to evaluate if the second boolean is true, and a third expression to evaluate if both booleans are false. You may assume that a correct implementation of function if from (a) is available to you, and use it if you like. Problem 4 [10 Points). The 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 this functi You may assume that the funct required in Problem 3 (a) and (b) are already available to you, and you may use them if you like. You may also assume that if you use the functions from Problem 3, you are simply able to state the condition as logical statements. 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] Problem 5. [10 Points] Consider a function compose3, which takes three functions f(x), g(x) and h(x) as arguments, and evaluates to a function to compute f(g(h(x))). Define compose3 in lambda calculus. Submission: You have two options for submission. Either type in your answers as text, or upload a PDF

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago

Question

1. Which is the most abundant gas presented in the atmosphere?

Answered: 1 week ago