<<

CS 173 Homework 1 Solutions Fall 2008

CS 173: Discrete Mathematical Structures, Spring 2008 Homework 1 Solutions

1. [10 points] Translate the following sentences into propositional logic, making the meaning of your propositional variables clear, and then create a for each sentence. See page 11 of the textbook for some examples of translating English sentences into propositional logic.

Solution: Normal English is somewhat vague about the meaning of “or.” As a result, the sentences in both parts of this problem could be translated using either the inclusive or (∨) or the (⊕) operator. We’ve shown one option, but the other is also worth full credit. Be aware that in mathematical English (e.g. proofs), “or” should always be read as inclusive or.

(a) Either the Chicago White Sox pitching improves and they continue to hit well or the Minnesota Twins will win the division. Let p, q, and r represent “the Chicago White Sox pitching improves”, “the White Sox continue to hit well”, and “the Minnesota Twins will win the division” respectively. Then the above can be written as (p ∧ q) ⊕ r. The truth table for this sentence is: p q r (p ∧ q) ⊕ r T T T F T T F T T F T T T F F F F T T T F T F F F F T T F F F F (b) Discrete mathematics is interesting and has many useful applications or the students will not be happy. Let p, q, and r represent “Discrete mathematics is interesting”, “Discrete mathematics has many useful applications”, and “the students will be happy” respectively. Then the above can be written as (p ∧ q) ∨ ¬r. The truth table for this sentence is: p q r (p ∧ q) ∨ ¬r T T T T T T F T T F T F T F F T F T T F F T F T F F T F F F F T

1 CS 173 Homework 1 Solutions Fall 2008

2. [4 points] Use a truth table to show that the following logical equivalence is correct

¬((p ∧ p) ⊕ q) ≡ (p ↔ q)

Solution:

p q p ∧ p (p ∧ p) ⊕ q ¬((p ∧ p) ⊕ q) (p ↔ q) T T T F T T T F T T F F F T F T F F F F F F T T

3. [10 points] In the following exercises, use the logical equivalences given on pages 24 and 25 of the textbook (in Tables 6 through 8) to show that:

(a) (¬p → (q → r)) ≡ (q → (p ∨ r))

Solution: Notice that there is typically more than one reasonable sequence of equiva- lences for such a problem, so your answer may not exactly match this one. (¬p → (q → r)) ≡ (¬p → (¬q ∨ r)) ≡ (¬¬p ∨ (¬q ∨ r)) ≡ (p ∨ (¬q ∨ r)) (double law) ≡ ((¬q ∨ r) ∨ p) (commutative law) ≡ (¬q ∨ (r ∨ p)) (associative law) ≡ (¬q ∨ (p ∨ r)) (commutative law) ≡ (q → (p ∨ r))

Solution: (b) ¬(p → ¬q) ∧ ¬(p ∨ q) is a (i.e. always ). ¬(p → ¬q) ∧ ¬(p ∨ q) ≡ (p ∧ q) ∧ ¬(p ∨ q) ≡ (p ∧ q) ∧ (¬p ∧ ¬q) (De Morgan’s law) ≡ p ∧ (q ∧ (¬p ∧ ¬q)) (associative law) ≡ p ∧ (q ∧ (¬q ∧ ¬p)) (commutative law) ≡ p ∧ ((q ∧ ¬q) ∧ ¬p) (associative law) ≡ p ∧ (F ∧ ¬p) (negation law) ≡ p ∧ (¬p ∧ F ) (commutative law) ≡ p ∧ F (domination law) ≡ F (domination law)

2 CS 173 Homework 1 Solutions Fall 2008

(c) (4 points) (p ∨ q) ∧ (¬p ∨ r) → (q ∨ r) is a (i.e. always true)

Solution: Notice that square brackets are used here simply as a variation of parentheses, so that complex sets of parentheses are easier to read. (p ∨ q) ∧ (¬p ∨ r) → (q ∨ r) ≡ ¬[(p ∨ q) ∧ (¬p ∨ r)] ∨ (q ∨ r) (from table 7) ≡ [¬(p ∨ q) ∨ ¬(¬p ∨ r)] ∨ (q ∨ r) (De Morgan’s law) ≡ [(¬p ∧ ¬q) ∨ ¬(¬p ∨ r)] ∨ (q ∨ r) (De Morgan’s law) ≡ [(¬p ∧ ¬q) ∨ (¬¬p ∧ ¬r)] ∨ (q ∨ r) (De Morgan’s law) ≡ [(¬p ∧ ¬q) ∨ (p ∧ ¬r)] ∨ (q ∨ r) (double negation law)

We now need to shuffle the terms around, so as to group together the q and ¬q terms, and also the p and ¬p terms. [(¬p ∧ ¬q) ∨ (p ∧ ¬r)] ∨ (q ∨ r) ≡ (¬p ∧ ¬q) ∨ [(p ∧ ¬r) ∨ (q ∨ r)] (associative law) ≡ (¬p ∧ ¬q) ∨ [(p ∧ ¬r) ∨ (r ∨ q)] (commutative law) ≡ (¬p ∧ ¬q) ∨ [((p ∧ ¬r) ∨ r) ∨ q)] (associative law) ≡ (¬p ∧ ¬q) ∨ [q ∨ ((p ∧ ¬r) ∨ r))] (commutative law) ≡ [(¬p ∧ ¬q) ∨ q] ∨ [(p ∧ ¬r) ∨ r] (associative law)

Now we can simplify each half of the expression: [(¬p ∧ ¬q) ∨ q] ∨ [(p ∧ ¬r) ∨ r] ≡ [q ∨ (¬p ∧ ¬q)] ∨ [r ∨ (p ∧ ¬r)] (commutative law) ≡ [(q ∨ ¬p) ∧ (q ∨ ¬q)] ∨ [(r ∨ p) ∧ (r ∨ ¬r)] (distributive law) ≡ [(q ∨ ¬p) ∧ T ] ∨ [(r ∨ p) ∧ T ] (negation law) ≡ (q ∨ ¬p) ∨ (r ∨ p) (identity law)

And finally merge them: (q ∨ ¬p) ∨ (r ∨ p) ≡ q ∨ [¬p ∨ (r ∨ p)] (associative law) ≡ q ∨ [¬p ∨ (p ∨ r)] (commutative law) ≡ q ∨ [(¬p ∨ p) ∨ r] (associative law) ≡ q ∨ (T ∨ r) (negation law) ≡ q ∨ (r ∨ T ) (commutative law) ≡ q ∨ T (domination law) ≡ T (domination law)

3 CS 173 Homework 1 Solutions Fall 2008

4. [5 points] Assume that there are only two kinds of people, a person is either authentic or a charlatan. A person is authentic every they make is true. A person is a charlatan if and only if every statement they make is false. Suppose you meet Augustus De Morgan and Charles Babbage in class one day and they say the following:

Babbage: Both De Morgan and I are authentic. De Morgan: Babbage is a charlatan

What kind of people are De Morgan and Babbage? Justify your answer.

Solution 1: De Morgan is authentic, while Babbage is a charlatan (no offense intended to Babbage). If Babbage is authentic, then his statement is true – both he and De Morgan are authentic. However, if De Morgan is authentic, then his statement is true – Babbage is a charlatan, which creates a contradiction. Thus, Babbage must be a charlatan. This means that De Morgan’s statement is true, so De Morgan is authentic.

Solution 2: First we model the possible statements from the problem definition:

• p = Babbage is authentic. • q = Babbage is a charlatan. • r = De Morgan is a authentic. • s = De Morgan is a charlatan.

There are only two kinds of people (a person is either authentic, or a charlatan, but not both). Thus we have:

• p ↔ ¬q • r ↔ ¬s

This means we can forget about q and s, and work uniquely with p and r (we could alternatively work with p and s, or q and s). We know that an authentic person always makes true statements. We can model “De Morgan: Babbage is a charlatan” as:

• r ↔ ¬p, that is, r ≡ ¬p.

This is saying that if r is true, De Morgan is authentic, whatever De Morgan says is true. In this case, De Morgan says Babbage is not authentic, a charlatan, or ¬p. If r is false (De Morgan is a charlatan), then ¬p needs to be false too, that is, Babbage is authentic. Similarly, we model “Babbage: Both De Morgan and I are authentic” with:

• p ↔ (p ∧ r)

Using r ≡ ¬p in p ↔ (p ∧ r):

4 CS 173 Homework 1 Solutions Fall 2008

• p ↔ (p ∧ ¬p)

Using a negation law in the previous expression:

• p ↔ F

Since r ≡ ¬p, we have that r ≡ T . We conclude that De Morgan is authentic (p), and Babbage a charlatan (¬r).

5. [5 points]

(a) State the negation of the statement “I have overslept or the building is on fire”, using deMorgan’s laws to move the negation from the whole thing onto the two component statements.

Solution: By De Morgan’s laws, ¬(p ∨ q) ≡ ¬p ∧ ¬q. Let p and q represent the statements “I have overslept” and “the building is on fire” respectively. Then the negation of the statement “I have overslept or the building is on fire” is “I have not overslept and the building is not on fire”. (b) Using your result from part (a), write the negation, contrapositive, and inverse of the following statement (see page 8 of the textbook for a related example). If I have overslept or the building is on fire, then the class will be canceled.

Solution: Let r represent the statement “the class is canceled”, and define p and q as above. Then ¬((p ∨ q) → r) ≡ (p ∨ q) ∧ ¬r, so the negation of the statement is “I have overslept or the building is on fire, and the class will not be canceled”. The contrapositive of the statement is ¬r → (¬p ∧ ¬q): “If the class is not canceled, then I have not overslept and the building is not on fire”. The converse of the statement is r → (p ∨ q): “If the class is canceled, then I have overslept or the building is on fire”. The inverse of the statement is (¬p ∧ ¬q) → ¬r: “If I have not overslept and the building is not on fire, then the class will not be canceled”.

5 CS 173 Homework 1 Solutions Fall 2008

6. [16 points] 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 (written ↓ or ⊥ or ∨ by different people) and the Sheffer stroke (written ↑ or | or ∧ by differ- ent 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) 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 oper- ators {∨, ¬} also functionally complete? Explain why or why not.

Solution: By De Morgan’s laws, 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 state- ment can be expressed in terms of the ∨ and ¬ operators, and so {∨, ¬} is functionally complete. (b) Express ¬p using only the Sheffer stroke operation ↑.

Solution: ¬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

p ¬p p ↑ q T F F F T T

(c) 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).

6 CS 173 Homework 1 Solutions Fall 2008

(d) 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 point bonus) 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)]

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.

7