Russell and Norvig, Chapter 7: First-Order Logic 7.1 Syntax and Semantics - constants - predicates - functions (not evaluated) - terms: refer to objects (constants or functions) - atomic sentences - complex sentences: atomics plus connectives - quantifiers - universal - existential - equality 7.2 Extensions and Notational Variations - higher-order logic - lambda operator - uniqueness quantifier - uniqueness operator - notational variations 7.3 Using First-Order Logic - kinship domain - axioms, definitions and theorems - set domain - special notation for sets, lists and arithmetic - asking questions and getting answers (Prolog) 7.4 Logical Agents for the Wumpus World [Fig7.2 = Fig6.1] - Percept = (PerceptList,TimeStep) - Action = [Turn(Right), Turn(Left), Forward, Shoot, Grab, Release, Climb] - Turn is a function, Release is new - reflex, model-based, goal-based 7.5 A Simple Reflex Agent - percept([S,B,glitter,U,C],T) => action(grab,T) - OR: percept([S,B,glitter,U,C],T) => atgold(T) atgold(T) => action(grab,T) - no memory, does the same thing in the same situations - randomness may help (e.g., orientation) 7.6 Representing Change in the World - retract(agent_location(X,Y)), assert(agent_location(X1,Y1)) - but no recollection of route (okay for simulator, but not for agent) - situation calculus - at(agent,[1,1],s0) - result(Action,Situation1) = Situation2 - frame axiom - (holding(X,S) and (A != release)) => holding(X,result(A,S)) - successor-state axiom - holding(X,result(A,S)) <=> [(A = grab) and present(X,S) and portable(X)) V (holding(X,S) and (A != release))] - keeping track of location - at(Agent,Location,Situation) - orientation(Agent,Situation) - locationToward(Location,Orientation) = NewLocation - locationAhead(Agent,Situation) = AheadLocation - adjacent(Location1,Location2) - wall(Location) - agent location changes upon moving forward into a non-wall - agent orientation changes upon turning left or right - agent no longer has arrow after shoot - hasarrow(Agent,result(Action,Situation)) <=> hasarrow(Agent,Situation) ^ Action != shoot - gold location, wumpus location and health - wumpus dead if agent has arrow and shoots in direction of wumpus - dead(wumpus,result(Action,S)) <=> Action = shoot ^ hasarrow(agent,S) ^ at(agent,[X,Y],S) ^ orientation(agent,S) = 0 ^ at(wumpus,[X1,Y1],S) ^ Y = Y1 ^ X < X1 - three other disjuncts for other orientations - why would agent shoot? - need a goal 7.7 Deducing Hidden Properties of the World - causal rules (model-based) - at(wumpus,L1,S) ^ adjacent(L1,L2) => smelly(L2) - at(pit,L1,S) ^ adjacent(L1,L2) => breezy(L2) - ~at(wumpus,L,S) ^ ~at(pit,L,S) <=> ok(L) - diagnostic rules - at(agent,L,S) ^ stench(S) => smelly(L) - at(agent,L,S) ^ breeze(S) => breezy(L) - percept([none,none,G,U,C],T) ^ at(agent,L1,S) ^ adjacent(L1,L2) => ok(L2) - compare to above causal rule - causal rules infer strongest conclusions 7.8 Preferences Among Actions - action-value system - great, good, medium and risky actions - great(A,S) => action(A,S) - good(A,S) ^ ~E(A2) great(A2,S) => action(A,S) - great(A,S) <=> (A = grab ^ atgold(S)) V (A = climb ^ at(agent,[1,1],S) ^ holding(gold,S)) 7.9 Toward a Goal-Based Agent - above preferences will get the gold safely (if possible), but then what - holding(gold,S) => goalLocation([1,1],S) - kill the wumpus - achieve via - inference (inefficient for long paths) - search - planning