1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation IV ● Answer Extraction ● Factoring.

Slides:



Advertisements
Similar presentations
Resolution Proof System for First Order Logic
Advertisements

1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Standard Logical Equivalences
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Automated Reasoning Systems For first order Predicate Logic.
First Order Logic Resolution
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
CS 330 Programming Languages 12 / 02 / 2008 Instructor: Michael Eckmann.
Using Predicate Logic Chapter 5.
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
CSE (c) S. Tanimoto, 2008 Propositional Logic
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
Artificial Intelligence
CSE (c) S. Tanimoto, 2005 Logic Programming 1 Logic Programming Outline: Motivation Examples: The Grandmother relation Formulation in Prolog Logic,
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
For Wednesday Read chapter 10 Prolog Handout 4. Exam 1 Monday Take home due at the exam.
UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
First Order Predicate Logic
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
1CS3754 Class Notes 14B, John Shieh, Figure 2.5: Further steps in the unification of (parents X (father X) (mother bill)) and (parents bill.
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 2 – Prolog: History and Introduction.
Resolution Strategies One common strategy for applying resolution is called level saturation. Here you try to resolve every pair of clauses from the original.
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
For Monday Finish chapter 19 No homework. Program 4 Any questions?
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Systems For first order Predicate Logic.
UNIVERSITI TENAGA NASIONAL CMPB454 ARTIFICIAL INTELLIGENCE (AI) CHAPTER 6 LOGIC PROGRAMMING USING PROLOG CHAPTER 6 LOGIC PROGRAMMING USING PROLOG Instructor:
Reasoning using First-Order Logic
1 Section 9.1 Automatic Reasoning Recall that a wff W is valid iff ¬ W is unsatisfiable. Resolution is an inference rule used to prove unsatisfiability.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
CSE (c) S. Tanimoto, 2008 Predicate Calculus II 1 Predicate Calculus 2 Outline: Unification: definitions, algorithm Formal interpretations and satisfiability.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
1-1 An Introduction to Logical Programming Sept
Answer Extraction To use resolution to answer questions, for example a query of the form  X C(X), we must keep track of the substitutions made during.
Chap. 10 Learning Sets of Rules 박성배 서울대학교 컴퓨터공학과.
CPSC 433 Artificial Intelligence Unification & Resolution Examples Andrew Kuipers Please include [CPSC433] in the subject line.
1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation III ● Required Readings: 9.1, 9.2,
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
1 Introduction to Artificial Intelligence LECTURE 9: Resolution in FOL Theorem Proving in First Order Logic Unification Resolution.
Lecture 9: Resolution in First Order Logic Heshaam Faili University of Tehran Theorem Proving in First Order Logic Unification Resolution.
Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.
CSE (c) S. Tanimoto, 2001 Logic Programming
CSE 341, S. Tanimoto Logic Programming -
For Monday Read Prolog handout 4 Homework:
Horn Clauses and Unification
Prolog programming Introduction to Prolog (part2)
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2004 Logic Programming
CSE (c) S. Tanimoto, 2002 Logic Programming
Horn Clauses and Unification
CS621 : Artificial Intelligence
Resolution Proof System for First Order Logic
Presentation transcript:

1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation IV ● Answer Extraction ● Factoring (optional, not on Test 2) ● Prolog (not on Test 2) ● Review: One more example (do it yourself)

2 Hojjat Ghaderi, University of Toronto, Fall 2006 Answer Extraction. ● The previous example shows how we can answer true-false questions. With a bit more effort we can also answer “fill-in-the-blanks” questions (e.g., what is wrong with the car?). ● As in Prolog we use free variables in the query where we want the fill in the blanks. We simply need to keep track of the binding that these variables received in proving the query. ■ parent(art, jon) –is art one of jon’s parents? ■ parent(X, jon) -who is one of jon’s parents?

3 Hojjat Ghaderi, University of Toronto, Fall 2006 Answer Extraction. ● A simple bookkeeping device is to use an predicate symbol answer(X,Y,…) to keep track of the bindings automatically. ● To answer the query parent(X,jon), we construct the clause (  parent(X,jon), answer(X)) ● Now we perform resolution until we obtain a clause consisting of only answer literals (previously we stopped at empty clauses).

4 Hojjat Ghaderi, University of Toronto, Fall 2006 Answer Extraction: Example 1 1. father(art, jon) 2. father(bob,kim) 3. (  father(Y,Z), parent(Y,Z)) i.e. all fathers are parents 4. (  parent(X,jon), answer(X)) i.e. the query is: who is parent of jon? Here is a resolution proof: 5. R[4,3b]{Y=X,Z=jon} (  father(X,jon), answer(X)) 6. R[5,1]{X=art} answer(art) so art is parent of jon

5 Hojjat Ghaderi, University of Toronto, Fall 2006 Answer Extraction: Example 2 1. (father(art, jon), father(bob,jon) //either bob or art is parent of jon 2. father(bob,kim) 3. (  father(Y,Z), parent(Y,Z)) //i.e. all fathers are parents 4. (  parent(X,jon), answer(X)) //i.e. query is parent(X,jon) Here is a resolution proof: 5. R[4,3b]{Y=X,Z=jon} (  father(X,jon), answer(X)) 6. R[5,1a]{X=art} (father(bob,jon), answer(art)) 7. R[6,3b] {Y=bob,Z=jon} (parent(bob,jon), answer(art)) 8. R[7,4] {X=bob} (answer(bob), answer(art)) A disjunctive answer: either bob or art is parent of jon.

6 Hojjat Ghaderi, University of Toronto, Fall 2006 Factoring (optional) 1. (p(X), p(Y)) //  X.  Y.  p(X)  p(Y) 2. (¬p(V), ¬p(W)) //  V.  W. p(V)   p(W) ● These clauses are intuitively contradictory, but following the strict rules of resolution only we obtain: 3. R[1a,2a](X=V) (p(Y), ¬p(W)) Renaming variables: (p(Q), ¬p(Z)) 4. R[3b,1a](X=Z) (p(Y), p(Q)) No way of generating empty clause! Factoring is needed to make resolution complete, without it resolution is incomplete!

7 Hojjat Ghaderi, University of Toronto, Fall 2006 Factoring (optional). ● If two or more literals of a clause C have an mgu , then C  with all duplicate literals removed is called a factor of C. ● C = (p(X), p(f(Y)), ¬q(X))  = {X=f(Y)} C  = (p(f(Y)), p(f(Y)), ¬q(f(Y)))  (p(f(Y)), ¬q(f(Y)) is a factor Adding a factor of a clause can be a step of proof: 1. (p(X), p(Y)) 2. (¬p(V), ¬p(W)) 3. f[1ab]{X=Y} p(Y) 4. f[2ab]{V=W} ¬p(W) 5. R[3,4]{Y=W} ().

8 Hojjat Ghaderi, University of Toronto, Fall 2006 Prolog ● Prolog search mechanism (without not and cut) is simply an instance of resolution, except 1. Clauses are Horn (only one positive literal) 2. Prolog uses a specific depth first strategy when searching for a proof. (Rules are used first mentioned first used, literals are resolved away left to right).

9 Hojjat Ghaderi, University of Toronto, Fall 2006 Prolog ● Append: 1. append([], Z, Z) 2. append([E1 | R1], Y, [E1 | Rest]) :- append(R1, Y, Rest) Note:  The second is actually the clause (append([E1|R1], Y, [E1|Rest]), ¬append(R1,Y,Rest))  [ ] is a constant (the empty list)  [X | Y] is cons(X,Y).  So [a,b,c] is short hand for cons(a,cons(b,cons(c,[])))

10 Hojjat Ghaderi, University of Toronto, Fall 2006 Prolog: Example of proof ● Try to prove : append([a,b], [c,d], [a,b,c,d]): 1. append([], Z, Z) 2. (append([E1|R1], Y, [E1|Rest]), ¬append(R1,Y,Rest)) 3. ¬append([a,b], [c,d], [a,b,c,d]) 4. R[3,2a]{E1=a, R1=[b], Y=[c,d], Rest=[b,c,d]} ¬append([b], [c,d], [b,c,d]) 5. R[4,2a]{E1=b, R1=[], Y=[c,d], Rest=[c,d]} ¬append([], [c,d], [c,d]) 6. R[5,1]{Z=[c,d]} ()

11 Hojjat Ghaderi, University of Toronto, Fall 2006 Review: One Last Example! Consider the following English description ● Whoever can read is literate. ● Dolphins are not literate. ● Flipper is an intelligent dolphin. ● Who is intelligent but cannot read.

12 Hojjat Ghaderi, University of Toronto, Fall 2006 Example: pick symbols & convert to first-order formula ● Whoever can read is literate.  X. read(X)  lit(X) ● Dolphins are not literate.  X. dolp(X)   lit(X) ● Flipper is an intelligent dolphin dolp(flipper)  intell(flipper) ● Who is intelligent but cannot read?  X. intell(X)   read(X).

13 Hojjat Ghaderi, University of Toronto, Fall 2006 Example: convert to clausal form ●  X. read(X)  lit(X) (  read(X), lit(X)) ● Dolphins are not literate.  X. dolp(X)   lit(X) (  dolp(X),  lit(X)) ● Flipper is an intelligent dolphin. dolp(flipper) intell(flipper) ● who are intelligent but cannot read?  X. intell(X)   read(X).   X.  intell(X)  read(X)  (  intell(X), read(X), answer(X))

14 Hojjat Ghaderi, University of Toronto, Fall 2006 Example: do the resolution proof 1. (  read(X), lit(X)) 2. (  dolp(X),  lit(X)) 3. dolp(flip) 4. intell(flip) 5. (  intell(X), read(X),answer(X)) 6. R[5a,4] X=flip. (read(flip), answer(flip)) 7. R[6,1a] X=flip. (lit(flip), answer(flip)) 8. R[7,2b] X=flip. (  dolp(flip), answer(flip)) 9. R[8,3] answer(flip) so flip is intelligent but cannot read!