1 / 35

Knowledge Representation and Reasoning

Learn how knowledge about the world can be represented using propositional calculus and how reasoning can be done with that knowledge. Explore the syntax, semantics, and rules of inference in propositional logic.

deide
Télécharger la présentation

Knowledge Representation and Reasoning

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. Knowledge Representation and Reasoning Advance Artificial Intelligence

  2. Knowledge Representation & Reasoning Knowledge representation is the study of how knowledge about the world can be represented and what kinds of reasoning can be done with that knowledge. We will discuss two different systems that are commonly used to represent knowledge in machines and perform algorithmic reasoning: • Propositional calculus • Predicate calculus Advance Artificial Intelligence

  3. Propositional Calculus In propositional calculus, • features of the world are represented by propositions, • relationships between features (constraints) are represented by connectives. Example: LECTURE_BORING  TIME_LATE  SLEEP This expression in propositional calculus represents the fact that for some agent in our world, if the features LECTURE_BORING and TIME_LATE are both true, the feature SLEEP is also true. Advance Artificial Intelligence

  4. Propositional Calculus You see that the language of propositional calculus can be used to represent aspects of the world. When there are • a language, as defined by a syntax, • inference rules for manipulating sentences in that language, and • semantics for associating elements of the language with elements of the world, then we have a system called logic. Advance Artificial Intelligence

  5. The Language Atoms: The atoms T and F and all strings that begin with a capital letter, for instance, P, Q, LECTURE_BORING, and so on. Connectives: •  “or” •  “and” •  “implies” or “if-then” •  “not” Advance Artificial Intelligence

  6. The Language Syntax of well-formed formulas (wffs): • Any atom is a wff. • If 1 and 2 are wffs, so are 1  2 (conjunction) 1  2 (disjunction) 1  2 (implication) 1 (negation) • There are no other wffs. Advance Artificial Intelligence

  7. The Language • Atoms and negated atoms are called literals. • In 1  2 , 1 is called the antecedent, and 2 is called the consequent of the implication. • Examples of wffs (sentences): (P  Q)  P P  P P  P  P (P  Q)  (Q  P) P • The precedence order of the above operators is     For example, P  Q  R means ((P)  Q)  R. Advance Artificial Intelligence

  8. Rules of Inference We use rules of inference to generate new wffs from existing ones. One important rule is called modus ponens or the law of detachment. It is based on the tautology (P  (P  Q))  Q. We write it in the following way: P P  Q _____  Q The two hypotheses P and P  Q are written in a column, and the conclusionbelow a bar, where  means “therefore”. Advance Artificial Intelligence

  9. Rules of Inference Q P  Q _____  P Modus tollens Addition P ______  PQ P  Q Q  R _______  P  R PQ _____  P Hypothetical syllogism Simplification P Q ______  PQ PQ P _____  Q Conjunction Disjunctive syllogism Advance Artificial Intelligence

  10. Proofs The sequence of wffs {1, 2, …, n} is called a proof (or a deduction) of n from a set of wffs  iff (if and only if) each i in the sequence is either in  or can be inferred from one or more wffs earlier in the sequence by using one of the rules of inference. If there is a proof of n from , we say that n is a theorem of the set . We use the following notation:  |_ n In this notation, we can also indicate the set of inference rules R that we use:  |_ R n Advance Artificial Intelligence

  11. P P  Q R Q Q  R Proofs Example: Given a set of wffs  = {P, R, P  Q}, the following sequence is a proof of Q  R given the inference rules that we discussed earlier: {P, P  Q, Q, R, Q  R} Tree representation: Advance Artificial Intelligence

  12. Semantics • In propositional logic, we associate atoms with propositions about the world. • We thereby specify the semantics of our logic, giving it a “meaning”. • Such an association of atoms with propositions is called an interpretation. • In a given interpretation, the proposition associated with an atom is called the denotation of that atom. • Under a given interpretation, atoms have values – True or False. We are willing to accept this idealization (otherwise: fuzzy logic). Advance Artificial Intelligence

  13. Semantics Example: “Sonali is either intelligent or a good actor. If Sonali is intelligent, then she can count from 1 to 10. Sonali can only count from 1 to 2. Therefore, Sonali is a good actor.” Propositions: I: “Sonali is intelligent.” A: “Sonali is a good actor.” C: “Sonali can count from 1 to 10.” Advance Artificial Intelligence

  14. Semantics I: “Sonali is intelligent.”A: “Sonali is a good actor.”C: “Sonali can count from 1 to 10.” Step 1: C Hypothesis Step 2: I  C Hypothesis Step 3: I Modus Tollens Steps 1 & 2 Step 4: A  I Hypothesis Step 5: A Disjunctive SyllogismSteps 3 & 4 Conclusion: A (“Sonali is a good actor.”) Advance Artificial Intelligence

  15. Semantics Let us consider an agent which cause action when it gets some input from the sensors • The sensors inform the agent about a set of features of the outside world. • We can associate propositions with these features such as “There is a wall in the cell on the right hand side.” • The sensors tell the agent whether each of these propositions is currently true or false. • This propositional information that is available to the agent is called its knowledge base. Advance Artificial Intelligence

  16. Semantics • We say that an interpretation satisfies a wff if the wff is assigned the value True under that interpretation. • An interpretation that satisfies a wff is called a model of that wff. • An interpretation that satisfies each wff in a set of wffs is called a model of that set. • The more wffs we have that describe the world, the fewer models there are. • This means that the more we know about the world, the less uncertainty there is. Advance Artificial Intelligence

  17. Semantics • If no interpretation satisfies a wff (or a set of wffs), the wff is said to be inconsistent or unsatisfiable, for example, P  P. • A wff is said to be valid if it has value True under all interpretations of its constituent atoms, for example, P  P. • Neither valid wffs nor inconsistent wffs tell us anything about the world. Advance Artificial Intelligence

  18. Semantics • Two wffs are said to be equivalent if and only if their truth values are identical under all interpretations. For two equivalent wffs 1 and 2 we write 1  2. • If a wff  has value True under all of those interpretations for which each of the wffs in a set  has value True, then we say that •  logically entails  •  logically follows from  •  is a logical consequence of  •  |=  Advance Artificial Intelligence

  19. Soundness and Completeness • If, for any set of wffs  and wff ,  |_ R implies  |= , we say that the set of inference rules R is sound. • If, for any set of wffs  and wff , it is the case that whenever  |= , there exists a proof of  from  using the set of inference rules R , we say that R is complete. • When R is sound and complete, we can determine whether one wff follows from a set of wffs by searching for a proof instead of using a truth table (increased efficiency). Advance Artificial Intelligence

  20. Resolution • Multiple rules of inference can be combined into one rule, called resolution. • A clause is a set of literals, which is a short notation for the disjunction of all the literals in the set. For example, the wff {P, Q, R} is the same as the wff P  Q  R. • The empty clause { } (or NIL) is equivalent to F. Advance Artificial Intelligence

  21. Resolution Resolution rule for the propositional calculus: From {}  1 and {}  2 (where 1 and 2 are sets of literals and  is an atom), we can infer 1  2, which is called the resolvent of the two clauses. The atom  is the atom resolved upon, and the process is called resolution. Examples: • Resolving R  P and P  Q yields R  Q. In other words: {R, P}, {P, Q} yields {R, Q}. • Resolving R and R  P yields P. In other words: {R}, {R, P} yields {P}. Advance Artificial Intelligence

  22. Resolution And yet Another Example: Resolving P  Q  R with P  W  Q  R • on Q yields P  R  R  W, which is True. • on R yields P  Q  Q  W, which is also True. You cannot resolve on Q and R simultaneously! Note: • Any set of wffs containing  and   is unsatisfiable, i.e. if one wff is the negation of another wff in that set, it is impossible that all wffs in that set are true. • Any clause that contains  and  has value True regardless of the value of . Advance Artificial Intelligence

  23. Converting wffs to Conjunctions of Clauses Resolution is a powerful tool for algorithmic inference, but we can only apply it to conjunctions of clauses (conjunctive normal form, CNF). So is there a way to convert any wff into such a conjunction of clauses? Fortunately, there is such a way, allowing us to apply resolution to any wff. Advance Artificial Intelligence

  24. Converting wffs to Conjunctions of Clauses Example: (P  Q)  (R  P). Step 1: Eliminate implication operators: (P  Q)  (R  P) Step 2: Reduce the scopes of  operators by using DeMorgan’s laws and eliminating double  operators: (P  Q)  (R  P) Step 3: Convert to CNF by using the associative and distributive laws: (P  R  P)  (Q  R  P), and then (P  R)  (Q  R  P) Advance Artificial Intelligence

  25. Resolution Refutations Resolution is a sound rule of inference, but it is not complete. For example, PR = PR, but the resolution rule does not allow us to infer PR from {P}, {R}. However, we can use resolution to show that the negation of PR is inconsistent with {P}, {R} and thereby showing that PR = PR. The negation of PR is P  R. Conjunctively combining all clauses results in P  R  P  R. This resolves to the empty set, so by contradiction we have indirectly shown that PR = PR. Advance Artificial Intelligence

  26. Resolution Refutations The following statements about resolution refutation are true: • Completeness of resolution refutation: For a set of wffs  and a wff , if  = , then resolution refutation will produce the empty clause. This means that propositional resolution is refutation complete. • Decidability of propositional calculus by resolution refutation: if  is a finite set of clauses and if   , then resolution refutation will terminate without producing the empty clause. Advance Artificial Intelligence

  27. Resolution Refutations Example: “Sonali is intelligent or a good actor. If Sonali is intelligent, then she can count from 1 to 10. Sonali can only count from 1 to 2. Therefore, Sonali is a good actor.” Propositions: I: “Sonali is intelligent.” A: “Sonali is a good actor.” C: “Sonali can count from 1 to 10.” Advance Artificial Intelligence

  28. Resolution Refutations Hypotheses: I  A, I  C, C In CNF: (I  A)  (I  C)  C Conclusion: A Conjunction of Clauses for Resolution Refutation: (I  A)  (I  C)  C  A Advance Artificial Intelligence

  29. Resolution Refutations (I  A)  (I  C)  C  A Resolution on A: I  (I  C)  C Resolution on I: C  C Resolution on C: False Therefore, the initial set of clauses is inconsistent, and the conclusion is correct: Sonali is a good actor. Advance Artificial Intelligence

  30. Resolution Refutations Another Example: “If Dhara visits a pub on Thursday, he is late for work on Friday. If Dhara is late for work on Friday, he has to work during the weekend. Dhara had to work during the weekend. Therefore, Dhara visited a pub on Thursday.” Propositions: T: “Dhara visits a pub on Thursday.” F: “Dhara is late for work on Friday.” W: “Dhara has to work during the weekend.” Advance Artificial Intelligence

  31. Resolution Refutations Hypotheses: T  F, F  W, W In CNF: (T  F)  (F  W)  W Conclusion: T Conjunction of Clauses for Resolution Refutation: (T  F)  (F  W)  W  T Advance Artificial Intelligence

  32. Resolution Refutations (T  F)  (F  W)  W  T Resolution on F: (T  W)  W  T Simplification: W  T No further resolution is possible. Therefore, the argument is invalid and the conclusion that Dharam went to a pub on Thursday is incorrect. (He could have been forced to work during the weekend for other reasons.) Advance Artificial Intelligence

  33. Propositional Calculus We have seen that resolution, including resolution refutation, is a suitable tool for automated reasoning in the propositional calculus. If we build a machine that represents its knowledge as propositions, we can use these mechanisms to enable the machine to deduce new knowledge from existing knowledge and verify hypotheses about the world. However, propositional calculus has some serious restrictions in its capability to represent knowledge. Advance Artificial Intelligence

  34. Propositional Calculus In propositional calculus, atoms have no internal structure; we cannot reuse the same proposition for a different object, but each proposition always refers to the same object. For example, in the toy block world, the propositions ON_A_B and ON_A_C are completely different from each other. We could as well call them DILEEP and SHASHI instead. So if we want to express rules that apply to a whole class of objects, in propositional calculus we would have to define separate rules for every single object of that class. Advance Artificial Intelligence

  35. Predicate Calculus So it is a better idea to use predicates instead of propositions. This leads us to predicate calculus. Predicate calculus has symbols called • object constants, • relation constants, and • function constants These symbols will be used to refer to objects in the world and to propositions about the word. Advance Artificial Intelligence

More Related