Oct 24 - Lesson Plans - 473 Intro to AI From Resolution to Prolog Today: 1. Syntactic Reasoning Frege Systems Modus Ponens Propositional resolution 4. Resolution proofs 5. Unification Monday: 6. Answering Queries with Resolution 7. Resolution strategies Linear resolution 8. Prolog --------------------------------------------------- [1] Syntactic Reasoning Starting today we will look at a very different way of doing inference. Instead of thinking about TRUTH or the MEANING of formulas, logic allows us to reason by simple syntactic manipulation of sentences! We will be covering a lot of fairly deep material quickly. Why? Because a major goal of this course is to introduce you to many important tools from AI, that you may use in your future career. One of these is Prolog, a powerful, logic-based language that is widely used in expert systems, natural language understanding, databases, and other areas. But we have to cover some ground before Prolog really makes sense. For the assigned readings I selected what I thought were the most critical passages from R&N -- we could easy spend the entire quarter on just the chapters on logical reasoning alone! But if you find the material in this class (and possibly next!) either confusing or interesting, I encourage you to go back and re-read the chapters straight through. FREGE SYSTEM 1. A logic 2. A set of rules for deriving new sentences from old MODUS PONENS Propositional logic P, P=>Q ------- Q same as: P, ~P v Q ------- Q RESOLUTION P v R, ~P v Q ------------- Q Example: logic is cool or confusing; logic is not confusing or I am a liar; THEREFORE logic is cool or I am a liar IN GENERAL P v X1 v...v Xj, ~P v Y1 v...v Yk --------------------------------- X1 v...v Xj v Y1 v...v Yk --------------------------------------------------- [2] Resolution Proof: Completeness of Resolution: If a formula is UNSATISFIABLE, there is a resolution proof of the empty clause (false). Want to prove F is VALID (true in all truth assignments) Can do this with a resolution proof that ~F entails FALSE. A proof is often written as A DIRECTED GRAPH that ends in FALSE. Example: If times are good tuition goes up. ~G v U If times are not good tuition goes up. G v U Conclusion: tuition goes up. negate conclusion: ~U DO PROOF. --------------------------------------------------- [3] Resolution with Variables DPPL and Walksat only work on fully-instantiated formulas - no variables! These are also called GROUND formulas. THE ADVANTAGE OF RESOLUTION IS THAT IT CAN WORK DIRECTLY ON FORMULAS WITH VARIABLES! TRUE FIRST-ORDER REASONING! The classical syllogism: All men are mortal. Socrates is a man. Therefore Socrates is mortal. (all x).(man(x) => mortal(x)) CLAUSAL FORM: ~man(x) v mortal(x) man(Socrates) DERIVE mortal(Socrates) The algorithm for matching terms and variables is UNIFICATION Examples: Unification of and is where mortal(x) mortal(SOCRATES) mortal(SOCRATES) x/SOCRATES mortal(SOCRATES) mortal(HENRY) does not unify! mortal(x) mortal(y) mortal(x) y/x child(x,BILL) child(JOHN,y) child(JOHN,BILL) x/JOHN, y/BILL Resolution with variables: 1. Unify COMPLEMENTARY propositions 3. Apply substitutions from unification THROUGHOUT clauses 2. Join clauses - complementary propositions Technical note: must always make sure clauses use different names for their variables - rename if necessary! Example: All men are mortal. The child of a mortal is mortal. The chidren of men are mortal. (all y,z) ((mortal(y) & child(z,y))->mortal(z)) ~man(x) v mortal(x) ~mortal(y) v ~child(z,y) v mortal(z) THEREFORE CAN CONCLUDE ~man(x) v ~child(z,x) v mortal(z) ADD: mortal(JOHN), mortal(FRED), child(ANDY,JOHN), child(TOM,FRED). WANT TO PROVE: mortal(FRED) DO REFUTATION PROOF. NOTE: DID NOT NEED TO REASON ABOUT ANDY OR JOHN! Unification algorithm - simple recursive algorithm in book. Also handles complex terms with function symbols! --------------------------------------------------- IF TIME: In class exercise: Using the predicates: happy(x) person(x) loves(x,y) rich(x) mother(x,y) spouse(x,y) People who love happy people are happy. People who are rich are happy. People love their mother. People love their spouse. Prove: Bill Gates mother-in-law is happy.