1 / 31

CS 4100 Artificial Intelligence

CS 4100 Artificial Intelligence. Prof. C. Hafner Class Notes Jan 19, 2012. Beliefs of the agent as a logical theory. A theory is a set of logical sentences (axioms) We view this as a KB of the agent’s beliefs

zaza
Download Presentation

CS 4100 Artificial Intelligence

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. CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012

  2. Beliefs of the agent as a logical theory • A theory is a set of logical sentences (axioms) • We view this as a KB of the agent’s beliefs • The truth or falsity of other sentences may follow logically from the agent’s beliefs (is entailed) • For some sentences S, neither S nor ~S is entailed by the agent’s beliefs -- therefore in general a theory corresponds to many world models. • As a theory gets bigger (by adding sentences), its set of models gets smaller.

  3. Models and Logical Entailment • Semantics for logic is truth-functional and is defined in terms of models, which are formally structured worlds with respect to which truth can be evaluated. If m is a model, then m assigns true or false to every logical sentence. • We say m is a model of a sentence α if α is true in m • M(α) is the set of all models of α • Then KB ╞ α iffM(KB)  M(α) • E.g. KB = Giants won and Redswon • α = Giants won • What if KB = Giants won or Reds won???

  4. M(α) KB ╞ α

  5. M(α) KB ╞ α

  6. Example: semantics of logic: W1 Giants_won Reds_won W2 Giants_won W3 Reds_won W4 M(α) is the set of all models of α What are each of these: M(Giants won) M(Reds won) M(Giants won and Reds won ) M(Giants won or Reds won)

  7. Example: world models W1 Giants_won Reds_won W2 Giants_won W3 Reds_won W4 M(Giants won) = {W1, W2} M(Reds won) = {W1, W3} M(Giants won and Reds won ) = { W1 } M(Giants won or Reds won) = {W1, W2, W3} Giants won or Reds won ╞ Giants won ?? Iff {W1, W2, W3}  {W1, W2} -- not true

  8. Computing entailment in the wumpus world Situation after detecting nothing in [1,1], moving right, breeze in [2,1] Consider possible models for the existence of pits in the 3 squares marked ? 3 Boolean choices  8 possible models

  9. All possible models for pits in the ? locations

  10. Models consistent with wumpus-world rule and the agent’s observations (KB)

  11. Proof by model checking • KB = wumpus-world rules + observations • α1 = "[1,2] is safe", KB ╞ α1, proved by model checking

  12. Wumpus models • KB = wumpus-world rules + observations

  13. Proof by model checking • KB = wumpus-world rules + observations • α2 = "[2,2] is safe", KB ╞ α2

  14. Truth tables

  15. Using truth tables to show logical equivalenceP => Q == ~PV Q ~P v Q True True False True

  16. Syntactic Reasoning: Sound rules of inference When we put the KB into clause form, then Resolution is both a complete and a sound rule of inference

  17. The resolution rule Show that modus ponens is a special case of the resolution rule: B B  C (same as ~B v C) ---------------- C

  18. Representing Wumpus world w/ Propositional Logic (PL) Let Pi,j be true if there is a pit in [i, j]. (16 propositions) Let Bi,j be true if there is a breeze in [i, j].  P1,1 B1,1 B2,1 • "Pits cause breezes in adjacent squares“ (“axioms”) B1,1 (P1,2 P2,1) B2,1  (P1,1 P2,2  P3,1) Note that in propositional logic, we can’t generalize the knowledge about breezes and adjacent squares. Why?? No variables!! (a simplified answer)

  19. Clauses and Inference • Def: a literal is an “atomic sentence”: P, Q, R Or the negation of an atomic sentence:  P • Def: a clause is a disjunction of literals: P v  Q v R • Def: a KB is in Conjunctive Normal Form (CNF) if it is represented as a conjunction of disjunctions of literals. In practice we use a set of clauses (conjunction is implicit) representing the agent’s beliefs • -------------------------------------------------------------------- • Def: a Horn clause is a clause with at most one positive literal  P1 v  P2 v . . .  Pn • A definite clause is a Horn clause with exactly one positive literal  P1 v  P2 v . . .  Pn v R

  20. Clauses and Inference • Theorem: any set of logic sentences can be transformed into CNF (conjunctive normal form) • Resolution – sound and complete inference method for KB in CNF – we only need that one inference rule !! • Two more efficient inference methods that work for Horn Clauses: • Forward chaining (data driven) • Backward chaining (goal driven)

  21. The Resolution Inference Rule for Propositional Logic [P1 v P2 v . . . Pk ]  [ P1 v Q2 v . . . Qn ] --------------------------------------------------- P2 v . . . Pk v Q2 v . . . Qn

  22. Applying Resolution to Clauses C1.  A v  B v  C v D v E v F C2.  P v  Q v F v R v S -------------------------------------- These two clauses “RESOLVE”. The resolvent is:  A v  B v  C v  P v  Q v D v E v R v S Note convention of ordering clauses: negative literals, then positive literals.

  23. Implicative form for clauses  A v  B v  C v D v E Note convention of ordering clauses: negative literals, then positive literals. Same as: A ^ B ^ C  D v E (Proof of this is part of assignment 2)

  24. Example Proof by Resolution Axioms: Qualified  Hireable College-degree  Experience  Qualified Axioms:  Qualified v Hireable  College-degree v  Experience v Qualified -------------------------------------------------------  College-degree v  Experience v Hireable Note: does this mean if a person is hireable they have a college degree and experience? Justify your answer.

  25. Class Exercise (from text) • Given the following, can you prove that the unicorn is mythical? Magical? Horned? If the unicorn is mythical, then it is immortal, but if it is not mythical, then it is a mortal mammal. If the unicorn is either immortal or a mammal, then it is horned. The unicorn is magical if it is horned.

  26. Forward ChainingStart with a percept derives new knowledge • Horn clauses: • C1.  P1 v P4 P1  P4 • C2.  P4 v P5 P4  P5 • ------------------------- Step 1: Percept P1 resolve with C1 to get P4 Step 2: Resolve P4 with C2 to get P5 This is called Rule Chaining In practical Horn Clause reasoning: Q is called a “fact”, Q  S is called a “rule” [from a formal logic standpoint, all sentences represent facts]

  27. Backward Chaining • Horn clauses: • C1.  P1 v  P2 v P4 P1  P2  P4 • C2.  P4 v P5 P4  P5 ------------------------- • Goal: prove: P5 (Backward chaining) • Subgoal: prove P4 • To prove P4 • Sub-sub-goal: prove P1 • Sub-sub-goal: prove P2

  28. Any KB (i.e., any sentence) can be transformed into an equivalent CNF representation • Replace P => Q with  P v Q • Replace   P with P • Replace  (P v Q) with  P ^  Q • Replace (P ^ Q) with  P v  Q • Apply distributive rule replacing: (P ^ Q) v R with (P v R) ^ (Q v R)

  29. Example P v Q => R ^ S  (P v Q) v (R ^ S) (1) ( P ^  Q) v (R ^ S) (3) (( P ^  Q) v R ) ^ (( P ^  Q) v S) (5) Clause DB:  P v R ^  Q v R ^  P v S ^  Q v S (5,5) Convert back to implicative form for intuition ??

  30. Discussion of Assignments: Forward Chaining KB: agent’s beliefs(sometimes called “facts” and “rules”) fruit  edible vegetable  edible vegetable ^ green  healthy apple  fruit banana  fruit spinach  vegetable spinach  green edible ^ healthy  recommended --------------------- New Percepts ---------------------------- • spinach

  31. Next time: • Discuss the backward chaining algorithm • Move on to FOL (first order logic) and extending our three inference methods to structured beliefs

More Related