Title: Propositional Logic
1Propositional Logic
2Grammatical Complexity
- A natural language is complex. E.g.
- The dog chased the cat.
- The dog that ate the rat chased the cat.
- The cherry blossoms in the spring sank.
3Ambiguity
- A natural language has ambiguity, e.g.
- Theres a girl in the room with a telescope.
- Which one of the figures the sentence intends to
capture?
- In short we need to define a syntax.
4Syntax
5Propositional Constants
- Examples
- raining
- r32aining
- rAiNiNg
- rainingorsnowing
- Non-Examples
- 324567
- raining.or.snowing
6Compound Sentences
- Negations
- Øraining
- Conjunctions
- (rainingÙsnowing)
- The arguments of a conjunction are called
conjuncts. - Disjunctions
- (rainingÚsnowing)
- The arguments of a disjunction are called
disjuncts.
7Compound Sentences
- Implications
- (raining Þ cloudy)
- The left argument of an implication is the
antecedent. - The right argument of an implication is the
consequent. - Reductions
- (cloudy Ü raining)
- The left argument of a reduction is the
consequent. - The right argument of a reduction is the
antecedent. - Equivalences
- (cloudy Û raining)
- Notice that the constituent sentences within any
compound sentence can be either simple sentences
or compound sentences or a mixture of two.
8Parenthesis Removal
- One disadvantage of our notation, as written, is
that the parentheses tend to build up and need to
be matched correctly. It would be nice if we
could dispense with parentheses, e.g. simplifying
- ((pÚq) Þ Ør) into
- pÚq Þ Ør
- Unfortunately, we cannot do without parentheses
entirely, since then we would be unable to render
certain sentences unambiguously. - For example, the sentence shown above could have
resulted from dropping parentheses from either of
the following sentences. - ((p Úq)Þ Ør )
- (p Ú(q Þ Ør ))
9Operator Precedence
- The solution to this problem is the use of
operator precedence. The following table gives a
hierarchy of precedences for our operators. - The Ø operator has higher precedence than Ù, Ù
has higher precedence than Ú,and Ú has higher
precedence than Þ, - Ü, and Û.
- Ø
- Ù
- Ú
- ÜÛÞ
10Parenthesis
- Note that just because precedence allows us to
delete parentheses in some cases, this doesnt
mean that we can dispense with parentheses
entirely. - E.g.
- (p Þ q) Ú (sÞ r)
- Here, we cannot remove the parenthesis
11Semantics
12Algebra and Logic
- The semantics of logic is similar to the
semantics of algebra. - Algebra is unconcerned with the real-world
meaning of variables like x and y. - What is interesting is the relationship between
the variables expressed in the equations we
write and - algebraic methods are designed to respect these
relationships, no matter what meanings or values
are assigned to the constituent variables. - In a similar way, logic itself is unconcerned
with what sentences say about the world being
described. - What is interesting is the relationship between
the truth of simple sentences and the truth of
compound sentences within which the simple
sentences are contained. - Also, logical reasoning methods are designed to
work no matter what meanings or values are
assigned to the logical variables used in
sentences.
13Interpretation
- Although the values assigned to variables are not
crucial in the sense just described, in talking
about logic itself, it is sometimes useful to
make these assignments explicit and to consider
various assignments or all assignments and so
forth. Such an assignment is called an
interpretation. - A propositional logic interpretation (i) is an
association between the propositional constants
in a propositional language and the truth values
T or F. - p ¾i T pi T
- q ¾i F can be written also qi F
- r ¾i T ri T
14Operator Semantics
- The notion of interpretation can be extended to
all sentences by application of operator
semantics. - Negation
- f Øf
- T F
- F T
- For example, if the interpretation of p is F,
then the interpretation of Øp is T. - For example, if the interpretation of Øp is T,
then the interpretation of ØØp is F.
15Operator Semantics (continued)
- Conjunction
- f y f Ùy
- T T T
- T F F
- F T F
- F F F
- Disjunction
- f y f Úy
- T T T
- T F T
- F T T
- F F F
16Operator Semantics (continued)
- Implication
- f y f Þy
- T T T
- T F F
- F T T
- F F T
- Reduction
- f y f Ãœy
- T T T
- T F T
- F T F
- F F T
17Evaluation
- We can easily determine for any given
interpretation whether or not any sentence is
true or false under that interpretation. - The technique is simple. We substitute true and
false values for the propositional constants and
replace complex expressions with the
corresponding values, working from the inside
out. - We say that an interpretation i satisfies a
sentence if and only if it is true under that
interpretation. - As an example, consider the interpretation i show
below. - pi true
- qi false
- ri true
- We can see that i satisfies (pÚq)Ù(ØqÚr).
- (true Ú false) Ù (Øfalse Ú true)
- true Ù(Øfalse Ú true)
- true Ù(true Ú true)
- true Ù true
- true
18Evaluation (continued)
- Now consider interpretation j defined as follows.
- pj true
- qj true
- rj false
- In this case, j does not satisfy (pÚq)Ù(ØqÚr).
- (true Ú true) Ù(Øtrue Ú false)
- trueÙ (Øtrue Ú false)
- true Ù( false Ú false)
- trueÙ false
- false
- Using this technique, we can evaluate the truth
of arbitrary sentences in our language. - The cost is proportional to the size of the
sentence.
19Reverse Evaluation
- Reverse evaluation is the opposite of evaluation.
We begin with one or more compound sentences and
try to figure out which interpretations satisfy
those sentences. - One way to do this is using a truth table for the
language. - A truth table for a propositional language is a
table showing all of the possible interpretations
for the propositional constants in the language. - The interpretations i and j correspond to the
third and seventh rows of this table,
respectively. - Note that, for a propositional language with n
logical constants, there are n columns in the
truth tables 2n rows.
p q r T T T T T F T F T T F
F F T T F T F F F T F F F
20Validity, Satisfiability, Unsatisfiability
- A sentence is valid if and only if it is
satisfied by every interpretation. - p Ú Øp is valid.
- A sentence is satisfiable if and only if it is
satisfied by at least one interpretation. - We have already seen several examples of
satisfiable sentences. - A sentence is unsatisfiable if and only if it is
not satisfied by any interpretation. - p Û Øp is unsatisfiable. No matter what
interpretation we take, the sentence is always
false. - In one sense, valid sentences and unsatisfiable
sentences are useless. Valid sentences do not
rule out any possible interpretations
unsatisfiable sentences rule out all
interpretations thus they say nothing about the
world. - On the other hand, from a logical perspective,
they are extremely useful in that, as we shall
see, they serve as the basis for legal
transformations that we can perform on other
logical sentences. - Note that we can easily check the validity,
satisfiability, or unsatisfiability of a sentence
can easily by looking at the truth table for the
propositional constants in the sentence.
- In one sense, valid sentences and unsatisfiable
sentences are useless. - Valid sentences do not rule out any possible
interpretations - Unsatisfiable sentences rule out all
interpretations thus they say nothing about the
world. - On the other hand, they are very useful in that,
they serve as the basis for legal transformations
that we can perform on other logical sentences. - Note that we can easily check the validity,
satisfiability, or unsatisfiability of a sentence
by looking at the truth table for the
propositional constants in the sentence.
21Entailment
- We would like to know, given some sentences,
whether other sentences are or are not logical
conclusions. - This relative property is known as logical
entailment. - A set of sentences D logically entails a sentence
j - D j
- iff every interpretation that satisfies D also
satisfies j. - E.g.
- The sentence p logically entails the sentence (p
Ú q). - Since a disjunction is true whenever one of its
disjuncts is true, then (p Ú q) must be true
whenever p is true. - On the other hand, the sentence p does not
logically entail (p Ù q). - A conjunction is true if and only if both of its
conjuncts are true, and q may be false.
22Semantic Reasoning Methods
- Several basic methods for determining whether a
given set of premises propositionally entails a
given conclusion.
23Truth Table Method
- One way of determining whether or not a set of
premises logically entails a possible conclusion
is to check the truth table for the logical
constants of the language. - This is called the truth table method and can be
formalized as follows. - Starting with a complete truth table for the
propositional constants, iterate through all the
premises of the problem, for each premise
eliminating any row that does not satisfy the
premise. - Do the same for the conclusion.
- Finally, compare the two tables. If every row
that remains in the premise table, i.e. is not
eliminated, also remains in the conclusion table,
i.e. is not eliminated, then the premises
logically entail the conclusion.
24Amys
Simple sentences Amy loves Pat. loves(amy,
pat) Since we dont have vars but only
constants, it the same as saying
lovesAmyPat. Amy loves Quincy. loves(amy,
quincy) Same as lovesAmyQuincy It is
Monday. ismonday
Premises If Amy loves Pat, Amy loves
Quincy. lovesAmyPat Þ lovesAmyQuincy If it
Monday, Amy loves Pat or Quincy. ismonday Þ
lovesAmyPat Ú lovesAmyQuincy Question If it
is Monday, does Amy love Quincy? I.e. is
ismonday ÞlovesAmyQuincy entailed by the premises?
25Truth table for the premises
lovesAmyPat lovesAmyQuincy ismonday lovesAmyPat Þ lovesAmyQuincy ismonday Þ lovesAmyPat Ú lovesAmyQuincy
T T T T T
T T F T T
T F T F T
T F F F T
F T T T T
F T F T T
F F T T F
F F F T T
26Crossing out non-sat interpretations
lovesAmyPat lovesAmyQuincy ismonday lovesAmyPat Þ lovesAmyQuincy ismonday Þ lovesAmyPat Ú lovesAmyQuincy
T T T T T
T T F T T
T F T F T
T F F F T
F T T T T
F T F T T
F F T T F
F F F T T
27Truth table for the conclusion
lovesAmyPat lovesAmyQuincy ismonday ismonday Þ lovesAmyQuincy
T T T T
T T F T
T F T F
T F F T
F T T T
F T F T
F F T F
F F F T
28Crossing out non-sat interpretations
lovesAmyPat lovesAmyQuincy ismonday ismonday Þ lovesAmyQuincy
T T T T
T T F T
T F T F
T F F T
F T T T
F T F T
F F T F
F F F T
29Comparing tables
- Finally, in order to make the determination of
logical entailment, we compare the two rightmost
tables and notice that every row remaining in the
premise table also remains in the conclusion
table. - In other words, the premises logically entail the
conclusion. - The truth table method has the merit that it is
easy to understand. It is a direct implementation
of the definition of logical entailment. - In practice, it is awkward to manage two tables,
especially since there are simpler approaches in
which only one table needs to be manipulated.
30Validity checking
- One of these approaches is the validity checking
method. It goes as follows. - To determine whether a set of sentences
- j1,,jn
- logically entails a sentence j, we form the
sentence - (j1 Ù Ù jn Þ j)
- and check that it is valid.
- To see how this method works, consider the
problem of Amy and Pat and Quincy once again. In
this case, we write the tentative conclusion as
shown below. - (lovesAmyPat Þ lovesAmyQuincy) Ù (ismonday Þ
lovesAmyPat Ú lovesAmyQuincy) Þ (ismonday Þ
lovesAmyQuincy) - We then form a truth table for our language with
an added column for this sentence and check its
satisfaction under each of the possible
interpretations for our logical constants.
31Unsatisfability Checking
- The satisfiability checking method is another
single table approach. It is almost exactly the
same as the validity checking method, except that
it works negatively instead of positively. - To determine whether a finite set of sentences
j1,,jn logically entails a sentence j, we form
the sentence - (j1 Ù Ù jn Ù Øj)
- and check that it is unsatisfiable.
- Both the validity checking method and the
satisfiability checking method require about the
same amount of work as the truth table method,
but they have the merit of manipulating only one
table.
32A truth table
p q r p Þ q p Þ r p Þ r ? q (p Þ q) ? (p Þ r) Þ (p Þ r ? q) p Þ r ? q (p Þ q) ? (p Þ r) Þ (p Þ r ? q)
T T T T T T T T T
T T F T F T T F T
T F T F T T T F T
T F F F F F T F T
F T T T T T T T T
F T F T T T T T T
F F T T T T T T T
F F F T T T T T T
33Proofs
34Intro
- Semantic methods for checking logical entailment
have the merit of being conceptually simple they
directly manipulate interpretations of sentences. - Unfortunately, the number of interpretations of a
language grows exponentially with the number of
logical constants. - When the number of logical constants in a
propositional language is large, the number of
interpretations may be impossible to manipulate. - Proof methods provide an alternative way of
checking and communicating logical entailment
that addresses this problem. - In many cases, it is possible to create a proof
of a conclusion from a set of premises that is
much smaller than the truth table for the
language - moreover, it is often possible to find such
proofs with less work than is necessary to check
the entire truth table.
35Schemata
- An important component in the treatment of proofs
is the notion of a schema. A schema is an
expression satisfying the grammatical rules of
our language except for the occurrence of
metavariables in place of various subparts of the
expression. - For example, the following expression is a
pattern with metavariables j and y. - j Þ (y Þj)
- An instance of a sentence schema is the
expression obtained by substituting expressions
for the metavariables. - For example, the following is an instance of the
preceding schema. - p Þ(qÞ p)
36Rules of Inference
- The basis for proof methods is the use of correct
rules of inference that can be applied directly
to sentences to derive conclusions that are
guaranteed to be correct under all
interpretations. - Since the interpretations are not enumerated,
time and space can often be saved. - A rule of inference is a pattern of reasoning
consisting of - one set of sentence schemata, called premises,
and - a second set of sentence schemata, called
conclusions. - A rule of inference is sound if and only if, for
every instance, the premises logically entail the
conclusions.
37E.g. Modus Ponens
- j Þy
- j
- y
- rainingÞ wet
- raining
- wet
- wet Þ slippery
- wet
- slippery
- p Þ(qÞ r)
- p
- q Þ r
- (p Þ q)Þ r
- p Þ q
- r
- I.e. we can substitute for the metavariables
complex sentences - Note that, by stringing together applications of
rules of inference, it is possible to derive
conclusions that cannot be derived in a single
step. This idea of stringing together rule
applications leads to the notion of a proof.
38Axiom schemata
- The implication introduction schema (II),
together with Modus Ponens, allows us to infer
implications. - j Þ (y Þj)
- The implication distribution schema (ID) allows
us to distribute one implication over another. - (j Þ (y Þ c)) Þ((jÞy) Þ(jÞ c))
- The contradiction realization schemata (CR)
permit us to infer a sentence if the negation of
that sentence implies some sentence and its
negation. - (y Þ Øj) Þ((y Þj) ÞØy)
- (Øy ÞØj) Þ((Øy Þj)Þy)
- The equivalence schemata (EQ) capture the meaning
of the Û operator. - (j Ûy)Þ (j Þy)
- (j Ûy)Þ (y Þj)
- (j Þy)Þ ((y Þj)Þ (y Ûj))
- The meaning of the other operators in
propositional logic is captured in the following
axiom schemata. - (j Üy)Û(y Þj)
- (j Úy )Û(Øj Þy)
- (j Ùy)Û Ø(Øj Ú Øy)
- The axiom schemata in this section are jointly
called the standard axiom schemata for
Propositional Logic. They all are valid.
39Proofs
- A proof of a conclusion from a set of premises is
a sequence of sentences terminating in the
conclusion in which each item is either (1) a
premise, (2) an instance of an axiom schema, or
(3) the result of applying a rule of inference to
earlier items in sequence. - 1. p Þ q Premise
- 2. q Þ r Premise
- 3. (q Þ r)Þ (p Þ(q Þ r)) II
- 4. p Þ(qÞ r) MP 3,2
- 5. (p Þ(qÞ r)) Þ(( pÞ q) Þ(p Þ r)) ID
- 6. (p Þ q)Þ (p Þr ) MP 5,4
- 7. p Þ r MP 6,1
40Proofs (continued)
- If there exists a proof of a sentence j from a
set D of premises and the standard axiom schemata
using Modus Ponens, then j is said to be provable
from D (written as D - j) and is called a
theorem of D. - Earlier, it was suggested that there is a close
connection between provability and logical
entailment. In fact, they are equivalent. A set
of sentences D logically entails a sentence j if
and only if j is provable from D. - Soundness Theorem If j is provable from D, then
D logically entails j. - Completeness Theorem If D logically entails j,
then j is provable from D. - The concept of provability is important because
it suggests how we can automate the determination
of logical entailment. - Starting from a set of premises D, we enumerate
conclusions from this set. - If a sentence j appears, then it is provable from
D and is, therefore, a logical consequence. - If the negation of j appears, then Øj is a
logical consequence of D and j is not logically
entailed (unless D is inconsistent). - Note that it is possible that neither j nor Øj
will appear.
41Resolution
42Intro
- Propositional resolution is an extremely powerful
rule of inference for Propositional Logic. Using
propositional resolution (without axiom schemata
or other rules of inference), it is possible to
build a theorem prover that is sound and complete
for all of Propositional Logic. - What's more, the search space using propositional
resolution is much smaller than for standard
propositional logic.
43Clausal Form
- Propositional resolution works only on
expressions in clausal form. Before the rule can
be applied, the premises and conclusions must be
converted to this form. - A literal is either an atomic sentence or a
negation of an atomic sentence. For example, if p
is a logical constant, the following sentences
are both literals p, Øp - A clause expression is either a literal or a
disjunction of literals. If p and q are logical
constants, then the following are clause
expressions - p, Øp, p Úq
- A clause is the set of literals in a clause
expression. For example, the following sets are
the corresponding clauses p, Øp, p,q - Note that the empty set is also a clause. It
is equivalent to an empty disjunction and,
therefore, is unsatisfiable.
44Converting to clausal form
- 1. Implications (I)
- j1 Þ j2 Øj1 Ú j2
- j1 Ü j2 j1 Ú Øj2
- j1 Ûj2 (Øj1 Ú j2 ) Ù(j1 Ú Øj2 )
- 2. Negations (N)
- ØØj j
- Ø(j1 Ù j2 ) Øj1 ÚØj2
- Ø(j1 Új2 ) Øj1 ÙØj2
- 3. Distribution (D)
- j1 Ú (j2 Ù j3 ) (j1 Ú j2) Ù(j1 Ú j3 )
- (j1 Ùj2 ) Ú j3 (j1 Ú j3 ) Ù (j2 Ú j3)
- (j1 Új2 ) Ú j3 j1 Ú (j2 Ú j3 )
- (j1 Ùj2 ) Ù j3 j1 Ù (j2 Ù j3)
- 4. Operators (O)
- j1 Ú... Újn j1,...,jn
- j1 Ù ...Ùjn j1...jn
45Examples
- g Ù (r Þ f )
- I g Ù (Ør Ú f )
- N g Ù (Ør Ú f )
- D g Ù (Ør Ú f )
- O g
- Ør, f
Ø(g Ù (rÞ f )) I Ø(g Ù (Ør Ú f )) N Øg ÚØ(Ør Ú
f )) Øg Ú(ØØr Ù Øf ) Øg Ú(r ÙØf ) D (Øg Úr)
Ù(Øg Ú Øf ) O Øg,r Øg,Øf
46Propositional Resolution
- j1,..., c,...,jm
- y1,...,Øc,...,yn
- j1,...,jm,y1,...,yn
- E.g.
- p,q
- Øp,r
- q,r
- The idea of resolution is simple.
- Suppose we know that p is true or q is true, and
suppose we also know that p is false or r is
true. - One clause contains p, and the other contains Øp.
- If p is false, then by the first clause q must be
true. - If p is true, then, by the second clause, r must
be true. - Since p must be either true or false, then it
must be the case that q is true or r is true. - In other words, we can cancel the p literals.
47Example
- 1. p,q Premise
- 2. Øp, q Premise
- 3. p,Øq Premise
- 4. Øp,Øq Premise
- 5. q 1,2
- 6. Øq 3,4
- 7. 5,6
48Two finger (or pointer) method
- We keep two pointers (the slow and the fast)
- On each step we compare the sentences under the
pointers. If we can resolve, we add the new
derived sentence at the end of the list. - At the start of the inference we initialize slow
and fast at the top of the list. - As long as the two pointers point to different
positions, we leave the slow where it is and
advance the fast. - When they meet, we move the fast at the top of
the list and we move the slow one position down
the list.
49Example (two finger method)
- 1. p,q Premise
- 2. Øp,r Premise
- 3. Øq, r Premise
- 4. Ør Premise
- 5. q,r 1,2
- 6. p,r 1,3
- 7. Øp 2,4
- 8. Øq 3,4
9. r 3,5 10. q 4,5 11. r 2,6 12. p
4,6 13. q 1,7 14. r 6,7 15. p 1,8 16.
r 5,8 17. 4,9
50TFM With Identical Clause Elimination
- 1. p,q Premise
- 2. Øp,r Premise
- 3. Øq, r Premise
- 4. Ør Premise
- 5. q,r 1,2
- 6. p,r 1,3
- 7. Øp 2,4
- 8. Øq 3,4
- 9. r 3,5
- 10. q 4,5
- 11. p 4,6
- 12. 4,9
51Another TFM example
- 1. p,q
- 2. p,Øq
- 3. Øp,q
- 4. Øp,Øq
- 5. p 1,2
- 6. q 1,3
- 7. Øq, q 2,3
- 8. p,Øp 2,3
- 9. q,Øq 1,4
- 9.5 p,Øp 1,4
- 10. Øq 2,4
11. Øp 3, 4 12. q 3,5 13. Øq 4,5 14. p
2,6 15. Øp 4,6 16. p,q 1,7 17. Øq, p
2,7 18. Øp,q 3,7 19. Øq,Øp 4,7 20. q 6,7
52continued
- 21. Øq, q 7, 7
- 22. Øq, q 7, 7
- 23. q, p 1,8
- 24. Øq, p 2,8
- 25. Øp,q 3,8
- 26. Øp,Øq 4,8
- 27. p 5,8
- 28. Øp, p 8,8
- 29. Øp, p 8,8
- 30. p,q 1,9
31. Øq, p 2,9 32. Øp, q 3,9 33. Øq,Øp 4,
9 34. q 6,9 35. Øq,q 7,9 36. q,Øq
9,9 37. q,Øq 9,9 38. p 1,10 39. Øp
3,10 40. 6,10
53Proof With Identical Clause Elimination
- 1. p,q
- 2. p,Øq
- 3. Øp,q
- 4. Øp,Øq
- 5. p 1,2
- 6. q 1,3
- 7. Øq, q 2,3
- 8. p,Øp 2,3
- 9. q,Øq 1,4
- 10. Øq 2,4
- 11. Øp 3,4
- 12. 6,10
54Motivation for Tautology Elimination
- A tautology is a clause with a complementary pair
of literals. - 1. p,q Premise
- 2. p,Øp Premise
- 3. p,q 1,2
55Proof with TE and ICE
- 1. p, q
- 2. p,Øq
- 3. Øp, q
- 4. Øp,Øq
- 5. p 1,2
- 6. q 1,3
- 7. Øq 2, 4
- 8. Øp 3,4
- 9. 6,7