1 / 39

Artificial Intelligence Logic Part 2

Artificial Intelligence Logic Part 2. L. Manevitz. Unification. P(x,f(y),B). Alphabetic variant. Term substitution. “Ground”. S 1 ={z/x,w/y}. P(z,f(w),B). S 2 ={g(z)/x,A/y}. P(g(z),f(A),B). S 3 ={C/x,A/y}. P(C,f(A),B). P(a). P(a). P(a) Q(a). P(x) Q(x). Q(a). Example.

gaye
Download Presentation

Artificial Intelligence Logic Part 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Artificial IntelligenceLogic Part 2 L. Manevitz L. Manevitz Lecture 5

  2. Unification P(x,f(y),B) • Alphabetic variant. • Term substitution. • “Ground”. S1={z/x,w/y} P(z,f(w),B) S2={g(z)/x,A/y} P(g(z),f(A),B) S3={C/x,A/y} P(C,f(A),B) L. Manevitz Lecture 5

  3. P(a) P(a) P(a) Q(a) P(x) Q(x) Q(a) Example x [P(x) Q(x)] P(a) Q(a) x [ P(x) Q(x)] Substitution L. Manevitz Lecture 5

  4. {A(x),A(z)} {A(x),A(z)} {A(a)} {A(x)} {Ei} S1 = {Ei}g S2 Unification cont. m.g.u g: s s’ {Ei}s = {Ei}g s’ S1={a/x,a/z} S2={x/z} L. Manevitz Lecture 5

  5. P(A) P[f(x),x,g(x)] P[f(x,g(A,y)),g(A,y)] 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]} L. Manevitz Lecture 5

  6. Unification – Algorithm Unify(E1,E2) • If E1 or E2 is an atom (that is, a predicate symbol, a function symbol, a constant symbol, a negation symbol or a variable), interchange the arguments E1 and E2 (if necessary) so that E1 is an atom, and do: L. Manevitz Lecture 5

  7. Unification – Algorithm cont. • Begin: • If E1 and E2 are identical, return NIL. • If E1 is a variable, do: • Begin: • If E1 occurs in E2, return FAIL. • Return {E2 / E1}. • End. • If E2 is a variable, return {E1 / E2}. • Return FAIL. • End. L. Manevitz Lecture 5

  8. Unification – Algorithm cont. • F1the first element of E1, T1 the rest of E1. • F2 the first element of E2, T2 the rest of E2. • Z1UNIFY(F1,F2). • If Z1 = FAIL, return FAIL. L. Manevitz Lecture 5

  9. Unification – Algorithm cont. • G1result of applying Z1 to T1. • G2result of applying Z1 to T2. • Z2UNIFY(G1,G2). • If Z2 = FAIL, return FAIL. • Return the composition of Z1and Z2. L. Manevitz Lecture 5

  10. 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. L. Manevitz Lecture 5

  11. x [R(x) L(x)] x [D(x) L(x)] x [D(x) I(x)] Example • Whoever can read is literate. • Dolphins are not literate. • Some dolphins are intelligent. L. Manevitz Lecture 5

  12. x [I(x) R(x)] Example cont. To prove: some who are intelligent can not read. L. Manevitz Lecture 5

  13. Example cont. Clause Form: • R(x) L(x) • D(y) L(y) • Divided to two: A is Skolem constant • D(A) • I(A) • Negation of theory: I(z) R(z) L. Manevitz Lecture 5

  14. I(z) R(z) I(A) R(A) L(A) D(A) D(A) R(x) L(x) D(y) L(y) 3.2 4 1 2 3.1 Example cont. NIL L. Manevitz Lecture 5

  15. Control Methods • Breadth First. • Set of Support. • Linear Input. L. Manevitz Lecture 5

  16. I(z) R(z) I(z) L(z) I(A) R(A) L(A) D(A) L(A) I(A) R(A) L(A) D(A) R(x) L(x) I(z) D(z) R(y) D(y) D(y) L(y) NIL Breadth First - Example L. Manevitz Lecture 5

  17. I(z) R(z) I(z) L(z) I(A) R(A) L(A) D(A) I(A) D(A) L(A) D(A) D(A) R(x) L(x) I(y) D(y) D(y) L(y) Set of Support - Example L. Manevitz Lecture 5

  18. I(z) R(z) I(z) L(z) I(A) L(A) L(A) R(A) L(A) R(A) I(A) D(A) R(x) L(x) I(z) D(z) I(y) D(y) R(y) D(y) D(y) L(y) Linear Input - Example L. Manevitz Lecture 5

  19. Q(y) P(y) P(A) P(x) Q(w) Q(w) P(w) Q(u) P(A) Q(x) P(x) NIL A refutation tree(note: no linear input tree) L. Manevitz Lecture 5

  20. 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 L. Manevitz Lecture 5

  21. Q(y) P(y) P(A) P(x) Q(w) Q(w) P(w) Q(u) P(A) Q(x) P(x) NIL A refutation tree(note: no linear input tree) L. Manevitz Lecture 5

  22. Example no.1 x [AT(JOHN,x) AT(FIDO,x)] AT(JOHN,School) Where is FIDO ? x [AT(FIDO,x)] x [ AT(FIDO,x)] AT(FIDO,x) L. Manevitz Lecture 5

  23. 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. L. Manevitz Lecture 5

  24. AT(FIDO,x) Negation of Goal AT(JOHN,x) y x AT(JOHN,SCHOOL) Axiom 2 x SCHOOL NIL Example no.1 cont. AT(JOHN,y) AT(FIDO,y) Axiom 1 L. Manevitz Lecture 5

  25. AT(JOHN,x) AT(FIDO,x) AT(FIDO,x) AT(FIDO,x) AT(JOHN,y) AT(FIDO,y) y x AT(JOHN,SCHOOL) x SCHOOL AT(FIDO,SCHOOL) Example no.1-Green’s Trick L. Manevitz Lecture 5

  26. 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)] L. Manevitz Lecture 5

  27. Example no.2 cont. Clause form: • On(u,v) Above(u,v) • Above(x,y) Above(y,z) Above(x,z) • On(B,A) • On(A,Table) • Above(B,Table) L. Manevitz Lecture 5

  28. Above(B,y) Above(y,Table) On(y,Table) Above(B,y) 2 5 1 1 3 4 NIL On(B,y) On(y,Table) On(A,Table) Example no.2 – Resolution L. Manevitz Lecture 5

  29. 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 L. Manevitz Lecture 5

  30. Frame Problem B A A B • Operator: • PutonTable(x): • If x not on table, it puts x on table. How should we represent this in logic ? L. Manevitz Lecture 5

  31. 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) L. Manevitz Lecture 5

  32. 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 L. Manevitz Lecture 5

  33. 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,S0) On(A,Table,S0) 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 L. Manevitz Lecture 5

  34. Frame Problem cont. Clause form: • On(B,A,S0) • On(A,Table,S0) • On(x,Table, S3) On(x,Table,PutonTable(x,S3)) • On(y,z,S4) z=Table On(y,Table,S4) • (A=B) • (B=Table) • (A=Table) • On(u,v,w) On(v,u,w) • On(B,Table,s) Goal Formula L. Manevitz Lecture 5

  35. On(y,z,S4) z=Table On(y,Table,S4) On(B,Table, S3) On(B,Table, PutonTable(B,S3)) S3 S0 S4 S3 On(B,z,S3) z=Table 9 3 4 7 1 On(B,A,S0) On(B,A,S3) NIL On(B,Table, PutonTable(B,S3)) On(B,Table,S) On(B,Table, PutonTable(B,S3)) On(B,Table, PutonTable(B,S0)) S PutonTable(B,S3) x B z A y B On(x,Table, S3)On(x,Table,PutonTable(x,S3)) On(B,Table,S) (A=Table) Green’s Trick L. Manevitz Lecture 5

  36. 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 L. Manevitz Lecture 5

  37. Slide Missing on Start of Proofof A and B on table • Show where you get stuck L. Manevitz Lecture 5

  38. 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 L. Manevitz Lecture 5

  39. q Table On(A,Table,S0) A=B (A=B) 10 5 2 9 On(A,Table,S0) On(A,Table,S0) On(A,Table, PutonTable(B,S0)) NIL p A r B t S0 On(p,q,t) p=r On(p,q,PutonTable(r,t)) L. Manevitz Lecture 5

More Related