Knowledge and reasoning – second part
description
Transcript of Knowledge and reasoning – second part
![Page 1: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/1.jpg)
SE 420 1
Knowledge and reasoning – second part
• Knowledge representation• Logic and representation• Propositional (Boolean) logic• Normal forms• Inference in propositional logic• Wumpus world example
![Page 2: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/2.jpg)
SE 420 2
Knowledge-Based Agent
• Agent that uses prior or acquired knowledge to achieve its goals• Can make more efficient decisions• Can make informed decisions
• Knowledge Base (KB): contains a set of representations of facts about the Agent’s environment
• Each representation is called a sentence
• Use some knowledge representation language, to TELL it what to know e.g., (temperature 72F)
• ASK agent to query what to do• Agent can use inference to deduce
new facts from TELLed facts
Knowledge Base
Inference engine
Domain independent algorithms
Domain specific content
TELL
ASK
![Page 3: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/3.jpg)
SE 420 3
Generic knowledge-based agent
1. TELL KB what was perceivedUses a KRL to insert new sentences, representations of facts, into KB
2. ASK KB what to do.Uses logical reasoning to examine actions and select best.
![Page 4: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/4.jpg)
SE 420 4
Wumpus world example
![Page 5: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/5.jpg)
SE 420 5
Wumpus world characterization
• Deterministic?
• Accessible?
• Static?
• Discrete?
• Episodic?
![Page 6: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/6.jpg)
SE 420 6
Wumpus world characterization
• Deterministic? Yes – outcome exactly specified.
• Accessible? No – only local perception.
• Static? Yes – Wumpus and pits do not move.
• Discrete? Yes
• Episodic? (Yes) – because static.
![Page 7: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/7.jpg)
SE 420 7
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 8: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/8.jpg)
SE 420 8
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 9: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/9.jpg)
SE 420 9
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 10: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/10.jpg)
SE 420 10
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 11: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/11.jpg)
SE 420 11
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 12: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/12.jpg)
SE 420 12
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 13: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/13.jpg)
SE 420 13
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 14: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/14.jpg)
SE 420 14
Exploring a Wumpus world
A= AgentB= BreezeS= SmellP= PitW= WumpusOK = SafeV = VisitedG = Glitter
![Page 15: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/15.jpg)
SE 420 15
Other tight spots
![Page 16: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/16.jpg)
SE 420 16
Another example solution
No perception 1,2 and 2,1 OK
Move to 2,1
B in 2,1 2,2 or 3,1 P?
1,1 V no P in 1,1
Move to 1,2 (only option)
![Page 17: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/17.jpg)
SE 420 17
Example solution
S and No S when in 2,1 1,3 or 1,2 has W
1,2 OK 1,3 W
No B in 1,2 2,2 OK & 3,1 P
![Page 18: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/18.jpg)
SE 420 18
Logic in general
![Page 19: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/19.jpg)
SE 420 19
Types of logic
![Page 20: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/20.jpg)
SE 420 20
The Semantic Wall
Physical Symbol System World
+BLOCKA+
+BLOCKB+
+BLOCKC+
P1:(IS_ON +BLOCKA+ +BLOCKB+)P2:((IS_RED +BLOCKA+)
![Page 21: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/21.jpg)
SE 420 21
Truth depends on Interpretation
Representation 1 World
A
BON(A,B) TON(A,B) F
ON(A,B) F A
ON(A,B) T B
![Page 22: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/22.jpg)
SE 420 22
Entailment
Entailment is different than inference
![Page 23: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/23.jpg)
SE 420 23
Logic as a representation of the World
FactsWorld Factfollows
Refers to (Semantics)
Representation: Sentences Sentenceentails
![Page 24: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/24.jpg)
SE 420 24
Models
![Page 25: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/25.jpg)
SE 420 25
Inference
![Page 26: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/26.jpg)
SE 420 26
Basic symbols
• Expressions only evaluate to either “true” or “false.”
• P “P is true”• ¬P “P is false” negation• P V Q “either P is true or Q is true or both” disjunction• P ^ Q “both P and Q are true” conjunction• P => Q “if P is true, the Q is true” implication• P Q “P and Q are either both true or both false”
equivalence
![Page 27: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/27.jpg)
SE 420 27
Propositional logic: syntax
![Page 28: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/28.jpg)
SE 420 28
Propositional logic: semantics
![Page 29: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/29.jpg)
SE 420 29
Truth tables
• Truth value: whether a statement is true or false.• Truth table: complete list of truth values for a statement
given all possible values of the individual atomic expressions.
Example:
P Q P V QT T TT F TF T TF F F
![Page 30: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/30.jpg)
SE 420 30
Truth tables for basic connectives
P Q ¬P ¬Q P V Q P ^ Q P=>Q PQ
T T F F T T T TT F F T T F F FF T T F T F T FF F T T F F T T
![Page 31: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/31.jpg)
SE 420 31
Propositional logic: basic manipulation rules
• ¬(¬A) = A Double negation
• ¬(A ^ B) = (¬A) V (¬B) Negated “and”• ¬(A V B) = (¬A) ^ (¬B) Negated “or”
• A ^ (B V C) = (A ^ B) V (A ^ C) Distributivity of ^ on V• A => B = (¬A) V B by definition• ¬(A => B) = A ^ (¬B) using negated or• A B = (A => B) ^ (B => A) by definition• ¬(A B) = (A ^ (¬B))V(B ^ (¬A)) using negated and & or• …
![Page 32: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/32.jpg)
SE 420 32
Propositional inference: enumeration method
![Page 33: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/33.jpg)
SE 420 33
Enumeration: Solution
![Page 34: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/34.jpg)
SE 420 34
Propositional inference: normal forms
“sum of products of simple variables ornegated simple variables”
“product of sums of simple variables ornegated simple variables”
![Page 35: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/35.jpg)
SE 420 35
Deriving expressions from functions
• Given a boolean function in truth table form, find a propositional logic expression for it that uses only V, ^ and ¬.
• Idea: We can easily do it by disjoining the “T” rows of the truth table.
Example: XOR function
P Q RESULTT T FT F T P ^ (¬Q)F T T (¬P) ^ QF F F
RESULT = (P ^ (¬Q)) V ((¬P) ^ Q)
![Page 36: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/36.jpg)
SE 420 36
A more formal approach
• To construct a logical expression in disjunctive normal form from a truth table:
- Build a “minterm” for each row of the table, where:
- For each variable whose value is T in that row, include
the variable in the minterm
- For each variable whose value is F in that row, include
the negation of the variable in the minterm
- Link variables in minterm by conjunctions
- The expression consists of the disjunction of all minterms.
![Page 37: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/37.jpg)
SE 420 37
Example: adder with carry
Takes 3 variables in: x, y and ci (carry-in); yields 2 results: sum (s) and carry-out (co). To get you used to other notations, here we assume T = 1, F = 0, V = OR, ^ = AND, ¬ = NOT.
co is:
s is:
![Page 38: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/38.jpg)
SE 420 38
Tautologies
• Logical expressions that are always true. Can be simplified out.
Examples:
TT V AA V (¬A)¬(A ^ (¬A))A A((P V Q) P) V (¬P ^ Q)(P Q) => (P => Q)
![Page 39: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/39.jpg)
SE 420 39
Validity and satisfiability
Theorem
![Page 40: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/40.jpg)
SE 420 40
Proof methods
![Page 41: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/41.jpg)
SE 420 41
Inference Rules
![Page 42: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/42.jpg)
SE 420 42
Inference Rules
![Page 43: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/43.jpg)
Resolution
Conjunctive Normal Form (CNF) conjunction of disjunctions of literals clauses
E.g., (A B) (B C D)• Resolution inference rule (for CNF):
li … lk, m1 … mn
li … li-1 li+1 … lk m1 … mj-1 mj+1 ... mn
where li and mj are complementary literals.
E.g., P1,3 P2,2, P2,2
P1,3
• Resolution is sound and complete for propositional logic
![Page 44: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/44.jpg)
Conversion to CNF
B1,1 (P1,2 P2,1)
1) Eliminate , replacing α β with (α β)(β α).(B1,1 (P1,2 P2,1)) ((P1,2 P2,1) B1,1)
2) Eliminate , replacing α β with α β.(B1,1 P1,2 P2,1) ((P1,2 P2,1) B1,1)
3) Move inwards using de Morgan's rules and double-negation:
(B1,1 P1,2 P2,1) ((P1,2 P2,1) B1,1)
4) Apply distributivity law ( over ) and flatten:(B1,1 P1,2 P2,1) (P1,2 B1,1) (P2,1 B1,1)
![Page 45: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/45.jpg)
Resolution algorithm
• Proof by contradiction, i.e., show KBα unsatisfiable
![Page 46: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/46.jpg)
Resolution example
• KB = (B1,1 (P1,2 P2,1)) B1,1 α = P1,2
•
![Page 47: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/47.jpg)
Forward and backward chaining
• Horn Form (restricted)KB = conjunction of Horn clauses
• Horn clause = • proposition symbol; or• (conjunction of symbols) symbol
• E.g., C (B A) (C D B)• Modus Ponens (for Horn Form): complete for Horn KBs
α1, … ,αn α1 … αn ββ
• Can be used with forward chaining or backward chaining.• These algorithms are very natural and run in linear time•
•
•
![Page 48: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/48.jpg)
Forward chaining
• Idea: fire any rule whose premises are satisfied in the KB,• add its conclusion to the KB, until query is found
![Page 49: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/49.jpg)
Forward chaining algorithm
• Forward chaining is sound and complete for Horn KB
![Page 50: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/50.jpg)
Forward chaining example
![Page 51: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/51.jpg)
Forward chaining example
![Page 52: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/52.jpg)
Forward chaining example
![Page 53: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/53.jpg)
Forward chaining example
![Page 54: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/54.jpg)
Forward chaining example
![Page 55: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/55.jpg)
Forward chaining example
![Page 56: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/56.jpg)
Forward chaining example
![Page 57: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/57.jpg)
Forward chaining example
![Page 58: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/58.jpg)
Proof of completeness
• FC derives every atomic sentence that is entailed by KB
1. FC reaches a fixed point where no new atomic sentences are derived
2. Consider the final state as a model m, assigning true/false to symbols
3. Every clause in the original KB is true in m a1 … ak b
4. Hence m is a model of KB5. If KB╞ q, q is true in every model of KB,
including m•
![Page 59: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/59.jpg)
Backward chaining
Idea: work backwards from the query q:check if q is known already, orprove by BC all premises of some rule concluding q
Avoid loops: check if new subgoal is already on the goal stack
Avoid repeated work: check if new subgoal1. has already been proved true, or2. has already failed
•
• to prove q by BC,
![Page 60: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/60.jpg)
Backward chaining example
![Page 61: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/61.jpg)
Backward chaining example
![Page 62: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/62.jpg)
Backward chaining example
![Page 63: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/63.jpg)
Backward chaining example
![Page 64: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/64.jpg)
Backward chaining example
![Page 65: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/65.jpg)
Backward chaining example
![Page 66: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/66.jpg)
Backward chaining example
![Page 67: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/67.jpg)
Backward chaining example
![Page 68: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/68.jpg)
Backward chaining example
![Page 69: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/69.jpg)
Backward chaining example
![Page 70: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/70.jpg)
Forward vs. backward chaining
• FC is data-driven, automatic, unconscious processing,• e.g., object recognition, routine decisions
• May do lots of work that is irrelevant to the goal
• BC is goal-driven, appropriate for problem-solving,• e.g., Where are my keys? How do I get into a PhD
program?
• Complexity of BC can be much less than linear in size of KB
-
![Page 71: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/71.jpg)
Efficient propositional inference
Two families of efficient algorithms for propositional inference:
Complete backtracking search algorithms• DPLL algorithm (Davis, Putnam, Logemann,
Loveland)
• Incomplete local search algorithms• WalkSAT algorithm
•
![Page 72: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/72.jpg)
The DPLL algorithm
Determine if an propositional logic sentence (in CNF) is satisfiable.
Improvements over truth table enumeration:1. Early termination
A clause is true if any literal is true.A sentence is false if any clause is false.
2. Pure symbol heuristicPure symbol: always appears with the same "sign" in all clauses. e.g., In the three clauses (A B), (B C), (C A), A and B are pure,
C is impure. Make a pure symbol literal true.
3. Unit clause heuristicUnit clause: only one literal in the clauseThe only literal in a unit clause must be true.
•
![Page 73: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/73.jpg)
The DPLL algorithm
![Page 74: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/74.jpg)
The WalkSAT algorithm
• Incomplete, local search algorithm
• Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses
• Balance between greediness and randomness
![Page 75: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/75.jpg)
The WalkSAT algorithm
![Page 76: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/76.jpg)
Inference-based agents in the wumpus world
A wumpus-world agent using propositional logic:
P1,1
W1,1
Bx,y (Px,y+1 Px,y-1 Px+1,y Px-1,y)
Sx,y (Wx,y+1 Wx,y-1 Wx+1,y Wx-1,y)
W1,1 W1,2 … W4,4
W1,1 W1,2
W1,1 W1,3 …
64 distinct proposition symbols, 155 sentences•
•
![Page 77: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/77.jpg)
![Page 78: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/78.jpg)
SE 420 78
Wumpus world: example
• Facts: Percepts inject (TELL) facts into the KB• [stench at 1,1 and 2,1] S1,1 ; S2,1
• Rules: if square has no stench then neither the square or adjacent square contain the wumpus• R1: !S1,1 !W1,1 !W1,2 !W2,1
• R2: !S2,1 !W1,1 !W2,1 !W2,2 !W3,1
• …
• Inference: • KB contains !S1,1 then using Modus Ponens we infer
!W1,1 !W1,2 !W2,1
• Using And-Elimination we get: !W1,1 !W1,2 !W2,1• …
![Page 79: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/79.jpg)
SE 420 79
Limitations of Propositional Logic
1. It is too weak, i.e., has very limited expressiveness:
• Each rule has to be represented for each situation:e.g., “don’t go forward if the wumpus is in front of you” takes 64 rules
2. It cannot keep track of changes:• If one needs to track changes, e.g., where the agent has
been before then we need a timed-version of each rule. To track 100 steps we’ll then need 6400 rules for the previous example.
Its hard to write and maintain such a huge rule-base
Inference becomes intractable
![Page 80: Knowledge and reasoning – second part](https://reader036.fdocuments.in/reader036/viewer/2022081519/5681484b550346895db55fcb/html5/thumbnails/80.jpg)
SE 420 80
Summary