In this problem you are tasked with matching items from the left-hand-side to the right-hand side. The items are general to lambdas/functions, so make the best matching pairs that you can, however there is an intended match for each item. There are no "extra" items, there are 10 pairs in total that must be constructed, and there are no pairs made from items on the same side.
| Left-hand side | Right-hand side |
|---|---|
| a. named function | 1. |
| b. | 2. |
| c. | 3. lambda x, y: x(y) |
| d. | 4. lambda x, y: x * y |
| e. unnamed function | 5. lambda a: lambda b: a |
| f. | 6. lambda b: lambda a: b |
| g. | 7. def mul(x, y): return x * y |
| h. | 8. |
| i. | 9. lambda x, y: mul(x, y) |
| j. | 10. |
In this problem you are given 2 Python programs and 3 lambda calculus expressions. Your job is to identify the Free and Bound variables in the programs/expressions. Identify the free variables by highlighting/underlining all occurrences of them in the program/expression.
In this sub-problem you are given the following Python program:
x = 12
y = "I'm free, I promise ;)"
w = "Hello"
w += " World!"
def B(a, b, x):
if True:
return a, b
else:
return x
In this sub-problem you are given the following Python program:
"I'm Free!"
augend = 10
addend = 27
def A(a, b, m):
return m * (augend + b)
multiplier = 2
def B(f, y, x):
x * multiplier
print(f(y + addend))
In this sub-problem you are given the following Lambda Calculus expression:
In this sub-problem you are given the following Lambda Calculus expression:
In this sub-problem you are given the following Lambda Calculus expression:
In the following problem you are tasked with performing successful alpha, beta, and eta conversions using proper substitution on the following lambda calculus expressions.
Perform an alpha conversion on the following lambda:
Perform a beta conversion on the following lambda expression:
Perform an eta conversion on the following lambda:
Perform the following proper substitutions on the lambda calculus expression:
Perform the following proper substitutions on the lambda calculus expression:
Perform the proper substitution on the following lambda:
Use all the conversion rules to simplify the following lambda expression as much as possible (Assume "mul" is a function that takes two arguments and multiplies them):
In this problem you are tasked with identifying the Domain, Codomain, Image, and Pre-image for a number of lambdas. For each of the lambdas you must also identify if the function is Injective, Surjective, and/or Bijective. Accompany each lambda with a two oval mapping diagram to organize your information. The type information is given in the following new format:
In this new format the left-hand-side of the colon is the lambda expression and the right-hand-side features the input type with an arrow pointing toward the output type.
State all the requested information for the following lambda:
State all the requested information for the following lambda:
For the following lambda, a new unary operator is introduced. The new operator is the floor operation which rounds a real number down to the nearest integer. It is visually represented similarly to absolute value except it uses two "hockey sticks" as opposed to two pipes. Here are a few examples:
State all the requested information for the following lambda:
State all the requested information for the following lambda:
As with the other creative endeavors from the previous Optional HW's, integrate your learning into a real world event/experience/memory! (However always remember that you can work out an alternate creative endeavour if you want to involve your hobbies! You can make creative works in any form such as games, drawings, paintings, dioramas, sculptures, videos, fake blogs, memes, anything!) (For instance, while I am working on this HW I am hungry and can imagine a number of ways that you could organize a grocery store into sets and tuples. Are shelves ordered? In what ways? what about bargain deal aisles, are they unordered? I could make a set/tuple representation of all of Ralphs!) (Just make sure to talk to me first!)
We saw in class that Collections, while of course being responsible for holding other types, was more complicated than simply picking a basket to throw things in. When choosing to represent a collection of items, the decision between using a set or tuple was more fundamental than just needing to hold onto some values. Choosing a Set inherently suggested that membership was all that mattered and that there was no special meaning to being anywhere in the group. Choosing a Tuple suggested that order was important and that your collections of elements could not be understood in any other manner. With this said, my suggestion for your creative endeavour is to really feel what the difference between a set and a tuple is by taking something in your hobby that is ordered and attempt to engage with it in an unordered manner and take something that is normally unordered and engage with it in an ordered manner. Document the results to me!
What does it mean to find something ordered in your hobby? Well, look for something that is always done in the same manner or something that is normally done with consistency and see what you can accomplish when you do it inconsistently! To give some examples:
What about finding something unordered in your hobby? Search for something that is typically done at any time or without conditions and see how things change when you enforce consistency upon it! For instance:
Take the ordered and unordered experiences you get from your hobby and write/show/display to me how they are different as a result. Explain to me what the experience is normally like and then explain what specific parts of that experience changes for better or for worse when you "switch the collection type" around!
For instance, I enjoy lecturing for this course, I am your professor after all, and something that is typically ordered is how we go through lecture. Everything builds on the next thing, so what would happen if for one lecture I did the announcements at the end, the recap in the middle, put examples out of order? Would the lecture still be understandable? Would it still be enjoyable for me to teach this way or for you to learn in those conditions? What kind of lectures can survive this change? What I would do is try to lecture in this manner and identify what parts of the lecture are still successful and what parts are not and then I would write down how making it unordered specifically changed it. Then I would identify something that is typically unordered about my teaching, such as how I pick students to answer questions, and I would see what would happen if I always picked students in order from front of the class to back of the class. Would that shift students around the classroom? Would is make answering the question more or less stressful? Would more or less people show up to class? I would then try this process out for a lecture or two and then write down the changes I noticed that specifically arose due to the change in picking students.
I am only asking that you perform this investigation for one ordered and one unordered experience in your hobby. If you want to do more that is great and will get you more points! However, the main way to gain points is to pick something interesting and be thoughtful in your description (and theories that you come up with along the way) about how swapping order for disorder and disorder for order changes the experience! The more properties you include and the more operations you find, the more points you earn!
This optional project can be submitted until one week after the homework due date.
| Component | Points | Description |
|---|---|---|
| Q1 | 20 | Lambda calculus matching |
| Q2 | 25 | Free and bound variables |
| Q3 | 30 | Lambda conversions and substitutions |
| Q4 | 25 | Function properties and classifications |
| Optional Section | 20 | Collections experiment in your hobbies (Points For S3 Only) |
| Total | 100 |