UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.

Slides:



Advertisements
Similar presentations
Artificial Intelligence 8. The Resolution Method
Advertisements

Resolution Proof System for First Order Logic
First-Order Logic.
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 06 : First Order Logic Resolution Prove.
Standard Logical Equivalences
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: – Constant symbols (i.e., the "individuals"
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Artificial Intelligence
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
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.
Resolution in Propositional and First-Order Logic.
Predicate Calculus Russell and Norvig: Chapter 8,9.
Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus.
Resolution Theorem Prover in First-Order Logic
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.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
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
Inference in First-Order Logic
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
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.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
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.
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.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 17 Wednesday, 01 October.
Resolution Strategies One common strategy for applying resolution is called level saturation. Here you try to resolve every pair of clauses from the original.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 12 Friday, 17 September.
Computing & Information Sciences Kansas State University Lecture 14 of 42 CIS 530 / 730 Artificial Intelligence Lecture 14 of 42 William H. Hsu Department.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Automated Reasoning Systems For first order Predicate Logic.
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.
Reasoning using First-Order Logic
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.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
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.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
1 Introduction to Artificial Intelligence LECTURE 9: Resolution in FOL Theorem Proving in First Order Logic Unification Resolution.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Introduction to Logic for Artificial Intelligence Lecture 2
Artificial Intelligence: Agents and Propositional Logic.
Horn Clauses and Unification
RESOLUTION.
Resolution Proof System for First Order Logic
Resolution Preliminaries
Presentation transcript:

UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004

Last Time SAT checking using DPLL (instantiate, propagate, backtrack) Entailment/SAT checking using Resolution (create more and more clauses until KB is saturated) Formal verification uses mainly SAT checking such as DPLL, but also sometimes resolution

From Homework You Should Know Deduction theorem for FOL Language of FOL Soundness, completeness, and incompleteness theorems Models of FOL

Today Reasoning procedure for FOL –Proving entailment using Resolution Application du jour: Temporal Reasoning Applications we will not touch –Spatial reasoning, formal verification, mathematics, planning, NLP, …

First-Order Theories Signature L: –Function symbols (f(x,y)) –Predicate (relation) symbols (P(x,A)) –Constant symbols (A,B,C,…) FOL language: quantification over objects

Model Theory: Reminder Structure/Interpretation: –U = Universe of elements –I = Mapping of Constant symbols to elements in U Predicate symbols to relations over U Function symbols to functions over U M T - M satisfies T –T is a theory, i.e., a set of FOL sentences in language L for which M is an interpretation ╨

Logical Entailment ? ╨     ╨  L={man, woman, loves} M 1 = U 1 ={Sue,Kim,Pat} I 1 [man]={Pat} I 1 [woman]={Sue,Kim} I 1 [loves]={, } ? M1  ╨ ╨ 

Clausal Form Every FOL formula is consistency- equivalent to conjunction of F.O. clauses. First-order clause –Only universal quantifiers (which are implicit) –Disjunction of literals (atoms or their negation)

Conversion to Clausal Form 1.“  ” replaced by “  ”, ”  ” 2.Negations in front of atoms 3.Standardize variables (unique vars.) 4.Eliminate existentials (Skolemization) 5.Drop all universal quantifiers 6.Move disjunctions in (put into CNF) 7.Rename vars. (standardize vars. apart)

Take a Breath Until now: –First-order logic basics –How to convert a general FOL sentence to clausal form From now: Resolution theorem proving –Search in the space of proofs Later: Temporal reasoning

Resolution Theorem Proving Given: –KB – a set of first-order sentences –Query Q – a logical sentence Calling procedure: 1.Add  Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T.

Resolution Theorem Proving 1.Add  Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Deduction theorem: KB Q iff KB   Q FALSE ╨╨

Resolution Theorem Proving 1.Add  Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Deduction theorem: KB Q iff KB   Q FALSE ╨╨

First-Order Resolution Resolution inference rule: C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) mgu(, ) = {r1,…,rn} C3: (C1’  C2’) {r1,…,rn}

First-Order Resolution Resolution algorithm (saturation): 1.While there are unresolved C1,C2: (1)Select C1, C2 in KB (2)If C1, C2 are resolvable, resolve them into a new clause C3 (3)Add C3 to KB (4)If C3={ } return T. 2.STOP C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) mgu(, ) = {r1,…,rn} C3: (C1’  C2’) {r1,…,rn}

Resolution in Action On board Negated Query KB C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) mgu(, ) = {r1,…,rn} C3: (C1’  C2’) {r1,…,rn}

Resolution in Action On board Negated Query KB C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) mgu(, ) = {r1,…,rn} C3: (C1’  C2’) {r1,…,rn}

First-Order Resolution Resolution algorithm (saturation): 1.While there are unresolved C1,C2: (1)Select C1, C2 in KB (2)If C1, C2 are resolvable, resolve them into a new clause C3 (3)Add C3 to KB (4)If C3={ } return T. 2.STOP C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) mgu(, ) = {r1,…,rn} C3: (C1’  C2’) {r1,…,rn}

First-Order Resolution Rule (2) If C1, C2 are resolvable, resolve them into a new clause C3 If C1,C2 have two literals l1,l2 with same predicates (P) and opposite polarity, and If l1= P(t1,…,tk), l2=  P(s1,…,sk), unifiable with mgu (most general unifier) {r1,…,rn}, then… C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) mgu(, ) = {r1,…,rn} C3: (C1’  C2’) {r1,…,rn}

Unification …P(t1,…,tk),  P(s1,…,sk), unifiable with mgu (most general unifier) σ={r1,…rk} Substitution: replace vars. by terms –Term: constant, variable, or a function of terms Composition of substitutions {x/g(w,v)} {w/A,v/f(B,z)} = {x/g(A,f(B,z),w/A,v/f(B,z)} (P(x) v Q(f(x)) v P(g(B,x)) v P(f(y))) {x/B,y/z} (P(B) v Q(f(B)) v P(g(B,B)) v P(f(z))) {x/B,y/z}{x/B,y/z,x/w}{x/B,y/z,z/w}

Unification Unification: find a substitution σ for C1: P(t1,…,tk)  C1’(t1,…,tk) C2:  P(s1,…,sk)  C2’(s1,…,sk) such that P(t1,…,tk)σ = P(s1,…,sk)σ P(A,y,g(x,y)){y/f(A)} = P(z,f(z),g(x,f(w))){z/A,w/A} σ={y/f(A),z/A,w/A} P(A,y,g(x,y)){y/f(w)} = P(z,f(w),g(x,f(w))){z/A} σ={y/f(w),z/A} Most general unifier

Unification Substitution σ1 more general than σ2 if there is substitution γ such that σ1 γ = σ2 P(A,y,g(x,y)){y/f(A)} = P(z,f(z),g(x,f(w))){z/A,w/A} σ={y/f(A),z/A,w/A} P(A,y,g(x,y)){y/f(w)} = P(z,f(w),g(x,f(w))){z/A} σ={y/f(w),z/A} Most general unifier

Unification Substitution σ1 more general than σ2 if there is substitution γ such that σ1 γ = σ2 σ2={y/f(A),z/A,w/A} σ1={y/f(w),z/A} Most general unifier γ={w/A}

Finding the MGU Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,w))

Finding the MGU Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,w))

Finding the MGU Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,w))

Finding the MGU Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,w))

Finding the MGU Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,w))

part(3,x) = y part(3,y) = f(w)part(1,x) = P part(1,y) = Ppart(2,x) = A part(2,y) = z Finding the MGU Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,w)) part(4,x) = g(x,f(w)) part(4,y) = g(v,w) F Occurs check

Finding the MGU: another example Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,f(w)))

Finding the MGU: another example Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,f(w)))

Finding the MGU: another example Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,f(w)))

Finding the MGU: another example Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,f(w)))

Finding the MGU: another example Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ x = P(A,y,g(x,y)) y = P(z,f(w),g(v,f(w)))

part(3,x) = y part(3,y) = f(w)part(1,x) = P part(1,y) = Ppart(2,x) = A part(2,y) = z Finding the MGU: another example Procedure MGU(x,y) 1.If x=y, return { } 2.If x or y are vars., return MGUvar(x,y) 3.If x or y are const.,or Len(x)=/=Len(y), return F. 4.σ ← { }; For i ← 1 to Len(x) 1.s ← MGU(part(i,x),part(i,y)); if s=F, return F. 2.σ ← compose(σ,s); x ← subst(x,σ); y ← subst(y,σ); 5.Return σ part(4,x) = g(x,f(w)) part(4,y) = g(v,f(w)) σ={y/f(w),z/A,v/x} x = P(A,y,g(x,y)) y = P(z,f(w),g(v,f(w)))

Correctness of FOL Resolution Soundness: Resolution is sound for first- order inference Refutation Completeness: Resolution will find the empty clause, if FALSE is entailed No guarantee of termination (saturation), if FALSE not entailed: FOL semi-decidable

Simple Efficiency Improvements Subsumption between clauses: –If clause C subsumes clause D (C entails D), then we can remove D from the KB. {P(A)}{P(A),P(B)} {P(A)}{~P(A)} {P(f(x),A),Q(g(x),B)}{P(f(v),y),Q(g(v),y)} Algorithm for checking subsumption? ╨ ╨ ╨ {P(A)}{P(t)} ╨

Simple Efficiency Improvements Subsumption within the clause: –If literal a subsumes literal b (a entails b), then we can remove a from the clause… –But, notice the variables’ scope {P(A),P(t)} {P(A),~P(B),P(t)} {P(A,x),P(y,B)} {P(x),Q(x),P(A)} {P(A)} {P(A),~P(B)} {P(A,x),P(y,B)} {P(x),Q(x),P(A)}

Properties of Resolution Unifying two literals of length n O(n 2 ) – because of occurs check Finding two resolvable clauses from m clauses of length n: O(m 2 n 2 ) – the simple bound Overall algorithm: –Semi-decidable –Unbounded length of proof as function of n,m

Related to FOL Resolution Clause selection and restriction strategies for resolution (lecture #5, paper #19) Consequence finding (paper #3) Constraint Satisfaction Problem (paper #5) Reasoning with equality (paper #6) DPLL in FOL (paper #7) Decidable fragments of FOL (paper #8)

Summary So Far Resolution theorem proving allows us to find contradictions and explanation. –The deduction theorem tells us how to ask queries from Resolution Next: Temporal Reasoning

Situation Calculus A first-order language for describing the effects of actions and events over time –Constants: S0 – initial state; action constants –Functions: result(, ) –Predicates: “fluents” – properties that change over time at(1, S0) at(x,s)  at(x+1,result(move_fwd,s)) Query: at(1+1,s’)   ans(s’) ?  at(1+1,s’)  ans(s’)

Situation Calculus Requires axioms describing effects and non-effects of actions/events Can be used for planning, projection, diagnosis, filtering (tracking) Frame Problem: the compact and natural- language-like specification of effects of actions Qualification Problem: the preconditions of actions

Notations Substitutions –φσ σ = {x1/t1,…,xk/tk} –φ σ σ = [x1/t1,…,xk/tk]

Next Time Description Logics Requires prior knowledge of: –FOL theorem proving –Tableau theorem proving – will be useful –Frame systems – will be useful