Download presentation
Presentation is loading. Please wait.
1
All rights reservedL. Manevitz Lecture 51 Artificial Intelligence Logic Part 2 L. Manevitz
2
All rights reservedL. Manevitz Lecture 52 Unification Alphabetic variant. Term substitution. “Ground”. P(x,f(y),B) S 1 ={z/x,w/y} S 2 ={g(z)/x,A/y} S 3 ={C/x,A/y} P(z,f(w),B) P(g(z),f(A),B) P(C,f(A),B)
3
All rights reservedL. Manevitz Lecture 53 Example x [P(x) Q(x)] P(a) Q(a) x [ P(x) Q(x)] P(x) Q(x) P(a) Q(a) P(a) Q(a) Substitution
4
All rights reservedL. Manevitz Lecture 54 Unification cont. m.g.ug: s s’ {Ei}s = {Ei}g s’ {A(x),A(z)} {A(a)}{A(x)} S 1 ={a/x,a/z } S 2 ={x/z} {Ei} S 1 = {Ei}g S 2
5
All rights reservedL. Manevitz Lecture 55 Example of m.g.u {P(x),P(A)} {P[f(x),y,g(y)],P[f(x),x,g(z)]} {P[f(x,g(A,y)),g(A,y)],P[f(x,z),z]} P(A) P[f(x),x,g(x)] P[f(x,g(A,y)),g(A,y)]
6
All rights reservedL. Manevitz Lecture 56 Unification – Algorithm Unify(E 1,E 2 ) If E 1 or E 2 is an atom (that is, a predicate symbol, a function symbol, a constant symbol, a negation symbol or a variable), interchange the arguments E 1 and E 2 (if necessary) so that E 1 is an atom, and do:
7
All rights reservedL. Manevitz Lecture 57 Unification – Algorithm cont. 2.Begin: 1.If E 1 and E 2 are identical, return NIL. 2.If E 1 is a variable, do: 3.Begin: 2.If E 1 occurs in E 2, return FAIL. 3.Return {E 2 / E 1 }. 4.End. 5.If E 2 is a variable, return {E 1 / E 2 }. 6.Return FAIL. 3.End.
8
All rights reservedL. Manevitz Lecture 58 Unification – Algorithm cont. 4.F 1 the first element of E 1, T 1 the rest of E 1. 5.F 2 the first element of E 2, T 2 the rest of E 2. 6.Z 1 UNIFY(F 1,F 2 ). 7.If Z 1 = FAIL, return FAIL.
9
All rights reservedL. Manevitz Lecture 59 Unification – Algorithm cont. 8.G 1 result of applying Z 1 to T 1. 9.G 2 result of applying Z 1 to T 2. 10.Z 2 UNIFY(G 1,G 2 ). 11.If Z 2 = FAIL, return FAIL. 12.Return the composition of Z 1 and Z 2.
10
All rights reservedL. Manevitz Lecture 510 4Trace of Unification Unify ((fxx), (fAy)) –4. F1 = f; T1 = (xx) ; F2 = f; T2 =(Ay) –6. Unify (f, f) 1. f = f so return NIL 8. G1 = NIL(T1) = (xx) G2 = (Ay) 10. Unify ((xx, Ay) 4. F1 = x F2 = A etc 6. Unify (x, A) 3.3 Return A/x 8. Apply A/x to (x) (y) get (A y) 10. Unify (A, y) get A/y Return composition of A/x and A/y Result is fAA.
11
All rights reservedL. Manevitz Lecture 511 Example 1.Whoever can read is literate. 2.Dolphins are not literate. 3.Some dolphins are intelligent. x [R(x) L(x)] x [D(x) L(x)] x [D(x) I(x)]
12
All rights reservedL. Manevitz Lecture 512 Example cont. To prove: some who are intelligent can not read. x [I(x) R(x)]
13
All rights reservedL. Manevitz Lecture 513 Example cont. Clause Form: 1.R(x) L(x) 2.D(y) L(y) 3.Divided to two:A is Skolem constant 1.D(A) 2.I(A) 4.Negation of theory: I(z) R(z)
14
All rights reservedL. Manevitz Lecture 514 Example cont. I(z) R(z) I(A)R(A) R(x) L(x) L(A) D(y) L(y) D(A) NIL 3.2 4 1 23.1
15
All rights reservedL. Manevitz Lecture 515 Control Methods Breadth First. Set of Support. Linear Input.
16
All rights reservedL. Manevitz Lecture 516 Breadth First - Example I(z) R(z) I(A)R(A) R(x) L(x) L(A) D(y) L(y) L(A)D(A) NIL I(z) L(z) R(y) D(y) I(A) R(A) I(z) D(z) D(A)L(A)
17
All rights reservedL. Manevitz Lecture 517 Set of Support - Example I(z) R(z) I(A)R(A) R(x) L(x) L(A) D(y) L(y) D(A) I(A) I(y) D(y) D(A)L(A) D(A) I(z) L(z)
18
All rights reservedL. Manevitz Lecture 518 Linear Input - Example I(A)R(A) R(x) L(x) L(A) D(y) L(y) D(A) I(A) I(y) D(y) L(A) R(A) I(z) L(z) I(z) R(z) R(y) D(y) I(z) D(z) L(A)
19
All rights reservedL. Manevitz Lecture 519 A refutation tree (note: no linear input tree) Q(x) P(x) Q(y) P(y) Q(w) P(w) P(A) P(x) Q(w) NIL Q(u) P(A)
20
All rights reservedL. Manevitz Lecture 520 Ancestor Filtered Like linear input but also … Additional resolutions where one parent is the ancestor of the other one. Surprisingly, this is a complete strategy
21
All rights reservedL. Manevitz Lecture 521 A refutation tree (note: no linear input tree) Q(x) P(x) Q(y) P(y) Q(w) P(w) P(A) P(x) Q(w) NIL Q(u) P(A)
22
All rights reservedL. Manevitz Lecture 522 Example no.1 x [AT(JOHN,x) AT(FIDO,x)] AT(JOHN,School) Where is FIDO ? x [AT(FIDO,x)] AT(FIDO,x)
23
All rights reservedL. Manevitz Lecture 523 Example no.1 cont. Answer: Append negation of each clause that arises from negation of theorem to each leaf in derivation tree in which it appears. Follow structure of derivation tree. Use clause at root as answer.
24
All rights reservedL. Manevitz Lecture 524 Example no.1 cont. AT(FIDO,x) Negation of Goal AT(JOHN,y) AT(FIDO,y) Axiom 1 NIL AT(JOHN,x) AT(JOHN,SCHOOL) Axiom 2 y x x SCHOOL
25
All rights reservedL. Manevitz Lecture 525 Example no.1-Green’s Trick AT(JOHN,y) AT(FIDO,y) AT(FIDO,SCHOOL) AT(JOHN,SCHOOL) y x x SCHOOL AT(FIDO,x) AT(JOHN,x) AT(FIDO,x)
26
All rights reservedL. Manevitz Lecture 526 Example no.2 On (B,A) On (A,Table) T.S. Above (B,Table) The axioms : x y[On(x,y) Above(x,y)] x y z[Above(x,y) Above(y,z) Above(x,z)]
27
All rights reservedL. Manevitz Lecture 527 Example no.2 cont. Clause form: 1.On(u,v) Above(u,v) 2.Above(x,y) Above(y,z) Above(x,z) 3.On(B,A) 4.On(A,Table) 5.Above(B,Table)
28
All rights reservedL. Manevitz Lecture 528 Example no.2 – Resolution Above(B,y) Above(y,Table)On(y,Table) Above(B,y)On(B,y) On(y,Table) 25 1 1 3 4 On(A,Table) NIL
29
All rights reservedL. Manevitz Lecture 529 Example no.3 Predicates: On(A,Table) On(B,A) Function: PutonTable? x On(x,Table) How to use the function? Need to add situation parameter
30
All rights reservedL. Manevitz Lecture 530 Frame Problem A B BA Operator: PutonTable(x): If x not on table, it puts x on table. How should we represent this in logic ?
31
All rights reservedL. Manevitz Lecture 531 Making Situation Part of Logic S0 – initial situation. On(A,Table,S0) On(B,A,S0) PutonTable axiom: z x [ On(x,Table,z) On(x,Table,PutonTable(x,z)] (PutonTable is function P:Object X Situation Situation)
32
All rights reservedL. Manevitz Lecture 532 Making Situation Part of Logic Other axioms (how do we find them ?) x y z [On(x,y,z) On(y,x,z)] A = B A = Table B = Table
33
All rights reservedL. Manevitz Lecture 533 Frame Problem cont. When will B be on the Table? Apply Green’s Trick Goal: z On(B,Table,z) z On(B,Table,z) Axioms: On(B,A,S 0 ) On(A,Table,S 0 ) z x[ On(x,Table,z) On(x,Table,PutonTable(x,z))] z y x[On(y,x,z) x=Table On(y,Table,z)] x y z[On(y,x,z) On(x,y,z)] negated
34
All rights reservedL. Manevitz Lecture 534 Frame Problem cont. Clause form: 1.On(B,A,S 0 ) 2.On(A,Table,S 0 ) 3.On(x,Table, S 3 ) On(x,Table,PutonTable(x,S 3 )) 4.On(y,z,S 4 ) z=Table On(y,Table,S 4 ) 5.(A=B) 6.(B=Table) 7.(A=Table) 8.On(u,v,w) On(v,u,w) 9.On(B,Table,s) Goal Formula
35
All rights reservedL. Manevitz Lecture 535 On(x,Table, S 3 ) On(x,Table,PutonTable(x,S 3 )) On(B,Table,S) On(B,Table, S 3 ) On(B,z,S 3 ) z=Table (A=Table) On(B,A,S 3 ) NIL 93 On(y,z,S 4 ) z=Table On(y,Table,S 4 ) 4 7 On(B,A,S 0 ) 1 x B y BS 4 S 3 z A S 3 S 0 S PutonTable(B,S3) Green’s Trick On(B,Table,S) On(B,Table, PutonTable(B,S 3 )) On(B,Table, PutonTable(B,S0)) On(B,Table, PutonTable(B,S 3 ))
36
All rights reservedL. Manevitz Lecture 536 Frame Problem cont. Do we know a state where both A and B on table? Goal: s[On(B,Table,s) On(A,Table,s)] Negate + Clause: On(B,Table,s) On(A,Table,s) New formula no.9
37
All rights reservedL. Manevitz Lecture 537 Slide Missing on Start of Proof of A and B on table Show where you get stuck
38
All rights reservedL. Manevitz Lecture 538 Frame Problem cont. The knowledge that A stays put wasn’t put into logic ! Needs a “frame axiom” : s x y z[On(x,y,s) x=z On(x,y,PutonTable(z,s))] Clause form: On(p,q,t) p=r On(p,q,PutonTable(r,t)) Formula no.10
39
All rights reservedL. Manevitz Lecture 539 On(p,q,t) p=r On(p,q,PutonTable(r,t)) On(A,Table,S 0 ) A=B (A=B) On(A,Table,S 0 ) NIL 10 5 On(A,Table,S 0 ) 2 p Ar B t S 0 On(A,Table, PutonTable(B,S 0 )) 9 q Table
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.