Download presentation
Presentation is loading. Please wait.
1
Artificial Intelligence: Logic agents
2
AI in the News April 6, 2005: GIDEON - Global Infectious Disease and Epidemiology Network. Media review by Vincent J. Felitti. JAMA, the Journal of the American Medical Association ( Vol. 293, No. 13, pages ; subscription req'd.). "GIDEON: The Global Infectious Disease and Epidemiology Network is a superbly designed expert system created to help physicians diagnose any infectious disease (337 recognized) in any country of the world (224 included). The program was created and has been progressively refined over more than a decade by a talented group of Americans, Canadians, and Israelis ============================================= December 13, 2004: WebMed dispenses advice to students. By Robyn Shelton. Orlando Sentinel. "The site -- 24/7 WebMed -- takes students through questions, judges the severity of their symptoms and offers guidance for what to do next. ... 'It's decision-support systems, or artificial intelligence in a way,' said Dr. Scott Gettings, DSHI medical director. 'The system learns about you as you flow through and answer questions and determines how ill you are.' It makes no attempt to go further and diagnose the patient's illness -- but gauges the seriousness of the symptoms. 'This is not intended to take the place of human interaction, but to augment it,' said Dr. Michael Deichen, associate director of clinical services at the UCF Student Health Center. 'It really just helps the students know with what urgency they should be evaluated.'" 28 November 2018
3
“Thinking Rationally”
Computational models of human “thought” processes Computational models of human behavior Computational systems that “think” rationally Computational systems that behave rationally 28 November 2018
4
Logical Agents Reflex agents find their way from Arad to Bucharest by dumb luck Chess program calculates legal moves of its king, but doesn’t know that a piece cannot be on 2 different squares at the same time Logic (Knowledge-Based) agents combine general knowledge with current percepts to infer hidden aspects of current state prior to selecting actions Crucial in partially observable environments 28 November 2018
5
Outline Knowledge-based agents Wumpus world Logic in general
Propositional and first-order logic Inference, validity, equivalence and satifiability Reasoning patterns Resolution Forward/backward chaining 28 November 2018
6
Knowledge Base Knowledge Base : set of sentences represented in a knowledge representation language and represents assertions about the world. Inference rule: when one ASKs questions of the KB, the answer should follow from what has been TELLed to the KB previously. tell ask 28 November 2018
7
Generic KB-Based Agent
28 November 2018
8
Abilities KB agent Agent must be able to:
Represent states and actions, Incorporate new percepts Update internal representation of the world Deduce hidden properties of the world Deduce appropriate actions 28 November 2018
9
A Typical Wumpus World Wumpus 28 November 2018
10
Wumpus World PEAS Description
28 November 2018
11
Wumpus World Characterization
Observable? Deterministic? Episodic? Static? Discrete? Single-agent? 28 November 2018
12
Wumpus World Characterization
Observable? No, only local perception Deterministic? Yes, outcome exactly specified Episodic? No, sequential at the level of actions Static? Yes, Wumpus and pits do not move Discrete? Yes Single-agent? Yes, Wumpus is essentially a natural feature. 28 November 2018
13
Exploring the Wumpus World
[1,1] The KB initially contains the rules of the environment. The first percept is [none, none,none,none,none], move to safe cell e.g. 2,1 [2,1] breeze which indicates that there is a pit in [2,2] or [3,1], return to [1,1] to try next safe cell 28 November 2018
14
Exploring the Wumpus World
[1,2] Stench in cell which means that wumpus is in [1,3] or [2,2] YET … not in [1,1] YET … not in [2,2] or stench would have been detected in [2,1] THUS … wumpus is in [1,3] THUS [2,2] is safe because of lack of breeze in [1,2] THUS pit in [1,3] move to next safe cell [2,2] 28 November 2018
15
Exploring the Wumpus World
[2,2] move to [2,3] [2,3] detect glitter , smell, breeze THUS pick up gold THUS pit in [3,3] or [2,4] 28 November 2018
16
What is a logic? A formal language
Syntax – what expressions are legal (well-formed) Semantics – what legal expressions mean in logic the truth of each sentence with respect to each possible world. E.g the language of arithmetic X+2 >= y is a sentence, x2+y is not a sentence X+2 >= y is true in a world where x=7 and y =1 X+2 >= y is false in a world where x=0 and y =6 28 November 2018
17
Entailment One thing follows from another KB |=
KB entails sentence if and only if is true in worlds where KB is true. E.g. x+y=4 entails 4=x+y Entailment is a relationship between sentences that is based on semantics. 28 November 2018
18
Models Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated. m is a model of a sentence if is true in m M() is the set of all models of 28 November 2018
19
Wumpus world model 28 November 2018
20
Wumpus world model 28 November 2018
21
Wumpus world model 28 November 2018
22
Wumpus world model 28 November 2018
23
Wumpus world model 28 November 2018
24
Wumpus world model 28 November 2018
25
Logical inference The notion of entailment can be used for logic inference. Model checking (see wumpus example): enumerate all possible models and check whether is true. If an algorithm only derives entailed sentences it is called sound or truth preserving. Otherwise it just makes things up. i is sound if whenever KB |-i it is also true that KB|= Completeness : the algorithm can derive any sentence that is entailed. i is complete if whenever KB |= it is also true that KB|-i 28 November 2018
26
Schematic perspective
If KB is true in the real world, then any sentence derived From KB by a sound inference procedure is also true in the real world. 28 November 2018
27
Inference KB |-i a Soundness: Inference procedure i is sound if whenever KB |-i a, it is also true that KB |= a Completeness: Inference procedure i is complete if whenever KB |= a, it is also true that KB |-i a 28 November 2018
28
Validity and Inference
((P V H) ^ ØH) => P P H P V H (P H) Ø V ^ H ((P V H) ^ ØH) => P T T T F T T F T T T F T T F T F F F F T 28 November 2018
29
Rules of Inference a |- b a b Valid Rules of Inference: Modus Ponens
And-Elimination And-Introduction Or-Introduction Double Negation Unit Resolution Resolution 28 November 2018
30
Examples in Wumpus World
Modus Ponens: a => b, a |- b (WumpusAhead ^ WumpusAlive) => Shoot, (WumpusAhead ^ WumpusAlive) |- Shoot And-Elimination: a ^ b |- a (WumpusAhead ^ WumpusAlive) |- WumpusAlive Resolution: a V b, Øb V g |- a V g (WumpusDead V WumpusAhead), (ØWumpusAhead V Shoot) ` (WumpusDead V Shoot) a => b a b a ^ b a a V b Øb V g a V g 28 November 2018
31
Proof Using Rules of Inference
Prove A => B, (A ^ B) => C, Therefore A => C A => B |- ØA V B A ^ B => C |- Ø(A ^ B) V C |- ØA V ØB V C So ØA V B resolves with ØA V ØB V C deriving ØA V C This is equivalent to A => C 28 November 2018
32
Rules of Inference (continued)
And-Introduction a1, a2, …, an a1 ^ a2 ^ … ^ an Or-Introduction ai a1 V a2 V …ai … V an Double Negation ØØa a Unit Resolution (special case of resolution) a V b Alternatively: Øa => b Øb Øb a a 28 November 2018
33
Wumpus World KB Proposition Symbols for each i,j:
Let Pi,j be true if there is a pit in square i,j Let Bi,j be true if there is a breeze in square i,j Sentences in KB “There is no pit in square 1,1” R1: ØP1,1 “A square is breezy iff pit in a neighboring square” R2: B1,1 (P1,2 V P2,1) R3: B1,2 (P1,1 V P1,3 V P2,2) “Square 1,1 has no breeze”, “Square 1,2 has a breeze” R4: ØB1,1 R5: B1,2 28 November 2018
34
Inference in Wumpus World
Apply biconditional elimination to R2: R6: (B1,1 => (P1,2 V P2,1)) ^ ((P1,2 V P2,1) => B1,1) Apply AE to R6: R7: ((P1,2 V P2,1) => B1,1) Contrapositive of R7: R8: (ØB1,1 => Ø(P1,2 V P2,1)) Modus Ponens with R8 and R4 (ØB1,1): R9: Ø(P1,2 V P2,1) de Morgan: R10: ØP1,2 ^ ØP2,1 28 November 2018
35
Searching for Proofs Finding proofs is exactly like finding solutions to search problems. Can search forward (forward chaining) to derive goal or search backward (backward chaining) from the goal. Searching for proofs is not more efficient than enumerating models, but in many practical cases, it’s more efficient because we can ignore irrelevant propositions 28 November 2018
36
Full Resolution Rule Revisited
Start with Unit Resolution Inference Rule: Full Resolution Rule is a generalization of this rule: For clauses of length two: 28 November 2018
37
Resolution Applied to Wumpus World
At some point we determine the absence of a pit in square 2,2: R13: ØP2,2 Biconditional elimination applied to R3 followed by modus ponens with R5: R15: P1,1 V P1,3 V P2,2 Resolve R15 and R13: R16: P1,1 V P1,3 Resolve R16 and R1: R17: P1,3 28 November 2018
38
Resolution: Complete Inference Procedure
Any complete search algorithm, applying only the resolution rule, can derive any conclusion entailed by any knowledge base in propositional logic. Refutation completeness: Resolution can always be used to either confirm or refute a sentence, but it cannot be used to enumerate true sentences. 28 November 2018
39
Conjunctive Normal Form
Conjunctive Normal Form is a disjunction of literals. Example: (A V B V ØC) ^ (B V D) ^ (Ø A) ^ (BVC) literals clause 28 November 2018
40
CNF Example Example: (A V B) (C => D) Eliminate Eliminate =>
((A V B) => (C => D)) ^ ((C => D) => (A V B) Eliminate => (Ø (A V B) V (ØC V D)) ^ (Ø(ØC V D) V (A V B) ) Drive in negations ((ØA ^ ØB) V (ØC V D)) ^ ((C ^ ØD) V (A V B)) Distribute (ØA V ØC V D) ^ (ØB V ØC V D) ^ (C V A V B) ^ (ØD V A V B) 28 November 2018
41
Resolution Algorithm To show KB |= a, we show (KB ^ Øa) is unsatisfiable. This is a proof by contradiction. First convert (KB ^ Øa) into CNF. Then apply resolution rule to resulting clauses. The process continues until: there are no new clauses that can be added (KB does not entail a) two clauses resolve to yield empty clause (KB entails a) 28 November 2018
42
Simple Inference in Wumpus World
KB = R2 ^ R4 = (B1,1 (P1,2 V P2,1)) ^ ØB1,1 Prove ØP1,2 by adding the negation P1,2 Convert KB ^ P1,2 to CNF PL-RESOLUTION algorithm 28 November 2018
43
Horn Clauses Real World KB’s are often a conjunction of Horn clauses
proposition symbol; or (conjunction of symbols) => symbol Examples: C (B => A) (C ^ D => B) 28 November 2018
44
Forward Chaining Fire any rule whose premises are satisfied in the KB.
Add its conclusion to the KB until query is found. 28 November 2018
45
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
46
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
47
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
48
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
49
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
50
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
51
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
52
Forward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
53
Backward Chaining Motivation: Need goal-directed reasoning in order to keep from getting overwhelmed with irrelevant consequences Main idea: Work backwards from query q To prove q: Check if q is known already Prove by backward chaining all premises of some rule concluding q 28 November 2018
54
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
55
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
56
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
57
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
58
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
59
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
60
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
61
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
62
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
63
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
64
Backward Chaining Example
P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018
65
Forward Chaining vs. Backward Chaining
FC is data-driven—it may do lots of work irrelevant to the goal BC is goal-driven—appropriate for problem-solving 28 November 2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.