a first course in logic: solutions to exercises

39
A FIRST COURSE IN LOGIC: SOLUTIONS TO EXERCISES Mark V. Lawson November 13, 2017

Upload: others

Post on 20-Mar-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

A FIRST COURSE IN LOGIC:SOLUTIONS TO EXERCISES

Mark V. Lawson

November 13, 2017

2

Introductory exercises

1. (a) C was a knight. The key point is the following. If you ask a knightwhat he is he will say he is a knigh whereas if you ask a knavewhat he is he is obliged to lie and so also say that he is a knight.Thus no one on this island can say they are a knave. This meansthat B is lying and so is a knave. Hence C was correct in sayingthat B lies and so C was a knight.

(b) A is a knave, B a knight and C a knave. If all three were knavesthen C would be telling the truth which would contradict the factthat he is a self-proclaimed knave. Therefore C is a knave andthere is either one knight or there are two knights. Suppose thatthere were exactly two knights. Then these would have to be Aand B. But they contradict each other. It follows that exactly oneof them is a knight. Hence A is knave and B is a knight.

2. Sam drinks water and Mary owns the aardvark. The following tableshows all the information you should have deduced.

1 2 3 4 5

House Yellow Blue Red White GreenPet Fox Horse Snails Dog Aardvark

Name Sam Tina Sarah Charles MaryDrink Water Tea Milk Orange juice CoffeeCar Bentley Chevy Oldsmobile Lotus Porsche

You should check that the above solution is consistent with all theinformation you have been given.

To solve the problem, a reasonable starting point is the following table.

1 2 3 4 5

HousePet

NameDrinkCar

3

Using clues (h), (i) and (n), we can make the following entries in thetable.

1 2 3 4 5

House BluePet

Name SamDrink MilkCar

There are a number of different routes from here. I shall just give someexamples of how you can reason. Clue (a) tells us that Sarah lives inthe red house. Now she cannot live in the first house, because Samlives there, and she cannot live in the second house because that isblue. We are therefore left with the following which summarizes all thepossibilities so far.

1 2 3 4 5

House Yellow? White? Green? Blue Red? Red? Red?Pet

Name Sam Sarah? Sarah? Sarah?Drink MilkCar

Clue (b) tells us that Charles owns the dog. It follows that Sam cannotown the dog. We are therefore left with the following possibilities.

1 2 3 4 5

House Yellow? White? Green? Blue Red? Red? Red?Pet Fox? Horse? Snails? Aardvark?

Name Sam Sarah? Sarah? Sarah?Drink MilkCar

The reasoning now continues . . ..

3. There are two possible secret numbers consistent with the informationgiven: 2745 or 4725.

4

4. This difficult question is taken from the famous book: Godel, Escher,Bach. The answer to the question is no. The key is to focus on thenumber of Is in a string which we call the I-count. Rule-I does notchange the I-count. Rule-II doubles the I-count. Rule-III reduces theI-count by 3. Rule-IV does not change the I-count. We begin witha string whose I-count is 1 and our goal is to obtain a string whoseI-count is 0. The problem reduces to showing that applying the aboverules to a string whose I-count is 1 never results in a string whose I-count is 0. This amounts to showing that if 3 does not divide n then 3does not divide 2n, and if 3 does not divide n then 3 does not dividen− 3.

5. Here is the completed puzzle taken from Solving sudoku by MichaelMepham available at www.sudoku.org.uk/PDF/Solving_Sudoku.pdf.

8 1 3 4 2 9 7 6 54 6 2 5 7 1 8 3 97 9 5 3 6 8 1 4 22 4 7 1 5 3 9 8 65 3 9 8 4 6 2 1 76 8 1 2 9 7 4 5 39 7 8 6 1 5 3 2 41 2 6 7 3 4 5 9 83 5 4 9 8 2 6 7 1

6. This is called the Collatz problem or the 3x+1 problem. Nobody has yetfound a proof. It is therefore conceivable that there is a number wherethe process described in the question does not terminate. I includedthis question to show that unsolved problems are not limited to whatyou might regard as advanced mathematics. Bear in mind that thequestion can be rephrased as asking whether a very simple programprints the output 1 for any allowable input.

5

Exercises 1.1

1.

(a) T .

(b) F .

(c) T .

(d) F .

(e) T .

(f) T .

(g) F .

(h) T .

(i) T .

(j) T .

2. The following statement is supposed to be true

‘a card has a vowel on one side → it has an even number onthe other side’.

You would falsify this statement if you could find a card that had avowel on one side but did not have an even number on the other. Thus,clearly, I need to turn over the first card to check that it has an evennumber on the other side. The next two cards play no role. Now lookat the last card. If it had a vowel on the other side then it would falsifythe statement. So, I need to turn that card over as well. Thus I onlyneed turn over two cards.

It is possible to answer the question using just PL though it really needsthe notion of logical equivalence described in Section 1.4. Observe thatthe truth tables for p→ q and ¬q → ¬p are the same. Thus these wffhave the same meaning. The first wff immediately tells us to turn overthe first card. The second wff says that ‘a card had an odd numberon one side → it has a consonant on the other’. Thus we need to turnover the fourth card to check that it does show a consonant.

This question has its origins in the psychology of reasoning. Read thewikipedia article if you want to know more. What is interesting is that

6

if the same problem is couched in the language of social rules it becomesa lot easier to solve. Here is an example. You have to be 18 or over tobuy alcohol in the UK. Below is some data about four people: on oneside is their age and on the other what they want to buy. Who do youhave to check?

Beer 25 Cola 16

My guess is that you immediately saw that you had to check the ageof the guy buying beer and the 16 year old to check that they werenot trying to buy booze. But the logical structure of this problem isidentical to the one originally posed.

7

Exercises 1.2

1.

(a)

¬

p

q

q p

(b)

p →

q r

p q

p r

(c)

8

p ¬

p

¬

p

(d)

¬

p ¬

p

(e)

p →

q r

p q

r

9

Exercises 1.3

1.

(a) This is satisfiable with only one truth assignment p = T and q = Fleading to an F .

(b) This is satisfiable with only one truth assignment p = T and q = Fleading to an F .

(c) This is satisfiable with the satisfying truth assignments being p =T, q = T, r = T and p = T, q = T, r = F and p = F, q = F, r = F .

2.

(a) This is not a tautology.

(b) This is a tautology.

(c) This is a tautology.

(d) This is not a tautology.

(e) This is a tautology.

3. There are potentially many different solutions to this question.

Column wff

1 (p ∨ ¬p) ∧ (q ∨ ¬q)2 p ∨ q3 p ∨ ¬q4 p5 p→ q6 q7 p↔ q8 p ∧ q9 ¬(p ∧ q)10 p⊕ q11 ¬q12 ¬(p→ q)13 ¬p14 ¬p ∧ q15 ¬(p ∨ q)16 (p ∧ ¬p) ∧ q

10

Exercises 1.4

1. To show that A ≡ B construct truth tables for A and B separately andshow that they are the same.

2. (a) p ∨ ¬p is a tautology.

(b) p ∧ ¬p is a contradiction.

(c) Clear.

(d) Clear.

(e) Clear.

(f) Clear.

(g) If p is true then p→ f is false. If p is false then p→ f is true. Itfollows that p→ f ≡ ¬p.

(h) If p is true than t→ p is true. If p is false then t→ p is false. Itfollows that t→ p ≡ p.

3. Check that both (p ⊕ q) ⊕ r and p ⊕ (q ⊕ r) have the following truthtable.

p q rT T T TT T F FT F T FT F F TF T T FF T F TF F T TF F F F

4. It is important to lay out the solutions clearly with proper annotations.

(a)

(p→ q) ∧ (p ∨ q) ≡ (¬p ∨ q) ∧ (p ∨ q) since x→ y ≡ ¬x ∨ y

≡ (¬p ∧ p) ∨ q by distributivity

≡ F ∨ q since ¬p ∧ p is a contradiction

≡ q.

11

(b)

(p→ r) ∨ (q → r) ≡ (¬p ∨ r) ∨ (¬q ∨ r) since x→ y ≡ ¬x ∨ y

≡ ¬p ∨ r ∨ ¬q ∨ r by associativity

≡ ¬p ∨ ¬q ∨ r ∨ r by commutativity

≡ ¬p ∨ ¬q ∨ r by idempotence

≡ ¬(p ∧ q) ∨ r by De Morgan

≡ (p ∧ q)→ r since x→ y ≡ ¬x ∨ y.

(c)

(p→ q) ∨ (p→ r) ≡ (¬p ∨ q) ∨ (¬p ∨ r) since x→ y ≡ ¬x ∨ y

≡ ¬p ∨ ¬p ∨ q ∨ r by associativity and commutativity

≡ ¬p ∨ q ∨ r by idempotence

≡ p→ (q ∨ r) since x→ y ≡ ¬x ∨ y.

5. (a) A(p, q, r, s) is true when exactly one of p, q, r, s is true.

(b) Define

A(p1, . . . , pn) =

(n∨

i=1

pi

)∧

( ∧1≤k<l≤n

¬(pk ∧ pl)

).

We claim that A(p1, . . . , pn) is true when exactly one of the pi istrue. Suppose first, that ps is true and all other atoms are false.The first bracket is clearly true. Now look at the second bracket.Then pk ∧ pl where k 6= l is either ps ∧ pl where l 6= s or pk ∧ plwhere k 6= l 6= s. Therefore, under the specific truth assignmentabove, pk ∧ pl is always false and so the second bracket is true. Itfollows that A(p1, . . . , pn) is true. Now suppose that A(p1, . . . , pn)is true. Then both brackets have to be true. It follows that atleast one pi is true. Suppose that at least two were true: ps andpt where s < t. Then the second bracket would contain the wff¬(ps ∧ pt) which is false giving us a contradiction. It follows thatexactly one pi is true.

I will use the notation xor(p1, . . . , pn) instead of A(p1, . . . , pn).

12

6. By symmetry, it is enough to show that � A ↔ B implies that �A∗ ↔ B∗. Let the atoms in A and B be p1, . . . , pn. Suppose thatA∗ ↔ B∗ is not a tautology. Then there is some assignment of truthvalues to the atoms such that A∗ is true and B∗ is false, or vice-versa.Observe that ¬A∗ = A(¬p1, . . . ,¬pn) and ¬B∗ = B(¬p1, . . . ,¬pn).Thus A(¬p1, . . . ,¬pn) is false and B(¬p1, . . . ,¬pn) is true. Thus byreversing the truth values assigned to p1, . . . , pn it follows that A isfalse and B is true but this contradicts the fact that A and B assumethe same truth values for the same truth assignments to the atoms.

13

Exercises 1.5

1. (a) The wff A is the following

(p⊕ q) ∧ (r ⊕ s) ∧ (t⊕ u) ∧ (v ⊕ w) ∧ (p⊕ r) ∧ (q ⊕ s)

∧ (t⊕ v) ∧ (u⊕ w) ∧ (p⊕ t) ∧ (r ⊕ v)⊕ (q ⊕ u) ∧ (s⊕ w).

(b) There are 28 = 256 rows of the truth table.

(c) 2.

(d) The atoms assigned the value T will tell us which numbers occurin which cells.

(e) The rows of the truth table for A that have the output T are asfollows

p q r s t u v wT F F T F T T FF T T F T F F T

These two rows of the truth table correspond to the following twosolutions of the Sudoku.

1 22 1

2 11 2

2. (a) I = p1,2,1 ∧ p1,4,4 ∧ p1,5,2 ∧ . . . ∧ p9,8,7. There are 29 atoms in all.

(b) Fix i and j. Then Eij = xor(pi,j,1, . . . , pi,j,9).

(c) E =∨

1≤i,j≤9Ei,j. Thus E is true when every cell contains exactlyone digit.

(d) Fix i and k. Then xor(pi,1,k, pi,2,k, . . . , pi,9,k) is true when the digitk occurs exactly once in row i. Thus

Ri =9∧

k=1

xor(pi,1,k, pi,2,k, . . . , pi,9,k)

is true when each digit occurs exactly once in row i.

(e) R =∧9

i=1 Ri is true when each row contains each digit exactlyonce.

14

(f) This is similar to what we did in the above two parts. Put C =∧9j=1Cj where

Cj =9∧

k=1

xor(p1,j,k, . . . , p9,j,k).

(g) We look at block 5 where 4 ≤ i ≤ 6 and 4 ≤ j ≤ 6. Then

W5 =9∧

k=1

xor(p4,4,k, p4,5,k, p4,6,k, . . . , p6,6,k)

and W5 is true when each digit occurs exactly once in block 5. Ina similar way, we may define Wl to be true when each digit occursexactly once in block l.

(h) W =∧9

l=1Wl.

(i) We now consider when P is true. Suppose that you come up with apotential solution to this Sudoku. This means that for each cell cijyou enter a digit k. This assigns the value true to the atom pi,j,k.Once you have done this for every cell, all the remaining atoms areassigned the value false. Thus a potential solution to the puzzleleads to a truth assignment to all 729 atoms. With respect tothis truth assignment, P is either true or false. It will be false ifany one of the constraints is violated. If none of the constraintsis violated, then your potential solution is correct. Thus a correctsolution to the puzzle leads to a truth assignment to the atomsthat satisfies P .

Now suppose that you have found a truth assignment that satisfiesP . If Pi,j,k is true then put digit k in cell cij. I claim that becauseof the way that P is defined, this will lead to every empty cellbeing assigned a digit. This is because if P is true then E istrue and so each cell contains exactly one digit. Thus the truthassignment leads to a potential solution to the puzzle. But sinceP is true all constraints are satisfied and so the Sudoku has, infact, been solved.

3. Define A to be the conjunction of the following wff.

• Initial state: q(0) = 1.

15

• Input constraints:

((i(0) = a)⊕ (i(0) = b)) ∧ ((i(1) = a)⊕ (i(1) = b)).

• Unique state at each instant of time t = 0, t = 1 and t = 2:

xor ((q(0) = 1), (q(0) = 2))

∧ xor ((q(1) = 1), (q(1) = 2))

∧ xor ((q(2) = 1), (q(2) = 2)) .

• First set of possible state transitions:

(q(0) = 1) ∧ (i(0) = a)→ (q(1) = 1)

∧ (q(0) = 1) ∧ (i(0) = b)→ (q(1) = 2)

∧ (q(0) = 2) ∧ (i(0) = a)→ (q(1) = 1)

∧ (q(0) = 2) ∧ (i(0) = b)→ (q(1) = 2).

• Second set of possible state transitions:

(q(1) = 1) ∧ (i(1) = a)→ (q(2) = 1)

∧ (q(1) = 1) ∧ (i(1) = b)→ (q(2) = 2)

∧ (q(1) = 2) ∧ (i(1) = a)→ (q(2) = 1)

∧ (q(1) = 2) ∧ (i(1) = b)→ (q(2) = 2).

• Finally, there is the actual input string of length 2.

(i(0) = a) ∧ (i(1) = b).

We look at the circumstances under which A is true. ‘q(0) = 1’ is trueand so ‘q(0) = 2’ is false; ‘i(0) = a’ is true and so ‘i(0) = b’ is false. Wetherefore deduce from the first set of state transitions that ‘q(1) = 1’ istrue and so ‘q(1) = 2’ is false. From the second set of state transitionswe deduce that ‘q(2) = 2’ is true and so ‘q(2) = 1’ is false.

16

Exercises 1.6

1.

¬p pnand p pnor pp ∧ q (pnand q)nand (pnand q) (pnor p)nor (q nor q)p ∨ q (pnand p)nand (q nand q) (pnor q)nor (pnor q)p→ q pnand (q nand q) ((pnor p)nor q)nor ((pnor p)nor q)

2. (a) We have that p → q ≡ ¬p ∨ q. It follows that p ∨ q ≡ ¬p → q.Thus from ¬ and → we can construct ∨, but ∨ and ¬ togetherare adequate, and so ¬ and → are adequate.

(b) Observe that p→ f ≡ ¬p. Adequacy now follows from part (a).

3. (a) If T ∗ T = T we would never be able to construct negation using∗.

(b) If F ∗ F = F we would never be able to construct negation using∗.

(c) The possible truth tables for ∗ are as follows.

x y nand nand ¬y ¬xT T F F F FT F T F T FF T T F F TF F T T T T

If we look at the third column, the value of x1 ∗ . . . ∗ xn willeither be xn or ¬xn. It will therefore be true for exactly half thetruth assignments. But there are plenty of wff which are not truefor exactly half the truth assignments. Therefore it cannot beadequate on its own. A similar argument applies to the fourthcolumn.

17

Exercises 1.7

1. (a) p ∧ ¬q ∧ r.

(b) (p ∧ q ∧ ¬r) ∨ (p ∧ ¬q ∧ ¬r).

(c) (p ∧ q ∧ r) ∨ (p ∧ ¬q ∧ r) ∨ (¬p ∧ q ∧ r) ∨ (¬p ∧ ¬q ∧ r).

18

Exercises 1.8

1. (a)

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

≡ ¬(¬p ∨ q) ∨ p

≡ (¬¬p ∧ ¬q) ∨ p

≡ (p ∧ ¬q) ∨ p NNF and DNF.

(b)

p→ (q → p) ≡ ¬p ∨ ¬q ∨ p NNF and DNF.

(c)

(q ∧ ¬p)→ p ≡ ¬(q ∧ ¬p) ∨ p

≡ (¬q ∨ ¬¬p) ∨ p

≡ ¬q ∨ p ∨ p

≡ ¬q ∨ p NNF and DNF.

(d) (p ∨ q) ∧ r is already in NNF and (p ∨ q) ∧ r ≡ (p ∧ r) ∨ (q ∧ r) isin DNF.

(e) p→ (q ∧ r) ≡ ¬p ∨ (q ∧ r) is in NNF and DNF.

(f) (p∨q)∧(r → s) ≡ (p∨q)∧(¬r∨s) is in NNF and (p∨q)∧(¬r∨s) ≡(p ∧ ¬r) ∨ (p ∧ s) ∨ (q ∧ ¬r) ∨ (q ∧ s) is in DNF.

2. We use the calculations from Question 1 above.

(a) (p ∧ ¬q) ∨ p ≡ (p ∨ p) ∧ (¬q ∨ p) ≡ p ∧ (¬q ∨ p).

(b) (¬p ∨ ¬q ∨ p).

(c) (¬q ∨ p).

(d) (p ∨ q) ∧ (r).

(e) ¬p ∨ (q ∧ r) ≡ (¬p ∨ q) ∧ (¬p ∨ r).

(f) (p ∨ q) ∧ (¬r ∨ s).

19

3. (a)

p q r A

T T T TT T F FT F T TT F F FF T T TF T F FF F T TF F F F

(b) (p ∧ q ∧ r) ∨ (p ∧ ¬q ∧ r) ∨ (¬p ∧ q ∧ r) ∨ (¬p ∧ ¬q ∧ r).

(c)

p q r ¬AT T T FT T F TT F T FT F F TF T T FF T F TF F T FF F F T

(d) (p ∧ q ∧ ¬r) ∨ (p ∧ ¬q) ∧ ¬r) ∨ (¬p ∧ q ∧ ¬r) ∨ (¬p ∧ ¬q ∧ ¬r).

(e) (¬p ∨ ¬q ∨ r) ∧ (¬p ∨ q ∨ ¬r) ∧ (p ∨ ¬q ∨ r) ∧ (p ∨ q ∨ r).

4. (a)

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

≡ (¬p ∨ ¬q ∨ r) ∧ ((p ∧ q) ∨ r).

(b) (¬p ∧ p ∧ q) ∨ (¬p ∧ r) ∨ (¬q ∧ q ∧ p) ∨ (¬q ∧ r) ∨ (r ∧ p ∧ q) ∨ r.

(c) (¬p ∨ ¬q ∨ r) ∧ (p ∨ r) ∧ (q ∨ r).

20

(d)

A ≡ ((p ∧ q)→ r) ∧ (¬(p ∧ q)→ r)

≡ (¬(p ∧ q) ∨ r) ∧ (¬¬(p ∧ q) ∨ r)

≡ (¬(p ∧ q) ∧ (p ∧ q)) ∨ r

≡ r.

5. (¬p ∨ ((¬q ∨ r) ∧ (¬r ∨ q))) ∧ (p ∨ (q ∧ ¬r) ∨ (r ∧ ¬q)). This questionillustrates the fact that although we can write any wff in NNF, thereare good reasons for not always doing so.

6. (a) (q → p) ∧ (r → q). Satisfiable with all atoms taking the value F .

(b) ((q ∧ r)→ p)∧ ((s∧ u)→ f)∧ ((p∧ q)→ r)∧ (t→ p)∧ (t→ q).Satisfiable with the following truth assignment

p q r s uT T T F F

(c) (t→ p) ∧ (t→ q) ∧ ((p ∧ q)→ f) ∧ (p→ r). Unsatisfiable

21

Exercises 1.9

1. (a) A says that you should 2-colour the graph so that adjacent verticeshave different colours.

(b) It is a contradiction.

(c) It is impossible to 2-colour this graph in this way.

22

Exercises 1.10

1. (a) Show that � (p→ q)→ (¬q ∨ ¬p).

(b) Show that � ((p→ q) ∧ (¬q → p))→ q.

(c) Show that ((p→ q) ∧ (r → s) ∧ (p ∨ r))→ (q ∨ r).

(d) Show that ((p→ q) ∧ (r → s) ∧ (¬q ∨ ¬s))→ (¬p ∨ ¬r).

2. Suppose that x1 ∨ x2 ∨ x3 and ¬x1 ∨ y2 ∨ y3 are both true. There aretwo cases. Suppose that x1 is true. Then ¬x1 is false. Thus at leastone of y2 or y3 is true and so x2 ∨ x3 ∨ y2 ∨ y3 is true. Suppose that x1

is false. Then at least one of x2 or x3 is true and so x2 ∨ x3 ∨ y2 ∨ y3 istrue.

3. The proofs of (a), (b) and (c) are all straightforward.

(d) Suppose that A1, . . . , Am, X � B1, . . . , Bn is a valid argument. Weprove that A1, . . . , Am � ¬X,B1, . . . , Bn is a valid argument. Supposethat A1, . . . , Am are all true. If X is false then ¬X is true and we aredone. If X is true then B1 ∨ . . . ∨ Bn is true and we are done. Theproof of (e) is straightforward.

(f) Suppose that A1, . . . , Am are all true, Then B1∨ . . .∨Bn∨X is trueand B1 ∨ . . .∨Bn ∨Y . Thus, by distributivity, B1 ∨ . . .∨Bn ∨ (X ∧Y )is true. The proof of (g) is straightforward. The proof of (h) followsby (e) and (g).

23

Exercises 1.11

1. (a) p→ qXr → sXp ∨ rX¬(q ∨ s)X

¬q¬s

¬p

7p r

7¬r s7

q7

All branches close so argument is valid.

(b) p→ qXr → sX¬q → ¬sX¬(¬p ∨ ¬r)X

X¬¬pX¬¬r

pr

7¬p q

7¬q ¬s

7¬r s7

All branches close so argument is valid.

24

(c) p→ qXr → sXp ∨ ¬sX¬(q ∨ ¬r)X

¬q¬¬rX

r

¬p

p7 ¬s

7¬r s7

q7

All branches close so argument is valid.

2. (a) ¬(q → (p→ q))X

q¬(p→ q)X

p¬q7

Truth tree closes and so a tautology.

(b) ¬((p→ q) ∧ (q → r))→ (p→ r))X

(p→ q) ∧ (q → r)X¬(p→ r)X

p→ qXq → rX

p¬r

7¬p q

7¬q r7

Truth tree closes and so a tautology.

25

(c) ¬(((p→ q) ∧ (p→ r))→ (p→ (q ∧ r)))X

(p→ q) ∧ (p→ r)X¬(p→ (q ∧ r))X

p→ qXp→ rX

p¬(q ∧ r)X

7¬p q

7¬q ¬r

7¬p r7

Truth tree closes and so a tautology.

(d) ¬(((p→ r) ∧ (q → r)) ∧ (p ∨ q))→ r)X

((p→) ∧ (q → r)) ∧ (p ∨ q)X¬r

p→ rXq → rXp ∨ qX

¬p

7p q

7¬q r7

r7

Truth tree closes and so a tautology.

3. Pooh’s argument in symbolic form is

p, p→ q, q → r, r → s, s→ t � t.

The truth tree for this argument is as follows.

26

pp→ qXq → rXr → sXs→ tX¬t

¬p7 q

7¬q r

7¬r s

7¬s 7t

Since the tree closes the argument is valid.

27

Exercises 1.12

28

Exercises 2.1

1. True in both cases since neither the order of the elements in a set norrepetitions affect what the set is.

2. There are 16 such subsets. These consist of ∅ and {a, b, c, d}; foursubsets containing exactly one element each; six subsets that containexactly two elements each; four subsets that contains exactly threeelements each.

3. (a) A = {2, 4, 6, 8, 10}.(b) B = {1, 3, 5, 7, 9}.(c) C = {6, 7, 8, 9, 10}.(d) D = ∅.(e) E = {2, 3, 5, 7}.(f) F = {1, 2, 3, 4, 7, 8, 9, 10}.

4. (a) 0.

(b) 1.

(c) 2.

(d) 3.

29

Exercises 2.2

1. (a) A ∩B ∩ C.

(b) A ∩B ∩ C.

(c) A ∩B ∩ C.

(d) A ∩B ∩ C.

(e) A ∩B ∩ C.

(f) A ∩B ∩ C.

(g) A ∩B ∩ C.

(h) (A ∪B ∪ C).

2. Straightforward.

3. Use truth tables.

4. Each of the sets in Question 2 is defined using the corresponding wffin Question 3. Logical equivalence of the wff translates into equality ofthe corresponding sets.

5.

b = b + 0 by (B3)

= b + (bb) by (B10)

= (b + b)(b + b) by (B8)

= (b + b)1 by (B9)

= b + b by (B6).

6.

0b = (bb)b by (B10)

= (bb)b

= bb2 by (B5) and (B4)

= bb since b2 = b

= 0 by (B10).

30

7.

1 + b = (b + b) + b by (B9)

= (b + b) + b by (B2)

= b + (b + b) by (B1)

= b + b since b + b = b

= 1 by (B9).

8. (a)

a(a + b) = a2 + ab by distributivity

= a + ab since a2 = a

= a by absorption.

(b)

a(a + b) = aa + ab by distributivity

= 0 + ab since aa = 0

= ab.

9. (a) x.

(b) 0.

(c) x + y.

(d) x.

(e) (x + z)y.

(f) x + y.

10. Here is the idea. Details are omitted. Observe that each number in theset B is uniquely of the form 2x3y5z where x, y, z ∈ {0, 1}. Thus eachnumber n = 2x3y5z in B can be mapped to the subset Y of {2, 3, 5}where Y contains 2 if and only if x = 1, and contains 3 if and only ify = 1 and contains 5 if and only if z = 1.

11. We deal with the operation + first. By axioms (B2) and (B3), we havethat 0 + 0 = 0, 1 + 0 = 1 and 0 + 1 = 1. By Question 3, we havethat 1 + 1 = 1. Now we deal with the operation ·. By Question 2

31

and (B5), we have that 0 · 0 = 0, 0 · 1 = 0 and 1 · 0 = 0. By part(1) of Proposition 2.2.4, we have that 1 · 1 = 1. Finally, we deal withcomplementation. We use Proposition 2.2.7. By (B9) and (B10), wehave that 0 + 0 = 1 and 0 · 0 = 0. But 1 also satisfies both of theseequations in palce of 0 and so we deduce that 0 = 1. Similarly, 1+1 = 1and 1 · 1 = 0 implies that 1 = 0.

32

Exercises 2.3

1. (a) xyz.

(b) xyz + x y z.

(c) xyz + xyz + xyz.

2. (a) u = x.

(b) u = x.

(c) u = x + y.

3. u = 1.

4. u = x + y + z

5. (a) 1010.

(b) 101010.

(c) 10011001.

(d) 11111010001.

6. (a) 7.

(b) 85.

(c) 455.

7. (a) 110.

(b) 100011010.

(c) 111010.

8. A transistor is defined by the following Boolean expression x� y = x·y.Now, x nor y = (x + y) = x · y = x� y = (1�x)� y.

33

9. (a)c a b c′ a′ b′

0 0 0 0 0 00 1 0 0 1 00 0 1 0 0 10 1 1 0 1 11 0 0 1 0 01 1 0 1 0 11 0 1 1 1 01 1 1 1 1 1

(b) The inputs to the second Fredkin gate will be labelled a′, b′, c′ andthe outputs will be labelled a′′, b′′, c′′. If c = 0 then a′′ = a, b′′ = band c′′ = c. If c = 1 then, also, a′′ = a, b′′ = b and c′′ = c.Thus two such gates in series just give the identity function withoutputs equal to the inputs. This means that Fredkin gates arereversible.

(c) a′ = b · c. We can therefore construct and-gates.

(d) a′ = c. We can therefore construct not-gates. Also, a′ = c andc′ = c so we can also perform fanout.

(e) a′ = a + c. We can therefore construct or-gates.

10. (a)a b c a′ b′ c′

1 1 1 1 1 01 1 0 1 1 11 0 1 1 0 11 0 0 1 0 00 1 1 0 1 10 1 0 0 1 00 0 1 0 0 10 0 0 0 0 0

(b) a′′ = a, b′′ = b and c′′ = a′b′⊕ c′ = ab⊕ (ab⊕ c) = c where we haveused the fact that ⊕ is associative and x ⊕ x = 0. This meansthat Toffoli gates are reversible.

(c) c′ = a · b.

34

(d) c′ = a.

(e) b′ = b, c′ = b. This is fanout.

35

Exercises 2.4

36

Exercises 3.1

1. (a) Athelson doesn’t like himself.

(b) If Athestan likes himself then he isn’t taller than himself.

(c) Cenric isn’t melancholy and he doesn’t like Ethegiva.

(d) Athelstan is a cat if and only if either he is melancholy or he likesEthelgiva.

(e) Someone is taller than Cenric.

(f) Athelstan and Cenric like everyone.

(g) Athelstan and Cenric like everyone.

(h) Someone is taller than Athelstan or someone is taller than Cenric.

(i) Someone is taller than Athelstan or taller than Cenric.

(j) All cats like Ethelgiva.

(k) There is a cat that Ethelgiva doesn’t like.

(l) There is a cat that Ethelgiva doesn’t like.

(m) For each cat, either Cenric likes it or Ethelgiva likes it.

(n) There is a melancholy cat taller than Cenric.

2. (a) (∀x)L(x, e).

(b) (∀x)(L(c, x) ∨ L(a, x)).

(c) (∀x)L(a, x) ∨ (∀x)L(c, x).

(d) (∃x)(T (x, a) ∧ T (x, c)).

(e) (∃x)T (x, a) ∧ (∃x)T (x, c).

(f) (∀x)(C(x)→ L(e, x)).

(g) (∀x)(C(x)→ L(e, x)).

(h) (∃x)(C(x) ∧ L(e, x)).

(i) ¬(∃x)(C(x) ∧ L(e, x)).

(j) (∀x)(L(x, e)→ ¬C(x)).

(k) ¬(∃x)(L(x, e) ∧ C(x)).

(l) (∃x)(L(x, a) ∧ L(x, e)).

37

(m) ¬(∃x)(L(x, a) ∧ L(x, c)).

3. In all cases, for every variable x, regarded as a leaf, there is a path fromx to a quantifier with that variable.

(a)

∀x

P

x

∃x

P

x

(b)

∃x

P

x

∃y

P

y

(c)

38

∀y

∀x

P

x

P

y

(d)

∃y

P

y

∀x

P

x

(e)

39

¬

∃y

P

y

∀y

∃x

P

x

P

y

4. (a) (∃z)(P (z, x) ∧ P (z, y)) ∧B(x).

(b) (∃y)(∃z)(P (x, z) ∧ P (z, y)) ∧ A(x),

(c) (∃y)Q(x, y).

5. The 2-place predicate symbol will be interpreted as a directed graph.The two 1-place predicate symbols could be interpreted as, for example,colours of the vertices.