1. Homepage
  2. Homework
  3. CS 440: Programming Languages Assignment: Lambda Calculus
This question has been solved

CS 440: Programming Languages Assignment: Lambda Calculus

Engage in a Conversation
IITCS 440Programming LanguagesLambda Calculus

CS 440: Programming Languages CourseNana.COM

Assignment: Lambda Calculus CourseNana.COM

Logistics and Submission CourseNana.COM

Please submit your solutions as a PDF (typed or neatly handwritten!) on Blackboard by the due date. Abstract syntax trees CourseNana.COM

For each of the following lambda calculus expressions, (a) draw the corresponding abstract syntax tree – following the conventions used in lecture, and (b) circle all the free variables in the AST. (5 points each) CourseNana.COM

1. λx.x λz.z x
2. (λx.y) (λy.x)
3. (
λa.λb.a b) (λx.x x) (λy.b a) CourseNana.COM

Normal form CourseNana.COM

For each of the following lambda calculus expressions, (a) indicate whether applicative-order evaluation will eventually find normal form, and (b) if normal form can be reached via either applicative- or normal-order evaluation, show all the steps (β/η-reductions or α-conversions) that lead to it, and normal form itself. If (b) is not possible, show at least three reductions and explain why further normalization is not possible. (5 points each) CourseNana.COM

4. (λx.λw.w x) w λz.y z
5. (λx.y) ((λw.w w w) (λy.y y y)) 6. (λx.x y) (λw.w w)
7. (
λx.λy.x y x) (λw.w) (λz.z z) CourseNana.COM

CourseNana.COM

Alternative numbers CourseNana.COM

As alternatives to the Church numerals discussed in class, consider the following definitions: CourseNana.COM

TRUE λx.λy.x FALSE λx.λy.y CourseNana.COM

0 λx.x
INC λn.λx.(x FALSE) n CourseNana.COM

1 INC 0 2 INC 1 CourseNana.COM

.
8. Based on the definitions above, define the DEC (decrement) function, such that DEC (INC n) n, CourseNana.COM

and demonstrate — by showing the necessary reductions — that DEC (DEC 2) 0. (5 points) CourseNana.COM

9. Define the IS ZERO function, which should evaluate to TRUE when called on 0 and FALSE otherwise. (5 points) CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
IIT代写,CS 440代写,Programming Languages代写,Lambda Calculus代写,IIT代编,CS 440代编,Programming Languages代编,Lambda Calculus代编,IIT代考,CS 440代考,Programming Languages代考,Lambda Calculus代考,IIThelp,CS 440help,Programming Languageshelp,Lambda Calculushelp,IIT作业代写,CS 440作业代写,Programming Languages作业代写,Lambda Calculus作业代写,IIT编程代写,CS 440编程代写,Programming Languages编程代写,Lambda Calculus编程代写,IITprogramming help,CS 440programming help,Programming Languagesprogramming help,Lambda Calculusprogramming help,IITassignment help,CS 440assignment help,Programming Languagesassignment help,Lambda Calculusassignment help,IITsolution,CS 440solution,Programming Languagessolution,Lambda Calculussolution,