Download presentation

Presentation is loading. Please wait.

Published byJordan Caldwell Modified over 4 years ago

1
INFERENCE IN FIRST ORDER LOGIC

2
S UBST () S UBST () is a method of substituting particular instances for variables (or vice versa). The syntax is as follows: S UBST ({v/g}, ) v is some variable, or unknown g is a ground term, a term that contains no variables (i.e. a constant symbol such as e or pi) is a sentence in First-Order logic Thus, the purpose of using the S UBST for a sentence, is to replace a variable v with some ground term g.

3
Universal Elimination The purpose of Universal Elimination is to remove all occurrences of the variable v, and replace them with the more specific ground term g. Which can be written: For any sentence, variable v, and ground term g: v, --------------------- S UBST ({v/g}, )

4
An example of Universal Elimination could be: : v, Loves(v, A.I.) Now substitute the ground term Rose for v: S UBST ({v/Rose}, ) And youre left with: Loves(Rose, A.I.)

5
Why does this work? Think of Universal Elimination as And- Elimination (a^b^c |- a) Thus, Loves(v, A.I.) represents all instances of people who love A.I. If the knowledge base consisting of people who love A.I. was comprised of Rose, James, Maggie, and Neil we would have (Rose ^ James ^ Maggie ^ Neil). Using And-Elimination, we can eliminate James, Maggie, and Neil, and then conclude that Rose does in fact love A.I.

6
Existential Elimination The purpose of Existential Elimination, is to give a specific instance a name or symbol that does not already appear in our knowledge base. The definition is as follows: For any sentence, variable v, and constant symbol k that does not appear elsewhere in the knowledge base: v, ---------------------- S UBST ({v/k}, )

7
An example of Existential Elimination could be: : There exists a number that is equal to the circumference of a circle divided by its diameter. Thus, v, Satisfies(v, ) means: there exists some number v which satisfies the equation specified by. Now, we would like to give v a more specific name, so we might choose the symbol. So, S UBST ({v/ }, ) And were left with: Satisfies(, ), which reads: is a number which is equal to the circumference of a circle divided by its diameter.

8
Existential Elimination It is very important that does not already appear in our knowledge base. As it would be a large mistake to have two different numbers which can be represented by the symbol.

9
Existential Introduction: Existential Introduction is the exact opposite of Existential Elimination. Its purpose is to replace some symbol or ground term, with a variable. The definition is as follows: For any sentence, variable v that does not occur in, and ground term g that does occur in : --------------------------- v, S UBST ({g/v}, )

10
An example of Existential Introduction could be: is a number that is equal to the circumference of a circle divided by its diameter. Satisfies(, ) Now, we want to remove from this sentence, and make it more general. So, we apply our S UBST S UBST ({ /v}, ) And were left with: v, Satisfies(v, ) which reads: There exists some number that is equal to the circumference of a circle divided by its diameter.

11
An example of Existential Introduction could be(1): is a number that is equal to the circumference of a circle divided by its diameter. Satisfies(, ) Now, we want to remove from this sentence, and make it more general. So, we apply our S UBST S UBST ({ /v}, ) And were left with: v, Satisfies(v, ) which reads: There exists some number that is equal to the circumference of a circle divided by its diameter.

12
Existential Introduction(1): Similarly to Existential Elimination, it is important that v does not already occur in the sentence. And likewise, our ground term ( ) must be in the knowledge base to begin with.

13
An example of Existential Introduction could be(crime): 1 - The law says that is a crime for American 2 - to sell weapons to hostile nations. 3 - The country Nono,an enemy of America, 4 - has some missiles, and all of its missiles 5 - were sold to it by Colonel West,who is American

14
example of Existential(crime) "…it is a crime for an American to sell weapons to hostile nations." (8_1) : x,y,z American(x) ^ Weapons(y)^ Nation(z) ^ Hostile(z) ^ Sells(x,y,z) Criminal(x)

15
example of Existential(crime) (8_2) : None … has some missiles : $ x Owns (Nono,x)^Missile(x) (8_3) : All of its missiles were sold to it by Colonel West : $ x Owns (Nono,x) ^ Missile(x) Sells( West,Nono,x)

16
example of Existential(crime) )8_4( : missile is a kind of weapon : $Missile(x) Weapon(x) )8_5) : Hostile is an enemy of America : $Enemy (x,America) Hostile (x) (8_6) : west,who is American..... : $ American (West)

17
example of Existential(crime) (8_7) : The country Nono …": $ Nation(Nono) )8_8) : Nono,an enemy of America…" $ Enemy(Nono,America) (8_9( : $ Nation(America) From (8_2) and Existential Elimination : (8_10) : $ Owns(Nono,M1) ^ missile(M1)

18
example of Existential(crime) From (8_10(, And, (^) Elimination : (8_11 (: $ Owns(Nono,M1) From (8_4( and Universal Elimination : )8_13( : $ Missile (M1) Weapon(M1)

19
example of Existential(crime) From (8_12),(8_13 (,Modus Ponens (MP): (8_14( : $ Weapon(M1) From (8_3), Universal Elimination (UE): (8_15) : $ Owns(Nono,M1) ^ Missile(M1) Sells(West,Nono,M1)

20
example of Existential(crime) From (8_15(,(8_10), MP : (8_16) : $ Sells(West,Nono,M1) From (8-1), Universal E (3th) : (8_17) : $ American (West) ^ Weapon(M1) ^ Nation(Nono) ^ Hostile (Nono) ^ sells(West,Nono,M1) Criminal(West)

21
example of Existential(crime) From(8_5), Universal Elimination : (8_18) : $ Enemy (Nono, America) Hostile (Nono) From(8_18),(8_8),MP : (8_19) : $ Hostile (Nono)

22
example of Existential(crime) From (8_6),(8_7),(8_14),(8_16),(8_19) : (8_20) : $ American (West) ^ Weapon(M1) ^ Nation(Nono)^ Hostile (Nono) ^ Sells(West,Nono,M1) From (8_17),(8_20),MP : (8_21) : $ Criminal(West)

23
Generalized modus ponens enables us to take some sentences from a knowledge base and infer a new sentence in a single step. The formula is: For atomic sentences p i, p i 1, and q, where there is a substitution such that SUBST(, p i 1 ) = SUBST(, p i ), for all i: p 1 1,p 2 1,...,p n 1, (p 1 ^p 2 ^...^p n => q) ----------------------------------------- SUBST(theta, q) It is an efficient improvement and is more powerful than the regular modus ponens. Generalized modus ponens

24
example Example of generalized modus ponens of Existential(2) p 1 1,p 2 1,...,p n 1, (p 1 ^p 2 ^...^p n => q) ----------------------------------------- SUBST(theta, q) P1 is Missile(M1) p1 is Missile(x) P2 is Owns(y,M1) p2 is Owns(Nono,x) Theta is {x/M1, y/Nono} q is Sells (West,Nono,x) SUBST ( theta,q) is Sells ( West,Nono, M1)

25
Canonical form for modus ponens requires that each sentence in KB be either an atomic sentence or an implication with a conjunction of atomic sentences on the left hand side and a single atom on the right. Sentences in the canonical form are called Horn sentences. Canonical form

26
Horn sentences Sentences must be in Horn sentence form to use generalized modus ponens. If all the sentences are horn sentences, then the KB is in Horn Normal Form. We use and-elimination and existential- elimination to remove conjuncts and existential quantifiers. Horn sentences are a useful class of sentences for which a polynomial-time inference procedure exists.

27
We use the routine UNIFY to take two atomic sentences q and p and return a substitution that would make q and p look the same. This is how we found an appropriate substitution in the example of generalized modus ponens: UNIFY(p, q) =, SUBST(, P ) = SUBST(, q ) Unification

28
Efficiency: -it takes bigger steps, combining several small inferences into one. -In just one step it does what is required for -an And-Introduction -a Universal Elimination - and Modus Ponens -it takes sensible steps - it uses substitutions that are guaranteed to help rather than randomly trying Universal Eliminators. The unification algorithm takes two sentences and returns a substitution that makes them look the same if such a substitution exists. -it makes use of a pre-compilation step that converts all the sentences in the knowledge base into canonical form. Why generalized modus ponens are helpful

29
Unification Example John hates everyone he knows. Knows(John,x) Hates(John,x) Knows(John,Jane) Knows(y,Leonid) Knows(y,Mother(y)) Knows(x,Elizabeth)

30
Unification Example Continuance 1 _ UNIFY) Knows( John, x ), Knows( John, Jane )) = { x / jane } 2_ UNIFY) Knows( John, x ), Knows( John, Leonid )) = { x / Leonid, y / John} 3_ UNIFY) Knows( John, x ), Knows( y, Mother (y))) = { y / John, x / Mother ( John ))} 4_ UNIFY) Knows( John, x ), Knows( x, Leonid )) = fail [A point, in this state. We will see it, soon]

31
Renaming Renaming: Renaming is where you switch the variable inside a predicate, with another variable. Though after the renaming, the sentences must mean the same thing. Eg. A renaming of the sentence Watches(x, Movies) … Is: Watches(y, Movies) Though: Movies(x, x) and Movies(x, y) are not renamings of each other.

32
That point is here 4_ UNIFY) Knows( John, x 1), Knows( x2, Leonid )) ={x1 / Elizabeth, x2 / John } x2 Knows( x2, Elizabeth ), x Knows( x, Elizabeth ) Have unification sense

33
Unification Example( crime ) (8_22) : $ American (x) ^ Weapon(y) ^ Nation(z) ^ Hostile (z) ^ Sells(x,z,y) Criminal (x)

34
Unification Example( crime ) (8_23) : $ Owns( Nono, M1) (8_24) : $ Missile( M1) (8_25) : $ Owns( Nono, x ) ^ Missile( x ) Sells( West, Nono,x )

35
Unification Example( crime ) (8_26) : $ Missile( x ) Weapon ( x ) (8_27) : $ Enemy( x, America ) Hostile( x ) (8_28) : $ America ( West ) (8_29) : $ Nation ( Nono ) (8_30) : $ Enemy(Nono, America ) (8_31) : $ Nation (America)

36
Unification Example( crime ) From (8_24),(8_26),MP : (8_32) : $ Weapon ( M1) From (8_28),(8_32),(8_29),(8_33),(8_34), (8_22), MP : (8_34) : $ Criminal ( west )

37
We get: (4) x person(x) using Universal Introduction on 2 (5) x,y eatFruit(x,y) using Universal Introduction on 3 (6) x,y person(x) ^eatFruit(x,y) using And Introduction on 4,5 (7) x healthy(x) using modus ponens on 1,6 (8) healthy(Bob) by Universal Elimination on Using regular modus ponens: Given in the knowledge base: (1) x,y person(x) ^ eatFruit(x,y) => healthy(x) (2) person(Bob) (3) eatFruit(Bob, Mango) Comparing modus ponens with generalized modus ponens

38
Using generalized modus ponens: Given in the knowledge base: (1) x,y person(x) ^ eatFruit(x,y) => healthy(x) (2) person(Bob) (3) eatFruit(Bob, Mango) We get: (4) healthy(Bob) using = {x/Bob, y/Mango} Comparing modus ponens with generalized modus ponens

39
Composition Composition: Another technique we need before we begin is the idea of a composition of substitutions. Compose( 1, 2 ) returns a substitution, whose effect is identical to: Subst(Compose( 1, 2 ), p) = Subst( 2, Subst( 1, p)) Eg. p = Watches(x, y), 1 = {x / Don}, 2 = {y / TV} Subst( 2, Subst( 1, p)) = Subst( 2, Watches(Don, y)) = Watches(Don, TV). Subst(Compose( 1, 2 ), p) = Subst( {x / Don, y / TV}, p) = Watches(Don, TV).

40
Forward Chaining Algorithm This algorithm is used as a reasoning program. And it is based upon the Generalized Modus Ponens The algorithm takes sentences currently in the Knowledge Base and generates new conclusions that can be used to infer even more conclusions.

41
About Forward Chaining Adds inputted sentences to the Knowledge Base Uses Generalized Modus Ponens to attempt to infer new facts.

42
Second half of the Algorithm Procedure Find-And-Infer(KB, premises, conclusion, ) If premises = [] then Forward-Chain(KB, Subst(, conclusion)) else for each p in KB s.t. Unify(p, Subst(, First(premises))) = 2 do Find-And-Infer(KB, Rest(premises), conclusion, Compose(, 2 )) end

43
Procedure Forward-Chain(KB, p) If p or a renaming of p is in KB then Return Add p to KB For each (p 1 ^…^p n -> q) in KB s.t. I, Unify(p i,p) = succeeds do Find-And-Infer( KB, [p 1,…, p i-1, P i+1,…, p n ], q, ) End First half of the Algorithm

44
Forward Chaining Example(crime) (8_36) : $ American (x) ^ Weapon(y) ^ Nation(z) ^ Hostile (z) ^ Sells(x,z,y) Criminal (x)

45
Forward Chaining Example(crime) (8_37) : $ Owns (Nono, x ) ^ Missile ( x ) Sells( West, Nono, x ) (8_38) : $ Missle ( x ) Weapon (x) (8_39) : $ Enemy ( x, America ) Hotile( x )

46
Forward Chaining Example(crime) Addtion Atomic Sentenes To kowledge Base(1) Step 1 : Compatiable with (8_36) defaulte 1_FORWARD _ CHAIN (KB, America (West)) FC unknowns another (8_36)s defaultes then, fc return with no new inference Step 2 : Compatiable with (8_39) defaulte 2_FORWARD _ CHAIN (KB, Nation(Nono)) There are some lose defaulte then fc return Step 3 : Compatiable with (8_36) defaulte,and {x/Nono} 3_FORWARD _ CHAIN (KB, Enemy(Nono,America))

47
Forward Chaining Example(crime) Addtion Atomic Sentenes To kowledge Base(2) Step 4 : Compatiable with (8_36)s default 4_FORWARD _ CHAIN (KB, Hostile(Nono)) Stop processing Step 5 : Compatiable with (8_37)s default, and {x/ M1} 5_FORWARD _ CHAIN (KB, Owns(Nono,M1)) Stop processing Step 6 : Compatiable with (8_37)s and (8_38)s default 6_FORWARD _ CHAIN (KB, Missile(M1))

48
Forward Chaining Example(crime) Addtion Atomic Sentenes To kowledge Base(3) studing step 6 1_Step 6 : Compatiable with (8_37)s default

49
Backward Chaining Algorithm The same principle that applies for forward chaining, works in reveres for backward chaining. How it works: 1)Start with something you wish to prove. 2)Find implication sentences that would allow you to conclude it. 3)From there try to establish the premise in turn. In short it works the same as for the Generalized Modus Ponens, though in reverse.

50
The Algorithm pt. 1 Function Back-Chain(KB, q) returns a set of substitutions Back-Chain-List(KB, [q], {})

51
The Algorithm pt. 2 Function Back-Chain-List(KB, qlist, ) Inputs: KB, a knowledge base qlist, a list of conjuncts forming a query( already applied), the current substitution Local vars: answers, a set of substitutions, initially empty if qlist is empty then return { } q <- First(qlist) For each q i in KB s.t. <- Unify(q, q i ) succeeds do Add Compose(, i ) to answers end

52
The Algorithm pt. 3 For each (p1^…^pn -> qi) in KB s.t. i <- Unify(q,qi) succeeds do answers <- Back-Chain-List(KB, Subst( i, [p1...pn]),Compose(, i)) answers End Return the union of Back-Chain-List(KB, Rest(qlist), ) for each answers

53
How it works The algorithm tries to find the inputted sentence in the KB. If it is not found, it then attempts to find implications in the KB, where the inputted sentence is the conclusion The algorithm then recursively calls itself with each premise of each implication, until something definite can be said or found.

54
Backward Chain Inferences Tree The resoulet is certain West is a criminal American(x)Weapon(y)Nation(z)Hostile(Nono)Sells(West,Nono,M1) Missile(y)Enemy(Nono,America) Owns(Nono,M1)Missile(M1) Criminal(x) Yes,{x/west}Yes,{z/Nono} Yes,{y/M1} Yes,{}

55
Backward Chain Inference Tree The resoulet is not certain American(x)Weapon(y)Nation(z)Hostile(Nono)Sells(West, America,M1) Missile(y) fail Criminal(x) Yes,{x/west}Yes,{z/America} Yes,{y/M1}

56
An Example Back-Chain(GivesFreeDrinks(Glen)) |-> Back-Chain(Friend(Glen)) |-> Back-Chain(Bartender(Glen)) |-> Back-Chain(Beer(Guinness)) |-> Back-Chain(Serves(Glen, Guinness)) In KB: x,y Bartender(x) ^ Beer(y) ^ Serves(x, y) -> Friend(x) x Friend(x) -> GivesFreeDrinks(x) -------------------------------------------------------------------------------

57
Completeness 8_5 For a language to be complete, you must have the ability to be able to say For any sentence which is a consequence of a language, then that sentence is deducible from that language This hear brings us to Kurt Gödels Completeness Theorem, which he came up with in 1930 – 1931: If KB |= then KB |- R

58
More on Completeness There is one main problem with the completeness theorem. It states that if a sentence follows, then it can be proved. Normally we cant tell until a proof is done that a sentence does follow; what happens when the sentence does not follow?

59
Even more on Completeness In First Order Logic it turns out that we can not tell if a sentence follows or not. The proof procedure can go on infinitely but you can never tell if its stuck in a loop or if the answer will pop out. This problem very similar to the halting problem

60
Final info on Completeness Finally we can say FOL is semi decidable. This is because we can show sentences follow from premises, though we can not always show that they do not.

61
Resolution 8.6 Some basic rules of deduction we should all know and or recognize. v, v |- v Or equivalently ->, -> |- -> These are also the basic rules of resolution

62
Resolution Much like the Generalize Modus Ponens, There is a generalized form of resolution. It generalizes the two rules listed earlier into two forms of Generalized Resolution, one for disjunctions and one for implications.

63
Resolution Disjunction Generalized Resolution (Disjunction) For literals p i and q i, where Unify(p j, q k ) = p 1 v … p j … v p m q 1 v … q k … v q n ------------------------------------------------------------------------ Subst(, (p 1 v … p j-1 v … p m v q 1 … q k-1 v q k+1 … v q n ))

64
Resolution Implication Generalized Resolution (Implication) For atoms p i, q i, r i, s i, where Unify(p j, q j ) = p 1 ^ … p j … ^ p n1 -> r 1 ^ … ^ r n2 s 1 ^ … ^ s n3 -> q 1 v … q k … v q n4 --------------------------------------------------------------------- Subst(, (p 1 ^…^p j-1 ^p j+1 ^p n1 ^s 1 ^…^s n3 -> r 1 v…v r n2 v q v…v q k-1 v q k+1 v…v q n4 ) )

65
Resolution It is important to realize that resolution is a generalization of Modus Ponens.

66
Conclusion FOL is a tool for AI computers to interpret English from a mathematical point of view. The algorithms in this chapter help speed up the thought process done by a computer on FOL.

67
P(w) Q(w) True P(x) v R(x) True S(A) R(z) S(z) Q(y) S(y) P(w) S(w) True S(x) v R(x)

68
Resolution of S(A) from KB in (8_41) P(w) Q(w) True P(x) v R(x) True S(A) R(z) S(z) Q(y) S(y) P(w) S(w) True S(x) v R(x) {y/w} {w/x} {x/A, z/A}

69
P(w) Q(w) True P(x) v R(x) True S(A) R(z) S(z) Q(y) S(y) P(w) S(w) True S(x) v R(x) S(A) False True False y/w w/x z/x x/A

70
تبديل به فرم نرمال 1_ حذف تركيب شرطي p q = ~pvq 2_ حذف ~ ~(p v q ) ~p ^ ~q ~(p ^ q) ~p v ~q ~ x,p x ~p ~~p p

71
تبديل به فرم نرمال 3_استاندارد سازي تغيير نام هاي مشابه با توجه به حوزه عمل كرد سورها 4_انتقال سورها به چپ p v x q x p v q

72
تبديل به فرم نرمال skolemization :skolemize _5 x Person(x) y Heart (y) ^ Has (x,y) x Person(x) Heart (H) ^ Has (x, H) OR x Person(x) Heart (f(x)) ^ Has (x, f(x))

73
تبديل به فرم نرمال v 6_توزيع ^ بر (a ^ b ) v c == (a v c ) ^ (b v c ) 7_تركيبات فصلي و عطفي لانه اي مسطح شده (a v b ) v c == (a v b v c ) (a ^ b ) ^ c == (a ^ b ^ c ) 8_ تبديل تركيبات فصلي به تركيبات شرطي ( ~a v ~b v c v d ) (a ^ b) (c v d )

74
مثال اثبات Jake owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Jake or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat ?

75
مثال اثبات A. x Dog (x) ^ Owns (Jake,x) B. x [ y Dog(y) ^ Owns(x,y) Animal lover(x)] C. x Animallover(x) yAnimal(y) ~Kills(x,y) D. Kills(Jake, Tuna) v Kills(Curiosity, Tuna) E. Cat (Tuna) F. x Cat(x) Animal(x)

76
مثال اثبات A1. Dog(D) A2. Owns(Jake,D) B. Dog(y) ^ Owns(x,y) Animal lover(x) C. Animal lover(x) ^ Animal(y) ^ Kills(x,y) False D. Kills(Jake, Tuna) v Kills(Curiosity, Tuna) E. Cat(Tuna) F. Cat(x) Animal(x)

77
Dog(D) Dog(y)^Owns(x,y) Animallover(x) Animallover(x)^Animal(y)^Kills(x,y) False Owns(x,D) Animal lover(x) Owns(Jake,D) Animallover(Jake) Cat(Tuna)Cat(x) Animal(x) Kills(Jake,Tuna) v Kills(Curiosity,Tuna) Kills(Curiosity, Tuna) False Kills(Jake,Tuna) Animal(Tuna) Animallover(x)^Kills(x,Tuna) False ~Kills(Jake, Tuna) False {} {x/Jake} {y/D} {x/Jake} {x/Tuna} {y/Tuna}

Similar presentations

Presentation is loading. Please wait....

OK

한양대학교 정보보호 및 알고리즘 연구실 이재준 담당교수님 : 박희진 교수님

한양대학교 정보보호 및 알고리즘 연구실 이재준 담당교수님 : 박희진 교수님

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google