Lecture 04 Part B - Propositional Logic
Lecture 04 Part B - Propositional Logic
Propositional Logic
Department of EECS
North South Universtiy
[email protected]
Knoweldge Representation & Reasoning
Syntax
Semantic
Entailment
Propositional Logic
Syntax
Knoweldge Representation & Reasoning
SYNTAX
It defines the allowable sentences.
Atomic sentences
Complex sentences
1. (NOT) negation.
2. (AND) conjunction, operands are conjuncts.
3. (OR), operands are disjuncts.
4. ⇒ implication (or conditional) A ⇒ B, A is the
premise or antecedent and B is the conclusion or consequent. It
is also known as rule or if-then statement.
5. if and only if (biconditional).
Knoweldge Representation & Reasoning
• Logical constants TRUE and FALSE are sentences.
parenthesis ( Sentence )
NOT
AND
OR
Implies
Equivalent
R1 : ¬ P1,1
R2 : B1,1 (P1,2 P2,1)
R3 : B2,1 (P1,1 P2,2 P3,1)
True in all wumpus worlds
R4 : ¬ B1,1
R5 : B2,1
Propositional Logic
Semantic
Knoweldge Representation & Reasoning
SEMANTIC
The question:
How to compute the truth value of any sentence
given a model?
Truth tables
Truth tables
The five logical connectives:
A complex sentence:
Propositional Logic
Entailment
Knoweldge Representation &
Reasoning
KB
Propositional Inference: A B C ( C)
B C)
Enumeration Method False False False False False
Model checking
Premise
_____
Conclusion
Knoweldge Representation & Reasoning
Propositional Logic: An inference rule: Modus Ponens
Premise
___________
Conclusion
Example:
“raining implies soggy courts”, “raining”
Infer: “soggy courts”
Knoweldge Representation & Reasoning
Propositional Logic: An inference rule: Modus Tollens
¬ Premise
___________
¬ Conclusion
Example:
“raining implies soggy courts”, “courts not soggy”
Infer: “not raining”
Knoweldge Representation & Reasoning
Propositional Logic: An inference rule: AND elimination
From a conjunction, you can infer any of the
conjuncts.
And-Introduction
1, 2, …, n Premise
_______________
1 2 … n Conclusion
Double Negation
Premise
_______
Conclusion
Rules of equivalence can be used as inference rules.
(Tutorial).
Knoweldge Representation & Reasoning
Propositional Logic: Equivalence rules
R1 : ¬ P1,1
R2 : B1,1 (P1,2 P2,1)
R3 : B2,1 (P1,1 P2,2 P3,1)
True in all wumpus worlds
R4 : ¬ B1,1
R5 : B2,1
Inference and proofs
Our goal is to derive ¬ P1,2
R1 : ¬ P1,1
R2 : B1,1 (P1,2 P2,1)
R3 : B2,1 (P1,1 P2,2 P3,1)
True in all wumpus worlds
R4 : ¬ B1,1
R5 : B2,1
R1 : ¬ P1,1
R2 : B1,1 (P1,2 P2,1) R7 : ((P1,2 P2,1) B1,1 )
R3 : B2,1 (P1,1 P2,2 P3,1)
Apply contraposition to R7
True in all wumpus worlds
R4 : ¬ B1,1
R5 : B2,1 R8 : (¬B1,1 ¬ (P1,2 P2,1) )
l1 … li-1 li+1 … lk
P1,1 P3,1
If there’s a pit in one of [1,1], [2,2] and [3,1], and it’s not in
[2,2], then it’s in [1,1] or [3,1]
Knoweldge Representation & Reasoning
Resolution
Full resolution inference rule:
l1 … lk , m1 … m n
l1 l3
To derive the soundness of resolution consider the values l2
can take:
• If l2 is True, then since we know that ¬l2 l3 holds, it
must be the case that l3 is True.
• If l2 is False, then since we know that l1 l2 holds, it
must be the case that l1 is True.
Knoweldge Representation & Reasoning
factoring
Remove multiple copies of literals
A B, ¬ B A
A
Knoweldge Representation & Reasoning
Resolution
1. Properties of the resolution rule:
• Sound
• Complete (yields to a complete inference algorithm).
(A B )
( A B )
Simplification
(B B ) B
Knoweldge Representation & Reasoning
Resolution: Inference procedure
6. Inference procedures based on resolution work by using the
principle of proof by contradiction:
KB
True!
False in
all worlds
Knoweldge Representation & Reasoning
Resolution: Inference procedure
Function PL-RESOLUTION(KB,α) returns true or false
Clauses ← the set of clauses in the CNF representation of (KB¬α) ;
New ←{};
Loop Do
For each (Ci Cj ) in clauses do
resolvents ← PL-RESOLVE (Ci Cj );
If resolvents contains the empty clause then return true;
New ← New ∪ resolvents
End for
If New ⊆ Clauses then return false
Clauses ← Clauses ∪ new
End Loop
Knoweldge Representation & Reasoning
Resolution: Inference procedure
• If we can reduce all clauses to “Horn clauses” resolution is linear in space and time
AND gate
OR gate
“OR” Gate
“AND” gate
Forward chaining example
Forward chaining example
Forward chaining example
Forward chaining example
Forward chaining example
Knoweldge Representation & Reasoning
Inference for Horn clauses: backward chaining
Avoid loops:
check if new subgoal is already on the goal stack
Avoid repeated work: check if new subgoal has already been
proved true, or has already failed
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
we need P to prove
L and L to prove P.
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Forward vs. backward chaining
FC is data-driven, automatic, unconscious processing,
e.g., object recognition, routine decisions
Percept Sentences
S1,1 B1,1 Apply Modus Ponens to R1
S2,1 B2,1 Add to KB
S1,2 B1,2
…
W1,1 W W
2,1 1,2
Truth table method is sound and complete for propositional logic but Cumbersome in
most cases.