CS 173: Discrete Structures, Spring 2012 Homework 1 Solutions
Total Page:16
File Type:pdf, Size:1020Kb
CS 173: Discrete Structures, Spring 2012 Homework 1 Solutions This homework contains 3 problems worth a total of 25 points. 1. [1 point] Finding information on Piazza How many pet rats does Margaret’s family have? (Hint: see Piazza.) Solution: Margaret’s family has six pet rats. 2. [4 points] Demographic Survey 3. [20 points] Logic operators The late 19th century philosopher Charles Peirce (rhymes with ‘hearse,’ not ‘fierce’) wrote about a set of logically dual operators and, in his writings, coined the term ‘Ampheck’ to describe them. The two most common Ampheck operators, the Peirce arrow (written ↓ or ⊥ or ∨ by different people) and the Sheffer stroke (written ↑ or | or ∧ by different people), are defined by the following truth table: p q p ↑ q p ↓ q T T F F T F T F F T T F F F T T (a) (4 points) The set of operators {∧, ∨, ¬} is functionally complete, which means that every logical statement can be expressed using only these three operators. Is the smaller set of operators {∨, ¬} also functionally complete? Explain why or why not. Solution: By De Morgan’s laws, ¬(¬p∨¬q) ≡ ¬¬p∧¬¬q ≡ p∧q So every logical statement using the ∧ operator can be rewritten in terms of the ∨ and ¬ operators. Since every logical statement can be expressed in terms of the ∧, ∨, and ¬ operators, this implies that every logical statement can be expressed in terms of the ∨ and ¬ operators, and so {∨, ¬} is functionally complete. (b) (4 points) Express ¬p using only the Sheffer stroke operation ↑. Solution: Note that ¬p is true if and only if p is false. We can see from the truth table that when q is true, p ↑ q is true if and only if p is false. Thus, ¬p can be expressed as p ↑ T . Alternatively, p ↑ p is equivalent to ¬p 1 p ¬p p ↑ q T F F F T T (c) (5 points) Express p ∨ q using only the Sheffer stroke operation ↑. Justify your answer (e.g. using a truth table). p q (p ↑ T ) ↑ (q ↑ T ) p ∨ q T T T T T F T T F T T T F F F F Alternatively, observe from the table that p ↑ q ≡ ¬(p ∧ q). By De Morgan’s laws, ¬(p ∧ q) ≡ ¬p ∨ ¬q, so ¬p ↑ ¬q ≡ p ∨ q. Replacing ¬p with its definition in terms of the ↑ operator yields the expression (p ↑ T ) ↑ (q ↑ T ). Since p ↑ T ≡ ¬p ≡ p ↑ p, another equivalent formula is (p ↑ p) ↑ (q ↑ q). (d) (3 points) Explain why the set of operators {↑} is functionally complete. Solution: In parts b and c, we showed that the ¬ and ∨ operators can be expressed in terms of the ↑ operator, so any statement that can be expressed in terms of those two operators can be expressed in terms of the ↑ operator. In part a, we showed that the set of operators {∨, ¬} are sufficient to express any statement, so the set of the operator {↑} is also sufficient to express any statement, and thus is functionally complete. (e) (4 points) Express the Sheffer stroke operation p ↑ q using only the Peirce arrow ↓ operation. Explain why the set of operators {↓} is functionally complete. Solution: p q ((p ↓ F ) ↓ (q ↓ F )) ↓ F p ↑ q T T F F T F T T F T T T F F T T Alternatively, observe from the table that p ↓ q ≡ ¬(p ∨ q). By De Morgan’s laws, ¬(p ∨ q) ≡ ¬p ∧ ¬q, so ¬p ↓ ¬q ≡ p ∧ q. Looking again at the table, we see that p ↓ F ≡ ¬p. Recall that p ↑ q ≡ ¬(p ∧ q). Then we can see that ¬(p ∧ q) ≡ ¬(¬p ↓ ¬q), and rewriting the ¬ operator results in the expression ((p ↓ F ) ↓ (q ↓ F )) ↓ F as equivalent to p ↑ q. Notice that p ↓ F ≡ ¬p ≡ p ↓ p. So, if you want to remove the literal use of F from the above formula, you can use the identity p ↓ F ≡ p ↓ p. to convert it to [(p ↓ p) ↓ (q ↓ q)] ↓ [(p ↓ p) ↓ (q ↓ q)] 2 So, any statement that can be expressed with the ↑ can also be expressed with the ↓ operator. So, since {↑} is functionally complete, {↓} is also functionally complete. 3.