propositional logic · 2009. 9. 14. · the presentation, i will restrict myself to the language...

22
Propositional Logic Lecture 1 1 Introduction These notes follow closely notes originally developed by Alexander Kechris for the course Math 6c at Caltech. Somewhat informally, a proposition is a statement which is either true or false. Whichever the case, we call this its truth value. Example 1 “There are infinitely many primes”; “5 > 3”; and “14 is a square number” are propositions. A statement like “x is odd,” (a “propositional function”) is not a proposition since its truth depends on the value of x (but it becomes one when x is substituted by a particular number). Informally still, a propositional connective combines individual propositions into a com- pound one so that its truth or falsity depends only on the truth or falsity of the components. The most common connectives are: Not (negation), ¬, And (conjunction), , Or (disjunction), , Implies (implication), , Iff (equivalence), . A word of warning is in order: The precise mathematical meaning of a connective (say, ) should not be confused with the somewhat ambiguous meaning of the word (say, “implies”) used to name it. The intended mathematical meanings of the connectives are as follows: “Not” (¬) is a unary connective, i.e., it applies to only one proposition, and negates its truth value. There are other, less common, unary connectives: One that always returns a false value regardless of the truth or falsity of the proposition it is applied to, one that always returns a true value, and one that simply returns the same value of the proposition it is applied to. The other connectives mentioned above are binary, i.e., they bind two propositions: 1

Upload: others

Post on 08-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Propositional Logic

Lecture 1

1 Introduction

These notes follow closely notes originally developed by Alexander Kechris for the courseMath 6c at Caltech.

Somewhat informally, a proposition is a statement which is either true or false. Whicheverthe case, we call this its truth value.

Example 1 “There are infinitely many primes”; “5 > 3”; and “14 is a square number” arepropositions. A statement like “x is odd,” (a “propositional function”) is not a propositionsince its truth depends on the value of x (but it becomes one when x is substituted by aparticular number).

Informally still, a propositional connective combines individual propositions into a com-pound one so that its truth or falsity depends only on the truth or falsity of the components.The most common connectives are:

• Not (negation), ¬,

• And (conjunction), ∧,

• Or (disjunction), ∨,

• Implies (implication), →,

• Iff (equivalence), ↔ .

A word of warning is in order: The precise mathematical meaning of a connective (say, →)should not be confused with the somewhat ambiguous meaning of the word (say, “implies”)used to name it. The intended mathematical meanings of the connectives are as follows:

• “Not” (¬) is a unary connective, i.e., it applies to only one proposition, and negatesits truth value. There are other, less common, unary connectives: One that alwaysreturns a false value regardless of the truth or falsity of the proposition it is appliedto, one that always returns a true value, and one that simply returns the same valueof the proposition it is applied to.

The other connectives mentioned above are binary, i.e., they bind two propositions:

1

Page 2: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

• A proposition combining its components with “and” (∧) is true when, and only whenboth of its components are true.

• A proposition combining its components with “or” (∨) is true whenever either or bothof its components are true. That is, ∨ is the so-called “inclusive or.”

• The “iff” (“if and only if”) or equivalence connective (↔) is true precisely when bothof its components have the same truth value, be it true or false.

• Unlike the previous connectives, the “implication” (→) is not symmetric: p → q isnot the same as q → p. When we use p → q, we intend to convey the meaning thatwhenever p is true, q must also be. So if p is true, p→ q is true if and only if q is alsotrue. If, on the other hand, p is false, then p→ q is also true (we say it is “vacuously”true). The statement that p → q does not carry any “causal” connotation, unlikethe English phrases we use (for lack of anything better) to pronounce it (such as “pimplies q” or “if p, then q”).

We can summarize the meanings of these connectives using truth tables:

Of course, there are other binary connectives, and there are also ternary connectives, andconnectives of even higher arity.

There are many different ways of expressing a compound statement, and corresponding tothese there are different equivalent ways of combining propositions using these connectives:Their truth values are the same for any truth values of the original propositions. Here aresome examples:

1. The statements(¬p) ∨ (¬q) and ¬(p ∧ q)

are equivalent. This is one of what are known as De Morgan’s Laws.

2. The law of the double negative says that ¬¬p and p are equivalent. That is, if some-thing is not false, it is true, and vice versa.

2

Page 3: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

3. The statements(p→ q) and (¬q)→ (¬p)

are equivalent. The latter statement is called the contrapositive of the first. Note thatbecause of the law of the double negative, the first statement is also equivalent to thecontrapositive of the second.

4. Yet another way to say that p→ q is

(¬p) ∨ q.

One consequence of this is that we could, if we wanted to, do without the→ connectivealtogether.

5. Two more related statements which are not equivalent to p → q are the converse,q → p, and the inverse, (¬p)→ (¬q). The converse and inverse are contrapositives ofeach other, however, so they have the same truth value.

We now proceed to develop the theory of propositions in a rigorous setting.

2 Syntax of propositional logic

In order to rigorously prove results about the structure and truth of propositions and theirconnectives, we begin by developing a formal language, the language of propositional logic.Later, just as in the example of the tree system presented before, we will assign a semanticto this language.

Definition 1 In the language of propositional logic we have the following list of symbols:

1. Propositional variables. This is an infinite list p1, p2, p2, . . . of symbols. We often usep, q, r, . . . to denote propositional variables.

2. Symbols for the propositional connectives ¬ and → .

3. Parentheses: (, ).

It does not matter what the propositional variables or the connectives actually are, forexample, we can begin with any (countable) infinite set, and decide that its elements arethe propostional variables. Our only requirement is that the symbols ¬,→, (, and ) aredistinct from one another, and from the propositional variables.

We could also have symbols for ∧,∨,↔ and for additional connectives. In order to simplifythe presentation, I will restrict myself to the language above.

As before, a string or word is any finite sequence of the symbols in the language, includingthe empty string. Its length is its domain, just as before. Unlike the example of the tree-system, now we are only interested in certain strings, those that “represent” formulas. There

3

Page 4: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

are several conventions we could follow; for example, we could state that p → q, (p → q),or (p)→ (q) are formulas. To simplify the presentation, we restrict ourselves to only one ofthese options.

We will refer to the “grammatically correct” strings (those formed according to the conven-tions below) as well-formed formulas (wffs) or just formulas.

Definition 2 (Well-Formed Formulas) 1. Every propositional variable p is a wff.

2. If A is a wff, so is ¬A.

3. If A,B are formulas, so is (A→ B).

Thus a string A is a wff exactly when there is a finite sequence

A1, . . . , An

(called a parsing sequence) such that An = A and for each 1 ≤ i ≤ n, one of the followingholds:

1. Ai is a propositional variable, or

2. For some j < i, Ai = ¬Aj , or

3. For some j, k < i, Ai = (Aj → Ak).

Example 2 1. (p→ (q → r)) is a wff with parsing sequence

p, q, r, (q → r), (p→ (q → r)).

Note that

q, r, (q → r), p, (p→ (q → r))

is another parsing sequence, so parsing sequences are not unique.

2. (¬(p→ q)→ (¬p→ ¬q)) is a wff with parsing sequence

p, q, (p→ q), ¬(p→ q), ¬p, ¬q, (¬p→ ¬q), (¬(p→ q)→ (¬p→ ¬q)).

3. p → qr, )p ↔, → (q¬), and p → (q → r) are not wff, but to prove this requires anargument.

Remark 3 Just as in the case of the tree system, we have not yet assigned any “meaning”to any of the symbols in our formal language. Eventually, we intend to interpret symbolssuch as → in a way analogous to the propositional connective “implies,” at present they aresimply symbols that we are manipulating formally.

4

Page 5: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

3 Induction on formulas

We can prove properties of formulas by induction on the length of a formula. Suppose Φ(A)is a property of a formula A. For example, Φ(A) could mean “A has the same number ofleft and right parentheses.” If Φ(A) holds for all formulas of length 1 (i.e. the propositionalvariables) and whenever Φ(A) holds for all formulas A of length ≤ n, then it holds for allformulas of length n+ 1, we may conclude, by induction, that Φ(A) holds for all formulas.

However, because of the way formulas are defined, it is most useful to use another formof induction, sometimes called induction on the construction of wff (or just induction onformulas):

Let Φ(A) be a property of formulas A. Suppose:

1. Basis of the induction: Φ(A) holds, when A is a propositional variable.

2. Induction step: If Φ(A),Φ(B) hold for two formulas A,B, then

Φ(¬A),Φ((A→ B))

hold as well.

Then Φ(A) holds for all formulas A. We can prove the validity of this procedure usingstandard mathematical induction, and the existence of a parsing sequence for any wff.

Example 3 One can easily prove, using this form of induction, that every formula A hasthe same number of left and right parentheses. This result can be used to show that certainstrings, for example )p→, are not wffs, because they have unequal numbers of left and rightparentheses.

Example 4 We can easily prove by induction on the construction of wff that a nonemptyproper initial segment of a formula either consists of a string of ¬’s or else has more leftthan right parentheses. Another easy induction shows that no formula can be empty or justa string of ¬’s, so using also the previous example, no proper initial segment of a wff is awff.

This can also be used to show certain strings, for example, p → qr, are not wffs, as theycontain proper initial segments that are wffs (in the example, p). Similar methods can beused for other non-wffs.

4 Unique readability

While parsing sequences are not unique, there is a sense in which all alternative parsingsequences offered for a given wff are “the same”: they break the wff down in the same way,to the same components, albeit in a different order. Using induction on formulas, we canprove that this will always be the case. This is called unique readability.

5

Page 6: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Theorem 4 (Unique Readability Theorem) Every wff is in exactly one of the forms:

1. p (i.e., a propositional variable);

2. ¬A for A a uniquely determined wff;

3. (A→ B), for uniquely determined wff’s A,B.

Proof: By induction on the construction of formulas, it is straightforward that any formulamust be of one of these forms. To prove uniqueness first notice that no wff can be in morethan one of the forms (1), (2), (3). Obviously no two propositional variables are the same,and if ¬A = ¬B, then A = B.

So it is enough to show that in case (3), if (A→ B) = (C → D), then A = C and B = D.First notice that, by eliminating the left parenthesis, we have that A → B) = C → D).From this it follows that either A is an initial segment of C or vice versa. If A 6= C, thenone of A,C is a proper initial segment of the other, which is impossible, as they are bothformulas. So we must have A = C. Thus → B) =→ D) and so B = D. �

Remark 5 Similar arguments would have given the same result if we had followed a dif-ferent convention when defining formulas. For example, if we had stated that whenever Aand B are formulas, then so is (A) → (B). However, not all conventions would work. Forexample, if we had used A→ B, a formula such as A→ B → C would be “ambiguous.”

Definition 6 In form (2) we call ¬ the main connective and in (3) we call the→ connectingthe formulas denoted above by A and B, the main connective. Thus the main connective isthe one applied last in a parsing sequence.

Example 5 In ((p → (q → p)) → q) the main connective is the third “→” (from left toright).

Given a formula A, it might be hard to recognize immediately which is the main connective.Consider for example the following formula:

(((((p→ ¬q)→ ¬r)→ ((¬p→ (s→ ¬r))→ ((q → s)→ p)))→

(((¬q → ¬r)→ s)→ (s→ (¬r → q))))→ ((p→ (¬r → s))→ (s→ ¬r)))

(it turns out to be the 5th “→”). There is however an easy algorithm for determining themain connective: In the formula (A→ B) the main connective→ is the first binary connec-tive (from left to right) such that in the string preceding it the number of left parenthesesis exactly one more than the number of right parentheses.

6

Page 7: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

5 Recursive definitions

One can use the unique readability theorem to justify the following principle of definitionby recursion on the construction of formulas:

Let X be a set and let f : {p1, p2, . . . } → X, f¬ : X → X, and f→ : X2 → X be givenfunctions. Then there is a unique function g from the set of all formulas into X such that

• g(p) = f(p) for all propositional variables p,

• g(¬A) = f¬(g(A)) for any formula A, and

• g((A→ B)) = f→(g(A), g(B)) for any formulas A and B.

Without unique readability, the existence and uniqueness of g would be called into ques-tion: If there were two different ways of breaking down a formula, then the correspondingcompositions of the fs might yield different values of g for the same formula. But now thatwe know unique readibility, g is well defined and unique.

Example 6 1. Let L be defined according to the following clauses:

• L(p) = 1,

• L(¬A) = L(A) + 1,

• L((A→ B)) = L(A) + L(B) + 3.

Then it is easy to see that L(A) = |A| = the length of A.

2. Let

• C(P ) = 0,

• C(¬A) = C(A) + 1,

• C((A→ B)) = C(A) + C(B) + 1.

Then C(A) = the number of connectives in A.

3. Let p be a propositional variable and P a formula. We define for each formula A theformula g(A) = A[p/P ] according to the following clauses:

• g(p) = P,

• g(q) = q if q 6= p,

• g(¬A) = ¬g(A),

• g((A→ B)) = (g(A)→ g(B)).

Then it is easy to see that A[p/P ] is the formula obtained by substituting every oc-curence of p in A by P.

For example, if A = (¬p→ (q → p)) and P = (r → q), then

A[p/P ] = (¬(r → q)→ (q → (r → q))).

7

Page 8: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

4. The parse tree TA of a formula A is defined recursively as follows: The tree has a root∅, with a unique immediate successor.

• In the parse tree Tp of a propositional variable p, this successor is labelled p, andthis is the whole tree.

• In the parse tree T¬A, this successor is labelled ¬, and following it there is a copyof TA, with the root removed.

• In the parse tree T(A→B), this successor is labelled →, and following it there aretwo immediate successors, to which we attach a copy of TA and a copy of TB,with the roots removed.

Here is an example. For clarity, I use other connectives rather than just → . Say thatA = (¬(p ∧ q)↔ (¬p ∨ ¬q)). Then its parse tree is

where, again for clarity, we have omitted the root, and labelled the nodes by formulasrather than connectives.

The parse tree, starting now from the bottom up, gives us various ways of constructinga parsing sequence for the formula; for example:

p, q, (p ∧ q), ¬(p ∧ q), ¬p, ¬q, (¬p ∨ ¬q), (¬(p ∧ q)↔ (¬p ∨ ¬q)).

By unique readability, all parsing sequences can be obtained in this manner. Thus theparse tree extracts the “common part” referred to above, out of each parsing sequence.

5. The formulas occurring in the parse tree of a formula A are called the subformulas ofA. These are the formulas that arise in the construction of A. If we let subf(A) denotethe set of subformulas of A, then subf can be defined by the following recursion:

• subf(p) = {p},• subf(¬A) = subf(A) ∪ {¬A},• subf

((A→ B)

)= subf(A) ∪ subf(B) ∪ {(A→ B)}.

8

Page 9: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

6 Recognizing formulas

We will next discuss an algorithm for verifying that a given string is a formula.

Given a string S, let x be a propositional variable not occurring in S and let S(x) the stringwe obtain from S by substituting every propositional variable by x.

For any string T containing only the variable x, let T ′ be the string obtained from T asfollows: If T contains no substring (i.e. a string contained in T as a consecutive sequenceof symbols) of the form ¬x or (x → x), then T ′ = T. Otherwise substitute the leftmostoccurence of any one of these forms by x, to obtain T ′. Notice that if T 6= T ′, then thelength of T ′ is strictly smaller than that of T.

Now starting with an arbitrary string S, form first S(x), and then define recursively S0 =S(x), Sn+1 = S′n. This process stops when we hit n0 for which Sn0+1 = S′n0

= Sn0 , i.e., Snhas no substring of the above form. This must necessarily happen since otherwise we wouldhave an infinite decreasing sequence of lengths, which is impossible.

We then have that if Sn0 = x, then S is a formula, and otherwise it is not.

Example 7 1. Let S be ((p→ (q → ¬p)→ (r → (¬s→ t)))).

Then we have:

• ((x→ (x→ ¬x)→ (x→ (¬x→ x)))) = S(x) = S0.

• ((x→ (x→ x)→ (x→ (¬x→ x)))) = S1.

• ((x→ x→ (x→ (¬x→ x)))) = S2.

• ((x→ x→ (x→ (x→ x)))) = S3.

• ((x→ x→ (x→ x))) = S4.

• ((x→ x→ x)) = S5 = S6.

So S is not a wff.

2. Now let S be ((p→ ¬q)→ (p→ (¬r → s))).

Then we have:

• ((x→ ¬x)→ (x→ (¬x→ x))) = S(x) = S0.

• ((x→ x)→ (x→ (¬x→ x))) = S1.

• (x→ (x→ (¬x→ x))) = S2.

• ((x→ (x→ (x→ x))) = S3.

• ((x→ (x→ x)) = S4.

• (x→ x) = S5.

• x = S6 = S7.

So S is a wff.

Exercise 1 Prove the correctness of this algorithm.

9

Page 10: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

7 Abbreviations

Sometimes in practice, in order to avoid complicated notation, we adopt various abbrevia-tions in writing wff, if they do not cause any confusion.

First of all, we write (A ∨ B) instead of (¬A → B), (A ∧ B) instead of ¬(A → ¬B), and(A↔ B) instead of the formula abbreviated by ((A→ B) ∧ (B → A)).

Also, we usually omit outside parentheses: We write A∧B instead of (A∧B) or (A∧B)∨Cinstead of ((A ∧B) ∨ C), etc.

We adopt an order of preference between the binary connectives, namely

∧,∨,→,↔

where connectives from left to right bind closer, i.e., ∧ binds closer than ∨,→,↔; ∨ bindscloser than →,↔; and → binds closer than ↔ . So if we write p ∧ q ∨ r we really mean((p ∧ q) ∨ r) and if we write p→ q ∨ r we really mean (p→ (q ∨ r)), etc.

Finally, when we have repeated connectives, we always associate parentheses to the left, sothat if we write A∧B ∧C we really mean ((A∧B)∧C), and if we write A→ B → C → Dwe really mean (((A→ B)→ C)→ D).

All these are conventions that we follow (informally) in practice, although formally we havenot introduced symbols to the language, or extended the notion of formula, and are justwriting the unabbreviated forms each time.

8 A Hilbert-Type Proof System

We now describe a formal calculus of proofs. As in the example of the tree system, we startwith axioms and use rules of inference to deduce consequences.

This style of arguing in formal logic, using axioms and rules, was introduced by DavidHilbert and his school.

Hilbert was born in Konigsberg, Prussia, in 1862, and died in Gottingen, Germany, in 1943.He is one of the most important mathematicians of the late 19-th and early 20-th century.A strong advocate of nonconstructive methods, this probably started with his work on“invariant theory,” where he proved a Basis Theorem without exhibiting an explicit basis.The paper appeared in Mathematische Annalen in 1888. (The result states that in anynumber of variables there is a finite set of generators for the invariants of quantics. Aquantic is a symmetric tensor of a given degree constructed from tensor powers of a (finitedimensional) vector space. Invariance is measured under invertible operators of the spacein itself.)

Gordon, the world expert in invariant theory, strongly opposed in vain to the publicationof Hilbert’s result, due to its nonconstructive nature. On the other hand, Klein said of thisresult that “I do not doubt this is the most important work on general algebra that theAnnalen has ever published.”

10

Page 11: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Hilbert’s work in number theory led to his book on the theory of algebraic number fields,recently translated into English. He started his work on logic with the publication in 1899 ofthe Grundlagen der Geometrie, where he advocates the axiomatic approach to mathematics.

In 1900 he delivered the invited address “Mathematical problems” to the Second Interna-tional Congress of Mathematicians in Paris, where he listed 23 problems that in his opinionwere essential for the progress of mathematics. From here comes his dictum “Here is theproblem, seek the solution”. The inscription on his tombstone, “We must know, we willknow” comes from a speech in Konigsberg in 1938. His address can be found in the Bulletinof the AMS, vol 37, number 4 (2000).

His work on integral equations and calculus of variations led to functional analysis andthe concept of Hilbert space. He also solved Waring’s problem, a well-known problem innumber theory. His work in logic resulted in the development of proof systems and lead tothe incompleteness theorems of K. Godel.

8.1 Formal Proofs

A (logical) axiom is any formula of one of the following forms:

1. A→ (B → A),

2. (A→ (B → C))→ ((A→ B)→ (A→ C)),

3. ((¬B → ¬A)→ ((¬B → A)→ B))

(for arbitrary formulas A,B,C).

We also have a rule of inference called modus ponens or MP: “From A and A→ B, deriveB.” In formal calculi, a rule such as this for deriving one formula from others given, issometimes written as follows:

A, A→ B

B.

Modus ponens is short for latin “modus ponendo ponens” which means “proposing method.”.

Definition 7 Let S be any set (finite or infinite) of formulas. A formal proof from S isa finite sequence A1, A2, . . . , An of formulas such that each Ai is either a logical axiom,belongs to S, or comes by applying modus ponens to some Aj , Ak with j, k < i (i.e., Ak isthe formula Aj → An). We call this sequence a formal proof of An from S.

Definition 8 If there is a formal proof of a formula A from S we say that A is a formaltheorem of S and write

S ` A.

If S = ∅, we just write` A

and call A a formal theorem. If S = {B}, we just write B ` A.

11

Page 12: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Notice that S ` A and S ⊆ S′ imply that S′ ` A. Also notice that if S′ ` A and S ` B forall B ∈ S′, then S ` A, since the formal proofs can simply be concatenated. Finally, S ` Aimplies that there is finite S0 ⊆ S with S0 ` A, since a formal proof can only be finitelylong and hence can only use finitely many formulas of S.

Example 8 Let S = {(A→ B), A→ (B → C), A}. Here is a formal proof of C from S:

1. A→ (B → C) (in S),

2. ((A→ (B → C))→ ((A→ B)→ (A→ C))) (axiom (2)),

3. (A→ B)→ (A→ C) (MP from 1, 2),

4. A→ B (in S),

5. A→ C (MP from 3, 4),

6. A (in S),

7. C (MP from 5, 6)

In the proof above, I have listed next to each formula the reason why it can be written down.Just as in the case of proofs in the tree system, formally, the proof is just the sequence offormulas, without the companion explanations:

A → (B → C), ((A → (B → C)) → ((A → B) → (A → C))), (A → B) → (A → C),A→ B, A→ C, A, C.

Example 9 The following formal proof shows that ` A→ A:

1. (A→ ((A→ A)︸ ︷︷ ︸B

→ A︸︷︷︸C

))→ ((A→ (A→ A)︸ ︷︷ ︸B

)→ (A→ A︸︷︷︸C

)) (Ax. (2)),

2. A→ ((A→ A)︸ ︷︷ ︸B

→ A) (Ax. (1)),

3. ((A→ (A→ A))→ (A→ A)) (MP 1, 2),

4. A→ (A→ A) (Ax. (1)),

5. A→ A (MP 3, 4).

Lecture 2

I now proceed to present a series of results whose overall goal is to make the handling offormal proofs more efficient and natural. These results formalize different methods of rea-soning commonly used in practice. A second goal in presenting these results is in preparingthe way for the proof of the completeness theorem.

12

Page 13: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Theorem 9 (The deduction theorem) If S is a set of formulas, and A and B are for-mulas, then S ∪ {A} ` B if and only if S ` A→ B.

Proof: One direction is easy: Given any proof witnessing S ` A → B, one can extend itwith A,B and the resulting sequence witnesses S ∪ {A} ` B : We are allowed to add A,since it is in S ∪ {A}, and we can then add B by MP.

The other direction requires a bit more work. We actually present a procedure that trans-forms a proof witnessing S ∪ {A} ` B, say t1, . . . , tn, into a proof witnessing S ` A → B.There are three cases for each ti in the sequence:

Case 1: ti is either an axiom or ti ∈ S. Replace ti with the sequence ti, ti → (A→ ti), A→ti, and notice that this is a proof from S of A → ti. We will frequently use this argumentin what follows.

Case 2: ti = A. Replace ti with the proof of A→ A given in Example 9 from last lecture.

Case 3: ti comes from previous tj , tk by MP. Say tk = tj → ti. The procedure has so farprovided us with a sequence t = (t′1, . . . , t

′m) that contains a proof of A → tj from S, and

also a proof of A→ (tj → ti) from S. Replace ti with the sequence s =((A→ (tj → ti))→

((A → tj) → (A → ti)), (A → tj) → (A → ti), A → ti), and notice that t_s is a proof of

A→ ti from S. �

Definition 10 A set S of formulas is formally inconsistent iff there is some formula Asuch that S ` A and S ` ¬A.

Just as in the case of the tree system, an inconsistent set of axioms can prove anything.

Fact 11 If S is formally inconsistent, then S ` B for all B.

Proof: Let A be such that S ` A,¬A. Since S ` A, the argument of Case 1 from Theorem9 gives us that S ` ¬B → A. Similarly, since S ` ¬A, then S ` ¬B → ¬A. Invoking axiom(3) and using MP twice, we are done. �

Theorem 12 (Proof by contradiction) S ∪ {A} is formally inconsistent iff S ` ¬A.

Proof: One direction is clear: If S ` ¬A, then A ∪ {A} ` A,¬A.To prove the converse, we need a lemma:

Lemma 13 ¬¬A ` A.

Proof: Use axiom (3) in the form (¬A → ¬¬A) → ((¬A → ¬A) → A). Since ¬¬A isgiven, we then have that ¬A→ ¬¬A. We also have a proof of ¬A→ ¬A. Using MP twice,we conclude A. �

13

Page 14: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Suppose now that S ∪ {A} is formally inconsistent, say S ∪ {A} ` B,¬B. Since ¬¬A ` A,then S ∪ {¬¬A} ` B,¬B. By the deduction theorem, S ` ¬¬A → B,¬¬A → ¬B. Usingan appropriate instance of axiom (3) and invoking MP twice, we obtain that S ` ¬A, asrequired. �

Remark 14 Conversely, A ` ¬¬A. To see this, simply use proof by contradiction, noticingthat {A} ∪ {¬A} is formally inconsistent.

Remark 15 It is in order to obtain Theorem 12 that we stated axiom (3) the way we did.Another natural axiom to consider would have been (3)′ :

((B → ¬A)→ ((B → A)→ ¬B)).

The system one obtains from adopting axioms (1), (2), and (3)′, is strictly weaker (in severalsenses; for example, it proves fewer theorems) that the system we are using.

The standard system of propositional intuitionistic logic is obtained by adopting axioms (1),(2), (3)′, and (4) :

A→ (¬A→ B).

In this system, one can prove that A → ¬¬A, but not that ¬¬A → A. The semantics ofpropositional logic (to be discussed below) is also considerably simpler than the appropriatesemantics of its intuitionistic counterpart.

Theorem 16 (Proof by contrapositive) S ∪ {A} ` ¬B iff S ∪ {B} ` ¬A.

Proof: By symmetry, it is enough to prove the left-to-right implication. Assume S∪{A} `¬B. Then S∪{A}∪{B} is formally inconsistent. By proof by contradiction, S∪{B} ` ¬A.�

Say that S is formally consistent precisely when it is not formally inconsistent. It shouldbe clear by now that the main question we need to address is whether there are formallyconsistent sets S. We will soon show this, but for now we remark that in order to obtainmany examples of such sets S, it is enough to see that ∅ (i.e., just the set of axioms) isformally consistent.

Lemma 17 Suppose that S is formally consistent. Then, for any formula A, either S∪{A}or S ∪ {¬A} is also formally consistent.

Proof: Otherwise, both S ∪ {A} and S ∪ {lnotA} are formally inconsistent. By proofby contradiction, it then follows that S ` ¬A,¬¬A, and therefore S itself is formallyinconsistent. �

Say that a set S is complete iff for any formula A, either A ∈ S or ¬A ∈ S.The argument below should remind the reader of (part of) the argument of completenessfor the tree system.

14

Page 15: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Corollary 18 Suppose that S is formally consistent. Then there is a set S ⊇ S that is bothformally consistent and complete.

Proof: First notice that by an easy counting argument there are only countably manyformulas, so one can enumerate them as {A0, A1, . . . }.Now use Lemma 17 to form a sequenceS = S0 ⊇ S1 ⊇ . . . where each Sn is formally consistent and either Sn+1 = Sn ∪ {An} orSn+1 = Sn ∪ {¬An}.Set S =

⋃n Sn, and note that S extends S and is both formally consistent and complete,

as required. �

9 Semantics of propositional logic

We now proceed to assign an interpretation to our axioms and rules of deduction. Theidea is that we decide “arbitrarily” precisely which propositional variables represent truestatements, and from there we can conclude the truth or falsity of any formula. This willallow us, among other things, to verify that there are formally consistent sets S.

Definition 19 A truth assignment or valuation is a function v from the set of propositionalvariables into {0, 1}.

We identify 0 with false and 1 with true, so v(p) = 1 is our formalization of the statementthat p is true.

Definition 20 The lifting of a valuation v is the function v∗ extending v, defined on theset of all formulas, and given recursively by the following clauses:

• v∗(¬A) = 1− v∗(A).

• v∗(A→ B) = 1− v∗(A)(1− v∗(B)).

The common practice (that we follow) is to just write v instead of v∗ unless there is dangerof confusion. Note that v(A) ∈ {0, 1} for all formulas A, and that v(A → B) = 0 iffv(A) = 1 and v(B) = 0.

(This should probably remind the reader of truth tables.)

There is a slight inconvenience with this definition, in that even if a formula A only uses onepropositional variable p, we need to consider functions defined on infinitely many argumentsin order to evaluate the truth or falsity of A. The following straightforward observationallows us to avoid this problem.

Definition 21 The support supp(A) of a formula A is the set of propositional variablesmentioned in A. Recursively, one can define this set by the following clauses:

15

Page 16: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

• supp(p) = {p}.

• supp(¬A) = supp(A).

• supp(A→ B) = supp(A) ∪ supp(B).

The following can be easily shown by induction on the length of a parsing sequence.

Fact 22 Let A be a formula. Suppose that v1 and v2 are valuations, and that v1 � supp(A) =v2 � supp(A). Then in fact v1(A) = v2(A). �

Remark 23 Going through the parsing sequence of a formula provides us with an easyalgorithm to evaluate v(A) from v � supp(A).

Recall our convention that A ∨ B is shorthand for (¬A → B). Given a valuation v, wethen have v(A ∨ B) = 1 − (1 − v(A))(1 − v(B)), and it follows that v(A ∨ B) = 0 iffv(A) = v(B) = 0.

Similarly, one can check that v(A∧B) = 1 iff v(A) = v(B) = 1, and that v(A↔ B) = 1 iffv(A) = v(B).

Our conventions where chosen so that we would recover the usual truth tables of the con-nectives.

Definition 24 Given a valuation v and a formula A, say that v |= A, “v models A,” or “vsatisfies A,” or “v makes A true,” iff v(A) = 1. Otherwise, we write v 6|= A.

Remark 25 We can easily check that:

• v |= ¬A iff v 6|= A.

• v |= A ∧B iff v |= A and v |= B.

• v |= A ∨B iff v |= A or v |= B.

• v |= A→ B iff either v 6|= A, or else v |= B.

• v |= A↔ B iff (v |= A iff v |= B). I.e., iff either both v |= A and v |= B, or else bothv 6|= A and v 6|= B.

Definition 26 A formula A is said to be valid, or a tautology, iff v |= A for all valuationsv.

There are |2N| = |R| many valuations, but thanks to Fact 22, only finitely many (2|supp(A)|)valuations need to be considered to determine whether A is a tautology or not.

The following are examples of tautologies:

16

Page 17: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Example 10 The axioms are tautologies. For example, consider A → (B → A). Let v bea valuation. Then v 6|= A→ (B → A) iff v |= A and v 6|= B → A, i.e., iff v |= A and v |= Band v 6|= A, which of course is impossible.

Similar easy contradictions hold in the other two cases: v 6|= (A → (B → C)) → ((A →B)→ (A→ C)) iff v |= A→ (B → C) and v 6|= (A→ B)→ (A→ C), iff v |= A→ (B →C) and v |= A → B but v 6|= A → C. This last clause requires that v |= A and v 6|= C.The second to last clause requires then that v |= B. Hence, v 6|= B → C but v |= A, sov 6|= A→ (B → C), against our assumption.

Finally, v 6|= (¬A → ¬B) → ((¬A → B) → A) iff v |= ¬A → ¬B and v |= ¬A → B andv 6|= A. This last clause forces that v |= ¬A, and therefore we must have both v |= ¬B andv |= B, which is impossible.

Example 11 ¬¬A ↔ A is a tautology. Whenever A ↔ B is a tautology, we say thatA and B are logically equivalent, A ≡ B. One also says that A and B are semanticallyindistinguishable. It is straightforward to verify that ≡ is an equivalence relation.

Example 12 A → A is a tautology. This is easily verified directly. Next lecture we willsee that, in fact, any theorem (i.e., any A such that ` A) is a tautology.

Lecture 3

Example 13 ¬(A ∧ B) ↔ (¬A ∨ ¬B) is a tautology. This is an example of De Morgan’slaws.

Example 14 A ∨ (B ∧ C)↔ (A ∨B) ∧ (A ∨ C) is a tautology.

Definition 27 A formula A is satisfiable iff there is some valuation v such that v |= A.Otherwise, we say that A is contradictory, or unsatisfiable.

Remark 28 A is unsatisfiable iff ¬A is a tautology.

Example 15 (p→ q)→ (q → p) is not a tautology, but it is satisfiable.

Definition 29 If v is a valuation and S is a set of formulas, v |= S iff v |= A for all A ∈ S.For a given S, if there is such a valuation v, we say that S is satisfiable, or has a model,and that v is a model of S. Otherwise, S is unsatisfiable or contradictory.

Example 16 Let S = {pi ∨ p2,¬p2 ∨¬p3, p3 ∨ p4,¬p4 ∨¬p5, . . . }. Then S is satisfiable, aswitnessed by the valuation v given by

v(pi) = i mod 2.

17

Page 18: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Definition 30 S |= A iff for any valuation v, if v |= S, then also v |= A.

Remark 31 Note that if S is contradictory, then S |= A for any A. Also, |= A iff ∅ |= A.

We can now prove that there are sets S that are formally consistent. We begin by observingthat the semantic version of MP holds:

Fact 32 {A,A→ B} |= B. �

Theorem 33 (Soundness) Suppose that S is a set of formulas, and that S ` A; thenS |= A. In particular, any theorem is a tautology, and therefore there are formally consistentsets.

Proof: Since the axioms are tautologies, the first part of the result is immediate from Fact32 by induction on the length of proofs. For the second part, note that there are formulasthat are not tautologies, and that those formulas cannot be theorems. So ∅ is formallyconsistent. �

The semantic versions of the deduction theorem, of proof by contradiction, and of proof bycontrapositive also hold:

Fact 34 1. S ∪ {A} |= B iff S |= A→ B.

2. S ∪ {A} is contradictory iff S |= ¬A.

3. S ∪ {A} |= ¬B iff S ∪ {B} |= ¬A. �

Remark 35 Note that |= is monotone, in the sense that if S |= A and S ⊆ S′, then S′ |= A.also, if S |= A for all A ∈ T, and T |= B, then S |= B.

10 Compactness

Theorem 36 (Compactness) 1. Suppose that every finite subset of a set S of formulasis satisfiable. Then so is S.

2. Suppose that S |= A. Then there is a finite S0 ⊆ S such that S0 |= A.

Proof: The first item is immediate from Konig’s lemma. For the second: Suppose thatS |= A. Then S ∪ {¬A} is not satisfiable, so by item (1), there is a finite S0 ⊆ S such thatS0 ∪ {¬A} is not satisfiable. But then S0 |= A. �

To illustrate the power of Theorem 36, I present now two applications. First, I explain howto deduce Konig’s lemma from it (so that Konig’s lemma and compactness are actuallyequivalent).

18

Page 19: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Let T be a given infinite finite branching tree. For each node ν ∈ T let pν be a propositionalvariable. (Note that T has countably many nodes, so this labeling is possible.) Intuitively,we want to find a branch b of T, and think of pν as being the statement “ν is in b.” We nowpass to describe a theory S that, if satisfiable, will ensure that there is such a branch. Infact, we will arrange things so that from any valuation modeling S we can easily define abranch.

(It is customary to refer to sets of formulas as theories.)

Let S = {p∅} ∪ {pν → ¬pµ | ν 6= µ are nodes at the same level, or for some n, ν is at leveln, µ is at level n+ 1, and µ is not an immediate successor of ν} ∪ {pν1 ∨ · · · ∨ pνk

| for somem, {pν1 , . . . , pνk

} is the m-th level of T}.We have two tasks: First, we need to see that from a valuation v |= S one can (“easily”)define a branch through T. What we actually want is to check that given such a v, the set

b = {ν | v(pν) = 1}

is a branch.

This is actually easy. By induction, check that for each n there is exactly one ν in T atlevel n such that v(pν) = 1, and that if v(pν) = v(pµ) = 1, then ν is an initial segment ofµ, or vice versa.

The second task is where we use compactness: We need to show that there is indeed at leastone valuation v that models S. For this, compactness tells us that it is enough to check thatany finite S0 ⊂ S is satisfiable. We can do this as follows: For any such S0, the set

supp(S0) =⋃{supp(A) | A ∈ S0}

is contained in the first n levels of T, for some n. Pick any node µ at level n+ 1, and definev on the first n levels of T so that v(pν) = 1 iff ν @ µ. It is easy to see that v |= S0, and weare done.

The second application is the following result:

Theorem 37 Any countable partial order can be extended to a total order.

Proof: We first verify the result for finite partial orders:

Lemma 38 Any finite partial order can be extended to a total order.

Proof: Let (X,<) be a finite partial order. We argue by induction on n = |X|. If n = 1there is nothing to do. Suppose that n > 1 and that the result holds for n − 1. Say thatx ∈ X is minimal iff there is no y < x. Since X is finite, there is at least one minimalx0 ∈ X. Since the set X \ {x0} is of size n − 1, we can use the induction hypothesis andfind a linear extension of < on X \ {x0}. Further extend this order to all of X by letting x0

be its minimum. �

19

Page 20: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Now we proceed to the infinite case. Let (N,≺) be a poset. We want to find a total extension≺ of ≺ . For each i, j let pij be a propositional variable. Our intention is that pij is thestatement “i≺j.” As before, we build a theory S so that a valuation of S provides us withthe desired extension, and use compactness to check that S is satisfiable.

S needs to code the fact that ≺ is a linear order, and that it extends ≺ . With this in mind,it is easy to see that the following theory works:

S = S0∪S1∪S2∪S3, where S0 = {pij → ¬pji | i, j ∈ N}, S1 = {pij∧pjk → pik | i, j, k ∈ N},S2 = {pij ∨ pji | i 6= j}, and S3 = {pij | i ≺ j}. The axioms in S0 code that ≺ is irreflexive,S1 codes that it is transitive, and S2 that it is total. Finally, S3 codes that it extends ≺ .If we have that v |= S, we can then set ≺ = {(i, j) | v(pij) = 1}, and this is the desiredextension.

It remains to show that S is satisfiable. By compactness, it suffices to show that any finiteS′ ⊆ S is satisfiable. Given such S′, Lemma 38 tells us that the restriction of ≺ to

X = {i | for some j, pij ∈ supp(S′)}

can be extended to a linear order ≺′ . Define v so that given pij ∈ supp(S′), we havev(pij) = 1 iff i ≺′ j. It is easy to see that v |= S′, and we are done. �

It is instructive to use compactness to prove the infinite Ramsey’s theorem from its finiteversion (the finite version has nice, relatively easy, combinatorial proofs), or to prove thatany countable graph whose finite subgraphs are k-colorable is k-colorable as well.

Compactness also holds for theories of arbitrary size, not just countable ones, but ourargument, dependant in Konig’s lemma, needs to be modified.

Lecture 4

11 Completeness

We now want to show that whenever S |= A, then also S ` A. Combined with the soundnessTheorem 33, this shows that the notions of provable and true coincide for propositional logic,just as they did for the tree system. The examples above should hint at how flexible anduseful this result actually is. This will be even more evident for first order (predicate) logic.

Theorem 39 (Completeness) For any theory S and any formula A, if S |= A, thenS ` A.

Proof: We prove this by verifying that if S is formally consistent, then it is satisfiable. Tosee that this gives the result, suppose that S |= A. Then S ∪ {¬A} is unsatisfiable, and itwould therefore follow that S∪{¬A} is formally inconsistent. Thus S ` ¬¬A, and thereforeS ` A.

20

Page 21: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

Suppose then that S is a given formally consistent theory. By Corollary 18, we may assumethat S is also complete, i.e., that for any formula A, either A ∈ S or ¬A ∈ S. Consider thevaluation

v(p) = χS(p),

where χS is the characteristic function of S, i.e., v(p) = 1 iff p ∈ S. We claim that v |= S.

To prove this, we require one additional result about the provability relation `:

Lemma 40 ¬(A→ B) ` A,¬B.

Proof: To show that ¬(A → B) ` A, it suffices to see that ¬(A → B) ` ¬¬A. By proofby contrapositive, it is enough to show that ¬A ` ¬¬(A→ B), and for this it suffices to seethat ¬A ` A → B. By the deduction theorem, one only needs to check that {¬A,A} ` B.But this is clear, since this set is formally inconsistent.

Similarly, by proof of contrapositive, to see that ¬(A → B) ` ¬B, it suffices to see thatB ` A→ B, but this is clear. �

We now proceed to prove that v |= S for v as above. We check for all formulas A, byinduction on the length of a parsing sequence for A, that A ∈ S iff v(A) = 1.

Since S is complete and v = χS , this holds for A a propositional variable.

Assuming the result for A, it follows immediately for ¬A by completeness of S.

Finally, assume the result for both A and B, and we need to show that it also holds forA → B. We need to prove that A → B ∈ S iff v(A → B) = 1, or equivalently, thatA → B /∈ S iff v(A → B) = 0 or, what is the same, v(A) = 1 and v(B) = 0. By theinduction hypothesis, this is equivalent to saying that A ∈ S and B /∈ S.This is finally what we prove: A→ B /∈ S iff A ∈ S and B /∈ S.Assume first that A ∈ S and B /∈ S. Then A,¬B ∈ S. If A→ B ∈ S, then S ` B,¬B, andtherefore S is formally inconsistent.

Conversely, suppose that A → B /∈ S. Then ¬(A → B) ∈ S. By Lemma 40, S ` A,¬B, soA ∈ S and B /∈ S, and we are done. �

Corollary 41 There is an algorithm that on input S,A where S is a finite set of formulas,and A is a formula, decides whether S ` A. �

On the other hand, the question of how efficient such an algorithm is, turns out to be muchmore complicated (it is equivalent to the P vs NP problem.)

12 Additional connectives

All the results above hold even if we allow additional connectives in the language, moduloa suitable extension of the propositional axioms. (Some of the proofs need minor modi-fications, such as the argument for unique readability.) It is a useful exercise to see that

21

Page 22: Propositional Logic · 2009. 9. 14. · the presentation, I will restrict myself to the language above. As before, a string or word is any nite sequence of the symbols in the language,

if we allow the standard connectives ∧,∨,↔ in addition to ¬,→ then, by extending thepropositional axioms as follows, we can recover the completeness theorem:

1. (A→ (B → A)),

2. ((A→ (B → C)) −→ ((A→ B)→ (A→ C))),

3. ((¬A→ ¬B)→ (B → A)),

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

5. ((A ∧B)→ B),

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

7. (A→ (A ∨B)),

8. (B → (A ∨B)),

9. ((A→ C) −→ ((B → C)→ ((A ∨B)→ C))),

10. ((A↔ B)→ (A→ B)),

11. ((A↔ B)→ (B → A)),

12. ((A→ (B → C)) −→ ((A→ (C → B))→ (A→ (B ↔ C)))).

Typeset using LaTeX2WP.

22