70 likes | 260 Views
Ch. 8 – First Order Logic. Supplemental slides for CSE 327 Prof. Jeff Heflin. Syntax of First-Order Logic. Sentence AtomicSentence | ComplexSentence AtomicSentence Predicate(Term,…) | Term = Term ComplexSentence ( Sentence ) | Sentence
E N D
Ch. 8 – First Order Logic Supplemental slides for CSE 327 Prof. Jeff Heflin
Syntax of First-Order Logic Sentence AtomicSentence | ComplexSentence AtomicSentence Predicate(Term,…) | Term = Term ComplexSentence (Sentence) | Sentence | Sentence Sentence | Sentence Sentence | Sentence Sentence | Sentence Sentence | Quantifier Variable,… Sentence Term Function(Term,…) | Constant | Variable Quantifier | From Figure 8.3, p. 293
Knowledge-Based Agent function KB-Agent(percept) returns an actionpersistent: KB, a knowledge baset, a counter, initially 0 indicating time TELL(KB, Make-Percept-Sentence(percept, t)) action ASK(KB, Make-Action-Query(t)) TELL(KB, Make-Action-Sentence(action, t))t t + 1return action From Figure 7.1, p. 236
Minesweeper PEAS Description • Performance Measure • percentage of mines found • Environment • NxM grid with random placement of mines • Actuators • choose a square • Sensors • chosen square has x adjacent mines • or uncover mine and lose game
Minesweeper Predicates • Environment • Mine(s) • square s has a mine in it • Sensing • NearbyMines(s,k) • square s has k adjacent mines • Cleared(s) • square s is safe (didn’t uncover a mine)
Minesweeper Axioms • s Cleared(s) Mine(s) • s,r NearbyMines(s,0) Adjacent(s,r) Mine(r) • s NearbyMines(s,1) r Adjacent(s,r) Mine(r) (t Adjacent(s,t) Mine(t) r=t) • also need 6 other rules for 1<k<8 • s,r NearbyMines(s,8) Adjacent(s,r) Mine(r) • x,y,a,b Adjacent([x,y],[a,b]) (a=x+1 a=x a=x-1) (b=y b=y+1 b=y-1) (a=x a=y) Legal([x,y]) Legal([a,b]) • x,y Legal([x,y]) x > 0 y > 0 x N y M
Kinship Domain A1: x Male(x) Female(x) A2: w,h Husband(h,w) Male(h) Spouse(h,w) A3: x,y Spouse(x,y) Spouse(y,x) A4: p,c Parent(p,c) Child(c,p) A5: x,y Parent(x,y) Ancestor(x,y) A6: x,y,z Ancestor(x,y) Parent(y,z) Ancestor(x,z) A7: x,y Sibling(x,y) xyp Parent(p,x) Parent(p,y)