m8-fol

27
First-Order Logic Chapter 8

Upload: nurain-ali

Post on 17-Aug-2015

213 views

Category:

Documents


1 download

DESCRIPTION

firstorderlogic

TRANSCRIPT

First-Order LogicChapter 8OutlineWhy FOL?Syntax and semantics of FOLUsing FOLWumpus orld in FOL!noledge engineering in FOL"ros and cons of propositional logic "ropositional logic is declarati#e "ropositional logic allos partial$dis%uncti#e$negated information& 'unli(e most data structures and data)ases*"ropositional logic is compositional+& meaning of B1,1 P1,2 is deri#ed from meaning of B1,1 and of P1,2 ,eaning in propositional logic is context-independent& 'unli(e natural language- here meaning depends on context* "ropositional logic has #ery limited expressi#e poer& 'unli(e natural language*& ./g/- cannot say 0pits cause )ree1es in ad%acent s2uares3 except )y riting one sentence for each s2uare4&4&4&First-order logicWhereas propositional logic assumes the orld contains facts-first-order logic 'li(e natural language* assumes the orld contains&O)%ects+ people- houses- num)ers- colors- )ase)all games- ars- 5&6elations+ red- round- prime- )rother of- )igger than- part of- comes )eteen- 5&Functions+ father of- )est friend- one more than- plus- 5&&Syntax of FOL+ 7asic elementsConstants !ing8ohn- 9- :US-/// "redicates 7rother- ;-///Functions S2rt- LeftLegOf-///uantifiers - ?tomic sentences?tomic sentence = predicate 'term1-///-termn* or term1 = term2@erm = function 'term1-///-termn* or constant or variable ./g/- Brother(KingJohn,RichardTheionheart! " (ength(efteg#f(Richard!!, ength(efteg#f(KingJohn!!!Complex sentencesComplex sentences are made from atomic sentences using connecti#es$- $1 $2- $1 $2- $1 $2- $1 $2-./g/ $ibling(KingJohn,Richard! $ibling(Richard,KingJohn! ;'A-9* B 'A-9* ;'A-9* ;'A-9* @ruth in first-order logic Sentences are true ith respect to a model and an interpretation ,odel contains o)%ects 'domain elements* and relations among them Cnterpretation specifies referents forconstant sym)olsDo)%ectspredicate sym)olsDrelationsfunction sym)olsD functional relations ?n atomic sentence predicate(term1,%%%,termn! is trueiff the o)%ects referred to )y term1,%%%,termnare in the relation referred to )y predicate&,odels for FOL+ .xampleUni#ersal 2uantification Evariables; Esentence;.#eryone at :US is smart+x ?t'x-:US* Smart'x* x P is true in a model m iff P is true ith & )eing each possi)le o)%ect in the model6oughly spea(ing- e2ui#alent to the con%unction of instantiations of P?t'!ing8ohn-:US* Smart'!ing8ohn* ?t'6ichard-:US* Smart'6ichard* ?t':US-:US* Smart':US* ///44? common mista(e to a#oid@ypically- is the main connecti#e ith Common mista(e+ using as the main connecti#e ith +x ?t'x-:US* Smart'x*means 3.#eryone is at :US and e#eryone is smartF.xistential 2uantification Evariables; Esentence;Someone at :US is smart+ & ?t'x-:US* Smart'x*G & P is true in a model m iff P is true ith & )eing some possi)le o)%ect in the model6oughly spea(ing- e2ui#alent to the dis%unction of instantiations of P?t'!ing8ohn-:US* Smart'!ing8ohn* ?t'6ichard-:US* Smart'6ichard* ?t':US-:US* Smart':US* ///44?nother common mista(e to a#oid@ypically- is the main connecti#e ith Common mista(e+ using as the main connecti#e ith +& ?t'x-:US* Smart'x*is true if there is anyone ho is not at :USH4"roperties of 2uantifiers x y is the same as y x x y is the same as y x x y is not the same as y x x y Lo#es'x-y*& 3@here is a person ho lo#es e#eryone in the orldF y x Lo#es'x-y*& 3.#eryone in the orld is lo#ed )y at least one personF >uantifier duality+ each can )e expressed using the other x Li(es'x-CceCream* x Li(es'x-CceCream* x Li(es'x-7roccoli*x Li(es'x-7roccoli*&&.2uality term1 = term2 is true under a gi#en interpretation if and only if term1 and term2 refer to the same o)%ect./g/- definition of $ibling in terms of Parent+&,' $ibling(&,'! I'x = y* m-f 'm = f* "arent'm-x* "arent'f-x* "arent'm-y* "arent'f-y*J4Using FOL@he (inship domain+7rothers are si)lingsx-y Brother(&,'! $ibling(&,'!OneKs mother is oneKs female parentm-c (other(c! = m ()emale(m! Parent(m,c!!3Si)lingF is symmetricx-y $ibling(&,'! $ibling(',&!&4&4&Using FOL@he set domain+ s Set's* 's = LM * 'x-s9 Set's9* s = LxNs9M* x-s LxNsM = LM x-s x s s = LxNsM x-s x s I y-s9M 's = LyNs9M 'x = y x s9**J sA-s9 sA s9 'x x sA x s9* sA-s9 'sA = s9* 'sA s9 s9 sA* x-sA-s9 x 'sA s9* 'x sA x s9* x-sA-s9 x 'sA s9* 'x sA x s9*Cnteracting ith FOL !7s Suppose a umpus-orld agent is using an FOL !7 and percei#es a smell and a )ree1e ')ut no glitter* at t=*+Tell'!7-"ercept'ISmell-7ree1e-:oneJ-O**Ask'!7-a 7est?ction'a-O** C/e/- does the !7 entail some )est action at t=*? ?nser+ +es- La,$hootM P su)stitution ')inding list* Qi#en a sentence $ and a su)stitution R- $R denotes the result of plugging R into $S e/g/-$ = Smarter'x-y*R = Lx$Tillary-y$7illM$R = Smarter'Tillary-7ill*Ask'!7-S* returns some$all R such that !7U R 444!noledge )ase for the umpus orld"erception t-s-) "ercept'Is-)-QlitterJ-t* Qlitter't*6eflex t Qlitter't* 7est?ction'Qra)-t*&Veducing hidden propertiesx-y-a-) -d.acent'Ix-yJ-Ia-)J* Ia-)J LIxWA-yJ- Ix-A-yJ-Ix-yWAJ-Ix-y-AJM "roperties of s2uares+s-t -t'?gent-s-t* 7ree1e't* 7ree1y's*S2uares are )ree1y near a pit+&Viagnostic rule---infer cause from effects 7ree1y's* X.xiLrM ?d%acent'r-s* "it'r*G&Causal rule---infer effect from causer "it'r* Is ?d%acent'r-s* 7ree1y's*G J44!noledge engineering in FOLA/ Cdentify the tas(9/ ?ssem)le the rele#ant (noledgeY/ Vecide on a #oca)ulary of predicates- functions- and constantsZ/ .ncode general (noledge a)out the domainO/ .ncode a description of the specific pro)lem instance[/ "ose 2ueries to the inference procedure and get ansers\/ Ve)ug the (noledge )ase8/]/A^/AA/A9/AY/@he electronic circuits domainOne-)it full adder@he electronic circuits domainA/ Cdentify the tas(&Voes the circuit actually add properly? 'circuit #erification*9/ ?ssem)le the rele#ant (noledge&Composed of ires and gatesS @ypes of gates '?:V- O6- _O6- :O@*&Crrele#ant+ si1e- shape- color- cost of gatesY/ Vecide on a #oca)ulary&?lternati#es+@ype'_A* = _O6@ype'_A- _O6*_O6'_A*&4&&4&@he electronic circuits domainZ/ .ncode general (noledge of the domaintA-t9 Connected'tA- t9* Signal'tA* = Signal't9*t Signal't* = A Signal't* = ^&A ` ^tA-t9 Connected'tA- t9* Connected't9- tA*g @ype'g* = O6 Signal'Out'A-g** = A n Signal'Cn'n-g** = Ag @ype'g* = ?:V Signal'Out'A-g** = ^ n Signal'Cn'n-g** = ^g @ype'g* = _O6 Signal'Out'A-g** = A Signal'Cn'A-g** ` Signal'Cn'9-g**g @ype'g* = :O@ Signal'Out'A-g** ` Signal'Cn'A-g** & @he electronic circuits domainO/ .ncode the specific pro)lem instance@ype'_A* = _O6@ype'_9* = _O6@ype'?A* = ?:V@ype'?9* = ?:V@ype'OA* = O6Connected'Out'A-_A*-Cn'A-_9** Connected'Cn'A-CA*-Cn'A-_A**Connected'Out'A-_A*-Cn'9-?9** Connected'Cn'A-CA*-Cn'A-?A**Connected'Out'A-?9*-Cn'A-OA**Connected'Cn'9-CA*-Cn'9-_A**Connected'Out'A-?A*-Cn'9-OA**Connected'Cn'9-CA*-Cn'9-?A**Connected'Out'A-_9*-Out'A-CA**Connected'Cn'Y-CA*-Cn'9-_9**Connected'Out'A-OA*-Out'9-CA**Connected'Cn'Y-CA*-Cn'A-?9**@he electronic circuits domain[/ "ose 2ueries to the inference procedureWhat are the possi)le sets of #alues of all the terminals for the adder circuit? iA-i9-iY-oA-o9 Signal'Cn'A-CaA** = iA Signal'Cn'9-CA** = i9 Signal'Cn'Y-CA** = iY Signal'Out'A-CA** = oA Signal'Out'9-CA** = o9\/ Ve)ug the (noledge )ase,ay ha#e omitted assertions li(e A ` ^&44&SummaryFirst-order logic+&o)%ects and relations are semantic primiti#es&syntax+ constants- functions- predicates- e2uality- 2uantifiersCncreased expressi#e poer+ sufficient to define umpus orld 4&