Lecture 10: Propositional Logic

10:30 AM, Feb 26, 2009

1 Overview

This part of the course is devoted to knowledge representation and manipulation. Knowledge-based agents know something about their environment and they use their knowledge together with an inference engine to reason about their environment. Logic is a formalism in which to express knowledge and reasoning. Thislectureis concerned with thesyntax and semantics ofpropositional logic, Hilbert-style proofs and natural deduction, and modus ponens theorem provers.

2 Syntax

The syntax of a language are the rules that govern construction of its formulas, given an alphabet. The alphabet of propositional logic contains the constants {⊤, ⊥}, a set of propositional variables {P, Q, R, . . .}, and a set of connectives , , , →}. The following inductive definition describes the formulas of propositional logic. Complex formulas involve one or more of the connectives; atomic formulas do not.

  • the constants , are(atomic) formulas
  • the propositional variables P, Q, R, ...are(atomic) formulas
    • if A and B areformulas,then(complex) formulas areformed asfollows:
      • ¬(A)is a formula
      • (A B)is a formula
      • (A B)is a formula
      • (A B)is a formula

In the absence of parentheses, the precedence of the connectives is as follows: ¬, , , and .

Propositionalvariables represent propositions and connectives represent ways of combiningpropositions. For example, if P represents the proposition “the lights are on” and Q represents the proposition “thedoorisclosed,” then P Q represents the formula “the lights are on and the door is closed,” and ¬P represents the formula “the lights are not on.”

Semantics

The semantics of a language give meaning to its formulas. The formulas of propositional logic are assigned one of two values, eithertrue(T) orfalse(F).Atomicformulas are assigned valuesby an interpretation I = D, M, where

  • D = {T,F} is the domain of meanings
  • M maps atomic formulas into domain D s.t. M()=T and M()=F

Logical formulas are evaluated by a semantic evaluation function v, which takes as input interpretation I and formula A, and outputs an element of domain D. We abbreviate v(I,A) =Tby I|= A and v(I,A) =Fby I �|= A. The former is read “I satisfies A”or “I is a model of A;” the latter is read inversely. Given interpretation I and formula A, I|= A is defined inductively as follows:

  • I|= and I �|= , since M()=T and M()=F
  • I|= P iff M(P )=T
  • I|= ¬A iff I �|= A
  • I|= A B iff I|= A or I|= B
  • I|= A B iff I|= A and I|= B
  • I|= A B iff I|= B whenever I|= A

The inductive cases of the semantics are more precisely expressed as truth tables:

ABA BA BA BA B A ¬A TTTTT T TF TFTFF T FTFTTFT F FFFFT T

The semantics of propositional logic are compositional, since the truth or falsity of complex formulas in propositional logic is entirely determined by the truth or falsity of their constituents.

Remark: Logical implication is not equivalent in meaning to causal implication as it is used in natural language. Let A represent the formula “pigs can fly,” and let B represent the formula

“Al Gore is the president of the United States.” Now consider the formula A B. In natural language, onewouldinterpretthisformulatomeanthattheexistenceof flyingpigsisonecondition sufficientforAlGoretobepresident of theUnitedStates. Inpropositionallogic,however, A B isvacuously true(sincepigscannot fly).

The following definitions pertain to the formula A:

  • A is satisfiable iff there exists I s.t. I|= A
  • A is valid iff for all I, I|= A iff there does not exist I s.t. I �|= A
  • A is unsatisfiable iff for all I, I �|= A iff there does not exist I s.t. I|= A

Unsatisfiable formulas are also called contradictions, orlogicalfalsities: e.g., A ∧¬A. Thereis no interpretation I s.t. I|= A ∧¬A. On the other hand, valid formulas are also called tautologies, or logical truths, since they are true under all interpretations.

Examples of tautologies are listed below:

  • Law of Double Negation ¬¬A A
  • DeMorgan’s Laws ¬(A B)(¬A ∧¬B) ¬(A B)(¬A ∨¬B)
  • Distributive Laws (A B)C (A C)(B C) (A B)C (A C)(B C)
  • Associative Laws (A B)C A (B C) (A B)C A (B C)
  • Commutative Laws A B B A A B B A

Here, the connective is usedas an abbreviation: inparticular, A B means(A B)(B A). Exercise: Using truth tables, establish that these laws are in fact tautologies.

Logical Entailment

A knowledge-based agent is one equipped with a knowledge base—simply a set of sentences called axioms, because they are accepted as facts. The logical entailment problem is the following: given knowledge base KB and formula A, does the KB semantically entail A? Semantic entailment is defined as follows: in all interpretations in which the formulas of KB hold true, does A also hold true? If KB semantically entails A, this fact is denoted KB |= A.

A logic is decidable iff there exists an effective procedure for solving the logical entailment problem. Propositional logic is decidable. One effective procedure that decides logical entailment in the propositional case is enumeration of all possible interpretations using truth tables. But the complexity of thisprocedureisexponentialinthenumberofpropositional variables. Canwedobetter? Not unless P=NP, because A is valid iff ¬A is not satisfiable, and satisfiability is NP-complete.

Example: Today we have class. If we have class, then it is either Tuesday or Thursday. 1 If it is Thursday, then we can relax; the weekend is approaching. But if it is Tuesday, then we can study or we can relax(if we arelazy). If we study,then afterwards, we can relax. Can we relax?

Let C represent “we have class today;” let T represent “it is Tuesday;” let H represent “it is Thursday;” let R represent “we can relax;” let S represent “we can study.” Now the following list of axioms comprises our knowledge base: C, C T H, H R, T R S, and S R.

5 Logical Inference

Analternative approach to solving thelogical entailmentproblem, and onethatcanbegeneralized toapply tomoreexpressivelogicsthanmerelypropositionallogic(e.g., first-orderlogic),istouse proof-theoreticprocedures. Here, wepresenttwoproof theoriesforpropositionallogic, a Hilbert-style calculus, whichhas manylogical axiomsbut veryfew rules ofinference, and a Gentzen-style calculus, which has few logical axioms but many rules of inference.

The following are examples of logical axioms, or schema: for all formulas A, B, and C,

  1. A (B A)
  2. (A (B C))((A B)(A C))
  3. (¬A →¬B)(B A)

A rule of inference is a set of premises and a conclusion: e.g., if A B and A, then B. In this example, A B and A arepremises and B is the conclusion. A concrete instance of this inference rule is the following: given premises “if Socrates is a man, then Socrates is mortal,” and “Socrates is a man,” conclude “Socrates is mortal.” This type of inference is called modus ponens.

A Hilbert-style proof is sequence of statements in a logical language such that each statement is either an instance of a logical axiom or an immediate consequence of some rule of inference applied to previous statements in the sequence. A theorem is the last statement in the sequence. Hilbert-styleproofs are often cumbersome. 2 For example, thefollowingis aHilbert-stylederivation:

1.P Q Assumption

2.Q R Assumption

3. (Q R)(P (Q R)) Axiom 1

4.P (Q R) Modus Ponens 2,3

  1. (P (Q R))((P Q)(P R)) Axiom 2
  2. (P Q)(P R) Modus Ponens 4,5

7.P R Modus Ponens 1,6

1 Possibly both. 2 Recall high-school geometry.

C T H S R
T T T T T
T T T T F
T T T F T
T T T F F
T T F T T
T T F T F
T T F F T
T T F F F
T F T T T
T F T T F
T F T F T
T F T F F
T F F T T
T F F T F
T F F F T
T F F F F
F T T T T
F T T T F
F T T F T
F T T F F
F T F T T
F T F T F
F T F F T
F T F F F
F F T T T
F F T T F
F F T F T
F F T F F
F F F T T
F F F T F
F F F F T
F F F F F
C C T H H R T R S S R R
T T T T T T
T T F T F F
T T T T T T
T T F F T F
T T T T T T
T T T T F F
T T T T T T
T T T F T F
T T T T T T
T T F T F F
T T T T T T
T T F T T F
T F T T T T
T F T T F F
T F T T T T
T F T T T F
F T T T T T
F T F T F F
F T T T T T
F T F F T F
F T T T T T
F T T T F F
F T T T T T
F T T F T F
F T T T T T
F T F T F F
F T T T T T
F T F T T F
F T T T T T
F T T T F F
F T T T T T
F T T T T F

Figure 1: KB |= R: i.e., R holds in all interpretations in which KB holds.

Gentzen(andlaterPrawitz) devised aformalismfor expressinglogicalinference rules andproofs using tree(technically,graph) structures, rather thanlinearHilbert-stylederivations. Thisproof theoryiscalled naturaldeduction. Therulesof naturaldeductioncomeinintroduction-elimination pairs. Those rules relevantto(classical) propositionallogic arelistedinTable1.

Here is some evidence for the “naturality” of Gentzen and Prawitz’ system:

  • The rule ¬I can be understood as “proof by contradiction.”
  • The rule E can be understood as case analysis.
  • The rule E is called modus ponens.

Introduction Rules Elimination Rules

(I) (E)

A AB A BA B

(I) (E)

A B AB

[A][B]

..

..

..

..

AB A BC C

(I) (E)

A BA B C

[A]

.

.

.

.

B AA B

(I) (E)

A B B

[A]

.

.

.

.

¬¬A

(¬I) (¬E)

¬A A

Table 1: Rules of Natural Deduction.

The rule ¬E is called the law of double negation. Its presence indicates that the propostional logic under study is classical. 3

The following is the above derivation carried out using natural deduction.

[P ] P Q

(E)

QQ R

(E)

R (I)

P R

If there exists a derivation of theorem A from knowledge base KB using proof theory Π, we write KB Π A. A proof theory Π is sound iff KB Π A implies KB |= A (if A is provable, then it is true). A proof theory Π is complete iff KB |= A implies KB Π A (if A is true, then it is provable). Both the Hilbert-style and the Gentzen-style calculi are sound and complete for propositionallogic. Therefore,thelogical entailmentproblemforpropositionallogiccanberestated as a logical inference problem: e.g.,givenknowledgebaseKB andformula A, does KB A? For example, KB ND R (where ND denotes the prooftheory of natural deduction), as follows:

3 One alternative to classical logic is intuitionistic logic.

[H] H R

(E)

[T ] T R S

R CC T H

(E) (I) (E)

[R][S] S R

R SR ST H

(E) (E)

RR R S

(E)

R