1 / 56

Intelligent Systems: logical agents

This lecture provides an overview of logical agents and their role in dealing with partial or imperfect information. It discusses the syntax, semantics, and algorithms necessary for reasoning and decision-making in logical agents. The exploration of the Wumpus World is used as a case study.

michaelsj
Download Presentation

Intelligent Systems: logical agents

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Notes adapted from lecture notes for CMSC 421 by B.J. Dorr, with slides from Tom Lenaerts Intelligent Systems: logical agents Lecturer:Stefan Schlobach 15 January 2018

  2. Part 1 LogicalagentsWhat’s a logic? IS: Logical Agents

  3. The general idea: Logic Generic method to deal with: Partial or imperfect information Implicit information Knowledge about environment and task IS: Logical Agents

  4. What do we need? Syntax to write statements about rules and knowledge of the game IS: Logical Agents

  5. What do we need? Semantics to formalise the meaning of these statements IS: Logical Agents

  6. What do we need? Algorithms to determine whether statements are true or not, according to the intended semantics. IS: Logical Agents

  7. Knowledge-based/Logical agents • Logical 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 IS: Logical Agents

  8. A Wumpus World Wumpus IS: Logical Agents

  9. Wumpus World PEAS Description IS: Logical Agents

  10. Wumpus World Characterization • Observable? No, only local perception • Deterministic? Yes, outcome exactly specified • Static? Yes, Wumpus and pits do not move • Discrete? Yes • Single-agent? Yes, Wumpus is essentially a natural feature. This is actually online search/exploratory search IS: Logical Agents

  11. 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 IS: Logical Agents

  12. 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] IS: Logical Agents

  13. 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] IS: Logical Agents

  14. Logical Agents (in games) • Wumpus (online/exploration game) • Base transitions on explicit statements (“safe state”, wumpus(3,3), breeze(1,2) • Card Game (multiplayer game, (im)perfect information) • Base exploration on explicit statements • Explicit definitions of redundancy • Explicit definitions of heuristics • Logics as languagestoexpressknowledge IS: Logical Agents

  15. Logic! Logic! Logic! I think you should be more explicit here in step 2 IS: Logical Agents

  16. What is a logic? • A formal language • Syntax • Which expressions are legal (well-formed) • Semantics • what legal expressions mean • the meaning of each sentence with respect to interpretations • Calculus: • how to determine meaning for legal expressions IS: Logical Agents

  17. An example: A simple language of arithmetic Syntax: • X+2 >= y is a sentence, x2+y is not a sentence Semantics: • X+2 >= y is true in a world where x=7 and y =1 • X+2< X+3 is true in all worlds • X+2 >= y is false in a world where x=0 and y =6 Calculus: • Rule based IS: Logical Agents

  18. Part 2 Propositional logic IS: Logical Agents

  19. Yet Another example: A logic for propositions A proposition is the “content of a sentence” • Syntax • Semantic • Calculus We will use PL later to represent facts about the Wumpus World (and reason over it) IS: Logical Agents

  20. Syntax IS: Logical Agents

  21. Propositional Logic: Syntax IS: Logical Agents

  22. Semantics IS: Logical Agents

  23. Models • Truth is a terribly difficult philosophical notion. • Models are formal interpretations of the world with respect to which truth can be evaluated. • m is a model of a sentence  if •  holds in m -> m adheres to the constraints of  • M() is the set of all models of  IS: Logical Agents

  24. Entailment • The KB entails  (KB |=  ) means that  follows from the information in KB • Formally: • KB entails  iff holds in all the worlds where KB is true. • Based on models we can unambiguously and formally define semantics for entailment IS: Logical Agents

  25. Wumpus world model IS: Logical Agents

  26. Wumpus world model IS: Logical Agents

  27. Wumpus world model IS: Logical Agents

  28. Entailment • The KB entails  (KB |=  ) means that  follows from the information in KB • Formally: • KB entails  iff holds in all the worlds where KB is true. • E.g. x+y=4 entails 4=x+y • Based on models we can unambiguously and formally define semantics for entailment IS: Logical Agents

  29. Wumpus world model IS: Logical Agents

  30. Wumpus world model IS: Logical Agents

  31. Semantic notions: Entailment, Validity and satisfiability • A sentence  is entailed by a KB K iffholds/is true in all models of KB • A sentence is valid if it is true in all models, • e.g., True, A A, A  A, (A  (A  B))  B • A sentence is satisfiable if it is true in some model • e.g., A  B, C • A sentence is unsatisfiable if it is true in no models • e.g., AA IS: Logical Agents

  32. Propositional Logic Meaning of operators is recursively defined: IS: Logical Agents

  33. Logical equivalence • Two sentences are logically equivalent iff true in same set of models or ß iff |=ßand ß |= . IS: Logical Agents

  34. Wumpus world knowledge base IS: Logical Agents

  35. Pros and cons of propositional logic  Propositional logic is declarative Propositional logic allows partial/disjunctive/negated information • (unlike most data structures and databases) • Propositional logic is compositional: - (meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2  Meaning in propositional logic is context-independent) • (unlike natural language, where meaning depends on context)  Propositional logic has very limited expressive power (unlike natural language) • E.g., cannot say "pits cause breezes in adjacent squares“ • except by writing one sentence for each square IS: Logical Agents

  36. Modelling Schnapsen TrumpWedding(x) <-> Q(x) & Trump(x) & exists y (samecolor(x,y) & K(y) & myCard(y))  samecolor(x,y) <-> (C(x)&C(y)) v (D(x)&D(y)) v (H(x)&H(y)) v (S(x)&S(y) A(0), A(5),A(10),A(15),Ten(1),Ten(6),...J(14),J(19) card-value C(0),C(1),...S(18),S(19) the color-value of the 20 cards. myCard(5),myCard(7),myCard(13),myCard(17),myCard(18) IS: Logical Agents

  37. Part 3 First order logic IS: Logical Agents

  38. First-order logic • Whereas propositional logic assumes the world contains facts,first-order logic (like natural language) assumes the world contains • Objects: people, houses, numbers, colors, baseball games, wars, … • Relations: red, round, prime, brother of, bigger than, part of, comes between, … • Functions: father of, best friend, one more than, plus, … IS: Logical Agents

  39. Syntax of FOL: Basic elements IS: Logical Agents

  40. Atomic sentences Atomic sentence = predicate (term1,...,termn) or term1 = term2 Term = function (term1,...,termn) or constant or variable • E.g., Brother(KingJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)), Length(LeftLegOf(KingJohn))) IS: Logical Agents

  41. Complex sentences • Complex sentences are made from atomic sentences using connectives S, S1 S2, S1  S2, S1 S2, S1S2, E.g. Sibling(KingJohn,Richard) Sibling(Richard,KingJohn) >(1,2)  ≤ (1,2) >(1,2)  >(1,2) IS: Logical Agents

  42. Truth in first-order logic • Sentences are true with respect to a model and an interpretation • Model contains objects (domainelements) and relations among them • Interpretation specifies referents for constantsymbols→objectspredicatesymbols→relationsfunctionsymbols→ functional relations • An atomic sentence predicate(term1,...,termn) is true iff the objects referred to by term1,...,termn are in the relation referred to by predicate IS: Logical Agents

  43. Models for FOL: Example IS: Logical Agents

  44. Universal quantification • <variables> <sentence> Everyone at USGov is smart: x At(x,USGov)  Smart(x) • x P is true in a model m iff P is true with x being each possible object in the model • Roughly speaking, equivalent to the conjunction of instantiations of P At(KingJohn,USGov)  Smart(KingJohn)  At(Richard,USGov)  Smart(Richard)  At(USGov, USGov)  Smart(USGov)  ... IS: Logical Agents

  45. A common mistake to avoid • Typically,  is the main connective with  • Common mistake: using  as the main connective with : x At(x, USGov)  Smart(x) means “Everyone is at USGov and everyone is smart” IS: Logical Agents

  46. Existential quantification • <variables> <sentence> • Someone at USGov is smart: • x At(x,USGov)  Smart(x) • xP is true in a model m iff P is true with x being some possible object in the model • Roughly speaking, equivalent to the disjunction of instantiations of P At(KingJohn,USGov)  Smart(KingJohn)  At(Richard,USGov)  Smart(Richard)  At(USGov,USGov)  Smart(USGov)  ... IS: Logical Agents

  47. Another common mistake to avoid • Typically,  is the main connective with  • Common mistake: using  as the main connective with : x (At(x,USGov)  Smart(x)) is true if there is anyone who is not at USGov! IS: Logical Agents

  48. Properties of quantifiers • x y is the same as yxx y is the same as yx • x y is not the same as yx • x y Loves(x,y) • “There is a person who loves everyone in the world” • yx Loves(x,y) • “Everyone in the world is loved by at least one person” • Quantifier duality: each can be expressed using the other • x Likes(x,IceCream) same as x Likes(x,IceCream) x Likes(x,Broccoli) same as xLikes(x,Broccoli) IS: Logical Agents

  49. Using FOL The kinship domain: • Brothers are siblingsx,y Brother(x,y) ->Sibling(x,y) • One's mother is one's female parentm,c Mother(c) = m <->(Female(m) Parent(m,c))“Sibling” is symmetric x,y Sibling(x,y) Sibling(y,x) IS: Logical Agents

  50. Using FOL The set domain: s Set(s)  (s = {} )  (x,s2 Set(s2)  s = {x|s2}) x,s {x|s} = {} x,s x  s  s = {x|s} x,s x  s  [ y,s2} (s = {y|s2}  (x = y  x  s2))] s1,s2 s1 s2 (x x s1 x  s2) s1,s2 (s1 = s2)  (s1 s2 s2 s1) x,s1,s2 x  (s1 s2)  (x  s1 x  s2) x,s1,s2 x  (s1 s2)  (x  s1 x  s2) IS: Logical Agents

More Related