

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Logic Programming and Artificial Intelligence 3 March 2010 Solutions to LPA Problem Sheet 6
None {x′^7 → g(x), y 7 → g(x)} f (y′, g(y′)) XXXXX {y 7 → y′} {y′^7 → a, y 7 → g(a)}
None {y 7 → y′, x 7 → y′} f (a, y′) XXXXX XXXXX {y 7 → y′} {y′^7 → b} {y 7 → a, y′^7 → g(x)} f (a, b) XXXXX XXXXX XXXXX {} None f (y′, g(x′)) XXXXX XXXXX XXXXX XXXXX {x 7 → x′, y 7 → y′}
Some of these boxes also have other most general unifiers. For example, {x′^7 → x} is also a correct entry for the first column of the first row.
X = e ; Redo: (8) above(d, _G429)? creep % B Call: (9) on(d, _L204)? creep % leftmost atom of E Exit: (9) on(d, e)? creep % leftmost atom of E suceeds Call: (9) above(e, _G429)? creep % F Call: (10) on(e, _G429)? creep % G Fail: (10) on(e, _G429)? creep % G fails Redo: (9) above(e, _G429)? creep % back to F Call: (10) on(e, _L215)? creep % leftmost atom of H Fail: (10) on(e, _L215)? creep % leftmost atom of H fails Redo: (7) below(_G429, d)? creep % back to A
No
The search space continues forever in a similar manner. It contains no solutions. Given this problem, PROLOG would run forever, or until it ran out of space. It would go down the infinite path from the node labelled P(f(x),y) & A(y,j). (b) A(x,j) P(x,j) ............ from 3 fail P(y,j) & A(x,y) ... from 4’ fail
(c) A(j,x) [x=x] P(j,x) [x=x] ..................... from 3 [] [x=f(j)] ................... from 1 [] [x=m(j)] ................... from 2 P(j,y) & A(y,x) [x=x] ............ from 4 A(f(j),x) [x=x] ............... from 1 P(f(j),x) [x=x]............. from 3 [][x=f(f(j))] ........... from 1 [][x=m(f(j))] ........... from 2 P(f(j),y & A(y,x) [x=x] .... from 4 A(f(f(j)),x) [x=x] ...... from 1 A(m(f(j)),x) [x=x] ...... from 2 A(m(j),x) [x=x] ............... from 2 P(m(j),x) [x=x]............. from 3 [][x=f(m(j))] ........... from 1 [][x=m(m(j))] ........... from 2 P(m(j),y & A(y,x) [x=x] .... from 4 A(f(m(j)),x) [x=x] ...... from 1 A(m(m(j)),x) [x=x] ...... from 2
This search space is infinite and contains no failed paths. In contains an infinite set of solutions, all of the form [x=ANSWER], where ANSWER is any term generated by the following rules:
The first answer means that PROLOG has proved ∀x A(x, f (x)), that is, “one’s father is one’s ancestor.” The second answer means that PROLOG has proved ∀x A(x, m(x)), that is, “one’s mother is one’s ancestor.” (f) No inferences can be performed by SLD. P (x, x) does not unify with premise 1 or 2 because of an occur check. However, since PROLOG does not detect occur