lecture 10
play

Lecture 10: All men are mortal. Socrates is a man. Even more on - PowerPoint PPT Presentation

CS440/ECE448: Intro to Artificial Intelligence Inference in predicate logic Lecture 10: All men are mortal. Socrates is a man. Even more on Socrates is mortal. predicate logic We need a new version of modus ponens: x P(x)


  1. CS440/ECE448: Intro to Artificial Intelligence � Inference in predicate logic � Lecture 10: 
 All men are mortal. Socrates is a man. Even more on Socrates is mortal. predicate logic � We need a new version of modus ponens: � ∀ x P(x) ! Q(x) Prof. Julia Hockenmaier � P(s’) juliahmr@illinois.edu � !!!!!!!!!! � Q(s’) http://cs.illinois.edu/fa11/cs440 � � � CS440/ECE448: Intro AI � 2 � � How do we deal with 
 quantifiers and variables? � � Prerequisites 
 Solution 1: Propositionalization � Ground all the variables. � for lifted inference: 
 � Skolemization and Solution 2: Lifted inference � Ground (skolemize) all the existentially Unification � quantified variables. All remaining variables are universally quantified. � Use unification. � CS440/ECE448: Intro AI � 3 �

  2. Skolemization: remove The effect of Skolemization � existentially quantified variables � " x " y ! w " z Q(x, y, w, z, G(w, x)) Replace any existentially quantified variable ! x that is in the scope of universally is equivalent to � quantified variables " y 1 … " y n with a new � " x " y " z Q(x, y, P(x, y), z, G(P(x, y), x )) � function F(y 1 ,…,y n ) (a Skolem function ) � where P is the Skolem function for w. Replace any existentially quantified variable ! x that is not in the scope of any universally NB: the Skolem function is a function, 
 quantified variables with a new constant c so this is not decidable anymore. (a Skolem term ) � � CS440/ECE448: Intro AI � 5 � CS440/ECE448: Intro AI � 6 � Universal quantifiers: 
 Substitutions � Modus ponens � A substitution " is a set of pairings of variables v i With propositionalization: � ∀ x human(x) ! mortal(x) human(s’) with terms t i : 
 " = {v 1 /t 1 , v 2 /t 2 , v 3 /t 3 , …, v n / t n } !!!!!!!!!!!!!!! (UI) � human(s’) ! mortal(s’) • Each variable v i is distinct � !!!!!!!!!!!!!!!!!!!!!!!! (MP) • t i can be any term (variable, constant, mortal(s’) function), as long as it does not contain v i � directly or indirectly � How can we match human(s’) and 
 � ∀ x human(x) ! mortal(x) directly? � NB: the order of variables in " doesn ʼ t matter � {x/y, y/f(a)} = {y/f(a), x/y} = {x/f(a), y/f(a)} � CS440/ECE448: Intro AI � 7 �

  3. Unification � Unification � Two sentences # and $ unify to % 
 A set of sentences # 1, … # n unify to % � ( U NIFY ( # , $ ) = % ) 
 if for all i & j : S UBST ( % , # i ) = S UBST ( % , # j ). if % is a substitution such that 
 S UBST ( % , # ) = S UBST ( % , $ ). % is the unifier of # 1, … # n S UBST ( % , # i ) is a unification instance. Example: U NIFY (like(x, M’), like(C’,y)) ={x/C’, y/M’} Do these unify? 
 Standardizing apart � (Single lower case letters are variables) � Unification is not well-behaved if # and $ U NIFY (P(x,y,z), P(w, w, Fred)) contain the same variable: � � % = {x=Fred, y=Fred, z=Fred, w=Fred} U NIFY (like(x, M’), like(C’,x)): fail. We need to standardize # and $ apart 
 Equivalently: % ’ = {x=Fred, w=y, z=Fred , y=x} (rename this variable in one term): � � Both yield P(Fred,Fred,Fred) U NIFY (like(x, M’), like(C’,y)) = {x/C’, y/M’} to yield like(C’,M’) � CS440/ECE448: Intro AI � 11 �

  4. 
 
 Most General Unifier (MGU) � Are there others? � % is the most general unifier (MGU) of # and $ 
 U NIFY (P(x,y,z) , P(w, w, Fred)) if it imposes the fewest constraints. 
 % = {x=Mary, y=Mary, z=Fred, w=Mary} The MGU of # and $ is unique. 
 (modulo alphabetic variants, i.e. different variable names) � Equivalently: % ’ = {x=Mary, w=y, z=Fred , y=x} Applying the MGU to an expression yields a Both yield P(Mary, Mary, Fred) most general unification instance . � We often define U NIFY ( # , $ ) to return MGU( # , $ ) � What is the MGU? � What is the MGU? � M GU ( m(Ann, x, Bob), m(Ann, x, Bob) ): MGU(P(x,y,z), P(w,w,Fred)) m(Ann, x, Bob) M GU ( m(Ann, x, Bob), m(y, x, Chuck) ): fail . % ={x=w, y=w, z=Fred} yields P(w,w,Fred) M GU ( m(Ann, x, Bob), m(y, x, Father-of(Chuck) ): fail. M GU ( p(w, w, Fred) , p(x, y, y) ): Equivalently, % ={x=u, y=u, w=u, z=Fred} p(Fred, Fred, Fred) yields the alphabetic variant P(u,u,Fred) M GU ( q(r, r), q(x, F(x)) ): fail M GU ( r(g(x,Bob),y, y), r(z,g(Fred,w),z) ): r(g(x,Bob), g(Fred,w), g(Fred(w)))

  5. Generalized modus ponens � If p 1 ’…p n ’, p 1 …p n are atomic sentences with Lifted inference: 
 universally quantified variables, and there is a substitution " such that S UBST ( " , p i ’) = S UBST ( " , p i ) Generalized Modus p 1 ’ … p n ’ (p 1 ∧ … ∧ p n ) ' q Ponens 
 !!!!!!!!!!!!!!!!!!! (GMP) S UBST ( " , q) � � CS440/ECE448: Intro AI � 18 � Generalized modus ponens � With a slight abuse of notation…. � S UBST ( " , p 1 ’ ∧ … ∧ p n ’) S UBST ( " , p 1 ’ ∧ … ∧ p n ’) ' S UBST ( " ,q) Another way to look at GMP: � = # = # ' S UBST ( " ,q) !!!!!!!!!!!!!!!!!!!!!!!!!!! (MP) " makes p 1 ’ ∧ … ∧ p n ’ and p 1 ∧ … ∧ p n equal: � S UBST ( " , q) S UBST ( " , p 1 ’ ∧ … ∧ p n ’ ) = S UBST ( " , p 1 ∧ … ∧ p n ) # # � CS440/ECE448: Intro AI � 19 � CS440/ECE448: Intro AI � 20 �

  6. Generalized modus ponens � Generalized modus ponens � Knowledge base: � ∀ x ∀ y[s(x,y) ∧ p(x) ∧ d(y) ! c(x)] p(s’) d(c’) ∀ zs(s’,z) A person that sells drugs is a criminal . � !!!!!!!!!!!!!!!!!!!!!!!!!!! (GMP) � ∀ x ∀ y [s(x,y) ∧ p(x) ∧ d(y) ! c(x)] � S UBST ({x/s’, y/c’, z/c’}, c(x)) Socrates is a person: p(s’) � ( c(s’) Socrates sells anything: ∀ z s(s’,z) � Cannabis is a drug: d(c’) S UBST ({x/s’,y/c’,z/c’}, ∀ x ∀ y[s(x,y) ∧ p(x) ∧ d(y) ! c(x)]) � ( s(s’,c’) ∧ p(s’) ∧ d(t’) ! c(s’) Query: � Is Socrates a criminal? c(s’) � CS440/ECE448: Intro AI � 21 � CS440/ECE448: Intro AI � 22 � Generalized modus ponens � This is a lifted version of modus ponens: 
 it raises modus ponens from ground Inference with GMP: 
 propositional logic to first-order logic. � Forward chaining for � Lifting is more efficient than definite clauses � propositionalization: only necessary substitutions are made. � CS440/ECE448: Intro AI � 23 �

  7. � � � Generalized Modus Ponens 
 First order definite clauses � in definite clause form � Given (p 1 ∧ … ∧ p n ) ' q and p 1 ’ , … , p n ’ Definite clauses have exactly one positive literal. � with U NIFY (p 1 ∧ … ∧ p n, p 1 ’ ∧…∧ p n ’) = " , � � prove q. Implications: � [p 1 (x 1 ,…,x n ) ∧ … ∧ p m (x 1 ,…,x n )] ' q(x 1 ,…,x n ) As def. clause: (p 1 ∧ … ∧ p n ) ' q ( ¬ (p 1 ∧ … ∧ p n ) ∨ q � premise consequent � ( ¬ p 1 ∨…∨ ¬ p n ∨ q ≡ ¬ [p 1 (x 1 ,…,x n ) ∧ … ∧ p m (x 1 ,…,x n )] ∨ q(x 1 ,…,x n ) ≡ ¬ p 1 (x 1 ,…,x n ) ∨ … ∨ ¬ p m (x 1 ,…,x n ) ∨ q(x 1 ,…,x n ) p 1 ’ … p n ’ ¬ p 1 ∨…∨ ¬ p n ∨ q !!!!!!!!!!!!!!!!!!!!!!!! (MP) Facts: q(x 1 ,…,x n ). S UBST ( " , q) CS440/ECE448: Intro AI � 26 � 1. Americans who sell weapons to enemies are In definite clause form � criminals � ∀ x ∀ y ∀ z [(a(x) ∧ w(y) ∧ e(z) ∧ sell(x,y,z)) ' c(x)] 1. ∀ x ∀ y ∀ z [(a(x) ∧ w(y) ∧ e(z) ∧ sell(x,y,z)) ' c(x)] ¬ a(x) ∨ ¬ w(y) ∨ ¬ e (z) ∨ ¬ sell(x,y,z) ∨ c(x) 2. Nono has some weapons. � ∃ x[owns(N’, x) ∧ w(x)]. 2. ∃ x[owns(N’, x) ∧ w(x)]. 2a) owns(N’, M’) 2b) w(M’) 3. Its weapons were sold by West. � ∀ x[(owns(N’, x) ∧ w(x)) ' sell(W’, N’,x)]. 3. ∀ x[(owns(N’, x) ∧ w(x)) ' sell(W’, N’,x)]. ¬ owns(N’, x) ∨ ¬ w(x) ∨ sell(W’, N’,x). 4. West is an American. 5. Nono is an enemy � a(W’) e(N’) 4. a(W’) a(W’) Query: is West a criminal? c(W’) 5. e(N’) e(N’)

  8. Forward chaining: 
 apply GMP, starting from premises � Inference with 
 owns(N,M) w(M) ¬ owns(N,x) ∨¬ w(x) ∨ sell(W,N,x). ──────────────────────────────────── (GMP 2a, 2b, 3) � definite clauses: 
 6. sell(W,N,M). � a(W) e(N) w(M) sell(W,N,M) ¬ a(x) ∨¬ w(y) ∨¬ e(z) ∨¬ sell(x,y,z) ∨ c(x) backward chaining � ──────────────────────────────────── (GMP 4, 5, 2b, 6, 1) 7. c(W). Yes, West is a criminal. � CS440/ECE448: Intro AI � 29 � Backward chaining � Two ways to use modus ponens � Goal: prove that the literal q’ is true. � # ! $ # � !!!! (MP) 1. Find an implication clause ¬ p 1 ∨…∨ ¬ p n ∨ q $ � such that goal q’ unifies with consequent q. Forward: I know that # implies $ . I also know # . U NIFY (q’, q) = " ’ � Hence, I can conclude that $ is true as well. � 2. Apply " ’ to ¬ p 1 ∨…∨ ¬ p n ∨ q. � S UBST ( " ’, ¬ p 1 ∨…∨ ¬ p n ∨ q) = ¬ p’’ 1 ∨…∨ ¬ p’’ n ∨ q’’ � Backward: I want to know whether $ is true. � � I know that # implies $ . Hence, if I can prove # , 3. Find a unifier " ’’ that allows you to prove that I can conclude that $ is true as well. � each literal p’’ i is true. (Recursion!) � CS440/ECE448: Intro AI � 32 �

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