Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 16 of 42 Friday, 29 September.

Slides:



Advertisements
Similar presentations
Inference in first-order logic
Advertisements

Inference in first-order logic
First-Order Logic.
Inference Rules Universal Instantiation Existential Generalization
ITCS 3153 Artificial Intelligence Lecture 15 First-Order Logic Chapter 9 Lecture 15 First-Order Logic Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Computing & Information Sciences Kansas State University Lecture 16 of 42 CIS 530 / 730 Artificial Intelligence Lecture 16 of 42 Knowledge Engineering.
1 Resolution in First Order Logic CS 171/271 (Chapter 9, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Inference in FOL All rules of inference for propositional logic apply to first-order logic We just need to reduce FOL sentences to PL sentences by instantiating.
First-Order Logic Inference
1 FOL Resolution based Inferencing Resolution based rules studied earlier can lead to inferences, rules such as modus ponen, unit resolution etc… Other.
CSCE 580 Artificial Intelligence Ch.9: Inference in First-Order Logic
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Fall 2004.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2005.
1 Inference in First-Order Logic. 2 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining.
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
CHAPTER 9 Oliver Schulte Inference in First-Order Logic.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
Inference in First-Order Logic CS 271: Fall 2007 Instructor: Padhraic Smyth.
Inference in first-order logic I CIS 391 – Introduction to Artificial Intelligence AIMA Chapter (through p. 278) Chapter 9.5 (through p. 300)
1 Inference in first-order logic Chapter 9. 2 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 16 Monday, 29 September.
Computing & Information Sciences Kansas State University Wednesday, 20 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 12 of 42 Wednesday, 20 September.
Inference in first- order logic. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining.
Inference in First-Order Logic 부산대학교 전자전기컴퓨터공학과 인공지능연구실 김민호
Computing & Information Sciences Kansas State University Lecture 13 of 42 CIS 530 / 730 Artificial Intelligence Lecture 13 of 42 William H. Hsu Department.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 17 Wednesday, 01 October.
Computing & Information Sciences Kansas State University Lecture 14 of 42 CIS 530 / 730 Artificial Intelligence Lecture 14 of 42 William H. Hsu Department.
Computing & Information Sciences Kansas State University Monday, 25 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 14 of 42 Monday, 25 September.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 23 Friday, 17 October.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 14 of 41 Wednesday, 22.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 15 of 41 Friday 24 September.
Computing & Information Sciences Kansas State University Lecture 15 of 42 CIS 530 / 730 Artificial Intelligence Lecture 15 of 42 William H. Hsu Department.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 18 of 41 Friday, 01 October.
1 Inference in First-Order Logic CS 271: Fall 2009.
1 Inference in First Order Logic CS 171/271 (Chapter 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
5/18/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 13, 5/18/2005 University of Washington, Department of Electrical Engineering Spring.
1 First Order Logic (Syntax, Semantics and Inference)
An Introduction to Artificial Intelligence – CE Chapter 9 - Inference in first-order logic Ramin Halavati In which we define.
1 First Order Logic CS 171/271 (Chapters 8 and 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1/19 Inference in first-order logic Chapter 9- Part2 Modified by Vali Derhami.
Inference in first-order logic
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
Computing & Information Sciences Kansas State University Lecture 12 of 42 CIS 530 / 730 Artificial Intelligence Lecture 12 of 42 William H. Hsu Department.
Computing & Information Sciences Kansas State University Wednesday, 13 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 10 of 42 Wednesday, 13 September.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 14 of 42 Wednesday, 22.
Inference in First-Order Logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
1 Chaining in First Order Logic CS 171/271 (Chapter 9, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Computing & Information Sciences Kansas State University Monday, 18 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 11 of 42 Monday, 18 September.
Computing & Information Sciences Kansas State University Friday, 03 Oct 2008CIS 530 / 730: Artificial Intelligence Lecture 16 of 42 Friday, 03 October.
Inference in first-order logic
Inference in First-Order Logic
Introduction to Artificial Intelligence
Inference in First-Order Logic
Inference in first-order logic part 1
Artificial intelli-gence 1:Inference in first-order logic
Artificial Intelligence
Introduction to Artificial Intelligence
Artificial intelligence: Inference in first-order logic
Artificial Intelligence Inference in First Order Logic
Inference in first-order logic
Inference in first-order logic part 1
Inference in First Order Logic (1)
First-Order Logic Inference
Presentation transcript:

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 16 of 42 Friday, 29 September 2006 William H. Hsu Department of Computing and Information Sciences, KSU KSOL course page: Course web site: Instructor home page: Reading for Next Class: Review Chapter 9, Russell & Norvig 2 nd edition Logic Programming Discussion: Machine Problem 4

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture Outline Reading for Next Class: Chapter 9 review, R&N 2e Today  Logic programming in real life  Industrial-strength Prolog  Lead-in to MP4 Next Week: Knowledge Representation and Ontologies

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Adapted from slides by S. Russell, UC Berkeley Logic Programming (Prolog) Examples

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Completeness of Resolution Any Set of Sentences S Is Representable in Clausal Form (Last Class) Assume S Is Unsatisfiable, and in Clasual Form (By Herbrand’s Theorem) Some Set S’ of Ground Instances is Unsatisfiable (By Ground Resolution Theorem) Resolution Derives  From S’ (By Lifting Lemma)  A Resolution Proof S ├ n  Figure 9.13 p. 301 R&N 2e

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Adapted from slides by S. Russell, UC Berkeley Conjunctive Normal (aka Clausal) Form: Conversion (Nilsson) and Mnemonic Implications Out Negations Out Standardize Variables Apart Existentials Out (Skolemize) Universals Made Implicit Distribute And Over Or (i.e., Disjunctions In) Operators Out Rename Variables A Memonic for Star Trek: The Next Generation Fans Captain Picard: I’ll Notify Spock’s Eminent Underground Dissidents On Romulus I’ll Notify Sarek’s Eminent Underground Descendant On Romulus

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Adapted from slides by S. Russell, UC Berkeley Logic Programming as Horn Clause Resolution

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Logic Programming – Tricks of The Trade [1]: Dealing with Equality Problem  How to find appropriate inference rules for sentences with =?  Unification OK without it, but…  A = B doesn’t force P(A) and P(B) to unify Solutions  Demodulation  Generate substitution from equality term  Additional sequent rule: p. 284 R&N  Paramodulation  More powerful  Generate substitution from WFF containing equality constraint  e.g., (x = y)  P(x)  Sequent rule sketch: p. 284 R&N

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Logic Programming – Tricks of The Trade [2]: Resolution Strategies Unit Preference  Idea: Prefer inferences that produce shorter sentences (compare: Occam’s Razor)  How? Prefer unit clause (single-literal) resolvents  Reason: trying to produce a short sentence (   True  False) Set of Support  Idea: try to eliminate some potential resolutions (prevention as opposed to cure)  How? Maintain set SoS of resolution results and always take one resolvent from it  Caveat: need right choice for SoS to ensure completeness Input Resolution and Linear Resolution  Idea: “diagonal” proof (proof “list” instead of proof tree)  How? Every resolution combines some input sentence with some other sentence  Input sentence: in original KB or query  Generalize to linear resolution: include any ancestor in proof tree to be used Subsumption  Idea: eliminate sentences that sentences that are more specific than others  E.g., P(x) subsumes P(A)

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Universal instantiation (UI) Every instantiation of a universally quantified sentence is entailed by it:  v α Subst({v/g}, α) for any variable v and ground term g E.g.,  x King(x)  Greedy(x)  Evil(x) yields: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(Father(John))  Greedy(Father(John))  Evil(Father(John)).

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Existential instantiation (EI) For any sentence α, variable v, and constant symbol k that does not appear elsewhere in the knowledge base:  v α Subst({v/k}, α) E.g.,  x Crown(x)  OnHead(x,John) yields: Crown(C 1 )  OnHead(C 1,John) provided C 1 is a new constant symbol, called a Skolem constant

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Reduction to propositional inference Suppose the KB contains just the following:  x King(x)  Greedy(x)  Evil(x) King(John) Greedy(John) Brother(Richard,John) Instantiating the universal sentence in all possible ways, we have: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(John) Greedy(John) Brother(Richard,John) The new KB is propositionalized: proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc.

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Reduction contd. Every FOL KB can be propositionalized so as to preserve entailment (A ground sentence is entailed by new KB iff entailed by original KB) Idea: propositionalize KB and query, apply resolution, return result Problem: with function symbols, there are infinitely many ground terms,  e.g., Father(Father(Father(John)))

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Reduction contd. Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KB Idea: For n = 0 to ∞ do create a propositional KB by instantiating with depth-$n$ terms see if α is entailed by this KB Problem: works if α is entailed, loops if α is not entailed Theorem: Turing (1936), Church (1936) Entailment for FOL is semidecidable (algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence.)

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Problems with propositionalization Propositionalization seems to generate lots of irrelevant sentences. E.g., from:  x King(x)  Greedy(x)  Evil(x) King(John)  y Greedy(y) Brother(Richard,John) it seems obvious that Evil(John), but propositionalization produces lots of facts such as Greedy(Richard) that are irrelevant With p k-ary predicates and n constants, there are p·n k instantiations.

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence The unification algorithm

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence The unification algorithm

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Nono … has some missiles, i.e.,  x Owns(Nono,x)  Missile(x): Owns(Nono,M 1 ) and Missile(M 1 ) … all of its missiles were sold to it by Colonel West Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missiles are weapons: Missile(x)  Weapon(x) An enemy of America counts as "hostile“: Enemy(x,America)  Hostile(x) West, who is American … American(West) The country Nono, an enemy of America … Enemy(Nono,America)

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Forward chaining algorithm

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Forward chaining proof

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Forward chaining proof

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Forward chaining proof

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Properties of forward chaining Sound and complete for first-order definite clauses Datalog = first-order definite clauses + no functions FC terminates for Datalog in finite number of iterations May not terminate in general if α is not entailed This is unavoidable: entailment with definite clauses is semidecidable

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Efficiency of forward chaining Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1  match each rule whose premise contains a newly added positive literal Matching itself can be expensive: Database indexing allows O(1) retrieval of known facts  e.g., query Missile(x) retrieves Missile(M 1 ) Forward chaining is widely used in deductive databases

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Hard matching example Colorable() is inferred iff the CSP has a solution CSPs include 3SAT as a special case, hence matching is NP-hard Diff(wa,nt)  Diff(wa,sa)  Diff(nt,q)  Diff(nt,sa)  Diff(q,nsw)  Diff(q,sa)  Diff(nsw,v)  Diff(nsw,sa)  Diff(v,sa)  Colorable() Diff(Red,Blue) Diff (Red,Green) Diff(Green,Red) Diff(Green,Blue) Diff(Blue,Red) Diff(Blue,Green)

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining algorithm SUBST(COMPOSE(θ 1, θ 2 ), p) = SUBST(θ 2, SUBST(θ 1, p))

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Backward chaining example

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops   fix by checking current goal against every goal on stack Inefficient due to repeated subgoals (both success and failure)   fix using caching of previous results (extra space) Widely used for logic programming

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Prolog Appending two lists to produce a third: append([],Y,Y). append([X|L],Y,[X|Z]) :- append(L,Y,Z). query: append(A,B,[1,2]) ? answers: A=[] B=[1,2] A=[1] B=[2] A=[1,2] B=[]

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Resolution: brief summary Full first-order version: l 1  ···  l k, m 1  ···  m n ( l 1  ···  l i-1  l i+1  ···  l k  m 1  ···  m j-1  m j+1  ···  m n )θ where Unify ( l i,  m j ) = θ. The two clauses are assumed to be standardized apart so that they share no variables. For example,  Rich(x)  Unhappy(x) Rich(Ken) Unhappy(Ken) with θ = {x/Ken} Apply resolution steps to CNF(KB   α); complete for FOL

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Conversion to CNF Everyone who loves all animals is loved by someone:  x [  y Animal(y)  Loves(x,y)]  [  y Loves(y,x)] 1. Eliminate biconditionals and implications  x [  y  Animal(y)  Loves(x,y)]  [  y Loves(y,x)] 2. Move  inwards:  x p ≡  x  p,   x p ≡  x  p  x [  y  (  Animal(y)  Loves(x,y))]  [  y Loves(y,x)]  x [  y  Animal(y)   Loves(x,y)]  [  y Loves(y,x)]  x [  y Animal(y)   Loves(x,y)]  [  y Loves(y,x)]

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Conversion to CNF contd. 3.Standardize variables: each quantifier should use a different one  x [  y Animal(y)   Loves(x,y)]  [  z Loves(z,x)] 4.Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables:  x [Animal(F(x))   Loves(x,F(x))]  Loves(G(x),x) 5.Drop universal quantifiers: [Animal(F(x))   Loves(x,F(x))]  Loves(G(x),x) 6.Distribute  over  : [Animal(F(x))  Loves(G(x),x)]  [  Loves(x,F(x))  Loves(G(x),x)]

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Resolution proof: definite clauses

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Summary Points Previously: FOL, Forward/Backward Chaining, Resolution, Unification Today: Prolog and Decidability  Review: resolution inference rule  Single-resolvent form  General form  Application to logic programming  Review: decidability properties  FOL-SAT  FOL-NOT-SAT (language of unsatisfiable sentences; complement of FOL-SAT)  FOL-VALID  FOL-NOT-VALID  Unification Next Week  Intro to knowledge representation  Ontologies

Computing & Information Sciences Kansas State University Friday, 29 Sep 2006CIS 490 / 730: Artificial Intelligence Terminology Properties of Knowledge Bases (KBs)  Satisfiability and validity  Entailment and provability Properties of Proof Systems  Soundness and completeness  Decidability, semi-decidability, undecidability Resolution Refutation Satisfiability, Validity Prolog: Tricks of The Trade  Demodulation, paramodulation  Unit resolution, set of support, input / linear resolution, subsumption  Indexing (table-based, tree-based)