07 Knowledge Based Agents and Propositional Logic
07 Knowledge Based Agents and Propositional Logic
Alfredo Milani
Knowledge-Based Agents
• KB = knowledge base
– A set of sentences or facts
– e.g., a set of statements in a logic language
• Inference
– Deriving new sentences from old
– e.g., using a set of logical statements to infer new ones
• Sensors:
– Stench next to wumpus
– Breeze next to pit
– Glitter in square with gold
– Bump when agent moves into a wall
– Scream from wumpus when killed
[2,1] = breeze
• A formal language
– KB = set of sentences
• Syntax
– what sentences are legal (well-formed)
– E.g., arithmetic
• X+2 >= y is a wf sentence, +x2y is not a wf sentence
• Semantics
– loose meaning: the interpretation of each sentence
– More precisely:
• Defines the truth of each sentence wrt to each possible world
– e.g,
• X+2 = y is true in a world where x=7 and y =9
• X+2 = y is false in a world where x=7 and y =1
• Example:
– x + y = 4, where x = #men, y = #women
– Possible models = all possible assignments of integers to x and y
• Comments:
– Model-checking enumerates all possible worlds
• Only works on finite domains, will suffer from exponential
growth of possible models
α2 = "[2,2] is safe", KB ╞ α2
• Complex sentences:
Model checking
Searching through truth assignments.
• Improved backtracking: Davis--Putnam-Logemann-Loveland (DPLL)
• Heuristic search in model space: Walksat.
We want to prove: KB |
equivalent to : KB unsatifiable
literals
A “conjunction of disjunctions”
(A B) (B C D)
Clause Clause
(A B C )
( A ) “If A or B or C is true, but not A, then B or C
must be true.”
(B C )
(A B )
( A B )
Simplification
(B B ) B
KB
True
False in
all worlds
• If we can reduce all clauses to “Horn clauses” resolution is linear in space and time
• Idea: fire any rule whose premises are satisfied in the KB,
– add its conclusion to the KB, until query is found
AND gate
OR gate
“OR” Gate
“AND” gate
Like FC, is linear and is also sound and complete (for Horn KB)
we need P to prove
L and L to prove P.
– Underconstrained problems:
• Relatively few clauses constraining the variables
• Tend to be easy
• 16 of 32 possible assignments above are solutions
– (so 2 random guesses will work on average)
– Investigate experimentally….