Presentation is loading. Please wait.

Presentation is loading. Please wait.

Notes 7: Knowledge Representation, The Propositional Calculus ICS 270A Winter 2003.

Similar presentations


Presentation on theme: "Notes 7: Knowledge Representation, The Propositional Calculus ICS 270A Winter 2003."— Presentation transcript:

1 Notes 7: Knowledge Representation, The Propositional Calculus ICS 270A Winter 2003

2 ICS-270A: Notes 7: 2 Outline zRepresenting knowledge using logic yAgent that reason logically yA knowledge based agent yUsing constraints on feature values yA rich and implicit representation of the world state. zRepresenting and reasoning with logic yPropositional logic xSyntax xSemantic xvalidity and models xRules of inference for propositional logic xResolution xComplexity of propositional inference. zReading: Nillson Chapters 13,14, Russel and Norvig, Chapter 7

3 ICS-270A: Notes 7: 3 Why knowledge-base zThe state of the world ymay require lots of information.. zThe agent knowledge of the state of the world: y If s is world state K(s) is what the agent knows. zFor economy: yNot everything explicitly specified. Some facts can be inferred. yAgent may infer whatever he does not know explicitly. zNillson: Constraints on feature values yBlock A is not on the floor zIssues: yIn what language to express what the agent knows about the world. How explicit to make this knowledge. How to infer. Description of the world Agent knowledge of state Agent explicit specification of what he knows

4 ICS-270A: Notes 7: 4 Knowledge Representation Defined by: syntax, semantix AssertionsConclusions (knowledge base)Facts Inference Imply Computer Real-World Semantics Reasoning: in the syntactic level Example:

5 ICS-270A: Notes 7: 5 Constraints on the world zWorld so far were described by feature values: yOn(block,floor) On(A,B) Clear(C) zBut some information is more complex yLaw: all human are mortal, all blue box are pushable yNegative information: block a is not on the floor yEither A or B are pushable zExamples: A lifting robot: features: yBat_ok, liftable, moves zConstraints on the worlds can be written in logic: yBat_ok and liftable  moves yIf moves is false and Bat_ok is true, we infer liftable is false. zLogical languages involve ySyntax, the grammar ySemantics: the meaning of words and sentences yInference rules: deriving new information that is correct.

6 ICS-270A: Notes 7: 6 The party example zIf Alex goes, then Beki goes: A  B zIf Chris goes, then Alex goes: C  A zBeki does not go: not B zChris goes: C zQuery: Is it possible to satisfy all these conditions? zShould I go to the party?

7 ICS-270A: Notes 7: 7 Knowledge Representation zKnowledge representation: ydefined by syntax and semantics ySyntax says what sets of symbols are legal sentences. ySemantics says what a legal sentence means in the world. zEntailment: yGenerating new sentences that are true given old sentences that are true. KB |= alpha. zSound inference: yGiven a knowledge base KB, generates a new sentence that is entailed by KB or verify entailment. KB |--  y Soundness: we infer only what can be entailed (what is true). zProof: A sequence of sound inferences. zCompleteness: yAn inference is complete if it can prove everything that is true. zProof theory: zExample: algebra language

8 ICS-270A: Notes 7: 8 Example of Languages for Representation zProgramming languages: yFormal languages, not ambiguous, but cannot express partial information. Not expressive enough. zNatural languages: yvery expressive but ambiguous: ex: small dogs and cats. zGood representation language: yBoth formal and can express partial information, can accommodate inference zMain approach used in AI: Logic-based languages.

9 ICS-270A: Notes 7: 9 Propositional Logic zSyntax : yAlphabet: {true,false,P,Q} yConnectives: yWell-Formed formulas: (wffs or sentences): w 1, w 2 x xIf Alex_goes  Beki_goes zSemantics: yTrue means true yFalse means false ySymbols means objects in the world and they are true or false relative to a scenario, or a world, we refer to. yMeaning of a sentence is derived from its parts as defined by truth-tables.

10 ICS-270A: Notes 7: 10 Truth tables for the logical connectives

11 ICS-270A: Notes 7: 11 A grammer for sentences in propositional logic

12 ICS-270A: Notes 7: 12 Truth Tables zTruth tables can be used to compute the truth value of any wff. zCan be used to find the truth of zGiven n features there are 2 n different worlds, different interpretations. zInterpretation: any assignment of true and false to atoms zAn interpretation satisfies a wff if the wff is assigned true under the interpretation zA model: An interpretation is a model of a wff if the wff is satisfied in that interpretation. zSatisfiability of a wff can be determined by the truth-table yBat_on and turns-key_on  Engine-starts zWff is unsatisfiable or inconsistent it has no models y

13 ICS-270A: Notes 7: 13 Validity

14 ICS-270A: Notes 7: 14 Validity, Equivalence zValidity: A wff is Valid if it is true in all interpretations yP  P zEquivalence: two wffs are equivalent iff they have the same models. yDeMorgan laws, law of contrapositive yIf w 1 is equivalent to w 2 then: w 1  w 2 and w 2  w 1 zAssociative zDistributive zDeMorgan’s

15 ICS-270A: Notes 7: 15 Logical Entailment: truth in the world zKB ( ) entails a sentence, iff all the models of KB are models of alpha (in other words, any interpretation that satisfies KB satisfies alpha.) zIf some sentences are true in the world it implies that some other sentences are true. zstatement P is true whenever some other set KB of statements is true, then “KB entails P”. zWhenever means: yIn any possible world (model) in which every sentence of KB is true.

16 ICS-270A: Notes 7: 16 zProducing an additional wffs from a set of wffs zFrom alpha infer beta y zSound inference rule: yThe conclusion is true whenever the premises are true. zExamples yModus ponens: { A and A  B |-- B} is sound, resolution is sound. zProof: yA sequence of inference rules generating the desired conclusion from the KB. yExample: KB = yFrom yKB Rules of Inference

17 ICS-270A: Notes 7: 17 Rules of inference

18 ICS-270A: Notes 7: 18 Complete inference rules zAn inference rule is complete if y it can be used to prove anything that is true. zIs modes ponens complete? yPvQ, P -->A, Q --> A ycan we prove A by modes-ponens? yCab we prove A by resolution? zIs resolution complete? yExample: the party problem zResolution implies forward-chaining and backword chaining. yExample: zResolution is complete

19 ICS-270A: Notes 7: 19 Resolution in Propositional Calculus zUsing clauses as wffs yLiteral, clauses, conjunction of clauses (cnfs) zResolution rule: zResolving (P V Q) and (P V  Q) P yGeneralize modus ponens, chaining. yResolving a literal with its negation yields empty clause. zResolution is sound zResolution is NOT complete: yP and R entails P V R but you cannot infer P V R yFrom (P and R) by resolution zResolution is complete for refutation: adding (  P) and (  R) to (P and R) we can infer the empty clause. zDecidability of propositional calculus by resolution refutation: if a wff w is not entailed by KB then resolution refutation will terminate without generating the empty clause.

20 ICS-270A: Notes 7: 20 Soundness of resolution

21 ICS-270A: Notes 7: 21 The party example zIf Alex goes, then Beki goes: A  B zIf Chris goes, then Alex goes: C  A zBeki does not go: not B zChris goes: C zQuery: Is it possible to satisfy all these conditions? zShould I go to the party?

22 ICS-270A: Notes 7: 22 Example of proof by Refutation zAssume the claim is false and prove inconsistency: yExample: can we prove that Chris will not come to the party? zProve by generating the desired goal. zProve by refutation: add the negation of the goal and prove no model zProof: zRefutation:

23 ICS-270A: Notes 7: 23 The moving robot example bat_ok,liftable  moves ~moves, bat_ok

24 ICS-270A: Notes 7: 24 Converting wffs to Conjunctive clauses z1. Eliminate implications: ~(P  Q) or (R  P) z2. Reduce the scope of negation sign z3. Convert to cnfs using the associative and distributive laws

25 ICS-270A: Notes 7: 25 Converting wffs to Conjunctive clauses z1. Eliminate implications z2. Reduce the scope of negation sign z3. Convert to cnfs using the associative and distributive laws

26 ICS-270A: Notes 7: 26 Proof by refutation zGiven a database in clausal normal form KB yFind a sequence of resolution steps from KB to the empty clauses xUse the search space paradigm: States: current cnf KB + new clauses Operators: resolution Initial state: KB + negated goal Goal State: a database containing the empty clause Search using any search method

27 ICS-270A: Notes 7: 27 Proof by refutation (contd.) zOr: yProve that KB has no model - PSAT xA cnf theory is a constraint satisfaction problem: variables: the propositions domains: true, false constraints: clauses (or their truth tables) Find a solution to the csp. If no solution no model. This is the satisfiability question Methods: Backtracking arc-consistency  unit resolution, local search

28 ICS-270A: Notes 7: 28 Resolution refutation search strategies zOrdering strategies yBreadth-first, depth-first yI-level resolvents are generated from level-(I-1) or less resolvents yUnit-preference: prefer resolutions with a literal zSet of support: yAllows reslutions in which one of the resolvents is in the set of support yThe set of support: those clauses coming from negation of the theorem or their decendents. yThe set of support strategy is refutation complete zLinear input yRestricted to resolutions when one member is in the input clauses yLinear input is not refutation complete yExample: (PVQ) (P V not Q) (not P V Q) (not P V not Q) have no model

29 ICS-270A: Notes 7: 29 Complexity of propositional inference zChecking truth tables is exponential zSatisfiability is NP-complete zHowever, frequently generating proofs is easy. zPropositional logic is monotonic yIf you can entail alpha from knowledge base KB and if you add sentences to KB, you can infer alpha from the extended knowledge-base as well. zInference is local yTractable Classes: Horn, 2-SAT zHorn theories: yQ <-- P 1,P 2,...P n yPi is an atom in the language, Q can be false. zSolved by modus ponens or “unit resolution”.

30 ICS-270A: Notes 7: 30 Summary zRepresenting knowledge using logic yUsing logic to represent and reason about knowledge y Logic, syntax, semantics and proof theory zRepresenting and reasoning with logic yPropositional logic xSyntax xSemantic xvalidity and models xRules of inference for propositional logic xComplexity of propositional inference. zReading: Nillson Chaters 13, 14 Russel and Norvig Chapter 7.

31 ICS-270A: Notes 7: 31 The Wumpus world zThe state of world is still simple to specify, not too many facts. zHowever the agent’s knowledge is partial and he needs to infe and think about his state in order to choose a good action. zGoal: find gold, return to [1,1], climb out. zin wumpus square and near, perceive a stench znear a pit, breeze zin gold, percieve glitter zin wall, bump zactions: turn 90, grab,shoot, climb


Download ppt "Notes 7: Knowledge Representation, The Propositional Calculus ICS 270A Winter 2003."

Similar presentations


Ads by Google