lecture 8 first order back to resolution in predicate
play

Lecture 8: First-order Back to resolution in predicate logic - PowerPoint PPT Presentation

CS440/ECE448: Intro to Artificial Intelligence Lecture 8: First-order Back to resolution in predicate logic propositional logic Prof. Julia Hockenmaier juliahmr@illinois.edu http://cs.illinois.edu/fa11/cs440


  1. CS440/ECE448: Intro to Artificial Intelligence � Lecture 8: 
 First-order 
 Back to resolution in predicate logic � propositional logic � Prof. Julia Hockenmaier � juliahmr@illinois.edu � � http://cs.illinois.edu/fa11/cs440 � � � The resolution rule � Proof by contradiction � How do we prove that " ⊨ # ? Unit resolution: p 1 ∨… ∨ p i-1 ∨ p i ∨ p i+1 ∨… ∨ p n ¬ p i !!!!!!!!!!!!!!!!!!!!!!!!!!!! " entails # (‘ " ⊨ # ’) iff " ∧ ¬ # not satisfiable. p 1 ∨… ∨ p i-1 ∨ p i+1 ∨… ∨ p n � Full resolution: Proof: � " ∧ ¬ # not satisfiable iff ⊨ ¬ ( " ∧ ¬ # ) p 1 ∨… ∨…∨ p i ∨ …∨ …∨ p n q 1 ∨… ∨…∨ ¬ p i ∨ …∨ …∨ q m � ⊨ ¬ ( " ∧ ¬ # ). Assume � � !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ⊨ ¬ " ∨ # ) � p 1 ∨ … ∨ p n ∨ q 1 ∨… ∨…∨ q m �⊨ " ! # . � � � � � Thus, ¬ ( " ∧ ¬ # ) ≡ " ! # . Final step: factoring (remove any duplicate literals from the result A ∨ A ≡ A) � � �

  2. A resolution algorithm � function PLresolution( " , # ) input: formula " , // knowledge base formula # // query Goal: prove " ⊨ # ’ by showing that " ∧ ¬ # is clauses := CNF( " ∧ ¬ # ) not satisfiable ( false ) � new := {} � while true: for each c1, c2 in clauses do Observation: 
 resolvents := resolve( c1, c2) Resolution derives a contradiction ( false ) 
 if ∅ in resolvents then return true; if it derives the empty clause: � new := new ∪ resolvents p i ¬ p i if new ⊆ clauses then return false; !!!!!!! clauses := clauses ∪ new � ∅� � CS440/ECE448: Intro AI � 5 � CS440/ECE448: Intro AI � 6 � Completeness of Resolution � If RC(S) doesn ʼ t contain ∅… ∅… � Resolution closure RC(S): � …S is satisfiable, because we can build a model for its variables p 1 ….p n : � The set of all clauses that can be derived by resolution from a set of clauses S. � � If S is finite, RC(S) is finite. � For i from 1….n: � � � if a clause in RC(S) contains ¬ p i 
 Ground resolution theorem: � � � and all its other literals are false , 
 � If RC(S) contains ∅ , S is not satisfiable. � � then assign false to p i If RC(S) does not contain ∅ , S is satisfiable. � otherwise assign true to p i � � CS440/ECE448: Intro AI � 7 � CS440/ECE448: Intro AI � 8 �

  3. Meet your neighbors! � Task 1: Give a WFF that is � 1. Valid � 2. Satisfiable � A little exercise… � 3. Not valid � 4. Not satisfiable � 5. Satisfiable but not valid � 6. Valid but not satisfiable � Axiom set ! : Derivation of R Task 2: 1. P " Q 1. P " Q ! Is R true? 11. Q MP: 1,9 2. L " R 2. L " R ! Can we prove it 3. Q " R 3. Q " R 12. R MP: 3,11 ! using Modus 4. ¬ L " Z Ponens? 4. ¬ L " Z ! 5. S " L 5. S " L ! 6. P " G #"$ 6. P " G ! 7. ¬ L # 7. ¬ L ! 8. A 8. A ! $ 9. P 9. P ! 10. G 10. G !

  4. Derivation of R Give a WFF that is � 1. P " Q ! 11. Q MP: 1,9 2. L " R ! 3. Q " R 12. R MP: 3,11 P % ¬ P R " R 1. Valid �� ! 2. Satisfiable � P 4. ¬ L " Z ! 3. Not valid � 5. S " L ! P 6. P " G ! 4. Not satisfiable � P & ¬ P 7. ¬ L ! 5. Satisfiable but not valid � P 8. A ! 6. Valid but not satisfiable � 9. P ! Not possible 10. G ! Suppose ! is Satisfiable and ! Entails ' � Validity and Satisfiability � ' Valid ! Satisfiable All possible worlds (models) � What are the possible worlds of ' ? � All WFFs What are the possible worlds of ¬ ' ? � ( not universe of possible worlds!) What are the possible worlds of ( ! & ¬ ' )? �

  5. For all axiom sets we have these relationships E: entailed WFFs D: derivable WFFs Entailment � Sound but Complete but � not not sound E An axiom set ! contains 3 axioms: 
 D E D complete � ! ( & ) i i=1,3 All WFFs All WFFs � ( ! ( ) 1 & ) 2 & ) 3 ) � ) 2 � Neither ) 1 Sound and sound nor E complete D Any WFF that E complete D ) 3 completely includes Possible Worlds this intersection is All WFFs logically entailed All WFFs Shortcomings of 
 Shortcomings of 
 propositional logic � propositional logic � � We want to make generic statements: � There is at least one goal state. � � � (but we don ʼ t know which one….) 
 All humans are mortal. � � � human and mortal are properties � A queen on square X attacks a piece on square Y � if… � x is smaller than x+1 � � x,1 and x+1 refer to entities. 
 � There may be an infinite number of them. 
 � + is a function � � � CS440/ECE448: Intro AI � 19 � CS440/ECE448: Intro AI � 20 �

  6. 
 We need a richer model � We need a richer language � Domain : a set of entities {ann, peter, …,book1,…} Terms: refer to entities � – Variables, constants, functions, � Entities can have properties . 
 � A property defines a (sub)set of entities: 
 Predicates: refer to properties of entities or blue= {book5, mug3, ...} 
 relations between entities � � � There may be relations between entities. 
 Sentences (= propositions) 
 An n -ary relation defines a set of n -ary tuples of can be true or false � entities: belongsTo ={<book5, peter>, <mug3, ann>,…} � � 21 � 22 � So… � We need a more expressive language: � – We need to talk about entities, their properties, and their relations to other entities � First-order 
 predicate logic � We need richer models: � – We need to represent entities, properties, and their relations to other entities � CS440/ECE448: Intro AI � 23 �

  7. 
 Predicate logic � Some examples � John is a student: student(john) Syntax: What is the language of 
 well-formed formulas of predicate logic? � All students take at least one class: � ∀ x student(x) ! ∃ y(class(y) ∧ takes(x,y)) Semantics: What is the interpretation of a well-formed formula in predicate logic? 
 There is a class that all students take: � ∃ y(class(y) ∧ ∀ x (student(x) ! takes(x,y)) Inference rules and algorithms: How can we reason with predicate logic? � � CS440/ECE448: Intro AI � 26 � Terms � Predicates � Terms refer to entities. 
 Unary predicates 
 � define properties of entities: � They can be constants, variables, or n -ary functions applied to n terms: � student(john’) � � � john’, x, fatherOf(john’), N -ary predicates 
 define relations between n entities: � fatherOf(john’, tom’) � CS440/ECE448: Intro AI � 27 � CS440/ECE448: Intro AI � 28 �

  8. Formulas � Quantified formulas � Formulas have truth values. � Universal quantifier ( ʻ for all x ʼ ) � All x are P: ∀ x P(x) � All P are Q: ∀ x P(x) ! Q(x) Atomic formulas consist of an n-ary predicate applied to n terms: 
 � fatherOf(john’, tom’) Existential quantifier ( ʻ there exists an x ʼ ) � There is a P: ∃ x P(x) Formulas can be negated or joined with the same At least one P is a Q: ∃ x P(x) ∧ Q(x) connectives as in propositional logic: � ¬fatherOf(john’, max’); fatherOf(john’, tom’) ∧ fatherOf(ann’, tom’) CS440/ECE448: Intro AI � 29 � CS440/ECE448: Intro AI � 30 � � The syntax of FOL expressions � Why ʻ first order ʼ� Term ⇒ Constant | In first order predicate logic, variables refer Variable | only to entities. We can only quantify over Function(Term,...,Term) entities: ∀ x (P(x) ! Q(x)) Formula ⇒ Predicate(Term, ...Term) | ¬ Formula | In second order predicate logic, variables ∀ Variable Formula | can also refer to predicates. We can now ∃ Variable Formula | quantify over predicates: Formula ∧ Formula | Formula ∨ Formula | ∀ x ∀ Q (P(x) ! Q(x)) Formula $ Formula NB: zero-th order predicate logic = propositional logic � 3 CS440/ECE448: Intro AI � 32 � 1

  9. Quantifier scope � Quantifier scope equivalences � ∀ x (P(x,y) ! Q(x)) * x P(x) & * y Q(y) ( * x * y [P(x) & Q(y)] scope of ∀ * x * y [P(x) & Q(y)] ( * y * x [P(x) & Q(y)] x is bound by ∀ * x P(x) % * y Q(y) ( * x * y [P(x) % Q(y)] y is free. * x * y [P(x) % Q(y)] ( * y * x [P(x) % Q(y)] Variables that are in the scope of a quantifier + x P(x) % + y Q(y) ( + x + y [P(x) % Q(y)] are bound. Otherwise, they are free . � � + x + y [P(x) % Q(y)] ( + y + x [P(x) % Q(y)] � Only formulas without free variables have truth � values (= ʻ sentences/propositions ʼ ) � � � � CS440/ECE448: Intro AI � 33 � 34 � Negation and Quantifiers � Quantifier scope ambiguities � Not all x are P " 
 ʻ for each x there is a y such that P(x,y) ʼ
 � There is at least one x that is not P � * x + y P(x,y) ¬ * x P(x) ( + x ¬ P(x) � is NOT EQUIVALENT to � There is no x that is P " 
 � � All x are not P ʻ there is a y such that for each x P(x,y) ʼ� ¬ + x P(x) ( * x ¬ P(x) + y * x P(x,y) � � � � 35 � 36 �

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend