13
Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Embed Size (px)

Citation preview

Page 1: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Exercises for CS1512Weeks 7 and 8

Propositional Logic 1

(questions + solutions)

Page 2: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Exercise 1

1. Express each formula using only (at most) the connectives listed. In each case use a truth table to prove the equivalence. (Note: is exclusive `or`)

a. Formula: pq. Connectives: {,}.b. Formula: pq. Connectives: {,,}. c. Formula: pq. Connectives: {, }.d. Formula: (pq) ((p)q). Conn: {,}.

Page 3: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Answer to Exercise 1. (Other answers possible)

a. Formula pq. Connectives: {,}.Answer: pqb. Formula: pq. Connectives: {,,}.Answer: (p q)(q p)c. Formula: pq. Connectives: {, }.Answer: (pq)(q p)d. Formula: (pq) ((p)q). Conn: {,}.Answer: q (This was a trick question, since you don’t

need any connectives.)

Page 4: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Ex. 2. Which of these are tautologies?

1. p (q p)2. p (p p)3. (q p) (p q) 4. (q p) (p q)5. (p (q r)) (q (p r))

Please prove your claims, using truth tables. (Hint: Ask what assignment of truth values to p,q, and r would falsify each formula. In this way you can disregard parts of the truth table).

Page 5: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Answer to Ex.2

1. p (q p) Tautologous2. p (p p) Tautologous3. (q p) (p q) Contingent4. (q p) (p q) Tautologous5. (p (q r)) (q (p r)) Tautologous

1,2,4,5 are known as “`paradoxes’ of the material implication”, because they contrast with implication in ordinary language.

Page 6: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Ex. 3. Reading formulas off truth tables

• Background: In class, a proof was sketched for the claim that every propositional logic formula can be expressed using the connectives {, }. The proof proceeded essentially by “reading off” the correct formula off the truth table of any given formula.

• Task: Use this meticulous method to construct a formula equivalent to pq.

Page 7: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Answer to ex. 3. Steps:

1. Construct the truth table of pq.

2. Mark those two rows in the table that make pq TRUE.

3. Corresponding with these two rows, construct a disjunction of two formulas, one of which is (pq), and the other (qp).

4. Use the De Morgan Laws to convert this disjunction (pq)(qp) into the quivalent formula ((pq) (qp))

[5. Use truth tables again to check that these two formulas are indeed equivalent.]

Page 8: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Question 4a

• In class, it was proven that {, } is a functionally complete set of connectives. Making use of this result, can you prove that {,} is also functionally complete?

Page 9: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Question 4a

• In class, it was proven that {, } is a functionally complete set of connectives. Making use of this result, can you prove that {,} is also functionally complete?

• Answer: It is sufficient to show that both p and (pq) are expressible using the two connectives in {,}. The first of these two (i.e., negation) is obvious, and the second (i.e., conjunction) can be expressed as follows (pq) (pq), using one of De Morgan’s laws.

Page 10: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Question 4b

• In class, it was proven that {, } is a functionally complete set of connectives. Making use of this result, can you prove that {NAND} is also functionally complete?

[Explanation: (p NAND q) is TRUE iff (pq) is FALSE. This connective is also called the Sheffer stroke and written (p|q).)

Page 11: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Question 4b

• In class, it was proven that {, } is a functionally complete set of connectives. Making use of this result, can you prove that {NAND} is also functionally complete?

Answer: the reasoning is similar to that in 4a, but it may be a bit trickier to find the right formulas: p can be expressed as p p|p. (It helps to do negation before conjunction!) The formula pq is equivalent to (p|q)|(p|q) (in other words, the negation of p|q)

It might be useful to prove these equivalences using truth tables.

Page 12: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Question 4c

• Given this result, why do we bother defining and using more than one connective?

• Answer: Many things can be expressed more succinctly and transparently with a larger ‘vocabulary’ of connectives (as your answer to 4b will show). Also, it becomes easier to let your formulas resemble the things we say in e.g. English.

Page 13: Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)

Question 5

a. (rc)d

b. r(cd)

Comparison of truth tables shows (a) and (b) to be equivalent. Both formulas are false if and only if (r true,c true,d false).