38
1 PROPOSITIONAL LOGIC This book is about logical systems. Our view of such systems is that they consist of three major components: 1. a formal language, 2. an intended semantic interpretation, 3. a family of reasoning rules. The formal language is used to represent knowledge, i.e. collections of assumptions. The intended interpretation, which could be either purely mathematical or just intuitive, represents our perception of the connec- tion between the formal language and the knowledge. The reasoning rules allow us to draw logical conclusions from the representation of the knowledge. The most common and most widely used logical system is known as classical first-order predicate calculus. The power of the pred- icate calculus means that it (or its extensions) can be used for most application areas. The general field of logic has many applications. It started in philoso- phy for the analysis of human arguments and of various concepts we use, such as causality, necessity, time, concepts in the philosophy of religion, ethics, etc. Logic is used to analyze the foundations of mathematics. Some parts of logic such as set theory, model theory, recursion theory, constructive mathematics and topoi are now considered as mathemat- ics subjects in their own right. In linguistics suitable logics and logical grammars are constructed to analyze our use of language; for example, 1

PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1PROPOSITIONAL LOGIC

This book is about logical systems. Our view of such systems is thatthey consist of three major components:

1. a formal language,

2. an intended semantic interpretation,

3. a family of reasoning rules.

The formal language is used to represent knowledge, i.e. collections ofassumptions. The intended interpretation, which could be either purelymathematical or just intuitive, represents our perception of the connec-tion between the formal language and the knowledge. The reasoningrules allow us to draw logical conclusions from the representation of theknowledge. The most common and most widely used logical system isknown as classical first-order predicate calculus. The power of the pred-icate calculus means that it (or its extensions) can be used for mostapplication areas.

The general field of logic has many applications. It started in philoso-phy for the analysis of human arguments and of various concepts we use,such as causality, necessity, time, concepts in the philosophy of religion,ethics, etc. Logic is used to analyze the foundations of mathematics.Some parts of logic such as set theory, model theory, recursion theory,constructive mathematics and topoi are now considered as mathemat-ics subjects in their own right. In linguistics suitable logics and logicalgrammars are constructed to analyze our use of language; for example,

1

Page 2: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

2 1. PROPOSITIONAL LOGIC

how we use pronouns, quantifiers, tenses and so on. The use of logicin linguistics is important for natural language processing in computerscience. The logical analysis of the language must, in many cases, bedone first, in order to enable us to apply computer science to language.In addition, logic is used to study cognition in psychology, and specialquantum logics have been constructed for the study of the foundationsof quantum mechanics in physics. However, our formulation of logic inthis book is motivated by its use in computing. Logic is used directly incomputer science, especially in the areas of:

• specification and verification of programsLogic sentences are used to describe the desired behaviour of aprogram, and the program itself; manipulating the sentences canshow whether the program implements the specification.

• distributed computing, concurrency and process controlCertain forms of logic are devised specifically to reason about phys-ical phenomena, such as time and space, and these are used toreason about interacting processes.

• database managementQuerying databases is essentially a matter of testing to see if onesentence is a logical consequence of some other sentences; simi-larly, updating and consistency maintenance can also be viewed aslogical operations.

• circuit design and VLSILogic has been applied to the problem of describing and verifyingthe behaviour of electronic circuits.

• expert systems, planning and artificial intelligenceThese areas are substantially based on the application of rules todata, which is the raison d’être for logic.

• natural language processingThe semantics of sentences such as ‘Alun ate the cake that Bethanhad bought that morning’ can be represented by logic formulae.These formulae can then be used to reason about the consequencesof the sentences.

• logic programmingThis is the most obvious connection between computing and logic,

Page 3: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.1. INTRODUCING CLASSICAL PROPOSITIONAL LOGIC 3

where a special formulation of logic (called Horn clause logic) isused as a basis for the programming language Prolog.

1.1 Introducing classical propositional logicWe begin with the simplest of logics: the classical propositional logic.The rest of this chapter will describe the language of classical proposi-tional logic, which essentially can contain all the characteristic elementsof many major logical systems. Many different logics, formulations andstyles can all be recognized through their propositional parts.1

The first assumption of classical logic is that we are dealing withatomic propositions (statements), which can receive a truth value oftrue (>) or false (⊥), in any given situation. By situation we mean alocal snapshot, a description of what is happening at a certain place at acertain time from a fixed and agreed point of observation. The classicallogic is two valued, i.e. propositions can only have a truth value of trueor false. Here we are already making a very serious assumption withfar-reaching logical consequences. Statements like

John loves Mary.

may not in reality have a clear-cut truth value. In situations where itmay not be possible for propositions to have a precise truth value, a non-classical logic may be required. We present a logic for such situationsin Chapter 2.

The second assumption of classical logic is that we are dealing witha single situation, or snapshot. A notable different assumption could bethat we are dealing with a sequence of snapshots, a changing situationover time. This gives rise to the so-called temporal logics.

The third assumption for classical logic, as for most other logics, isthat the truth value of a complex structured sentence depends only onthe truth value of its parts. Thus the value of the complex sentence

John and June got married and John and June had a child.1This footnote can be appreciated after reading Chapters 7 and 8: different propo-

sitional logics can be presented through their own characterisitic propositional axiomsand rules. They can be turned into predicate logics by enriching the language andadding more axioms for the quantifiers. Up to very recently the quantificational com-ponent of a logic was more or less a standard addition (with some variation) to itspropositional part. (See Remark 8.3.8 below.) It is only recently that general theoriesof quantifiers are being developed.

Page 4: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

4 1. PROPOSITIONAL LOGIC

depends on whether the two sentences

John and June got married.John and June had a child.

are true or false.There are many intensional sentences whose truth value does not

depend on the truth values of the components. For example,

Tom believes that John and June had a child.

may be true or false independently of whether John and June did indeedhave a child or not.

1.1.1 Formal language

The formal language of propositional logic consists of a set of symbols(typically {p, q, r, . . .}) which are the atomic propositions, and the sym-bols ∧ for conjunction (pronounced ‘and’), ∨ for disjunction (‘or’), →for implication (‘implies’) and ¬ for negation (‘not’), to build up morecomplex sentences.

If A and B are the components, we can build up the formulae(A)∧(B), (A)∨(B), (A)→(B) and ¬(A) from them. The truth values ofthe more complex sentences are determined by the truth values of theatomic propositions and the logical symbols in the complex sentences.Take the sentence ¬(p), and suppose that the proposition p is given thevalue ⊥ (false). We find the value of ¬(p) by looking up the value givenby ¬ when applied to ⊥, in the table

A ¬A> ⊥⊥ >

For an argument which is ⊥, ¬ produces > (true), so ¬(p) is true whenp is false. Now consider the sentence (p)∧(q). The table for ∧ is

A B A∧B> > >⊥ > ⊥> ⊥ ⊥⊥ ⊥ ⊥

Page 5: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.1. INTRODUCING CLASSICAL PROPOSITIONAL LOGIC 5

Suppose that p is given the value > and q is given the value ⊥; thenwe can see that (p)∧(q) has the value ⊥. Similarly if both p and q aregiven the value >, then (p)∧(q) has the value > as well, which is why ∧is pronounced ‘and’.

The ∨ operator has the table

A B A∨B> > >⊥ > >> ⊥ >⊥ ⊥ ⊥

and thus (p)∨(q) has the value > whenever either p or q is given thevalue >; hence ∨ is called ‘or’. Finally, the table for → is

A B A→B> > >> ⊥ ⊥⊥ > >⊥ ⊥ >

so that when p is > and q is ⊥, (q)→(p) is >.The table for → is less straightforward than the previous ones, so

let us check the rationale behind it. Suppose we see an advertisementfor a shop which claims: ‘For payment in cash we give a 25% reductionon the price of all television sets.’ We decide to check the truth of thisadvertisement and go into the shop to buy a TV set. There are fourpossible outcomes:

1. We pay cash and get a 25% reduction.

2. We pay cash, but do not get a 25% reduction. (The shop clerk tellsus ‘this is our last set, take it or leave it!’)

3. We do not pay cash (i.e. we get credit), but nevertheless we get the25% reduction. (The shop clerk is very nice and says ‘Well, if youcan’t pay now, pay when your next salary cheque comes in’.)

4. We do not pay cash and we do not get the 25% reduction.

We summarize these outcomes in the following table:

Page 6: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

6 1. PROPOSITIONAL LOGIC

Pay Cash Get 25% Advert1 True True2 True False3 False True4 False False

What do we put in the right-hand column of this table? When is theadvertisement misleading? We cannot complain about outcomes 1 and3 since in both cases the 25% reduction was given. Outcome 2 would,if true, clearly make the advertisement false, so the only case whichmay leave us in doubt about what to put in the table is outcome 4. Wecannot say with conviction that the advertisement is misleading, becausewe did not pay cash. On the other hand, neither can we confirm thatthe advertisement is true, since we did not test the condition of payingby cash. We need to place some value there, if we are to continue to usetruth tables, so we must decide on some convention. Classical logic iscontent with assuming truth for outcome 4.

Pay Cash Get 25% Advert1 True True True2 True False False3 False True True4 False False ???

Later in the book we will introduce other views of →.If we have nested complex sentences, such as ¬((p)∨(q)), we work

out the value of the innermost sentences first, working outwards, so thatwe evaluate (p)∨(q) and use the result of that to evaluate the ¬. If pand q are both ⊥, then (p)∨(q) is also ⊥, and thus ¬((p)∨(q)) is >.

Exercise 1.1.1 Work out the truth values of the following formulaewhen p has the value >, and q has the value ⊥:

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

2. (p)→(p)

3. (p)→(¬(p))

4. ((q)∨(¬(q)))∧(p)

We now formally define the notion of a well-formed formula (wff)of classical propositional logic and the truth values given to the variousoperators.

Page 7: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.1. INTRODUCING CLASSICAL PROPOSITIONAL LOGIC 7

Definition 1.1.2 (Classical propositional logic)

1. The language of classical propositional logic contains a set Lp ofatomic propositions with typical members {p, q, r, s, q1, q2, q3, . . .} anda set of connectives {∧,∨,¬,→}.

2. The notion of a well-formed formula (wff) is defined inductively bythe following conditions:

(a) Any atom p ∈ Lp is a wff. We say it is built up from {p}.(b) If A and B are wffs then so are: ¬(A), (A)∧(B), (A)∨(B),

(A)→(B). If A is built up from the atoms {p1, . . . , pn} and B isbuilt up from the atoms {q1, . . . , qk}, then ¬(A) is built up fromthe same atoms as A and (A) ∧ (B), (A) ∨ (B) and (A)→ (B)are built up from {p1, . . . , pn, q1, . . . , qk}.

(c) Let A be a formula built up from q1, . . . , qk. We indicate this factby writing A(q1, . . . , qk). Let B1, . . . , Bk be wffs. We define bystructural induction the result of substituting in A the formulaeBi for the atom qi, for i = 1, . . . , k. We denote this substitutionby A(q1/B1, . . . , qk/Bk) and refer to it as a substitution instanceof A.• For atomic A(q) = q, we let A(q/B) = B.• (¬(A))(q1/B1, . . . , qk/Bk) = ¬(A)(q1/B1, . . . , qk/Bk)• ((A) → (B))(q1/B1, . . . , qk/Bk) = A(q1/B1, . . . , qk/Bk) →B(q1/B1, . . . , qk/Bk) and similarly for (A)∧ (B) and (A)∨(B).

3. An interpretation (or assignment) is any function h assigning truthvalues to the atomic propositions. h is a function from Lp into{>,⊥}, i.e. h : Lp 7→ {>,⊥}.

4. We can extend the definition of h from atomic propositions to anywff A by induction, as follows:

(a) h(¬(A)) = > if h(A) = ⊥ , otherwise the value is ⊥.(b) h((A)∧(B)) = > if h(A) = > and h(B) = >, otherwise the

value is ⊥.(c) h((A)∨(B)) = > if h(A) = > or h(B) = > or both, otherwise

the value is ⊥.

Page 8: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

8 1. PROPOSITIONAL LOGIC

(d) h((A)→(B)) = > if h(A) = ⊥ or h(B) = > or both, otherwisethe value is ⊥.

The above definition of h(A) agrees with our understanding of themeaning of the connectives as presented in the truth tables.

5. We find it convenient to assume that our language contains as atomicpropositions the constant atoms > and ⊥. > is always true and ⊥ isalways false.

By defining a precedence hierarchy for each of our connectives, wecan omit many of the brackets which clutter our formulae. Let us agreethat the precedence of the connectives is as follows: ¬ is stronger than∧ which is stronger than ∨ which is stronger than →. This is similarto the situation we have in algebra, where − (unary minus) is strongerthan ×, which is stronger than +. Thus −2 + 5 × 3 is equivalent to(−2) + (5 × 3) = 13. Similarly ¬q∨r∧s→q is ((¬q)∨(r∧s))→q. Toclarify the structure of written formulae further, we will sometimes use[ and ] instead of ( and ), e.g. as in [(¬q)∨(r∧s)]→q.

In general A ∧ B ∧ C means (((A) ∧ (B)) ∧ (C)) and similarly forA ∨B ∨ C.

1.1.2 Computing truth tables

To calculate the truth values of complex wffs for arbitrary truth values ofpropositions, we build a truth table for the sentence. This is how tocompute a truth table for the wff A = (¬p→q)∨r.

Step 1 Count the number of atoms in A. In this case it is 3 (p, q andr).

Step 2 Form a table with 23 = 8 rows and with as many columns asthere are subformulae (i.e. nested sentences) of A. In our casethe table is shown below, where r is the first atom, q is thesecond atom and p is the third atom (from the right).

Page 9: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.1. INTRODUCING CLASSICAL PROPOSITIONAL LOGIC 9

p q r ¬p (¬p→q) (¬p→q)∨r12345678

Step 3 Fill in the columns of the atoms with > and ⊥ by alternatingdownwards >⊥>⊥. . .for the first atoms, >>⊥⊥. . . for the second atoms and so onin powers of 2:

p q r ¬p (¬p→q) (¬p→q)∨r1 > > >2 > > ⊥3 > ⊥ >4 > ⊥ ⊥5 ⊥ > >6 ⊥ > ⊥7 ⊥ ⊥ >8 ⊥ ⊥ ⊥

Step 4 Compute the values in the other columns row by row using thebasic truth tables for the connectives:

p q r ¬p (¬p→q) (¬p→q)∨r1 > > > ⊥ > >2 > > ⊥ ⊥ > >3 > ⊥ > ⊥ > >4 > ⊥ ⊥ ⊥ > >5 ⊥ > > > > >6 ⊥ > ⊥ > > >7 ⊥ ⊥ > > ⊥ >8 ⊥ ⊥ ⊥ > ⊥ ⊥

Exercise 1.1.3 Compute the truth tables of the following sentences:

1. ¬A∨B

Page 10: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

10 1. PROPOSITIONAL LOGIC

2. ¬(¬A∧¬B)

3. A∨¬A

4. ((A∧B)→C)→(A→(B→C))

5. (A→B)∧(B→A); this formula is abbreviated (A↔ B)

6. (A→(B∧C))→((A→B)∧(A→C))

Most wffs have contingent truth tables, meaning that they becometrue or false depending on the truth values of their atoms. For example,the following can be made either true or false depending on the valuesof p and q:

[(p→q)∧q]→p

If p is intended to mean ‘you are a heavy smoker’ and q ‘you cough’,then the above might be read (more or less) as

[if you are a heavy smoker then you cough, and you cough,then you are a heavy smoker].

Now if you cough, and yet are not a heavy smoker, then the aboveformula is false. On the other hand, if you are a heavy smoker, theformula is true regardless of whether you cough or not.

We saw that every wff has a truth table, but is the converse true? Fora given truth table for, say, p, q and r, is there a corresponding formulaA(p, q, r) with the given truth table? The answer is yes. We demonstratethis by means of an example. Can we find a formula A(p, q, r) with thefollowing truth table?

p q r A1 > > > >2 ⊥ > > >3 > ⊥ > >4 ⊥ ⊥ > ⊥5 > > ⊥ ⊥6 ⊥ > ⊥ ⊥7 > ⊥ ⊥ ⊥8 ⊥ ⊥ ⊥ ⊥

The wff with the above table is

A = [p∧q∧r]∨[¬p∧q∧r]∨[p∧¬q∧r]

Page 11: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.1. INTRODUCING CLASSICAL PROPOSITIONAL LOGIC 11

How do we find A? We go over the table and take out the rows for whichthe table for A gives a value of > to A. In this example there are threesuch rows:

p q r A1 > > > >2 ⊥ > > >3 > ⊥ > >

For each such row we describe what the values of p, q and r are asindicated:

• For > > > write [p∧q∧r]

• For ⊥ > > write [¬p∧q∧r]

• For > ⊥ > write [p∧¬q∧r].

A is the disjunction (a combination using ∨) of all the wffs for the rows,i.e.

A = [p∧q∧r]∨[¬p∧q∧r]∨[p∧¬q∧r]What we said in symbols means the following in English: A is >

exactly when p, q and r are all true, or when p is false and q and r aretrue, or when p is true, q is false and r is true. We should show thatA has exactly the required table. In other words, that it is impossiblefor our formula A to be true under an assignment of truth values to p,q and r for which the truth table records a value of ⊥ for A. No suchsituation can arise, since for the wff A to be true, one of its disjunctsmust be true. Each of its disjuncts uniquely describes one row in thetruth table, in particular a row which gives a value of > to A.

Exercise 1.1.4

1. Find a wff A for each of the following tables:

p q A =?> > >> ⊥ ⊥⊥ > ⊥⊥ ⊥ >

p q r A =?> > > >> > ⊥ ⊥> ⊥ > ⊥> ⊥ ⊥ >⊥ > > ⊥⊥ > ⊥ >⊥ ⊥ > >⊥ ⊥ ⊥ ⊥

Page 12: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

12 1. PROPOSITIONAL LOGIC

2. Can the following be all true?

The television is switched on. If the television is switchedon and has power then there is a picture. There is no pic-ture.

(Hint: translate into symbols and check the truth table for a row inwhich the conjunction of the sentences is true.)

1.2 Notions of truth and validityWe have seen in the exercises that some wffs have truth tables with thevalue > throughout in the right-hand column. Such wffs are called tau-tologies. They are always true no matter what truth values their atomshave. We can also define a tautology in terms of the truth assignmenth.

Definition 1.2.1 A wff A is a tautology iff for every assignment h,h(A) = >. The symmetric concept is that A is a contradiction iff forevery h, h(A) = ⊥. If A is a tautology we denote it by � A.2

Some commonly encountered tautologies include

p∨¬p p→p[p∧(p→q)]→q p∧q→pp∧q→q ¬¬p→pp→¬¬p p→p∨qq→p∨q [(p→q)∧¬q]→¬p

Tautologies are logical truths. Contradictions, on the other hand, arelogical falsities, and can never be true. Here are some example contra-dictions:

p∧¬p¬(p→p)p∧(p→q)∧¬q

Notice that if A is a tautology, ¬A is a contradiction. If a formula A isnot a contradiction, then there is at least one assignment h to its atoms

2Tautologies are also called theorems of logic, especially in the context of someother ways of generating them. See next chapter.

Page 13: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.2. NOTIONS OF TRUTH AND VALIDITY 13

which gives h(A) = >. When this is the case, the formula A is saidto be consistent or satisfiable. Some examples of consistent (but nottautological) sentences are

p

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

1.2.1 Equivalences

Two formulae A,B which have the same truth table (i.e. h(A) = h(B)for all h) are said to be equivalent. Logically they ‘say’ the same thing.We indicate equivalence by writing ≡ (pronounced ‘if and only if’, or‘iff’). Thus A ≡ B means that A and B have the same truth table. Forexample,

¬¬p ≡ p

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

These first three are called the De Morgan laws. Others include

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

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

p ∧ p ≡ p

p ∧ q ≡ q ∧ p(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)

p ∨ p ≡ p

p ∨ q ≡ q ∨ p(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ ¬p ≡ ⊥p ∨ ¬p ≡ >

Using equivalences, we can define some of the truth connectives in termsof each other:

p→q ≡ ¬p∨q

Page 14: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

14 1. PROPOSITIONAL LOGIC

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

We can also use the equivalences to transform formulae to otherequivalent formulae like we do in school algebra. See Exercise 1.2.5 andits solution.

Exercise 1.2.2

1. Let p|q be defined as the wff with p, q having the table below:

p q p|q> > ⊥⊥ > >> ⊥ >⊥ ⊥ >

Define ∧,∨,¬ and → using |. (Hint: let ¬p be p|p.) The ‘|’ operatoris known as the Sheffer stroke.

2. Which of the following are tautologies?

(a) (p∨q)∧¬p→q(b) (¬q→¬p)→(p→q)(c) (p∧q∨r)→(p∧q∧r)(d) ((p→q)→p)→p

Definition 1.2.3 (Normal forms) There are two basic normal formsin which sentences can be written, based on disjunctions (combinationsusing ∨) and conjunctions (combinations using ∧). Such normal formsare sometimes used for automatic methods of checking whether a sen-tence is a tautology.

Page 15: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.2. NOTIONS OF TRUTH AND VALIDITY 15

1. Disjunctive normal form—a formula of the form

A1∨A2∨ · · · ∨Ak

where each Ai is a conjunction of either atoms or their negations, iscalled a wff in a disjunctive normal form. These are formulae we getout of tables in the manner we described in the previous section.The formula ⊥ is considered to be in a disjunctive normal form inwhich the number of disjuncts is k = 0.

2. Conjunctive normal form—a formula of the form

A1∧A2∧ · · · ∧Ak

where each Ai is a disjunction of atoms or their negations, is calleda wff in a conjunctive normal form. This is the dual to disjunctivenormal form where ∧ and ∨ are interchanged.The formula > is considered to be in a conjunctive normal form inwhich the number of conjuncts is 0.

3. One can give a more strict definition of normal forms. First we donot allow repetition; thus p ∧ p is not allowed. Second we want eachatom p appearing in the formula to appear either as p or ¬p in eachbasic component of the normal form. Thus for example p ∨ q is notacceptable. It should be (p∧q)∨(p∧¬q)∨(¬p∧q) which is equivalent.Such a normal form we shall call a strict normal form.

We can prove that all wff can be rewritten into either of the normalforms by using the equivalences we have presented above. In fact everyformula can be put into an equivalent strict normal form if we first buildthe full truth table for it and then construct the corresponding formulafor this truth table as done in Section 1.1.2.

Theorem 1.2.4 For any wff A, there are equivalent formulae Ac andAd where Ac is in conjunctive normal form and Ad is in disjunctivenormal form.

Proof. We prove the theorem by induction over the structure of theformula A.

1. The base case is when A is an atomic proposition, so that A = Ac =Ad.

Page 16: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

16 1. PROPOSITIONAL LOGIC

2. When A is ¬B, by induction we can rewrite B into the normal formformulae Bc and Bd. By applying the De Morgan laws, negating Bc

gives a formula in disjunctive normal form, and negating Bd givesa formula in conjunctive normal form. Hence if Bc = Bc

1∧ · · · ∧Bcn

where the Bci are conjunctions of propositions or their negations,

then each Bci can be negated to become a disjunction (¬Bc

i )d so thatAd = (¬Bc

1)d∨ · · · ∨(¬Bcn)d. Similarly Ac = (¬Bd

1)c∨ · · · ∨(¬Bdn)c.

3. When A is B∨C, by induction we can rewrite both B and C intothe normal form formulae Bc, Bd, Cc and Cd. Clearly Bd∨Cd isin disjunctive normal form. Now Bc∨Cc can be transformed intoconjunctive normal form by repeated use of the equivalence

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

Assume that Bc = Bc1∧ · · · ∧Bc

m and Cc = Cc1∧ · · · ∧Ccn. Now

(Bc1∧ · · · ∧Bc

m) ∨ (Cc1∧ · · · ∧Ccn)≡ ((Bc

1∧ · · · ∧Bcm)∨Cc1) ∧ · · · ∧ ((Bc

1∧ · · · ∧Bcm)∨Ccn)

≡ ((Bc1∨Cc1)∧ · · · ∧(Bc

m∨Cc1)) ∧ · · · ∧ ((Bc1∨Ccn)∧ · · · ∧(Bc

m∨Ccn))

The Bci and Ccj are all disjunctions of propositions or their negations;

hence the entire formula is in conjunctive normal form.

4. A similar argument holds for when A is B∧C.

5. When A is B→C, we can rewrite A to be ¬B∨C, and then the proofcontinues as for disjunction above.

Exercise 1.2.5 Transform the following to both disjunctive normal formand conjunctive normal form:

[(p→q)∨r]∧¬q→p(p∨q)∧rp∧q∧¬r

1.2.2 Arguments and consequence relations

An argument is a claim that one formula B (called the goal or theconclusion) follows logically from a set of formulae A1, . . . , An (called

Page 17: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.2. NOTIONS OF TRUTH AND VALIDITY 17

the data or the assumptions). The set of assumptions may be empty(i.e. no assumption). In such a case A1, . . . , An do not appear. We canformally use the trick of saying this is the case of n = 0. Representingthe assumptions by A1, . . . , An and the goal by B, we represent theargument by

A1,. . ., AnB

or alternatively A1, . . . , An ` B, which has the virtue of being a morecompact notation. Here is an example of an argument:

Either John is at home or John is in his office.John is not in the office.Therefore John is at home.

Writing this formally with propositional symbols h for John being athome, and and o for John being at the office, we have

h∨o¬oh

or h∨o, ¬o ` h. Perhaps the most well-known argument is

A, A→BB

or A, A→B ` B. This is known as modus ponens and will be usedextensively in future chapters.

Definition 1.2.6 (Validity of arguments) An argument withassumptions A1, . . . , An and conclusion B is logically valid when theformula [(A1)∧ . . .∧(An)]→B is a tautology, otherwise the argument isinvalid. Hence an argument is valid if, whenever the assumptions of theargument are true, the conclusion is true.

Given the following information,

Assumptions Conclusion(p→q) ¬q¬p

Page 18: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

18 1. PROPOSITIONAL LOGIC

does the conclusion follow? To answer, we check if [(p→q)∧¬p]→¬q is atautology. We can write A1, . . . , An `?B when we are not sure whetherthe argument is valid. Otherwise the question mark is omitted. Weleave the reader to check whether the argument is valid or not.

A valid argument from a set of assumptions to a conclusion canbe considered to form a relationship between the assumptions and theconclusion, namely that the conclusion is true as a consequence of theassumptions being true. Thus the ` symbol is often referred to as theconsequence relation. Consequence relations satisfy the following prop-erties:

• ReflexivityIf the conclusion is also one of the assumptions then the argumentis valid, i.e. A1, . . . , An, B ` B.

• MonotonicityIf a conclusion from a set of assumptions is valid, then the sameconclusion is valid from the set of assumptions with some addi-tional formulae added, i.e. if A1, . . . , An ` B then A1, . . . , An, C `B for any C.

• Cut3If a conclusion from a set of assumptions is added to that set ofassumptions, and this larger set is used to make a second conclu-sion, then the second conclusion can be made from the originalassumptions, i.e. if A1, . . . , An ` B and A1, . . . , An, B ` C thenA1, . . . , An ` C.

In fact one can define the notion of a logical system on the set of wffs tobe any relation satisfying the above three properties. Different logicalsystems satisfy different additional properties. For example, the above` for classical logic (defined using truth tables) also satisfies

A1, . . . , An, A ` B∨C iff A1, . . . , An ` (A→B)∨C

Note that the presence of C is important. In some other logics (such asintuitionistic logic, which we will discuss in Chapter 2), C is not allowed.Further discussion is postponed to Chapter 5.

3The notion of cut is central in logic. A full discussion is given in Chapter 3.Monotonicity or non-monotonicity is also very central. This will be discussed inChapter 10.

Page 19: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.2. NOTIONS OF TRUTH AND VALIDITY 19

Here is a list of valid arguments. They are so basic that they arecalled rules.

List of valid rules

1. A∧BA

and A∧BB

(∧ elimination)

2. A,BA∧B (∧ introduction)

3. A

A∨B and B

A∨B (∨ introduction)

4. A→C, B→C, A∨BC

(∨ elimination)

5. A, A→BB

This modus ponens rule has a related form:

¬A, A∨BB

(→ elimination)

6. B, ¬BC

(¬ elimination)

7. B→C, B→¬C¬B (¬ introduction)

8. If we want to show that B1, . . . , BkA→C is a valid argument we can

show instead that B1, . . . , Bk, AC

is valid.

Exercise 1.2.7

1. Show that A logically implies B, i.e. A ` B, is a valid argument ifand only if A∧¬B is not consistent.

2. Is A →B, B →C` A→C valid?

Definition 1.2.8 (Consistency of a set of formulae) A set of wffs

{A1, . . . , An, C}

Page 20: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

20 1. PROPOSITIONAL LOGIC

is consistent if there is a row in the truth table of their conjunction whichmakes the conjunction true. In other words, if values can be given to allthe atomic sentences in {A1, . . . , An, C} which make all of A1, . . . , An, Ctrue.

For example, consider the set {p→q, ¬p, ¬q}, which is consistent ifwe can find values for p and q which will make all members of the settrue. Assigning falsity to both p and q achieves this. Now consider theset {r→s, r, ¬s}. In this case we cannot find any such values for r ands (try drawing a truth table for the formula r→s∧r∧¬s).

Exercise 1.2.9

1. There are n people standing in a queue. The first person says

‘The last person in the line is lying.’

The other people in the line say

‘The person in front of me is lying.’

We can write one sentence of the form ‘person 1 is telling the truthiff person n is not telling the truth’ for the first person in the queue,and n−1 sentences of the form ‘person i is telling the truth iff personi − 1 is not telling the truth’, for the other people in the queue. Weuse pi to represent the sentence ‘person i is telling the truth’

A1 is p1 ↔ ¬pnA2 is p2 ↔ ¬p1

...An is pn ↔ ¬pn−1

Is the set {A1, . . . , An} consistent, i.e. can you give values to p1, . . . , pnso that all of A1, . . . , An are satisfied? Does it matter whether n isodd or even?

We have learnt the notion of contradiction. A is a contradiction if ¬Ais a tautology, i.e. if the truth table for A is all the ⊥ in the right-handcolumn. A is not consistent if and only if A is a contradiction. This givesus the connection of consistency with arguments. If {A1, . . . , An, C}

Page 21: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.2. NOTIONS OF TRUTH AND VALIDITY 21

is not consistent, and if {A1, . . . , An} is true (in some interpretation)then ¬C is true (in that interpretation). Thus A1∧ · · · ∧An→¬C is atautology. The other direction is also true. If A1∧ · · · ∧An→¬C is atautology, then any row in the truth table which makes A1, . . . , An truemust also make ¬C true, i.e. make C false. Thus we cannot make all of{A1, . . . , An, C} all true.

The practical conclusion from the above is that checking whetherA1, . . . , An ` B is a logically valid argument is the same as checkingwhether {A1, . . . , An,¬B} is inconsistent. Another view of the argument

A1, . . . , AnB

is to consider A1, . . . , An as data and to consider B as a query to beasked of the data. B follows logically from A1, . . . , An if the answer tothe query B should be yes.

Thus we have the following three ways to look at the formula (i.e. 1,2 and 3 below are equivalent).

A1∧ · · · ∧An→B

1. as a tautology,

2. as a valid logical argument

A1, . . . , AnB

with assumptions A1, . . . , An and conclusion B,

3. as a statement that if we query a database with goal B and thedatabase contains A1, . . . , An among its data, then the answer is yes.

Data QueryA1, . . . , An ? B

In Chapters 3 and 4 we shall look at some rule-based methods for an-swering the question ‘does the query logically follow from the data?’In the next chapter, we broaden our horizons by beginning to look atso-called non-classical logics where components of the classical logicalsystem have been changed, offering in some cases more expressive logics,and in others more restrictive logics.

Page 22: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

22 1. PROPOSITIONAL LOGIC

Exercise 1.2.10

1. Let p stand for ‘John loves Mary’, q stand for ‘Mary loves John’, rstand for ‘John is tall’, and s stand for ‘Mary is tall’. Translate thefollowing into symbols (you may need to introduce other atoms):

(a) John loves Mary only if she loves him and she is not tall.(b) If John is tall and Mary loves him then Mary is not tall.(c) If John and Mary love each other then Mary loves herself.

2. Use the equivalence rules (see Section 1.2.1) to push all occurrences ofthe negation symbol ‘¬’ next to the atoms in the following expressions:

¬((a→b)∨(a→c)∧¬a)¬(a∧¬b)→a

3. Show the equivalences below:

(A→>) ≡ > (A→⊥) ≡ ¬A(⊥→A) ≡ > (>→A) ≡ A(A∨>) ≡ > (A∨⊥) ≡ A(A∧>) ≡ A (A∧⊥) ≡ ⊥

4. Below are several arguments in English. For each argument:

• define a dictionary using the atoms p, q, r, s, . . ., i.e. assignone of these symbols to stand for each relevant proposition inthe argument,• translate the argument into logic using the dictionary,• check whether the argument is logically valid.

(a) Either it is warm or it is raining. Unless it is not warm, we gooutside. Therefore we go outside.

(b) If the king is in the room, then the courtiers laugh only if helaughs. The courtiers always laugh when the jester is in theroom. The king never laughs when the jester is in the room.Therefore either the king or the jester is not in the room.

(c) If we are not hungry, and the food is very hot, we eat slowly. Ifwe are not hungry, either we eat slowly or the food is very hot.The food is not very hot. Therefore we are hungry.

Page 23: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 23

(d) If Jones did not meet Smith last night, then either Smith was amurderer, or Jones is telling a lie. If Smith was not a murderer,then Jones did not meet Smith last night, and the murder hap-pened after midnight. If the murder happened after midnight,then either Smith was a murderer, or Jones is telling a lie, butnot both. Therefore, Smith was a murderer.

1.3 Worked examples

Example 1.3.1 (Worked examples for Section 1.1.1)Exercises

1. Following the definition, show that in every formula the numbers ofleft and right brackets are equal.

2. Explain why the following expression is not a formula:

¬((p) ∧ (q)) ∨ (p)

3. According to the definitions, show that if A is a formula, then (A)(q/B)is a formula.

4. Let l(A) be the length of a formula A (i.e. the total number of char-acters in the expression (A)). Prove that l((A)(q/B)) ≥ l(A).

5. Show that for any formula A, 3 divides (l(A)− 1).

6. Show that if A,B are formulae and q is an atom occurring n timesin A, then l((A)(q/B)) = l(A) + n · (l(B)− 1).

7. Find an example showing that formulae (A)(p, q/B,C) and ((A)(p/B))(q/C) may be distinct.

Solutions

1. For atomic propositions there is nothing to prove. If the claim is truefor A, then it is true for ¬(A), where the numbers of left and rightbrackets increase by one. If it is true for A and B, then it is true for(A) ∧ (B), (A) ∨ (B), (A) → (B), because the total numbers of leftand right brackets increase by two.

Page 24: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

24 1. PROPOSITIONAL LOGIC

2. Suppose it is. This expression does not begin with ‘(’ and is notan atomic proposition. So it is ¬(B) for some formula B. But theexpression B = (p) ∧ (q)) ∨ (p is not a formula, because every non-atomic formula ends with ‘)’.

3. By induction. If A is atomic then (A)(q/B) is either A or B. IfA = ¬(C) then (A)(q/B) = ¬((C)(q/B)). (C)(q/B) is a formula bythe induction hypothesis. Hence (A)(q/B) is a formula by 1.1.2(b).The cases when A is an implication, disjunction or conjunction aresimilar.

4. By induction. If A is atomic then l(A) = 1, and the claim is trivial.If A = (C) ∨ (D) then l(A) = l(C) + l(D) + 5.(A)(q/B) = ((C)(q/B)) ∨ ((D)(q/B)), and so l((A)(q/B)) = l((C)(q/B))+l((D)(q/B))+5. By the induction hypothesis, l((C)(q/B)) ≥l(C), and l((D)(q/B)) ≥ l(D). Therefore l((A)(q/B)) ≥ l(A).Other cases are similar.

5. By induction. The case when A is atomic is clear.If A = ¬(B), and l(B) = 3n+1, then l(A) = l(B)+3 = 3(n+1)+1. IfA = (B)5 (C), 5 being→,∨ or ∧, and l(B) = 3m+1, l(C) = 3n+1then l(A) = l(B) + l(C) + 5 = 3m+ 3n+ 7 = 3(m+ n+ 2) + 1.

6. Again by induction. We use the notation A′ = (A)(q/B).If A is atomic, A 6= q, then A′ = A, n = 0, and thus l(A′) =l(A) + n(l(B)− 1).If A = q, then A′ = B,n = 1, and so l(A′) = l(B) = 1 + (l(B)− 1) =l(A) + n(l(B)− 1).If A = ¬(C) then A′ = ¬(C ′) by 1.1.2(c), and l(A) = l(C)+3, l(A′) =l(C ′) + 3. If q occurs n times in A, then it occurs n times in C, andso by the induction hypothesis, l(C ′) = l(C) + n(l(B) − 1). Hencel(A′) = l(C ′) + 3 = l(C) + n(l(B)− 1) + 3 = l(A) + n(l(B)− 1).If A = (C)5 (D) then A′ = (C ′)5 (D′), and l(A) = l(C) + l(D) +5, l(A′) = l(C ′) + l(D′) + 5. If q occurs n times in A, x times inC, y times in D, then n = x + y. By the induction hypothesis,l(C ′) = l(C) + x(l(B)− 1), l(D′) = l(D) + y(l(B)− 1). Thus

l(A′) = l(C ′) + l(D′) + 5= l(C) + x(l(B)− 1) + l(D) + y(l(B)− 1) + 5= l(A) + n(l(B)− 1)

Page 25: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 25

7. This may happen when q occurs in B. For instance, take A = (p)∨(q),B = q, C = p. Then (A)(p, q/B,C) = (q)∨(p), but ((A)(p/B))(q/C) =((q) ∨ (q))(q/C) = (p) ∨ (p).

Example 1.3.2 (Worked examples for Section 1.1.2)Exercises

1. Find all values of the atoms p, q, r, s, t, u for which the following for-mula is false:

(a) ((p→ q ∧ r)→ (¬q → ¬p))→ ¬p(b) (p ∧ q) ∨ (p ∧ r) ∨ (q ∧ r) ∨ (s ∧ t) ∨ (s ∧ u) ∨ (t ∧ u) ∨ (¬p ∧ ¬s)(c) p ∨ q ∨ r → (p ∨ q) ∧ (p ∨ r)(d) (p ∨ q) ∧ (q ∨ r) ∧ (r ∨ p)→ p ∧ q ∧ r(e) p ∨ q → (¬p ∧ q) ∨ (p ∧ ¬q)

2. Consider the following propositions about a natural number n:

n < 100n > 35n > 9n > 10n > 5

Find n, for which two of these propositions are false, and three othersare true. Is such n unique?

3. m,n are natural numbers. Of the following four propositions

(a) n divides (m+ 1)(b) m = 2n+ 5(c) 3 divides (m+ n)(d) (m+ 7n) is prime

three are true, and one is false. Find all possible pairs a, b.

4. Three runners A,B,C had a race and finished almost at the sametime. Three sports commentators gave the following immediate re-ports:

(a) A has won.

Page 26: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

26 1. PROPOSITIONAL LOGIC

(b) B has not won.(c) C was not the last.

It turned out that exactly one of the commentators was right. Whatwas the result of the race?

5. After racing, four jockeys (A,B,C,D) made the following statementsabout their results:

(a) ‘I was neither the first, nor the last.’(b) ‘I was not the last.’(c) ‘I was the first.’(d) ‘I was the last.’

Three of these statements are true, and one is false. Find, who wastelling a lie and who came first.

6. A professor of logic meets 10 of his former students, Albert, Alice,Bob, Bertha, Clifford, Connie, David, Dora, Edgar and Edith, whohave become five married couples. When asked about their husbands,the ladies gave the following answers:Alice: My husband is Clifford, and Bob has married Dora.Bertha: My husband is Albert, and Bob has married Connie.Connie: Clifford is my husband, Bertha’s husband is Edgar.Dora: My husband is Bob, and David has married Edith.Edith: Yes, David is my husband. And Albert’s wife is Alice.Additional true information coming from the men was that every ladygave one correct and one wrong answer. This was sufficient to findout the truth. Reproduce the professor’s argument.

7. Each of four dwarfs, Ben, Ken, Len and Vin, is either always tellingthe truth or always lying. Here is their chat:Ben (to Ken). You are a liar.Len (to Ben). You yourself are a liar!Vin (to Len). They are both liars. And you too.Who is telling the truth?

Solutions

1. (a) The implication ((p → q ∧ r) → (¬q → p)) → ¬p is false iff(p → q ∧ r) → (¬q → ¬p) is >, and ¬p is ⊥. Then p is > andit remains to consider only q, r:

Page 27: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 27

q r q ∧ r p→ q ∧ r ¬q → ¬p (p→ q ∧ r)→ (¬q → ¬p)> > > > > >> ⊥ ⊥ ⊥ > >⊥ > ⊥ ⊥ ⊥ >⊥ ⊥ ⊥ ⊥ ⊥ >

So the answer is: p is >; q, r are arbitrary.(b) All possible combinations of truth values are listed in the table:

p q r s t u

> ⊥ ⊥ > ⊥ ⊥> ⊥ ⊥ ⊥ > ⊥> ⊥ ⊥ ⊥ ⊥ >> ⊥ ⊥ ⊥ ⊥ ⊥⊥ > ⊥ > ⊥ ⊥⊥ ⊥ > > ⊥ ⊥⊥ ⊥ ⊥ > ⊥ ⊥

Comment. The formulae p∧q, p∧r, q∧r, s∧t, s∧u, t∧u,¬p∧¬smust be false, and thus (p ∨ s) must be true. So we notice thatat least one of the following combinations appears:• p is >, and q, r are ⊥• s is >, and t, u are ⊥.

Having three values fixed, we compute the truth table for theother three.

(c)

p q r

⊥ ⊥ >⊥ > ⊥

Comment. p ∨ q ∨ r is > and (p ∨ q is ⊥ or p ∨ r is ⊥).(d)

p q r

⊥ > >> ⊥ >> > ⊥

Page 28: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

28 1. PROPOSITIONAL LOGIC

Comment. p∨ q, q∨ r, p∨ r must be true, and p∧ q∧ r false (i.e.at least one of the atoms is ⊥). If p is ⊥ then q, r are >. Twoother cases are analogous.

(e) p, q must both be true.

2. Denote these propositions by p1, . . . , p5. Then the following formulaeare true:

¬p1 → p2, p2 → p4, p4 → p3, p3 → p5

We notice that if p2 is > then the three other propositions (p3, p4, p5)are >. Hence p2 is ⊥.Since ¬p1 → p2 is > we get that p1 is >. But then p4 is false (other-wise, four propositions are true).Therefore p1, p3, p5 are true; p2, p4 are false.That is, we have: n < 100, n ≤ 35, n > 9, n ≤ 10, n > 5. Thus n = 10is the unique possibility.

3. The argument is similar to the previous exercise. Let p1, . . . , p4 bethe propositions in question. Then one can check that the followingformulae are true:

p3 → ¬p2, p3 → ¬p4

Since exactly one of the atoms is false, it follows easily that p1, p2, p4are > and p3 is ⊥. Then the following is true:

(a) n divides (m+ 1).(b) m = 2n+ 5.(c) (m+ 7n) is prime.

By (a), (b), n divides 2n+ 6, and thus n divides 6, i.e. n = 1, 2, 3 or6. Taking (c) into account, we get the two possibilities:

(i) n = 2,m = 9.(ii) n = 6,m = 17.

4. Consider the statements a, b, c as atoms. Clearly, a → b is true. Sothere are the following two possibilities:

(i) a, b are >, c is ⊥.

Then the positions of A,B,C are 1,2,3.

Page 29: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 29

(ii) c, b are >, a is ⊥.

Then A has not won, B has not won either, and C was the last. Thisis impossible. Therefore only the first possibility remains.

5. Consider the statements of A,B,C,D respectively as atoms a, b, c, d.The following two propositions are obviously true:

d→ b, c ∧ d→ a

Since exactly one of a, b, c must be false, there are two possibilitiesfor their truth values:

(i) a, b, d are >, c is ⊥.(ii) a, b, c are >, d is ⊥.

In the case (i) only B might be the first. (Note that D was the last,and the positions of A,C cannot be found exactly.) In the case (ii)we obtain a contradiction, because nobody can be the last. Therefore,B has won, and C was lying.

6. There are 25 atomic propositions of the form ‘a man whose namebegins with X and a woman whose name begins with Y are married’,which we denote by pAA, pAB, . . . , pEE. The information at the pro-fessor’s disposal is expressed by a rather long conjunction includingclauses (pXY → ¬pXZ) and (pY X → ¬pZX) for any triple X,Y, Zwhere Y 6= Z, and also the following ones:

(a) pCA ↔ ¬pBD(b) pAB ↔ ¬pBC(c) pCC ↔ ¬pEB(d) pBD ↔ ¬pDE(e) pDE ↔ ¬pAA

It will be convenient to show truth values of the atoms in a 5 × 5table. The first part of our conjunction means that > occurs exactlyonce at each row and each column of the table.Now assume that pCA is > and start filling in the table:

Page 30: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

30 1. PROPOSITIONAL LOGIC

A B C D E

A ⊥B ⊥C > ⊥ ⊥ ⊥ ⊥D ⊥E ⊥

Since (a) and (c) are true, we have that pBD is ⊥, pDE is >, and

A B C D E

A ⊥ ⊥B ⊥ ⊥ ⊥C > ⊥ ⊥ ⊥ ⊥D ⊥ ⊥ ⊥ ⊥ >E ⊥ ⊥

Using (c) we getA B C D E

A ⊥ ⊥ ⊥B ⊥ ⊥ ⊥ ⊥C > ⊥ ⊥ ⊥ ⊥D ⊥ ⊥ ⊥ ⊥ >E ⊥ > ⊥ ⊥ ⊥

and eventuallyA B C D E

A ⊥ ⊥ ⊥ > ⊥B ⊥ ⊥ > ⊥ ⊥C > ⊥ ⊥ ⊥ ⊥D ⊥ ⊥ ⊥ ⊥ >E ⊥ > ⊥ ⊥ ⊥

We have to check also another assumption: pCA is ⊥. Then if we fill

Page 31: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 31

in the table according to (a), (d), (e), we have

A B C D E

A > ⊥ ⊥ ⊥ ⊥B ⊥ ⊥ ⊥ > ⊥C ⊥ ⊥D ⊥ ⊥ ⊥E ⊥ ⊥

and we observe that (b) becomes false.Therefore the solution is unique.

7. Let B,K,L, V be the atoms stating that corresponding dwarfs aretruthful. The following formulae are known to be true:

(a) B ↔ ¬K(b) L↔ ¬B(c) V → ¬B ∧ ¬K ∧ ¬L(d) ¬V → ¬(¬B ∧ ¬K) ∧ L

Now assume that V is true. Then B,K must be ⊥ by (c), and so (a)becomes false.Hence V is ⊥. By (d) L is >, and by (b), (a) we get that B is ⊥, Kis >. (a)–(d) are true for these values of atoms. Therefore only Lenis telling the truth.

Example 1.3.3 (Worked examples for Section 1.2.1)Exercises

1. Show that A ≡ B iff (A↔ B) is a tautology.

2. Show that if A1 ≡ B1 and A2 ≡ B2 then (A1 → A2) ≡ (B1 → B2).

3. Prove that if A ≡ B then (C)(p/A) ≡ (C)(p/B).

4. Show that every substitution instance of a tautology is also a tautol-ogy.

5. Prove that if A ≡ B then(A)(p/C) ≡ (B)(p/C).

6. Check the following equivalences:

Page 32: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

32 1. PROPOSITIONAL LOGIC

(a) A ∨ (A ∧B) ≡ A(b) A ∧ (A→ B) ≡ A ∧B(c) A ∨ (B ∧ ¬A) ≡ A ∨B(d) A→ (B → C) ≡ A ∧B → C

(e) A→ (B → C) ≡ B → (A→ C)(f) (A→ B)→ A ≡ A(g) (A→ B)→ B ≡ A ∨B(h) (A↔ B)↔ C ≡ A↔ (B ↔ C).

7. Find disjunctive normal forms for the formulae

(a) p↔ q

(b) ¬(p↔ q)(c) (p↔ q)↔ r

8. Explain how to find (¬A)d provided Ad is given as a strict normalform.

9. Find a formula A built of three atomic propositions, such that thestrict normal forms Ad and (¬A)d have an equal number of disjuncts.

10. Let X be the set of all formulae built of three atomic propositions.Find a consistent formula A ∈ X with the following property:

for any B ∈ X, if B → A is a tautology, then either A ≡ B or B isa contradiction.

11. Find a formula A, such that the formula

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

is a tautology.

Solutions

1. Exercise 1.1.3.5 shows that for any assignment h, h(A↔ B) = > iffh(A) = h(B). Hence the claim follows.

2. Immediately by definitions: given that h(A1) = h(B1) and h(A2) =h(B2) we obtain that h(A1 → A2) = h(B1 → B2).

Page 33: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 33

3. By induction. For example, if C = D ∧ E then

(C)(p/A) = (D)(p/A) ∧ (E)(p/A),(C)(p/B) = (D)(p/B) ∧ (E)(p/B).

If the claim holds for D,E we obtain that (C)(p/A) ≡ (C)(p/B) asin the previous exercise.

4. Let A be a tautology. To show that A′ = (A)(q1/B1, . . . , qk/Bk) is atautology take any assignment h and prove that h(A′) = >. Let h1 bean assignment such that h1(q1) = h(B1), . . . , h1(qk) = h(Bk), h1(r) =h(r) for any other atom r. It suffices to prove that h(C ′) = h1(C)for any formula C (because then we have: h(A′) = h1(A) = >). Thisis easily done by induction on C. For example, if C = D ∧ E andh(D′) = h1(D), h(E′) = h1(E) then C ′ = D′ ∧ E′, and so h(C ′) = >iff h(D′) = h(E′) = > iff h1(D) = h1(E) = > iff h1(C) = >.

5. If A ≡ B then (A ↔ B) is a tautology (Exercise 1 above). Then(A↔ B)(p/C) is also a tautology (Exercise 4 above). But this is thesame as (A)(p/C)↔ (B)(p/C). Now apply Exercise 1 above again.

6. Sometimes it is easier to compute truth tables, and sometimes straight-forward arguments work better.

(a) For any assignment h, h(A ∨ (A ∧B)) = >iff h(A) = > or h(A ∧B) = >iff h(A) = > or h(A) = h(B) = >iff h(A) = >. Hence h(A ∨ (A ∧B)) = h(A).Another method: compute the truth table of A ∨ (A ∧B):

A B A ∧B A ∨ (A ∧B)> > > >> ⊥ ⊥ >⊥ > ⊥ ⊥⊥ ⊥ ⊥ ⊥

(b) h(A ∧ (A→ B)) = > iff h(A) = > and h(A→ B) = >iff h(A) = > and (h(A) = ⊥ or h(B) = >)iff h(A) = h(B) = >iff h(A ∧B) = >.

Page 34: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

34 1. PROPOSITIONAL LOGIC

(c) h(A ∨ (B ∧ ¬A)) = > iff h(A) = > or h(B ∧ ¬A) = >iff h(A) = > or h(B) = h(¬A) = >iff h(A) = > or (h(B) = > and h(A) = ⊥)iff h(A) = > or h(B) = >.

(d) The easiest way is to use equivalences mentioned in the text:

A→ (B → C) ≡ ¬A ∨ (B → C)≡ ¬A ∨ (¬B ∨ C)≡ (¬A ∨ ¬B) ∨ C≡ ¬(A ∧B) ∨ C≡ A ∧B → C

(e) Use the previous equivalence:

A→ (B → C) ≡ A ∧B → CB → (A→ C) ≡ B ∧A→ C

(f) Compute the truth table:

A B A→ B (A→ B)→ A

> > > >> ⊥ ⊥ >⊥ > > ⊥⊥ ⊥ > ⊥

(g) Compute the truth table:

A B A→ B (A→ B)→ B A ∨B> > > > >> ⊥ ⊥ > >⊥ > > > >⊥ ⊥ > ⊥ ⊥

(h) One way is to compute truth tables. Another way is to observethat (p ↔ q) has the same table as addition in the two-elementAbelian group in which > is the null element. Group addition isalways associative.

7. (a) (p ∧ q) ∨ (¬p ∧ ¬q)(b) (p ∧ ¬q) ∨ (¬p ∧ q)

Page 35: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 35

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

8. (¬A)d consists exactly of those disjuncts built of atoms and theirnegations which are missing in Ad. This follows immediately if weremember correspondence between truth tables and normal forms.

9. Use the previous exercise. Ad should have four disjuncts. For exam-ple,

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

10. Take an A such that in its truth table only one line gives the value>. If B → A is a tautology, B can be true only at the same line.So, for example, we can take A = p ∧ q ∧ r or A = ¬p ∧ q ∧ ¬r, etc.

11. It is sufficient to make (p→ ¬q)→ A a tautology. And this happensif A = (p→ ¬q).

Example 1.3.4 (Worked examples for Section 1.2.2)Exercises

1. (a) Find formulae A,B,C such that {A,B}, {A,C}, {B,C} are con-sistent, while {A,B,C} is not.

(b) For any n find an inconsistent set of n formulae, of which every(n− 1) formulae are consistent.

2. Find four pairwise inconsistent non-contradictory formulae.

3. What is the maximal number of pairwise inconsistent non-contradictoryformulae with two atomic propositions p, q?

4. Check validity of the rules 1–8 of page 19.

5. Given that A1, . . . , An, B ` C and A1, . . . , An, C ` B show thatA1, . . . , An ` B ↔ C.

Solutions

1. (a) For example, if A = p,B = q, C = ¬(p ∧ q).(b) For example, A1 = p1, . . . , An−1 = pn−1, An = ¬(p1∧· · ·∧pn−1).

The set {A1, . . . , Ai−1, Ai+1, . . . , An} is consistent because allthese formulae are true when every atom but pi is >.

Page 36: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

36 1. PROPOSITIONAL LOGIC

2. p ∧ q, p ∧ ¬q,¬p ∧ q,¬p ∧ ¬q.

3. Four, because for every formula there is at least one line in the truthtable when it is true, and no line fits for two distinct formulae.

4. Rules 1, 2, 3 are straightforward.Rule 4. We have to show that (A→ C)∧(B → C)∧(A∨B)→ C is atautology. Instead of drawing the truth table we can do it as follows.Assume that A→ C,B → C,A∨B are true. Then A is true or B istrue (or both). If A is > and A→ C is > then C is >. If B is > andB → C is > then C is >. Therefore C is true under our assumption.Rules 5, 6 are checked easily.Rule 7. Assume that B → C,B → ¬C are both true. If B were truethen C,¬C would be both true. Thus B is false, i.e. ¬B is true.

Rule 8. SupposeB1, . . . , Bk, A

Cis valid. Then

B1, . . . , Bk

A→ Cis valid,

because if B1, . . . , Bk are true then the truth of A implies the truth ofC.

5. By rule 8 we obtain A1, . . . , An ` B → C and A1, . . . , An ` C → B.Hence A1, . . . , An ` B ↔ C, because if A1, . . . , An are true then bothB → C, C → B are true.

SummaryIn this chapter we learnt the following main ideas:

• A logical system consists of a formal language, a semantic inter-pretation and a set of reasoning rules.

• The language of classical propositional logic uses letters such as p,q, r, etc. to represent atomic sentences, and connectives ∧, ∨, ¬and → to combine sentences into more complex sentences.

• Truth tables can be used to interpret the sentences of classicalpropositional logic.

• Sentences which are always true are called tautologies; those whichare always false are contradictions. If a sentence is not a contra-diction then it is said to be consistent.

Page 37: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction

1.3. WORKED EXAMPLES 37

• Sentences can be put in a convenient normal form.

• A valid argument is a relationship (known as the consequence)between a set of assumptions and a conclusion, and holds providedthe conclusion is true whenever the assumptions are all true.

• The consequence relation for any logical system possesses threeproperties: reflexivity, monotonicity and transitivity. Differing ad-ditional properties distinguish differing logical systems.

• If a set of assumptions and a negated formula are not consistent,then the formula is a conclusion in a valid argument from theassumptions.

Page 38: PROPOSITIONALLOGIC - College Publications · advertisement and go into the shop to buy a TV set. There are four possibleoutcomes: 1.Wepaycashandgeta25%reduction. 2.Wepaycash,butdonotgeta25%reduction