# First Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are four problems on pages 2-5, for 100 total points. Probable scale is A=93, C=69.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 20 points
Q2: 20 points
Q3: 35 points
Q4: 25 points
Total: 100 points
```

• Question 1 (20): I have ordered a pizza which might or might not have anchovies, might or might not have broccoli, and might or might not have calimari. Part (a) of the problem contains three statements about which ingredients I might have ordered. In part (b) you are asked to figure out which ones I did order.

• (a,5) Translate the following three statements as indicated, using "a" to represent "the pizza has anchovies", "b" for "the pizza has broccoli", and "c" for "the pizza has calimari":
• (to symbols) If the pizza has either anchovies or broccoli, or both, then it does not have calimari.
• (to English) (b∧¬c) → a
• (to symbols) Unless the pizza has both calimari and anchovies, it has broccoli.

• (b,15) Do the three statements in (a) determine exactly which ingredients are on the pizza? If so, find the set of ingredients and show that it is the only one consistent with the statements. If not, either find two or more distince sets of ingredients that are consistent, or show that no set of ingredients is consistent. You may use either a truth table or a propositional proof (the latter would probably be faster).

• Question 2 (20): This question involves the children's game rock-paper-scissors. (No prior familiarity with the game is necessary to answer the question.) Let M = {r,p,s} be the set of the three possible moves in the game, and let B be the binary relation on M defined so that B(x,y) means "move x either wins or ties against move y". That is, B is the relation {(r,r), (r,s), (p,r), (p,p), (s,p), (s,s)}.

• Is B a partial order on M? For each of the three defining properties of a partial order, prove either that B has this property or that it does not. (Remember that a universal statement may be proved false with a single counterexample.)

• Question 3 (35): Let N = {0,1,2,3,...} be the set of all naturals. This question deals with the following four functions from N to N:
• f(n) = n/2 (this is Java integer division, so that f(6) and f(7) each equal 3)
• h(n) = 2n
• t(n) = f(h(n)) (so that t = f ° h)
• s(n) = h(f(n)) (so that s = h ° f)

• (a,10) Explain what it means for a function to be a surjection, also called an onto function. Which of the four functions above, if any, are surjections? Justify your answers.
• (b,10) Explain what it means for a function to be an injection, also called a one-to-one function. Which of the four functions above, if any, are injections? Justify your answers.
• (c,5) Explain what it means for a function to be a bijection. Which of the four functions above, if any, are bijections? Justify your answers.
• (d,10) Prove or disprove the following statement: ∀n:s(s(n))=s(n), where s is the function defined above and the type of n is `natural`.

• Question 4 (25): This question deals with a set of dogs D and a binary relation P on D. If x and y are dogs, P(x,y) means "x plays nicely with y". You are given that P is an equivalence relation.

• (a,10) Translate each of the following statements as directed:
• (I) (to symbols) There is no dog that plays nicely with all dogs.
• (II) (to English) ∃c:∀d:∀e: (¬P(c,d)∧¬P(c,e))→P(d,e)

• (b,15) Using statements I and II from part (a) and the fact that P is an equivalence relation, prove that there exist two dogs such that every dog plays nicely with one or the other (that is, ∃x:∃y:∀z:P(z,x)∨P(z,y)). Be clear about your use of the four quantifier proof rules.