Propositional Logic: Artificial Intelligence
Propositional Logic: Artificial Intelligence
Propositional Logic
Anna Fensel
# Title
1 Introduction
2 Propositional Logic
3 Predicate Logic
4 Reasoning
5 Search Methods
6 CommonKADS
7 Problem-Solving Methods
8 Planning
9 Software Agents
10 Rule Learning
11 Inductive Logic Programming
12 Formal Concept Analysis
13 Neural Networks
14 Semantic Web and Services
2
Outline
• Motivation
• Technical Solution
– Syntax
– Semantics
– Inference
• Illustration by a Larger Example
• Extensions
• Summary
• References
3
MOTIVATION
4 4
Logic and Deduction
5
Why Propositional Logic?
6
What is Propositional Logic?
7
TECHNICAL SOLUTIONS
8 8
SYNTAX
9 9
Syntax
...or [disjunction]
...not [negation]
10
Syntax (cont’)
11
Syntax – BNF Grammar
Sentence AtomicSentence |
ComplexSentence
AtomicSentence True | False | P | Q | R | ...
ComplexSentence (Sentence )
| Sentence Connective Sentence
| Sentence
Connective ||→|↔
12
Syntax – Examples
13
SEMANTICS
14 14
Semantics
• Interpretations
• Equivalence
• Substitution
• Models and Satisfiability
• Validity
• Logical Consequence (Entailment)
• Theory
15
Semantics – Some Informal Definitions
16
Interpretations
17
Interpretations (cont’)
• Example:
– Suppose v is an assignment for which
v(p) = F, v(q) = T.
– If A = (¬p → q) ↔ (p V q), what is v(A)?
Solution:
v(A) = v((¬p → q) ↔ (p V q))
= v(¬p → q) ↔ v(p V q)
= (v(¬p) → v(q)) ↔ (v(p) V v(q))
= (¬v(p) → v(q)) ↔ (v(p) V v(q))
= (¬F → T) ↔ (F V T)
= (T → T) ↔ (F V T)
= T↔T
= T
18
Equivalence
19
Equivalence and Substitution – Examples
• Example: Simplify
– Solution:
20
Models and Satisfiability
21
Validity
22
Validity (cont’)
• Examples:
– Valid (tautology):
– Not valid, but satisfiable:
– False (contradiction):
• Theorem:
(a) A is valid if and only if ¬A is unsatisfiable
(b) A is satisfiable if and only if ¬A is falsifiable
23
Logical Consequence (i.e. Entailment)
24
Theory
25
INFERENCE
26 26
Inference Methods
27
Truth Table Method
28
Example
• Simple sentences:
– Amy loves Pat: lovesAmyPat
– Amy loves Quincy: lovesAmyQuincy
– It is Monday: ismonday
• Premises:
– If Amy loves Pat, Amy loves Quincy:
lovesAmyPat lovesAmyQuincy
– If it is 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?
29
Step 1: Truth table for the premises
30
Step 1: Eliminate non-sat interpretations
31
Step 2: Truth table for the conclusion
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
32
Step 2: Eliminate non-sat interpretations
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
33
Step 3: Comparing tables
34
Validity checking
35
Unsatisfability Checking
• 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
36
Example – A truth table
37
Deductive (proof) systems
38
Schemata
39
Rules of Inference
• The basis for proof systems 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
40
E.g. Modus Ponens (MP)
p (q r)
p
q r
42
Axiom schemata (cont’)
43
Proofs
44
ILLUSTRATION BY LARGER
EXAMPLE
45 45
Problem Example
46
Solution (a)
(a) “If I eat spicy foods, then I have strange dreams.” “I have strange dreams if there is
thunder while I sleep.” “I did not have strange dreams.”
• The relevant conclusions are: “I did not eat spicy food” and “There is no thunder
while I sleep”.
• Let the primitive statements be:
– s, ‘I eat spicy foods’
– d, ‘I have strange dreams’
– t, ‘There is thunder while I sleep’
• Then the premises are translated as: s → d, t → d, and ¬d.
• And the conclusions: ¬s, ¬t.
• Steps Reason
1. s→d premise
2. ¬d premise
3. ¬s Modus Tollens to Steps 1 and 2
4. t→d premise
5. ¬t Modus Tollens to Steps 4 and 2.
47
Solution (b)
48
Solution (c)
(c) “If I work, it is either sunny or partly sunny.” “I worked last Monday or I worked last
Friday.” “It was not sunny on Tuesday.” “It was not partly sunny on Friday.”
• There is no single relevant conclusion in this problem, its main difficulty is to to
represent the premises so that one is able infer anything at all. One possible relevant
conclusion is: “It was sunny or partly sunny last Monday or it was sunny last Friday.”.
• Let the primitive statements be:
– wm, ‘I worked last Monday’
– wf , ‘I worked last Friday’
– sm, ‘It was sunny last Monday’
– st, ‘It was sunny last Tuesday’
– sf , ‘It was sunny last Friday’
– pm, ‘It was partly sunny last Monday’
– pf , ‘It was partly sunny last Friday’
• Then the premises are translated as: wm ∨ wf , wm → (sm ∨ pm), wf → (sf ∨ pf ), ¬st,
and ¬pf .
• And the conclusion: sf ∨ sm ∨ pm.
49
Solution (c) – Method 1
• Steps Reason
1. wf → (sf ∨ pf ) premise
2. ¬wf ∨ sf ∨ pf expression for implication
3. ¬pf → (¬wf ∨ sf ) expression for implication
4. ¬pf premise
5. ¬wf ∨ sf modus ponens to Steps 3 and 4
6. wf → sf expression for implication
7. wm ∨ wf premise
8. ¬wm → wf expression for implication
9. ¬wm → sf rule of syllogism to Steps 8 and 6
10. wm ∨ sf expression for implication
11. ¬sf → wm expression for implication
12. wm → (sm ∨ pm) premise
13. ¬sf → (sm ∨ pm) rule of syllogism to Steps 11 and 12
14. sf ∨ sm ∨ pm expression for implication.
50
Solution (c) – Method 2 (Use the rule of resolution)
• Steps Reason
1. wf → (sf ∨ pf ) premise
2. ¬wf ∨ sf ∨ pf expression for implication
3. ¬pf premise
4. ¬wf ∨ sf rule of resolution to Steps 2 and 3
5. wm ∨ wf premise
6. wm ∨ sf rule of resolution to Steps 4 and 5
7. wm → (sm ∨ pm) premise
8. ¬wm ∨ sm ∨ pm expression for implication
9. sf ∨ sm ∨ pm rule of resolution to Steps 7 and 8
51
EXTENSIONS
52 52
Extensions
• Example:
– “A Mercedes Benz is a Car” and “A car drives” are two individual,
unrelated propositions
– We cannot conclude “A Mercedes Benz drives”
53
Extensions
54
SUMMARY
55 55
Summary
56
REFERENCES
57 57
References
• Mandatory Reading:
– First-Order Logic and Automated Theorem Proofing (2nd edition)
by Melvin Fitting
• Further Reading:
– Mathematical Logic for Computer Science (2nd edition) by
Mordechai Ben-Ari
• http://www.springer.com/computer/foundations/book/978-1-85233-3
19-5
• Wikipedia links:
– http://en.wikipedia.org/wiki/Propositional_calculus
58
Next Lecture
# Title
1 Introduction
2 Propositional Logic
3 Predicate Logic
4 Reasoning
5 Search Methods
6 CommonKADS
7 Problem-Solving Methods
8 Planning
9 Agents
10 Rule Learning
11 Inductive Logic Programming
12 Formal Concept Analysis
13 Neural Networks
14 Semantic Web and Services
59
Questions?
60