LMU ☀️ CMSI 585
PROGRAMMING LANGUAGE FOUNDATIONS
HOMEWORK #1 Due: 2024-05-17

Learning Objectives

With this assignment you will demonstrate:

Readings and Videos

Please:

If you need to see some additional references on mathematical or logical notation or need to brush up on such things, you can look at this page of basic notation and these slides by Gabriel Robins and for fun read Who can name the bigger number by Scott Aaronson.

Problems to Submit

You may work alone or in groups of at most 3 students. If you choose to pair or triple up, DO NOT “partition” the work. Letting a team member do some problems while you do others cheapens your educational experience and leaves you behind. It is best for each student to do all of the problems, then meet as a group to (1) select the “best” answer for submission when more than one exist, and (2) teach each other: that is, if one group member is unable to do one of the problems, another group member can teach that student how it do it. Everyone is responsible for understanding the entire homework submission, so everyone should contribute to the entire assignment.

Submit your answers on a beautiful PDF uploaded to BrightSpace.

  1. On the course notes page entitled “The Study of Programming Languages” we saw a function written in several programming languages. Write this function in a language not on this list. Prove that your function works on a tio.run or replit.com page. Include the link to your code in your answer.
  2. In your own words, write one sentence for each of the four major theories of computation, conveying its central question and its areas of concern. Write as if your job depended on clarity, accuracy, and solid English writing skills. If you look to Chat GPT for help, do not just copy what the bot says; but feel free to try so see if it can even get close on this one. The scope of the four theories are kind of fuzzy, so stick with the definitions you’ve heard in class rather than Chat-GPT’s training set.
  3. In the Theories of Computer Science lecture we saw how to express the odd-number test in Lambda Calculus notation, Lisp, Python, JavaScript, Java, Ruby, Clojure, and Swift. Show how, in each of these notations or languages, to express a function to cube a number. (Research may be required.)
  4. Mark each of the following as true or false:
    1. $\varnothing \in \varnothing$
    2. $\varnothing \in \{ \varnothing \}$
    3. $\varnothing \subseteq \varnothing$
    4. $\varnothing \subseteq \{ \varnothing \}$
    5. $\{ x, y \} \subseteq \mathcal{P}(\{ x, y, \{x,y\} \})$
    6. $\mathcal{P}(\varnothing) = \{ \varnothing \}$
    7. $\{ x, y, z\}^3 - \{ s \;\mid\; |s| \leq 3 \} \neq \varnothing$
    8. $\bigcup \{ \mathbb{N}, \mathbb{B}, \mathbb{Q} \} - \mathbb{B} = \mathbb{Q}$
    9. $(9, 3, F) \in \mathbb{Z} \times \mathbb{B} \times \mathbb{R} \wedge (1,2)\!\downarrow\!1 = 2$
    10. $|\mathcal{P}(\{a,b,c\}) - \mathcal{P}(\{a,b\})| = 5$
  5. Is the intersection of two partial orders a partial order? If so, prove it. If not, give a counterexample.
  6. Let $f = \lambda x. 2x + 1$ and $g = \lambda x. \lambda y. 3xy$. Reduce each of the following expressions (or if they cannot be reduced, say why):
    1. $f^5(20)$
    2. $f \circ f$
    3. $g(f[5/3](3) - f[5/3](2))$
    4. $(\lambda w. (f^{-1}(71), w(5), w(1)))(f \circ (g\:1)) $
    5. $(\lambda x. (x\:x))(\lambda x. (x\:x))$
  7. Simplify each of the following as much as possible without introducing any roundoff errors—your simplified expressions must still be exact:
    1. $3 \uparrow \uparrow 2$
    2. $2 \uparrow \uparrow \uparrow 3$
    3. $790912853^{3892359} \;\mathtt{mod}\; 90277$
    4. $(3 + 2i - 8k) \times (8i + 2j -k)$       (quaternion multiplication)
    5. $\log_8{2^{333333333}}$
  8. Translate the following sentences into logical notation.
    1. If you don't leave now, you will not win the prize.
    2. Ani or her sisters might have been late.
    3. Some dogs like cats who live in the capital of Turkey.
    4. The person who won the race prefers orange juice to tea.
    5. 3 will never be greater than 7.
    6. Not every odd number is greater than its own square.
    7. Something evil caused all evil things except itself.
    8. Some day, it will be possible that all players will have the same score.
    9. War is peace, freedom is slavery, and ignorance is strength.
    10. All that was once true will someday necessarily be forever false.
  9. In classical logic, $\exists$ and $\forall$ are duals of each other, because $(\neg \exists x.P) \equiv \forall x. \neg P$ and $(\neg \forall x.P) \equiv \exists x.\neg P$. Are the temporal operators $\textbf{F}$ and $\textbf{G}$ duals of each other? Why or why not?
  10. Suppose that you had a classical, bivalent logistic system powerful enough to express statements about the provability of its own formulas, for example, “This formula is not provable” or equivalently “I am not provable.” Show that such a system, if consistent, must be incomplete, and if complete, must be inconsistent.