First Order(Predicate)Logic
Transcript of First Order(Predicate)Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 180
983107983144983137983152983156983141983154 983088983096
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139
Instructor
LE Thanh Sach PhD
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 280
Artificial Intelligence Predicate Logic Slide 2
983113983150983155983156983154983157983139983156983151983154991257983155 983113983150983142983151983154983149983137983156983145983151983150
LE Thanh Sach PhDOffice
Department of Computer Science
Faculty of Computer Science and Engineering
HoChiMinh City University of Technology
Office Address
268 LyThuongKiet Str Dist 10 HoChiMinh City
VietnamE-mail LTSACHcsehcmuteduvn
E-home httpcsehcmuteduvn~ltsach
Tel (+84) 83-864-7256 (Ext 5839)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 380
Artificial Intelligence Predicate Logic Slide 3
983105983139983147983150983151983159983148983141983140983143983149983141983150983156
The slides in this PPT file are composed using thematerials supplied by
Prof Stuart Russell and Peter Norvig They
are currently from University of CaliforniaBerkeley They are also the author of the book ldquoArtificial Intelligence A Modern Approachrdquo whichis used as the textbook for the course
Prof Tom Lenaerts from Universiteacute Libre deBruxelles
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 480
Artificial Intelligence Predicate Logic Slide 4
983119983157983156983148983145983150983141
Why FOLSyntax and semantics of FOL
Using FOL
Wumpus world in FOL
Knowledge engineering in FOL
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 580
Artificial Intelligence Predicate Logic Slide 5
983127983144983161 983110983119983116983103983120983154983151983155 983137983150983140 983139983151983150983155 983151983142 983152983154983151983152983151983155983145983156983145983151983150983137983148 983148983151983143983145983139
Propositional logic is declarative
Propositional logic allows partialdisjunctivenegated information
(unlike most data structures and databases)
Propositional logic is compositional meaning of B 11 and P 12 is derived from meaning of B 11 and of P 12
Meaning in propositional logic is context-
independent
(unlike natural language where meaning depends on context)
Propositional logic has very limited expressive power (unlike natural language) Eg cannot say pits cause breezes in adjacent squaresldquo
983141983160983139983141983152983156 983138983161 983159983154983145983156983145983150983143 983151983150983141 983155983141983150983156983141983150983139983141 983142983151983154 983141983137983139983144 983155983153983157983137983154983141
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 680
Artificial Intelligence Predicate Logic Slide 6
983127983144983161 983110983119983116983103983110983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Whereas propositional logic assumes the worldcontains facts
first-order logic (like natural language) assumes
the world containsObjects people houses numbers colors baseballgames wars hellip
Relations red round prime brother of bigger
than part of comes between hellipFunctions father of best friend one more than
plus hellip
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 280
Artificial Intelligence Predicate Logic Slide 2
983113983150983155983156983154983157983139983156983151983154991257983155 983113983150983142983151983154983149983137983156983145983151983150
LE Thanh Sach PhDOffice
Department of Computer Science
Faculty of Computer Science and Engineering
HoChiMinh City University of Technology
Office Address
268 LyThuongKiet Str Dist 10 HoChiMinh City
VietnamE-mail LTSACHcsehcmuteduvn
E-home httpcsehcmuteduvn~ltsach
Tel (+84) 83-864-7256 (Ext 5839)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 380
Artificial Intelligence Predicate Logic Slide 3
983105983139983147983150983151983159983148983141983140983143983149983141983150983156
The slides in this PPT file are composed using thematerials supplied by
Prof Stuart Russell and Peter Norvig They
are currently from University of CaliforniaBerkeley They are also the author of the book ldquoArtificial Intelligence A Modern Approachrdquo whichis used as the textbook for the course
Prof Tom Lenaerts from Universiteacute Libre deBruxelles
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 480
Artificial Intelligence Predicate Logic Slide 4
983119983157983156983148983145983150983141
Why FOLSyntax and semantics of FOL
Using FOL
Wumpus world in FOL
Knowledge engineering in FOL
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 580
Artificial Intelligence Predicate Logic Slide 5
983127983144983161 983110983119983116983103983120983154983151983155 983137983150983140 983139983151983150983155 983151983142 983152983154983151983152983151983155983145983156983145983151983150983137983148 983148983151983143983145983139
Propositional logic is declarative
Propositional logic allows partialdisjunctivenegated information
(unlike most data structures and databases)
Propositional logic is compositional meaning of B 11 and P 12 is derived from meaning of B 11 and of P 12
Meaning in propositional logic is context-
independent
(unlike natural language where meaning depends on context)
Propositional logic has very limited expressive power (unlike natural language) Eg cannot say pits cause breezes in adjacent squaresldquo
983141983160983139983141983152983156 983138983161 983159983154983145983156983145983150983143 983151983150983141 983155983141983150983156983141983150983139983141 983142983151983154 983141983137983139983144 983155983153983157983137983154983141
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 680
Artificial Intelligence Predicate Logic Slide 6
983127983144983161 983110983119983116983103983110983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Whereas propositional logic assumes the worldcontains facts
first-order logic (like natural language) assumes
the world containsObjects people houses numbers colors baseballgames wars hellip
Relations red round prime brother of bigger
than part of comes between hellipFunctions father of best friend one more than
plus hellip
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 380
Artificial Intelligence Predicate Logic Slide 3
983105983139983147983150983151983159983148983141983140983143983149983141983150983156
The slides in this PPT file are composed using thematerials supplied by
Prof Stuart Russell and Peter Norvig They
are currently from University of CaliforniaBerkeley They are also the author of the book ldquoArtificial Intelligence A Modern Approachrdquo whichis used as the textbook for the course
Prof Tom Lenaerts from Universiteacute Libre deBruxelles
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 480
Artificial Intelligence Predicate Logic Slide 4
983119983157983156983148983145983150983141
Why FOLSyntax and semantics of FOL
Using FOL
Wumpus world in FOL
Knowledge engineering in FOL
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 580
Artificial Intelligence Predicate Logic Slide 5
983127983144983161 983110983119983116983103983120983154983151983155 983137983150983140 983139983151983150983155 983151983142 983152983154983151983152983151983155983145983156983145983151983150983137983148 983148983151983143983145983139
Propositional logic is declarative
Propositional logic allows partialdisjunctivenegated information
(unlike most data structures and databases)
Propositional logic is compositional meaning of B 11 and P 12 is derived from meaning of B 11 and of P 12
Meaning in propositional logic is context-
independent
(unlike natural language where meaning depends on context)
Propositional logic has very limited expressive power (unlike natural language) Eg cannot say pits cause breezes in adjacent squaresldquo
983141983160983139983141983152983156 983138983161 983159983154983145983156983145983150983143 983151983150983141 983155983141983150983156983141983150983139983141 983142983151983154 983141983137983139983144 983155983153983157983137983154983141
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 680
Artificial Intelligence Predicate Logic Slide 6
983127983144983161 983110983119983116983103983110983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Whereas propositional logic assumes the worldcontains facts
first-order logic (like natural language) assumes
the world containsObjects people houses numbers colors baseballgames wars hellip
Relations red round prime brother of bigger
than part of comes between hellipFunctions father of best friend one more than
plus hellip
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 480
Artificial Intelligence Predicate Logic Slide 4
983119983157983156983148983145983150983141
Why FOLSyntax and semantics of FOL
Using FOL
Wumpus world in FOL
Knowledge engineering in FOL
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 580
Artificial Intelligence Predicate Logic Slide 5
983127983144983161 983110983119983116983103983120983154983151983155 983137983150983140 983139983151983150983155 983151983142 983152983154983151983152983151983155983145983156983145983151983150983137983148 983148983151983143983145983139
Propositional logic is declarative
Propositional logic allows partialdisjunctivenegated information
(unlike most data structures and databases)
Propositional logic is compositional meaning of B 11 and P 12 is derived from meaning of B 11 and of P 12
Meaning in propositional logic is context-
independent
(unlike natural language where meaning depends on context)
Propositional logic has very limited expressive power (unlike natural language) Eg cannot say pits cause breezes in adjacent squaresldquo
983141983160983139983141983152983156 983138983161 983159983154983145983156983145983150983143 983151983150983141 983155983141983150983156983141983150983139983141 983142983151983154 983141983137983139983144 983155983153983157983137983154983141
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 680
Artificial Intelligence Predicate Logic Slide 6
983127983144983161 983110983119983116983103983110983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Whereas propositional logic assumes the worldcontains facts
first-order logic (like natural language) assumes
the world containsObjects people houses numbers colors baseballgames wars hellip
Relations red round prime brother of bigger
than part of comes between hellipFunctions father of best friend one more than
plus hellip
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 580
Artificial Intelligence Predicate Logic Slide 5
983127983144983161 983110983119983116983103983120983154983151983155 983137983150983140 983139983151983150983155 983151983142 983152983154983151983152983151983155983145983156983145983151983150983137983148 983148983151983143983145983139
Propositional logic is declarative
Propositional logic allows partialdisjunctivenegated information
(unlike most data structures and databases)
Propositional logic is compositional meaning of B 11 and P 12 is derived from meaning of B 11 and of P 12
Meaning in propositional logic is context-
independent
(unlike natural language where meaning depends on context)
Propositional logic has very limited expressive power (unlike natural language) Eg cannot say pits cause breezes in adjacent squaresldquo
983141983160983139983141983152983156 983138983161 983159983154983145983156983145983150983143 983151983150983141 983155983141983150983156983141983150983139983141 983142983151983154 983141983137983139983144 983155983153983157983137983154983141
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 680
Artificial Intelligence Predicate Logic Slide 6
983127983144983161 983110983119983116983103983110983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Whereas propositional logic assumes the worldcontains facts
first-order logic (like natural language) assumes
the world containsObjects people houses numbers colors baseballgames wars hellip
Relations red round prime brother of bigger
than part of comes between hellipFunctions father of best friend one more than
plus hellip
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 680
Artificial Intelligence Predicate Logic Slide 6
983127983144983161 983110983119983116983103983110983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Whereas propositional logic assumes the worldcontains facts
first-order logic (like natural language) assumes
the world containsObjects people houses numbers colors baseballgames wars hellip
Relations red round prime brother of bigger
than part of comes between hellipFunctions father of best friend one more than
plus hellip
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 780
Artificial Intelligence Predicate Logic Slide 7
983120983154983141983152983151983155983145983156983145983151983150983137983148 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
MORTALMANAll men are mortal
PLATOMANPlato is a man
SOCRATESMANSocrates is a manSentence in Prepositional LogicSentence in natural language
Disadvantages1 Socrates and Plato are human but the representation is not similar
2 Can not state that each person is mortal Difficult for reasoning
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 880
Artificial Intelligence Predicate Logic Slide 8
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
forallX (man(X) mortal(X))All men are mortal
man(plato)Plato is a man
man(socrates)Socrates is a man
Sentence in Predicate LogicSentence in natural language
Using predicate logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 980
Artificial Intelligence Predicate Logic Slide 9
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
Ability of reasoning
All men are mortal Socrates is mortal
Socrates is a man
ConclusionSentence in natural language
forallX (man(X) mortal(X))mortal(socrates)
man(socrates)
ConclusionSentence in Predicate Logic
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1080
Artificial Intelligence Predicate Logic Slide 10
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983137983149983152983148983141983155
13 MPmortal(socrates)4
man(socrates)mortal(socrates)
forallX (man(X) mortal(X))
man(socrates)
Representation
2 X= ldquosocratesrdquo UI3
Axiom2
Axiom1
Rule
Socrates is mortal
Backward mapping (to natural language)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1180
Artificial Intelligence Predicate Logic Slide 11
983123983161983150983156983137983160 983151983142 983110983119983116983098 983106983137983155983145983139 983141983148983141983149983141983150983156983155
Constants KingJohn 2 NUS
Predicates Brother gt
Functions
Sqrt LeftLegOf Variables
x y a b
Connectives not rArr and or hArr
Equality =
Quantifiers Universal Quantifier forall
Existential Quantifier exist
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1280
Artificial Intelligence Predicate Logic Slide 12
983105983156983151983149983145983139 983155983141983150983156983141983150983139983141983155
Term function (term1termn)or constant or variable
Atomic sentence predicate (term1termn)
or term1 = term
2
Eg
Brother(KingJohnRichardTheLionheart) gt (Length(LeftLegOf(Richard)) Length(LeftLegOf(KingJohn)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1380
Artificial Intelligence Predicate Logic Slide 13
983107983151983149983152983148983141983160 983155983141983150983156983141983150983139983141983155
Complex sentences are made from atomic sentences usingconnectives examples notS
S1 and S2
S1 or S2
S1rArr S2
S1 hArr S2
Eg Sibling(KingJohnRichard) rArr Sibling(RichardKingJohn)
gt(12) or le (12)
gt(12) and not gt(12)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1480
Artificial Intelligence Predicate Logic Slide 14
983124983154983157983156983144 983145983150 983142983145983154983155983156983085983151983154983140983141983154 983148983151983143983145983139
Sentences are true with respect to a model and an interpretation
Model contains objects (domain elements ) and relations among them
Interpretation specifies referents forconstant symbols rarr objects
predicate symbols rarr relations
function symbols rarr functional relations
An atomic sentence predicate(term1 termn) is true
iff the objects referred to by term1 termn
are in the relation referred to by predicate
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1580
Artificial Intelligence Predicate Logic Slide 15
983125983150983145983158983141983154983155983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
forallltvariablesgt ltsentence gt
Everyone at NUS is smart
forallx At(xNUS)rArr Smart(x )
forallx P is true in a model m iff P is true with x being each possible object
in the model Roughly speaking equivalent to the conjunction of instantiations of
P
983105983156983080983115983145983150983143983114983151983144983150983084983118983125983123983081rArr 983123983149983137983154983156983080983115983145983150983143983114983151983144983150983081
and 983105983156983080983122983145983139983144983137983154983140983084983118983125983123983081rArr 983123983149983137983154983156983080983122983145983139983144983137983154983140983081
and 983105983156983080983118983125983123983084983118983125983123983081rArr 983123983149983137983154983156983080983118983125983123983081and 983086983086983086
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1680
Artificial Intelligence Predicate Logic Slide 16
983105 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
TypicallyrArr is the main connective with forall
Common mistake using and as the main connective with forall
forallx At(xNUS) and Smart(x)
means ldquoEveryone is at NUS and everyone is smartrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1780
Artificial Intelligence Predicate Logic Slide 17
983109983160983145983155983156983141983150983156983145983137983148 983153983157983137983150983156983145983142983145983139983137983156983145983151983150
existltvariablesgt ltsentencegt
Someone at NUS is smart
exist x At(xNUS) and Smart(x )$
exist x P is true in a model m iff P is true with x being some possible object
in the model Roughly speaking equivalent to the disjunction of instantiations of P
At(KingJohnNUS) and Smart(KingJohn)or At(RichardNUS) and Smart(Richard)or At(NUSNUS) and Smart(NUS)or
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1880
Artificial Intelligence Predicate Logic Slide 18
983105983150983151983156983144983141983154 983139983151983149983149983151983150 983149983145983155983156983137983147983141 983156983151 983137983158983151983145983140
Typically and is the main connective with exist
Common mistake usingrArr as the main connective with
exist
exist x At(xNUS)rArr Smart(x
)is true if there is anyone who is not at NUS
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 1980
Artificial Intelligence Predicate Logic Slide 19
983120983154983151983152983141983154983156983145983141983155 983151983142 983153983157983137983150983156983145983142983145983141983154983155
forallx forally is the same as forally forallx
existx existy is the same as existy existx
existx forally is not the same as forally existx
existx forally Loves(xy) ldquoThere is a person who loves everyone in the worldrdquo
forally existx Loves(xy) ldquoEveryone in the world is loved by at least one personrdquo
Quantifier duality each can be expressed using the other
forallx Likes(xIceCream) notexistx notLikes(xIceCream )
existx Likes(xBroccoli) notforallx notLikes(xBroccoli
)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2080
Artificial Intelligence Predicate Logic Slide 20
983109983153983157983137983148983145983156983161
term1 = term2 is true under a given interpretation if andonly if term1 and term2 refer to the same object
Eg definition of Sibling in terms of Parent
forallxy Sibling(xy) hArr [not(x = y) and existmf not (m = f) and Parent(mx)and Parent(fx) and Parent(my) and Parent(fy)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2180
Artificial Intelligence Predicate Logic Slide 21
983125983155983145983150983143 983110983119983116
The kinship domain Brothers are siblings
forallxy Brother(xy) hArr Sibling(xy)
Ones mother is ones female parent
forallmc Mother(c) = m hArr (Female(m) and Parent(mc))
ldquoSiblingrdquo is symmetric
forallxy Sibling(xy) hArr Sibling(yx)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2280
Artificial Intelligence Predicate Logic Slide 22
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Representing the following sentences in Predicate Logic
1 Marcus was a man
2 Macus was a Pompeian
3 All Pompians were Romans4 Caesar was a ruler
5 All Romans were either loyal to Caesar or hated hime
6 Everyone is loyal to someone
7 People only try to assassinate rulers they are not loyal to
8 Marcus tried to assassinate Caesar
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2380
Artificial Intelligence Predicate Logic Slide 23
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
1 Marcus was a man
man(Marcus)
2 Macus was a Pompeian
Pompeian(Marcus)
3 All Pompeians were Romans
forallX Pompeian(X) Roman(X)
4 Caesar was a ruler
ruler(Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2480
Artificial Intelligence Predicate Logic Slide 24
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
5 All Romans were either loyal to Caesar or hated hime
ldquoorrdquo mean ldquoinclusive orrdquo - OR
forallX Roman(X) loyalto(X Caesar) v hate(X Caesar)
ldquoorrdquo mean ldquoexclusive orrdquo - XOR
forallX Roman(X) [ (loyalto(X Caesar) v hate(X Caesar)) ^
not(loyalto(X Caesar) ^ hate(X Caesar))]
or
forallX Roman(X) [ (loyalto(X Caesar) ^ nothate(X Caesar)) v
(notloyalto(X Caesar) ^ hate(X Caesar))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2580
Artificial Intelligence Predicate Logic Slide 25
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
6 Everyone is loyal to someone
forallX exist Y loyalto(XY)
7 People only try to assassinate rulers they are not loyal toforallX forall Y person(X) ^ ruler(Y) ^ tryassassinate(XY)notloyalto(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2680
Artificial Intelligence Predicate Logic Slide 26
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
8 Marcus tried to assassinate Caesartryassassinate(Marcus Caesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2780
Artificial Intelligence Predicate Logic Slide 27
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983122983141983152983154983141983155983141983150983156983137983156983145983151983150
Given the above sentences can we make aconclusion as follows
ldquoMarcus was not loyal to Caesar rdquo
or
notloyalto(MarcusCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2880
Artificial Intelligence Predicate Logic Slide 28
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)
(Rule What)
Add an implicit sentence
9 ldquoAll men are peoplerdquo
or
forallforallforallforallX man(X) X man(X) person(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 2980
Artificial Intelligence Predicate Logic Slide 29
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983120983154983151983151983142
notloyalto(MarcusCaesar)
person(Marcus) ruler(Caesar) tryassassinate(Marcus Caesar)
(7 Substitute)
(4) (8)(9 Substitute)
man(Marcus)
(1)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3080
Artificial Intelligence Predicate Logic Slide 30
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
How to represent exceptions example
ldquoPaulus was a Pompeian Paulus was neitherloyal nor hated Caesarrdquo
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3180
Artificial Intelligence Predicate Logic Slide 31
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation Semantic Net Simple by adding links
(properties) to subclasses or instances
Predicate Logic Not so simple like
983120983151983149983152983141983145983137983150(983120983137983157983148983157983155) 983134 983212983131983148983151983161983137983148983156983151(983120983137983157983148983157983155 983107983137983141983155983137983154) 983158
983144983137983156983141(983120983157983137983148983157983155 983107983137983141983155983137983154)983133
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3280
Artificial Intelligence Predicate Logic Slide 32
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation983118983151983156 983155983151 983155983145983149983152983148983141 983106983141983139983137983157983155983141 983156983144983141983154983141 983145983155 983139983151983150983142983148983145983139983156 983138983141983156983159983141983141983150983098
Pompeian(Paulus) ^ not[loyalto(Paulus Caesar) vhate(Pualus Caesar)]
983137983150983140
forallX Pompeian(X) loyalto(X Caesar) v hate(XCaesar)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3380
Artificial Intelligence Predicate Logic Slide 33
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098 983109983160983139983141983152983156983145983151983150
Exception representation A Better way
forallX Roman(X) ^ noteq(X Paulus) loyalto(X Caesar)v hate(X Caesar
Exception
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3480
Artificial Intelligence Predicate Logic Slide 34
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
In the case of describing relations betweennumbers example 1 983100 2
2 983100983091
983095 983102 983091 +2 983091 983102 1
991270
rArr
983123983144983151983157983148983140 983150983151983156 983141983160983152983148983145983139983145983156983148983161 983140983141983155983139983154983145983138983141983098983148983156(12) 983148983156(2983091) 991270
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3580
Artificial Intelligence Predicate Logic Slide 35
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141
rArr Need functions and computable predicates
rArr For example 983107983137983148983148 983137 983142983157983150983139983156983145983151983150 983156983151 983139983151983149983152983157983156983141 (983091+2)
983120983137983155983155 983156983144983141 983154983141983155983157983148983156 983156983151 983156983144983141 983152983154983141983140983145983139983137983156983141 991260983143983156991261983098 983143983156(983095 983091+2)
983111983141983156 983156983144983141 983142983145983150983137983148 983154983141983155983157983148983156 (983124983154983157983141)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3680
Artificial Intelligence Predicate Logic Slide 36
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
1 Marcus was a man
man(Marcus)
2 Marcus was a PompeianPompeian(Marcus)
3 Marcus was born in 40 AD
born(Marcus40)
4 All men are mortal
forallX man(X) mortal(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3780
Artificial Intelligence Predicate Logic Slide 37
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Facts
5 All Pompeian died when the vocano erupted in 79 AD
erupted(vocano 79) ^ forallX [Pompeian(X) died(X 79)]
6 No mortal lives longer then 150 yearsforallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
7 It is now 1991now = 1991
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3880
Artificial Intelligence Predicate Logic Slide 38
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Question
Is Marcus alive
Or
alive(Marcus now)
ornotnotnotnotalive(Marcus now)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 3980
Artificial Intelligence Predicate Logic Slide 39
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge
Relation between ldquodeadrdquo and ldquoaliverdquo
8 Alive means not deadforallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4080
Artificial Intelligence Predicate Logic Slide 40
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Add implicit knowledge Time properties of an event for example ldquodeadrdquo
9 Is someone dies the he is dead at all later times
forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4180
Artificial Intelligence Predicate Logic Slide 41
983120983154983141983140983145983139983137983156983141 983116983151983143983145983139983098983110983157983150983139983156983145983151983150 983083 983107983151983149983152983157983156983137983138983148983141 983120983154983141983140983145983139983137983156983141983084 983109983160983137983149983152983148983141
Summary of facts1 man(Marcus)
2 Pompeian(Marcus)
3 born(Marcus 40)
4 forallX man(X) mortal(X)
5 forallX Pompeian(X) died(X 79)
6 erupted(volcano 79)
7 forallX forallT1 forallT2 mortal(X) ^ born(X T1) ^ gt(T2 ndash T1 150) dead(X T2)
8 now = 19919 forallX forallT [alive(XT) notdead(XT)] ^
[notdead(XT) alive(XT)]
10 forallX forallT1 forallT2 died(XT1) ^ gt(T2 T1) dead(X T2)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4280
Artificial Intelligence Predicate Logic Slide 42
notalive(Marcus now)
dead(Marcus now)
(9 Substitute)
died(Marcus T1) gt(now T1)
(10 Substitute)
Pompeian(Marcus) gt(now 79)
(5 Substitute)(5 Substitute)
(2)gt(1991 79)
(8 Substitute)
(computation)
ss
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4380
Artificial Intelligence Predicate Logic Slide 43
983125983150983145983158983141983154983155983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983125983113)
Every instantiation of a universally quantified sentence is enta iled by it
forallv α
Subst(vg α)
for any variable v and ground term g
Eg forallx King( x) and Greedy( x)rArr Evil( x
) yieldsKing (John ) and Greedy (John ) rArr Evil (John )
King (Richard ) and Greedy (Richard ) rArr Evil (Richard )
King (Father (John )) and Greedy (Father (John )) rArr Evil (Father (John ))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4480
Artificial Intelligence Predicate Logic Slide 44
983109983160983145983155983156983141983150983156983145983137983148 983145983150983155983156983137983150983156983145983137983156983145983151983150 (983109983113)
For any sentence α variable v and constant symbol k that
does not
appear elsewhere in the knowledge baseexistv α
Subst(vk α )
Eg exist x Crown( x) and OnHead ( xJohn) yields
Crown(C 1) and OnHead (C 1 John )
provided C 1 is a new constant symbol called a Skolemconstant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4580
Artificial Intelligence Predicate Logic Slide 45
983122983141983140983157983139983156983145983151983150 983156983151 983152983154983151983152983151983155983145983156983145983151983150983137983148 983145983150983142983141983154983141983150983139983141
Suppose the KB contains just the followingforall
x King(x)and
Greedy(x)rArr
Evil(x)King(John)Greedy(John)Brother(RichardJohn)
Instantiating the universal sentence in all possible ways we haveKing(John) and Greedy(John) rArr Evil(John)King(Richard) and Greedy(Richard) rArr Evil(Richard)King(John)Greedy(John)Brother(RichardJohn
)
The new KB is propositionalized proposition symbols are
King(John) Greedy(John) Evil(John) King(Richard
) etc
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4680
Artificial Intelligence Predicate Logic Slide 46
983122983141983140983157983139983156983145983151983150 983139983151983150983156983140983086
Every FOL KB can be propositionalized so as to preserve entailment
(A ground sentence is entailed by new KB iff entailed by originalKB)
Idea propositionalize KB and query apply resolution return result
Problem with function symbols there are infinitely many ground
terms
eg Father (Father (Father (John
)))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4780
Artificial Intelligence Predicate Logic Slide 47
983122983141983155983151983148983157983156983145983151983150
Convert to clause form exampleldquoAll Romans who know Marcus either hate
Caesar or think that anyone who hates anyone is
crazyrdquo
forallX [roman(X) ^ know(X Marcus)]
[hate(X Ceasar) v(forallY existZ hate(YZ)
thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4880
Artificial Intelligence Predicate Logic Slide 48
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 4980
Artificial Intelligence Predicate Logic Slide 49
983122983141983155983151983148983157983156983145983151983150
1 Remove
using the equivalence a b = nota v b
forallX [roman(X) ^ know(X Marcus)][hate(X Ceasar) v
(forallY existZ hate(YZ) thinkcrazy(XY))]
=
forallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5080
Artificial Intelligence Predicate Logic Slide 50
983122983141983155983151983148983157983156983145983151983150
2 Move not next to terms
Using the following equivalence
a Double negative
not(notp) = p
b DeMorgan
not(a v b) = nota ^ notb
not(a ^ b) = nota v notb
c Equivalence of qualifiers notforallX P(X) = existX notP(X)
notexistX P(X) = forallX notP(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5180
Artificial Intelligence Predicate Logic Slide 51
983122983141983155983151983148983157983156983145983151983150
2 Move not next to termsforallX not[roman(X) ^ know(X Marcus)] v
[hate(X Ceasar) v
(forallY not(existZ hate(YZ)) v thinkcrazy(XY))]
=
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) vthinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5280
Artificial Intelligence Predicate Logic Slide 52
983122983141983155983151983148983157983156983145983151983150
3 Change name of variables as follows
forallX P(X) v forallX Q(X)
=forallX P(X) v forallY Q(Y)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5380
Artificial Intelligence Predicate Logic Slide 53
983122983141983155983151983148983157983156983145983151983150
4 Move qualifier to left donrsquot change the their order
forallX [notroman(X) v notknow(X Marcus)]v
[hate(X Ceasar) v
(forallY forallZ nothate(YZ) v
thinkcrazy(XY))]
=
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5480
Artificial Intelligence Predicate Logic Slide 54
983122983141983155983151983148983157983156983145983151983150
5 Replace existence qualifier using Skolem
function as follows
Skolem Function
forallX forallY existZ P(XYZ)
=
forallX forallY P(XYf(XY)) Variable of existence qualifier = function of all
the preceding variables in the every qualifier
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5580
Artificial Intelligence Predicate Logic Slide 55
983122983141983155983151983148983157983156983145983151983150
6 Remove every qualifiers (the default qualifier is
every)
forallXforallYforallZ [notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
=
[notroman(X) v notknow(X Marcus)] v[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5680
Artificial Intelligence Predicate Logic Slide 56
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
Using distribution rule of v and ^
Examples
(a ^ b) v c = (a v c) ^ (b v c)(a ^ b) v (c ^ d) = (a v c) ^ (a v d) ^ (b v c) ^ (b v d)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5780
Artificial Intelligence Predicate Logic Slide 57
983122983141983155983151983148983157983156983145983151983150
7 Convert to CNF
[notroman(X) v notknow(X Marcus)] v
[hate(X Ceasar) v
(nothate(YZ) v thinkcrazy(XY))]=
notroman(X) v notknow(X Marcus) v
hate(X Ceasar) v nothate(YZ) v thinkcrazy(XY)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5880
Artificial Intelligence Predicate Logic Slide 58
983122983141983155983151983148983157983156983145983151983150
8 Separate clauses
If having the clause form
(a v notb) ^ (nota v c v d) ^ (a v notc v e)
Then
1 (a v notb)
2 (nota v c v d)
3 (a v notc v e)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 5980
Artificial Intelligence Predicate Logic Slide 59
983122983141983155983151983148983157983156983145983151983150
9 Add every qualifier to clause
That is
(forallX P(X) ^ Q(X) )=
forallX P(X) ^ forallX Q(X)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6080
Artificial Intelligence Predicate Logic Slide 60
983122983141983155983151983148983157983156983145983151983150
Exercises
Convert to clause form for sentences in previous
example
Convert to clause form for
1 forallX A(X) v existX B(X) forallXC(X) ^ existX D(X)
2 forallX (p(X) v q(X)) forallX p(X) v forallX q(X)
3 existX p(X) ^ existX q(X)existX(p(X) ^ q(X))4 forallX existY p(XY) existY forallX p(XY)
5 forallX (p(X f(X)) p(XY))
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6180
Artificial Intelligence Predicate Logic Slide 61
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
X Variable t term
xt value of x will be t OR x is replaced by t
A substitution = x1 t1 x2 t2 xn tn
Empty substitution ε
E Predicate expression
θ A substitution
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6280
Artificial Intelligence Predicate Logic Slide 62
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
θ A substitution
Eθ Apply θ to E
ExampleE = p(XYf(X))
θ = Xa yf(b)Then Eθ = p(a f(b) f(a))
Union of θ and δ
E is a expression thenE(θδ) = (Eθ)δ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6380
Artificial Intelligence Predicate Logic Slide 63
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ = x1 t1 x2 t2 xn tn
δ = y1 s1 y2 s2 yn sn
θδ is calculated as follows
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6480
Artificial Intelligence Predicate Logic Slide 64
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θδ is calculated as follows
1 Apply δ to denominator of θx1 t1δ x2 t2δ xn tnδ
2 Remove all the form xi xi from 1
3 Remove from δ the form yi si
if yi isin x1x2 xn
4 θδ = union( line 2 and 3)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6580
Artificial Intelligence Predicate Logic Slide 65
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Union of θ and δ
θ δ substitution
ε empty substitution
E Expression
Properties
1 E(θδ) = (Eθ)δ
2 Eε = E
3 θε = εθ = θ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6680
Artificial Intelligence Predicate Logic Slide 66
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification
If θ The most general unifier of S containingexpression then Sθ is a set having singleelement
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6780
Artificial Intelligence Predicate Logic Slide 67
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
mgu most general unifier
S set of expressions
θ mgu of S if 983111983145983158983141983150 983137983150983161 983157983150983145983142983145983141983154 δ 983151983142 983123 983156983144983141983150
exist α 983155983157983139983144 983156983144983137983156983098
δ 983101 θα
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6880
Artificial Intelligence Predicate Logic Slide 68
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
S Set of expressions
Find the common longest substring from the
begining of each expression in S
Dis-set = set of right next term in all the
expressions
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 6980
Artificial Intelligence Predicate Logic Slide 69
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Dis-set
Example
S = p(X f(X) y) p(XYZ) p(X f(a) b)
Common longest substring = ldquop(Xrdquo
Dis-set = f(X) Y f(a)
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7080
Artificial Intelligence Predicate Logic Slide 70
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Unification algorithm
Input S = atoms Output mgu(S) or not unifiable(S)
1 Set K =0 and θ0 = ε Goto 22 Compute Sθk
If it is a set having single element stop mgu = θk Else D
k
= dis-set(Sθk
) Goto 3
3 If Dk contains variable V and a term tand V is not in term tThen compute θk+1 = θk Vt set K = K + 1 Goto 2
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7180
Artificial Intelligence Predicate Logic Slide 71
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Clausersquos properties
1 There is no common variable between twoclauses
2 There exist one or many atoms L1 L2 Lk in a
clause one or many literals notM1 notM2 notMn inanother clause so that there is a mgu for set L1L2 Lk M1 M2 Mn
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7280
Artificial Intelligence Predicate Logic Slide 72
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
N)-(DvN)-(C
D vMvv
C vLvv
n1
k 1
notthere4
notnot
θ θ
M
L
N = Liθ
= M jθ
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7380
Artificial Intelligence Predicate Logic Slide 73
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
1 Verify the difference of variable name betweentwo clauses
2 Find mgu θ for L1 L2 Lk M1 M2 Mn
3 Apply θ into C vagrave D4 Compute N = L1θ
5 Remove N from Cθ
6 Remove notN from Dθ
7 Compute union of 5 and 6 and result resovant
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7480
Artificial Intelligence Predicate Logic Slide 74
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Resolution rule
Properties of resolvants
E F are two clauses
G is their resolvant
EF is unsatisfiable if and only if
EFG is unsatisfiable
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7580
Artificial Intelligence Predicate Logic Slide 75
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Proof with resolution rule
Set of expression F Prove P
Procedure
1 Convert F into clauses
2 Take notP convert notP into clauses Add to resultof Step 1
3 Apply resolution rule to produce empty set iefind a contradiction
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7680
Artificial Intelligence Predicate Logic Slide 76
983123983157983138983155983156983145983156983157983156983145983151983150 983137983150983140 983125983150983145983142983145983139983137983156983145983151983150
Example
Tryassassinate(Marcus Caesar)8
notman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v loyalto(X4 Y1)7
Loyalto(X3 f1(X3))6
notRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
Ruler(Caesar)4notPompiean(X1) v Roman(X1)3
Pompiean(Marcus)2
man(Marcus)1
ClausesSTT
Prove ldquoMarcus hate Caesarrdquo or
hate(Marcus Ceasar)
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7780
Artificial Intelligence Predicate Logic Slide 77
310 X1 = MarcusnotPompiean(Marcus) v loyalto(Marcus Caesar)11
Pman(Marcus)1
PPompiean(Marcus)2
PnotPompiean(X1) v Roman(X1)3
PRuler(Caesar)4
PnotRoman(X2) v loyalto(X2 Caesar) v hate(X2 Caesar)5
PLoyalto(X3 f1(X3))6Pnotman(X4) v notruler(Y1) v nottryassassinate(X4 Y1) v
notloyalto(X4 Y1)
7
PTryassassinate(Marcus Caesar)8
Pnothate(Marcua Ceasar)959 X2= MarcusnotRoman(Marcus) v loyalto(Marcus Caesar)10
NoteClauses
Proof
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7880
Artificial Intelligence Predicate Logic Slide 78
15816
144nottryassassinate(Marcus Ceasar)15
131notruler(Ceasar) v nottryassassinate(Marcus
Ceasar)
14
127X4=Marcus y1=Ceasarnotman(Marcus) v notruler(Ceasar) v
nottryassassinate(Marcus Ceasar)
13
211loyalto(Marcus Ceasar)12
Ghi chuacuteClausesSTT
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 7980
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH
892019 First Order(Predicate)Logic
httpslidepdfcomreaderfullfirst-orderpredicatelogic 8080
Artificial Intelligence Predicate Logic Slide 80
983109983160983141983154983139983145983155983141983155
You know
All people living in PMH are rich
Rich people have much money
People who work only in government sector (or
called government staff) do not have muchmoney
An is a government staff Prove
An does not live in PMH