Professional Documents
Culture Documents
Logical agents
Outline
Contents
I
Logical agents
Knowledge-based agents
Knowledge-based agents
What is an agent?
Entailment
Entailment means that one sentence () follows from other sentences (KB) and is denoted:
KB
We say that the Knowledge Base KB entails if and only if is true in all worlds where KB is true. Entailment is a
relationship between sentences (i.e. syntax) that is based on semantics.
Example 4. Knowledge Base = { The car is blue The bicycle is green or yellow }
KB entails sentences like:
The car is blue
true
The car is blue or the bicycle is yellow
The sentence The car is blue and the bicycle is yellow is not entailed by KB.
Possible models of KB
Example 6.
(car,blue)
(bicycle,blue)
(car,blue)
(bicycle,blue)
(car, yellow)
(bicycle,yellow)
(car, yellow)
(bicycle,yellow)
(car,green)
(bicycle, green)
(car,green)
(bicycle, green)
not a model of KB
Inference
Definition 7. Inference: A sentence can be inferred from another sentence by some inference algorithm
i. This is denoted:
`i
Definition 8. Soundness: An inference algorithm is sound if it produces entailed sentences
Definition 9. Completeness: An inference algorithm is complete if it can derive all the sentences which it
entails.
Well-known logics
1. Propositional logic
2. First-order logic
3. Default logic
4. Circumscription
5. Temporal logic
6. Modal logic
7. ..
Every logic has its Pros and Cons (expressivity, soundness and completeness of inference algorithm)
Logical equivalence
Definition 14. Two sentences , are logically equivalent IF AND ONLY IF they are true in the same models. entails and
vice-versa.
( )
( )
(( ) )
(( ) )
()
( )
( )
( )
( )
( )
( ( ))
( ( ))
( ) commutativity of
( ) commutativity of
( ( )) associativity of
( ( )) associativity of
double-negation elimination
( ) contraposition
( ) implication elimination
(( ) ( )) biconditional elimination
( ) De Morgan
( ) De Morgan
(( ) ( )) distributivity of over
(( ) ( )) distributivity of over
Factoring:
ab
a
aa
a
Logical equivalences:
a b
(a b)
ab
abba
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
Q
R1
P
R2
R4
R3
L
R5
A R6
B R7
Q
R1
P
R2
R4
R3
L
R5
A R6
B R7
10
Q
R1
P
R2
R4
R3
L
R5
A R6
B R7
Q
R1
P
R2
R4
R3
L
R5
A R6
B R7
Q
R1
P
R2
R4
M
R3
R5
A R6
B R7
`1 `i `k ,
v w x, w x y z
v x y z
Resolution inference rule (2): CNF
The rule is applied on sentences like (`1 `k ) (`m `n ) where `i are positive/negative
literals.
This form is called Conjunctive Normal Form (CNF for short).
Every sentence in proposition logic is logically equivalent to a CNF sentence.
Example 24. (a b) (c d) is logically equivalent to the CNF (a c) (a d) (b c) (b
d) (c d a b).
Conversion to a CNF
1. Eliminate , replacing with ( ) ( ).
2. Eliminate , replacing with .
3. Move inwards using de Morgans rules {(a b) (a b), (a b) (a b)} and double
negation rule (a a)
4. Apply distributivity law ( over ) and flatten (a b) c (a c) (b c)
13
Resolution algorithm
Definition 25. Proof by contradiction: given KB, to prove , we prove that KB is not satisfiable.
Example 26. Symbols:
U nd: The students have understood this lecture
Gt: I am a good teacher
P arty: The students went to a party last night
Knowledge base:
KB = (U nd (Gt P arty)) U nd
Query to prove: I am a good teacher
= Gt
Resolution algorithm
Example 27. Conversion to CNF: KB (KB )CN F
(KB )CN F =(P arty U nd)
(Gt U nd P arty)
(U nd Gt)
U nd Gt
Example 28.
Party
Und
Gt
Und
Party
Und
Gt
Und
Gt
Resolution algorithm
Party
Und
Gt
Und
Party
Und
Gt
Und
Gt
Example 29.
Resolution algorithm
Party
Example 30.
Und
Und
Gt
Gt
Und
Und
14
Party
Und
Gt
Und
Gt
Resolution algorithm
Party
Und
Und
Example 31.
Gt
Gt
Und
Und
Party
Und
Gt
Und
Gt
Und
Gt
Und
Gt
Party
Resolution algorithm
Party
Und
Und
Example 32.
Gt
Gt
Und
Und
Party
Gt
Party
Resolution algorithm
Party
Example 33.
Party
Und
Gt
Und
Gt
Gt
Und
Und
Und
Party
Party
Resolution algorithm
15
Und
Gt
Und
Gt
Gt
Party
Example 34.
Party
Und
Gt
Und
Gt
Gt
Und
Und
Und
Party
Und
Gt
Und
Und
Party
Gt
Und
Gt
Gt
Party
Und
Und
Resolution algorithm
Party
Party
Und
Gt
Und
Gt
Gt
Und
Und
Party
Und
Und
Und
Gt
Gt
STOP
Empty clause
I am a good teacher
Example 35.
Summary
Logical agents apply inference to a knowledge base to derive new information and make decisions
Basic concepts of logic:
syntax: formal structure of sentences
semantics: truth of sentences wrt models
entailment: necessary truth of one sentence given another
inference: deriving sentences from other sentences
soundess: derivations produce only entailed sentences
completeness: derivations can produce all entailed sentences
Forward, backward chaining are linear-time, complete for Horn clauses Resolution is complete for
propositional logic
Propositional logic lacks expressive power
16