CS 291 Assignment #7

Due Tuesday, April 7th (by 11:59pm)
Not accepted after April 12th

Introduction:

The first two problems deal with lambda calculus manipulations. Your work for these problems should be typed and submitted electronically. (Feel free to approximate λ with a \ and generate a plain text file. If you choose not to generate plain text, please use Word and make sure you add .doc to your filename so it's clear.) For your convenience I'm listing the definitions you'll need below:
iszero? = λx.(x (λy.λz.false) (λx.x) true)
true = λx.λy.x
false = λx.λy.y
add = λn.λm.λf.λx.n f (m f x)
2 = λf.λx.(f (f x))

Problems 3 and 4 below deal with the definitions in family.pl from class. Do not modify this file. Instead, put your definitions in a separate file called defns.pl. Submit only defns.pl. You can load the definitions from both family.pl and your own file by starting a Prolog session with [family,defns].

The Assignment

  1. Show that (iszero? 2) evaluates to false. To keep things tidier, you can carry along terms like true and false until they're actually applied to an argument, at which time you should expand them into their lambda-calculus equivalents. At each step, underline the function that's being applied to an argument.
  2. Show that (add 2) 3 evaluates to the Church numeral 5. For this problem, use different variable names in 2 and 3 so you can better see how they get rearranged during the addition: Use λa.λb.(a (a b)) for 2 and λr.λs.(r (r (r s)) for 3. As before, you can carry along the terms defined above until they're actually applied to an argument, at which time you should expand them into their lambda-calculus equivalents, and underline the function that's being applied.
  3. Given the definitions in family.pl, design a query that asks "does holly's mother have any other children?" Add the query to your Prolog code as a comment.
  4. Define the predicate great_aunt. It takes two arguments, and holds if the first argument is the great aunt of the second. (For the relationship-challenged, a great aunt is an aunt of your grandparents' generation instead of your parents'.) In a comment, show the query you'd use to find all of my great aunts (given the facts in family.pl). Then show the query you'd use to find all great aunts.
  5. In class, we defined the predicate brother. It can be satisfied by full brothers, who share both parents, or by half brothers, who share only one parent. Define a new predicate full_brother that is true if the inputs are individuals who share both parents. You should not use brother in your definition of full_brother. In a comment, show how you would use your new predicate to find all full brothers in the family.pl database.

  6. Draw a proof tree demonstrating that brother(durkee, elmo) is true. (That's brother, not full_brother.) The tree is small enough that you can approximate it with ASCII and include it as a comment in your prolog program. If you can't manage that, please find some other electronic means of drawing your proof tree and submit it as a PDF.

Submitting:

Submit your two files (one containing your lambda evaluations, and one with your Prolog code and queries) as attachments to me at brichards@ups.edu. Please do not just copy and paste your solutions into the body of the E-mail! (If your E-mail client insists on including the content of text files into the body of the message, please zip the files up and attach the archive.)


Brad Richards, 2009