advanced topics in propositional logic chapter 17 language, proof and logic

22
Advanced Topics in Advanced Topics in Propositional Logic Propositional Logic Chapter 17 Language, Proof and Logic

Upload: barbara-hutchinson

Post on 03-Jan-2016

229 views

Category:

Documents


1 download

TRANSCRIPT

Advanced Topics in Advanced Topics in Propositional LogicPropositional Logic

Chapter 17

Language, Proof and

Logic

Truth assignments and truth tables17.1.a

A truth assignment for a first-order language is a function h from the set of all atomic sentences of the language into the set {T,F}.

Intuitively, such an h represents one row of the reference columns of a large truth table.

Every assignment h extends to a function h defined for all (propositional)sentences by:

1. h(Q) = h(Q) if Q is atomic; 2. h(QR) = T iff h(Q)=T and h(R)=T; 3. h(QR) = T iff h(Q)=T or h(R)=T, or both; 4. h(QR)=T iff h(Q)=F or h(R)=T, or both; 5. h(QR)=T iff h(Q)=h(R).

Such an h can be thought of as a single full row of a combined truth tablefor all sentences.

Truth assignments and truth tables17.1.b

A sentence S is a tautology iff, for every truth assignment h, h(S)=T, i.e. every truth assignment makes S true.

More generally, S is a tautological consequence of a set of sentences iff every truth assignment that makes all the sentences in true alsomakes S true.

A sentence S is tt-satisfiable iff there is a truth assignment h s.t. h(S)=T, i.e. there is a truth assignment that makes S true.

Similarly, a set of sentences tt-satisfiable iff there is a truth assignment that makes all the sentences in true.

Proposition 1. The sentence S is a tautological consequence of the set of sentences iff the set {S} is not tt-satisfiable.

Completeness for propositional logic17.2.a

FT --- the portion of F that only contains the rules for ,,,,,.

The Completeness Theorem for FT:If a sentence S is a tautological consequence of a set of sentences, then-T S.

We say that a set of sentences is formally inconsistent iff -T .Lemma 2. -T S iff {S} is formally inconsistent. Proof: easy, p.487.

Combining Lemma 2, Proposition 1 and applying contraposition, the above completeness theorem is equivalent to the following:

An Equivalent Formulation of the Completeness Theorem for FT:Every formally consistent set of sentences is tt-satisfiable.

Completeness for propositional logic17.2.b

Thus, we want to prove the following theorem:

Theorem: Every formally consistent set of sentences is tt-satisfiable.

We say that a set of sentences is formally complete iff, for every sentence S, -T S or -T S.

Proof outline for the Theorem:

• First we show that the Theorem holds for formally consistent sets of sentences that are also formally complete (Proposition 4).

• Next we show that every formally consistent set of sentences can be expanded to a formally consistent and complete set (Proposition 6).

• Now, the Theorem is an immediate consequence of the above two Propositions.

Completeness for propositional logic17.2.c

Lemma 3: Let be a formally consistent, formally complete set of sentences, and let R and S be any sentences of the language. Then:

1. -T (RS) iff -T R and -T S.

2. -T (RS) iff -T R or -T S.

3. -T S iff not -T S.

4. -T (RS) iff not -T R, or -T S.

5. -T (RS) iff both -T R and -T S, or neither -T R nor -T S.

Proof: p. 489.

Completeness for propositional logic17.2.d

Proposition 4: Every formally consistent, formally complete set of sentences is tt-satisfiable.

Proof: p. 491. It goes like this:

Assume is as above. For each atomic A, define h(A)=T iff -T A.

Then, by induction on the complexity of sentences, prove that, for every sentence S, h(S)=T iff -T S. Lemma 3 will be used here.

The above means that h makes every sentence of true. So, is tt-satisfiable.

Completeness for propositional logic17.2.e

Lemma 5: A set of sentences is formally complete iff, for every atomic sentence A, -T A or -T A.

Proof: p. 491-2. The direction from left to right is trivial.

For the other direction, assume settles/decides every atomic sentence. We proceed by induction on sentences, where the above assumption serves as a basis of induction.

For the inductive step for AB, assume (inductive hypothesis) that settles both A and B. The cases with other connectives are similar.

If derives either A or B, then, by Intro, we get a proof of AB.

Otherwise, by the inductive hypothesis, derives both A and B. From this, one can easily find (proof by contradiction) that -T (AB).

Completeness for propositional logic17.2.f

Proposition 6: Every formally consistent set of sentences can be expanded to a formally consistent, formally complete set.

Proof: p. 492. Let A1,A2,... be the list of all atoms, alphabetically. Go through these, and whenever you encounter Ai such that neither itnor its negation is derivable from , add Ai to . In view of Lemma 5,you will end up with a formally complete set.

To see that the same set is also formally consistent, suppose, for a contradiction, that it is not. Consider the step of adding an Ai whichmade the set inconsistent. If adding Ai to a set makes the set inconsistent, then, by Lemma 2, the set derives the negation of Ai, in which case, however, we would not have added Ai.

Completeness for propositional logic17.2.g

Compactness Theorem for Propositional Logic: Let be any set ofsentences of propositional logic. If every finite subset of is tt-satisfiable, then so is itself.

Proof: We prove the contrapositive of the claim.

Assume is not tt-satisfiable. Then, by the Completeness Theorem, isformally inconsistent, i.e. it derives . Obviously then some finite subset of derives . By the Soundness Theorem, is not tt-satisfiable.

Thus, there is a finite subset of that is not tt-satisfiable.

Horn Sentences17.3.a

A Horn Sentence is a conjunction of sentences, where each conjunct has one of the following three forms, with Ai, B being atomic:

(1) B(2) A1…An B(3) A1…An

(n≥1; is an always-false sentence)

E.g., the conjunction of the following sentences is a Horn sentence:

Even(a) Odd(b) Even(a) Odd(b) Odd(a+b) Odd(a+b)

database goal

Horn Sentences17.3.b

Why are Horn sentences special?

Using the truth table method, we can check if a sentence is satisfiable. However, this method of checking arbitrary formulas for satisfiability which involves n atomic sentences, will have to involve 2n computations corresponding to rows in the sentence’s truth table – this is computationally very expensive!

But for Horn sentences, we have an efficient algorithm for testing satisfiability. This algorithm is efficient because, in fact, it restricts attention to a single row of a sentence’s truth table.

Horn Sentences17.3.c

Suppose we have a Horn sentence S whose atoms are A1,…, An. The satisfaction

algorithm for S goes as follows:

1.Start out as though you were going to build a truth table, by listing all the atomic sentences in in a row, followed by S. But do not write T or F beneath any of them yet.2.If there is a conjunct of the form Ai, assign T to Ai, i.e., write T in the reference column under Ai. Repeat this as long as possible. 3.If there is a conjunct of the form (B1…Bk)A where you have assigned T to each of B1,…,Bk, then assign T to A. Repeat this as long as possible.4.If there is a conjunct of the form (B1…Bk) where you have assigned T to each of B1,…,Bk, declare S unsatisfiable. Otherwise declare it satisfiable.

A B C D A (AB) (ABC) (ABCD) (D)

A B C D A (AB) (ABCD) (D)

Theorem: This algorithm is correct: it classifies as satisfiable exactly the satisfiable Horn sentences.

T T T Tunsatisfiable

T Tsatisfiable

F F

Resolution17.4.a

People are generally good at figuring out when one sentence is a tautological consequence of another. But what about computer programs?

We need a reliable and efficient algorithm for determining when one sentence is a tautological consequence of another (think about when you use Taut Con in Fitch, it determines the answer pretty quickly! It uses an algorithm that is reasonably efficient in average case.)

Recall that S is a tautological consequence of premises P1 ,…, Pn iff the set {P1 ,…, Pn , S} is not satisfiable – that is to say, the conjunction of its elements is not satisfiable.

Resolution17.4.b

The resolution method is a method that can be applied to arbitrary sentences in CNF.

• It is not, in general, as efficient as the Horn sentence algorithm, but is, in general, much more efficient than the brute force method of checking truth tables.

• Its advantages include that it extends to first-order logic.

Resolution17.4.c

The basic notion in resolution is that of a set of clauses.

A clause is any finite set of literals.

For example, the following sets C1 and C2 are clauses:

C1 = { Small(a), Cube(a), BackOf(b,a) }

C2 = { Small(a), Cube(b) }

The special notation □ is used for the empty clause.

A truth assignment is considered to satisfy a clause iff it makes at least one of its literals true. Note that, hence, the empty clause can not be satisfied. A non-empty set S of clauses is said to be satisfied by the truth assignment h provided each clause in S is satisfied by h. This is equivalent to saying that the CNF sentence formed by conjoining the disjunctions formed from clauses of S is satisfied by h.

Resolution17.4.d

The goal of logicians’ work on the resolution method has been to find as efficient algorithm as possible that will determine whether a set of clauses is satisfiable.

An insight of the theory: in trying to show that a particular set S is not satisfiable, it is often easier to show that a larger set S′ derived from the set S is not satisfiable.

As long as the method of getting S′ from S insures that the two sets are satisfied by the same assignments, we can work with the larger set S′.

Resolution17.4.e

The Resolution Method:

1. Start with a set T of sentences in CNF which you hope to show is not satisfiable. Transform each of these sentences into a set of clauses:

• replace disjunctions of literals by clauses made up of the same literals

• replace the conjunction by the set of those clauses

2. Call the set of all these clauses S. The aim now is to show (or fail to show) that S is unsatisfiable.

2. To show that S is unsatisfiable, systematically add clauses to the set in such a way that the resulting set is satisfied by the same assignments as the old set (the added clauses are called resolvents of the old clauses.) If you get a set of clauses which contains □ (and so cannot be satisfied), then you know that the original set S could not be satisfied.

Resolution17.4.f

Example:

Let C1, C2, and C3 be the following clauses:

C1 = { Home(max), Home(claire) }

C2 = { Home(claire) }

C3 = { Home(max) }

Note that in order for an assignment to satisfy both C1 and C2, it must satisfy the clause

C4 = { Home(max) }

Thus we can put the resolvent C4 into our set of clauses. But note that {C1, C2, C3, C4} cannot be satisfied, as C3 and C4 are in conflict. So the original set is not satisfiable.

Resolution17.4.g

Definition: A clause R is a resolvent of clauses C1 and C2 if there is an atomic sentence in one of the clauses whose negation is in the other clause, and if R is the set of all the other literals in either clause.

Examples (A, B, C, and D are atomic):

{ A, D} {A }{ D }

{ B, C } {B, D }{ C, D }

{ D } {D }

Resolution17.4.h

Theorem (Soundness and Completeness of resolution): A set S of

clauses is unsatisfiable iff one arrives at □ by successive resolutions.

Here’s an example which illustrates the resolution method. Suppose S is the following sentence in CNF:

A (B C B) (C D) (A D) ( B D)

Applying Step 1, we convert the sentence S to the following clauses:

{ A }, { B, C }, {C, D }, { A, D }, { B, D }

Resolution17.4.i

Successive applications of Step 2 is illustrated as follows:

{ B, C } { C, D }

{ A, D } { A } { B, D } { B, D }

{ D } { D }

Since this set of clauses resolves to the empty clause, we know that the original set of sentences, in this case, the sentence S, is not satisfiable.

A figure like the one above is sometimes called a proof by resolution.