Download Advanced Topics in Propositional Logic

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Mathematical proof wikipedia , lookup

Mathematical logic wikipedia , lookup

Gödel's incompleteness theorems wikipedia , lookup

Truth wikipedia , lookup

Model theory wikipedia , lookup

Catuṣkoṭi wikipedia , lookup

Donald Davidson (philosopher) wikipedia , lookup

Quantum logic wikipedia , lookup

Cognitive semantics wikipedia , lookup

Semantic holism wikipedia , lookup

Law of thought wikipedia , lookup

Intuitionistic logic wikipedia , lookup

Laws of Form wikipedia , lookup

Theorem wikipedia , lookup

Grammaticality wikipedia , lookup

Propositional formula wikipedia , lookup

Propositional calculus wikipedia , lookup

Truth-bearer wikipedia , lookup

Transcript
Language, Proof and
Logic
Advanced Topics in
Propositional Logic
Chapter 17
17.1.a
Truth assignments and truth tables
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(QR) = T iff h(Q)=T and h(R)=T;
3. h(QR) = T iff h(Q)=T or h(R)=T, or both;
4. h(QR)=T iff h(Q)=F or h(R)=T, or both;
5. h(QR)=T iff h(Q)=h(R).
Such an h can be thought of as a single full row of a combined truth table
for all sentences.
17.1.b
Truth assignments and truth tables
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 also
makes 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.
17.2.a
Completeness for propositional logic
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.
17.2.b
Completeness for propositional logic
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.
17.2.c
Completeness for propositional logic
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.
2.
3.
4.
-T (RS) iff -T R and -T S.
-T (RS) iff -T R or -T S.
-T S iff not -T S.
-T (RS) iff not -T R, or -T S.
5. -T (RS) iff both -T R and -T S, or neither -T R nor -T S.
Proof: p. 489.
17.2.d
Completeness for propositional logic
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.
17.2.e
Completeness for propositional logic
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 AB, 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 AB.
Otherwise, by the inductive hypothesis,  derives both A and B.
From this, one can easily find (proof by contradiction) that -T  (AB).
17.2.f
Completeness for propositional logic
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 it
nor 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 which
made 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.
17.2.g
Completeness for propositional logic
Compactness Theorem for Propositional Logic: Let  be any set of
sentences 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,  is
formally 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.
17.3.a
Horn Sentences
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)
Database
Odd(a+b)  
Goal
Database implies Goal iff Database  (Goal  ) is not satisfiable.
17.3.b
Database:
Goal:
Father(a,b)Parent(a,b)
Mother(c,d)Parent(c,d)
Brother(a,b)Sibling(a,b)
Sister(a,b)Sibling(a,b)
Parent(a,b)Sibling(c,a)Parent(c,d)Cousin(b,d)
Father(a,b)
Sister(c,a)
Mother(c,d)
Cousin(c,d)
Database implies Goal iff Database  (Goal  ) is not satisfiable.
17.3.c
Knowledgebase:
Database:
Goal:
Father(x,y)Parent(x,y)
Mother(x,y)Parent(x,y)
Brother(x,y)Sibling(x,y)
Sister(x,y)Sibling(x,y)
Parent(x,y)Sibling(z,x)Parent(z,t)Cousin(y,t)
Father(a,b)
Sister(c,a)
Mother(c,d)
Cousin(c,d) ?
DATALOG
17.3.d
Horn Sentences
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.
17.3.e
Horn Sentences
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  (AB)  (ABC)  (ABCD)  (D) unsatisfiable
T T T T
A  B  C  D  A  (AB)  (ABCD)  (D)
T T F F
satisfiable
Theorem: This algorithm is correct: it classifies as satisfiable exactly
the satisfiable Horn sentences.
17.4.a
Resolution
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.
17.4.b
Resolution
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.
17.4.c
Resolution
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.
17.4.d
Resolution
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′.
17.4.e
Resolution
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.
17.4.f
Resolution
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.
17.4.g
Resolution
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 }
□
17.4.h
Resolution
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 }
17.4.i
Resolution
Successive applications of Step 2 is illustrated as follows:
{ A, D } { A }
{D}
{ B, C }
{ C, D }
{ B, D }
{ B, 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.