PROPOSITIONAL LOGIC - Part A - Last Version
PROPOSITIONAL LOGIC - Part A - Last Version
AGENT
and PROPOSITIONAL
LOGIC
CHAPTER 7
A Knowledge-Based Agent (1)
A knowledge-based agent consists of a knowledge
base (KB) and an inference engine (IE)
M(α)
KB |= a if and only if M(KB) M(a)
Knowledge base KB entails sentence a if and only if a is true in all
worlds where KB is true
M(a)
Entailment in the Wumpus world
Situation after detecting nothing in [1,1], moving right, detecting breeze in [1,2]
Consider possible models (models) for ?
1 2 3
Wumpus models m2
m1
m5
m3
m4
1
m8
m6
1 2 3
m7
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either
true or false, but not both.
In propositional logic, symbolic variables are used to represent the logic, “Ahmad is smart” p
and we can use any symbol for a representing a proposition
“Ahmad is hardworking” q
A proposition symbol can be
“Amman is the capital of Jordan”
A symbol stand for any arbitrary fact
Start with an uppercase letter and may contain other letters or subscripts
The conventional letters used for propositional variables are p, q, r, s,..,etc..
The value of the symbol can be True or False
For example: there is a breeze in square 1,1 B1,2
Example:
If it is raining, then the street is wet.
Let p= “It is raining”, and q= “Street is wet”, so it is represented as p → q
if the sky is cloudy, then the sun is not visible.
Let p= “the sky is cloudy”, and q= “the sun is not visible”, so it is represented as p → q
Logical Connectives
1. Biconditional: A sentence such as P⇔ Q is a Biconditional sentence,
Example: I am alive if only if I am breathing
p= “I am alive” , q=“I am breathing”, it can be represented as p ⇔ q.
F F T T T T
F T F T T T
T F T F T F
T T F T F F
?? Unsatisfiable
F F F T T T T T F
F F T T F T T F F
F T F F T T T F F
F T T F F T T F F
T F F T T F F T F
T F T T F F T F F
T T F F T T F F F
T T T F F T T F F
Inference and Derivation
inference rules allow the construction of new sentences from existing sentences
A sentence can be derived from or the sentence α entails the sentence β.
|- or
an inference procedure generates new sentences on the basis of inference rules
if all the new sentences are entailed, the inference procedure is called sound or
truth-preserving
Logical equivalence
To manipulate logical sentences, we need some rewrite rules.
Two sentences are logically equivalent (≡) if only if they are true in same models: α ≡ ß
Inference Rules
Modus Ponens
from an implication and its premise one can infer the conclusion
For example:
Modus Tollens
P Q,
Q
P
Inference Rules
double-negation elimination
a double negations infers the positive sentence P
P
And-elimination
from a conjunct, one can infer any of the conjuncts
Proof by Truth table:
PQ PQ
Or
P Q
Or-introduction
from a sentence, one can infer its disjunction with P
anything else
PQ
Wumpus world- Sample
Let Pi,j be true if there is a pit in [i, j]. Knowledge Base
Let Bi,j be true if the agent perceives a breeze in [i, j].
How to prove ¬P ? ? ?
1,2
2 ??
OK
S1: B1,1 (P1,2 P2,1)
S2: B2,1 (P1,1 P2,2 P3,1) ?
1
S3: P1,1 A ??
OK
S4: B1,1
S5: S1,1 1 2 3
S6: W
1,1 …..
We apply biconditional elimination to S1 to obtain S7 : (B1,1 ⇒ (P1,2 ∨ P2,1)) ∧ ((P1,2 ∨ P2,1) ⇒ B1,1) .
Now we can apply Modus Ponens with S9 and S4 ( B1,1), to obtain S10 : ¬(P1,2 ∨ P2,1)
Finally, we apply De Morgan’s rule, giving the conclusion S11 : ¬P 1,2 ∧ ¬P2,1
That is, neither [1,2] nor [2,1] contains a pit.
Wumpus world- Sample Knowledge Base
? ? ?
How to prove that there is no a S1: B1,1 (P1,2 P2,1)
3
pit in [2,2] ( P2,2)? S2: B2,1 (P1,1 P2,2 P3,1)
S3: B1,2 (P1,1 P2,2 P1,3) OK ? ?
2 A
S4: P1,1
2
S5: B1,1
Breeze ?
S6: S1,1 KB 1 A 1
OK
AA
S7: W1,1
S8: ¬P1,2 1 2 3
S9:
S10:¬PB2,1
1,2
S11: ¬ B2,1