f119311ea9c3e4c3b256a13b4fc99e31.ppt
- Количество слайдов: 53
CPE/CSC 481: Knowledge-Based Systems Dr. Franz J. Kurfess Computer Science Department Cal Poly © 2002 Franz J. Kurfess Logic and Reasoning 1
Course Overview u u Introduction Knowledge Representation u u Probability, Bayesian Decision Making Expert System Design u u Variables, Functions, Expressions, Constraints Expert System Implementation u u Concepts, Notation, Usage Pattern Matching u Reasoning with Uncertainty u u Predicate Logic, Inference Methods, Resolution CLIPS Overview u Reasoning and Inference u u Semantic Nets, Frames, Logic u Salience, Rete Algorithm Expert System Examples Conclusions and Outlook ES Life Cycle © 2002 Franz J. Kurfess Logic and Reasoning 2
Overview Logic and Reasoning u u u Motivation Objectives Knowledge and Reasoning u u u logic as prototypical reasoning system syntax and semantics validity and satisfiability logic languages u u u Reasoning Methods u u propositional and predicate calculus inference methods © 2002 Franz J. Kurfess Knowledge Representation and Reasoning Methods u Production Rules Semantic Nets Schemata and Frames Logic Important Concepts and Terms Chapter Summary Logic and Reasoning 3
Logistics u u Term Project Lab and Homework Assignments Exams Grading © 2002 Franz J. Kurfess Logic and Reasoning 4
Bridge-In © 2002 Franz J. Kurfess Logic and Reasoning 5
Pre-Test © 2002 Franz J. Kurfess Logic and Reasoning 6
Motivation © 2002 Franz J. Kurfess Logic and Reasoning 7
Objectives © 2002 Franz J. Kurfess Logic and Reasoning 8
Introduction to Logic u expresses knowledge in a particular mathematical notation All birds have wings --> ¥x. Bird(x) -> Has. Wings(x) u rules u of inference guarantee that, given true facts or premises, the new facts or premises derived by applying the rules are also true All robins are birds --> ¥x Robin(x) -> Bird(x) u given these two facts, application ¥x Robin(x) -> Has. Wings(x) © 2002 Franz J. Kurfess of an inference rule gives: Logic and Reasoning 11
Logic and Knowledge u rules of inference act on the superficial structure or syntax of the first 2 formulas u doesn't say anything about the meaning of birds and robins u could have substituted mammals and elephants etc. u major advantages of this approach u deductions are guaranteed to be correct to an extent that other representation schemes have not yet reached u easy to automate derivation of new facts u problems u computational efficiency u uncertain, incomplete, imprecise knowledge © 2002 Franz J. Kurfess Logic and Reasoning 12
Validity and Satisfiability ua sentence is valid or necessarily true if and only if it is true under all possible interpretations in all possible worlds u also called a tautology Is. Bird(Robin) V ~Is. Bird(Robin) Stench[1, 1] V ~Stench[1, 1] Open. Area[square in front of me] V Wall[square in front of me] u is NOT a tautology! v assumes every square has either a wall or an open area, so not true for all worlds "If every square has either a wall or an open area in it, then Open. Area[square in front of me] V Wall[square in front of me]" u is a tautology. . . ua sentence is satisfiable iff there is some interpretation in some world for which it is true u a sentence that is not satisfiable is unsatisfiable (also known as a contradiction): u It is raining and it is not raining. © 2002 Franz J. Kurfess Logic and Reasoning 13
Summary of Logic Languages u propositional u u facts true/false/unknown u first-order u u u logic facts, objects, relations true/false/unknown u temporal u logic facts, objects, relations, times true/false/unknown u probability u u u theory facts degree of belief [0. . 1] u fuzzy u logic degree of truth degree of belief [0. . 1] © 2002 Franz J. Kurfess Logic and Reasoning 14
Propositional Logic u u u Syntax Semantics Validity and Inference Models Inference Rules Complexity © 2002 Franz J. Kurfess Logic and Reasoning 15
Syntax u symbols u u u logical constants True, False propositional symbols P, Q, … logical connectives u u u conjunction , disjunction , negation , implication , equivalence parentheses , sentences u u constructed from simple sentences conjunction, disjunction, implication, equivalence, negation © 2002 Franz J. Kurfess Logic and Reasoning 16
BNF Grammar Propositional Logic Sentence Atomic. Sentence Complex. Sentence Atomic. Sentence | Complex. Sentence True | False | P | Q | R |. . . (Sentence ) | Sentence Connective Sentence | Sentence Connective | | | ambiguities are resolved through precedence or parentheses e. g. P Q R S is equivalent to ( P) (Q R)) S © 2002 Franz J. Kurfess Logic and Reasoning 17
Semantics u interpretation of the propositional symbols and constants u symbols can be any arbitrary fact u u sentences consisting of only a propositional symbols are satisfiable, but not valid the constants True and False have a fixed interpretation u u u True indicates that the world is as stated False indicates that the world is not as stated specification of the logical connectives u frequently explicitly via truth tables © 2002 Franz J. Kurfess Logic and Reasoning 18
Truth Tables for Connectives P Q False True © 2002 Franz J. Kurfess P P Q P Q True False False True True False True Logic and Reasoning 19
Validity and Inference u truth tables can be used to test sentences for validity u u one row for each possible combination of truth values for the symbols in the sentence the final value must be True for every sentence © 2002 Franz J. Kurfess Logic and Reasoning 20
Inference Rules u more efficient than truth tables © 2002 Franz J. Kurfess Logic and Reasoning 26
Modus Ponens u eliminates => (X => Y), X _______ Y u If it rains, then the streets will be wet. u It is raining. u Infer the conclusion: The streets will be wet. (affirms the antecedent) © 2002 Franz J. Kurfess Logic and Reasoning 27
Modus tollens (X => Y), ~Y ________ ¬X u u u If it rains, then the streets will be wet. The streets are not wet. Infer the conclusion: It is not raining. u NOTE: u u u Avoid the fallacy of affirming the consequent: If it rains, then the streets will be wet. The streets are wet. cannot conclude that it is raining. If Bacon wrote Hamlet, then Bacon was a great writer. u Bacon was a great writer. © 2002 Franz J. Kurfess Logic and Reasoning u cannot conclude that Bacon wrote Hamlet. u 28
Syllogism u chain implications to deduce a conclusion) (X => Y), (Y => Z) ___________ (X => Z) © 2002 Franz J. Kurfess Logic and Reasoning 29
More Inference Rules u and-elimination u and-introduction u or-introduction u double-negation u unit elimination resolution © 2002 Franz J. Kurfess Logic and Reasoning 30
Resolution (X v Y), (~Y v Z) _________ (X v Z) u basis for the inference mechanism in the Prolog language and some theorem provers © 2002 Franz J. Kurfess Logic and Reasoning 31
Complexity issues u truth table enumerates 2 n rows of the table for any proof involving n symbol u u it is complete computation time is exponential in n u checking u u a set of sentences for satisfiability is NP-complete but there are some circumstances where the proof only involves a small subset of the KB, so can do some of the work in polynomial time if a KB is monotonic (i. e. , even if we add new sentences to a KB, all the sentences entailed by the original KB are still entailed by the new larger KB), then you can apply an inference rule locally (i. e. , don't have to go checking the entire KB) © 2002 Franz J. Kurfess Logic and Reasoning 32
Horn clauses or sentences u class of sentences for which a polynomial-time inference procedure exists u P 1 ^ P 2 ^. . . ^Pn => Q where Pi and Q are non-negated atoms u not every knowledge base can be written as a collection of Horn sentences © 2002 Franz J. Kurfess Logic and Reasoning 33
Reasoning in Knowledge-Based Systems u shallow and deep reasoning u forward and backward chaining u alternative inference methods u metaknowledge © 2002 Franz J. Kurfess Logic and Reasoning 34
Shallow and Deep Reasoning u shallow u u also called experiential reasoning aims at describing aspects of the world heuristically short inference chains possibly complex rules u deep u u reasoning also called causal reasoning aims at building a model of the world that behaves like the “real thing” long inference chains often simple rules that describe cause and effect relationships © 2002 Franz J. Kurfess Logic and Reasoning 35
Examples Shallow and Deep Reasoning u shallow reasoning IF a car has a good battery good spark plugs gas good tires THEN the car can move u deep reasoning IF the battery is good THEN there is electricity IF there is electricity AND spark plugs THEN the spark plugs will fire good IF the spark plugs fire AND there is gas THEN the engine will run IF the engine runs AND there are good tires THEN the car can move © 2002 Franz J. Kurfess Logic and Reasoning 36
Forward Chaining u given a set of basic facts, we try to derive a conclusion from these facts u example: What can we conjecture about Clyde? IF elephant(x) THEN mammal(x) IF mammal(x) THEN animal(x) elephant (Clyde) modus ponens: IF p THEN q p q © 2002 Franz J. Kurfess unification: find compatible values for variables Logic and Reasoning 37
Forward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p q IF elephant( x ) THEN mammal( x ) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 38
Forward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p q IF elephant(Clyde) THEN mammal(Clyde) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 39
Forward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p q IF mammal( x ) THEN animal( x ) IF elephant(Clyde) THEN mammal(Clyde) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 40
Forward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p q IF mammal(Clyde) THEN animal(Clyde) IF elephant(Clyde) THEN mammal(Clyde) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 41
Forward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p animal( x ) q IF mammal(Clyde) THEN animal(Clyde) IF elephant(Clyde) THEN mammal(Clyde) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 42
Forward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p animal(Clyde) q IF mammal(Clyde) THEN animal(Clyde) IF elephant(Clyde) THEN mammal(Clyde) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 43
Backward Chaining © 2002 Franz J. Kurfess Logic and Reasoning 44
Backward Chaining u try to find supportive evidence (i. e. facts) for a hypothesis u example: Is there evidence that Clyde is an animal? IF elephant(x) THEN mammal(x) IF mammal(x) THEN animal(x) elephant (Clyde) modus ponens: IF p THEN q p q © 2002 Franz J. Kurfess unification: find compatible values for variables Logic and Reasoning 45
Backward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p q animal(Clyde) ? IF mammal( x ) THEN animal( x ) © 2002 Franz J. Kurfess Logic and Reasoning 46
Backward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p q animal(Clyde) ? IF mammal(Clyde) THEN animal(Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 47
Backward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p animal(Clyde) q ? IF mammal(Clyde) THEN animal(Clyde) ? IF elephant( x ) THEN mammal( x ) © 2002 Franz J. Kurfess Logic and Reasoning 48
Backward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p animal(Clyde) q ? IF mammal(Clyde) THEN animal(Clyde) ? IF elephant(Clyde) THEN mammal(Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 49
Backward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p animal(Clyde) q ? IF mammal(Clyde) THEN animal(Clyde) ? IF elephant(Clyde) THEN mammal(Clyde) elephant ( x ) © 2002 Franz J. Kurfess ? Logic and Reasoning 50
Backward Chaining Example IF elephant(x) THEN mammal(x) unification: IF mammal(x) THEN animal(x) find compatible values for variables elephant(Clyde) modus ponens: IF p THEN q p animal(Clyde) q IF mammal(Clyde) THEN animal(Clyde) IF elephant(Clyde) THEN mammal(Clyde) elephant (Clyde) © 2002 Franz J. Kurfess Logic and Reasoning 51
Forward vs. Backward Chaining Forward Chaining Backward Chaining planning, control diagnosis data-driven goal-driven (hypothesis) bottom-up reasoning top-down reasoning find possible conclusions supported by given facts find facts that support a given hypothesis similar to breadth-first search similar to depth-first search antecedents (LHS) control evaluation © 2002 Franz J. Kurfess consequents (RHS) control evaluation Logic and Reasoning 52
Alternative Inference Methods © 2002 Franz J. Kurfess Logic and Reasoning 53
Metaknowledge © 2002 Franz J. Kurfess Logic and Reasoning 54
Post-Test © 2002 Franz J. Kurfess Logic and Reasoning 55
Use of References u [Giarratano & Riley 1998] u [Russell & Norvig 1995] u [Jackson 1999] u [Durkin 1994] [Giarratano & Riley 1998] © 2002 Franz J. Kurfess Logic and Reasoning 57
References u u u u [Altenkrüger & Büttner] Doris Altenkrüger and Winfried Büttner. Wissensbasierte Systems Architektur, Enwicklung, Echtzeit-Anwendungen. Vieweg Verlag, 1992. [Awad 1996] Elias Awad. Building Expert Systems - Principles, Procedures, and Applications. West Publishing, Minneapolis/St. Paul, MN, 1996. [Bibel 1993] Wolfgang Bibel with Steffen Höldobler and Torsten Schaub. Wissensrepräsentation und Inferenz - Eine grundlegende Einführung. Vieweg Verlag, 1993. [Durkin 1994] John Durkin. Expert Systems - Design and Development. Prentice Hall, Englewood Cliffs, NJ, 1994. [Giarratano & Riley 1998] Joseph Giarratano and Gary Riley. Expert Systems - Principles and Programming. 3 rd ed. , PWS Publishing, Boston, MA, 1998 [Jackson, 1999] Peter Jackson. Introduction to Expert Systems. 3 rd ed. , Addison-Wesley, 1999. [Russell & Norvig 1995] Stuart Russell and Peter Norvig, Artificial Intelligence - A Modern Approach. Prentice Hall, 1995. © 2002 Franz J. Kurfess Logic and Reasoning 58
Important Concepts and Terms u u u u agent automated reasoning belief network cognitive science computer science hidden Markov model intelligence knowledge representation linguistics Lisp logic machine learning microworlds © 2002 Franz J. Kurfess u u u u natural language processing neural network predicate logic propositional logic rational agent rationality Turing test Logic and Reasoning 59
Summary Chapter-Topic © 2002 Franz J. Kurfess Logic and Reasoning 60
© 2002 Franz J. Kurfess Logic and Reasoning 61
f119311ea9c3e4c3b256a13b4fc99e31.ppt