Docsity

Solutions to CPSC 625: Artificial Intelligence Homework 5, Assignments of Computer Science

Toggle sidebar
bg1
CPSC 625: Artificial Intelligence
Fall 2000
Solutions to Homework 5
Question 1
Notes:
1. The traces which follow are based on the unification algorithm given on page
303 of the text, with the following modifications in the last line:
-{x/var} should be substituted by {var/x}
-when we perform add {var/x} to in UNIFY-VAR, we apply {var/x} to every
substitution already in , and then insert var/x in the set i.e. if =
{v1/s1, v2/s2, ...}, we replace all si by SUBST({var/x}, si) in and then
insert var/x in .
2. Lists of arguments are in LISP notation i.e. the empty list is (), the list of
elements x,y and z is (x y z)
(a) {P(f(y)), P(f(B))}
UNIFY(P(f(y)), P(f(B)))
UNIFY-INTERNAL(P(f(y)), P(f(B)), { })
UNIFY-INTERNAL((f(y)), (f(B)), UNIFY-INTERNAL(P, P, { }))
{ }
UNIFY-INTERNAL((f(y)), (f(B)), { })
UNIFY-INTERNAL((), (), UNIFY-INTERNAL(f(y), f(B), { }))
UNIFY-INTERNAL((y),(B), UNIFY-INTERNAL(f,f,{}))
{}
UNIFY-INTERNAL((y), (B), {})
UNIFY-INTERNAL((),(),UNIFY-INTERNAL(y,B,{}))
UNIFY-VAR(y,B,{ })
{y/B}
{y/B}
{y/B}
{y/B}
{y/B}
{y/B}
{y/B}
{y/B}
{y/B}
(b) {P(x,A), P(f(z),z)}
UNIFY(P(x,A), P(f(z),z))
UNIFY-INTERNAL(P(x,A), P(f(z),z), { })
UNIFY-INTERNAL((x A), (f(z) z), UNIFY-INTERNAL(P, P, { }))
{ }
UNIFY-INTERNAL((x A), (f(z) z), { })
UNIFY-INTERNAL((A), (z), UNIFY-INTERNAL(x, f(z), { }))
pf3
pf4
pf5

Partial preview of the text

Download Solutions to CPSC 625: Artificial Intelligence Homework 5 and more Assignments Computer Science in PDF only on Docsity!

CPSC 625: Artificial Intelligence

Fall 2000

Solutions to Homework 5

Question 1

Notes:

  1. The traces which follow are based on the unification algorithm given on page 303 of the text, with the following modifications in the last line:
    • {x/var} should be substituted by {var/x}
    • when we perform add {var/x} to  in UNIFY-VAR, we apply {var/x} to every substitution already in , and then insert var/x in the set  i.e. if  = {v 1 /s 1 , v 2 /s 2 , ...}, we replace all si by SUBST({var/x}, si) in  and then insert var/x in .
  2. Lists of arguments are in LISP notation i.e. the empty list is (), the list of elements x,y and z is (x y z) (a) {P(f(y)), P(f(B))} UNIFY(P(f(y)), P(f(B))) UNIFY-INTERNAL(P(f(y)), P(f(B)), { }) UNIFY-INTERNAL((f(y)), (f(B)), UNIFY-INTERNAL(P, P, { })) { } UNIFY-INTERNAL((f(y)), (f(B)), { }) UNIFY-INTERNAL((), (), UNIFY-INTERNAL(f(y), f(B), { })) UNIFY-INTERNAL((y),(B), UNIFY-INTERNAL(f,f,{})) {} UNIFY-INTERNAL((y), (B), {}) UNIFY-INTERNAL((),(),UNIFY-INTERNAL(y,B,{})) UNIFY-VAR(y,B,{ }) {y/B} {y/B} {y/B} {y/B} {y/B} {y/B} {y/B} {y/B} {y/B} (b) {P(x,A), P(f(z),z)} UNIFY(P(x,A), P(f(z),z)) UNIFY-INTERNAL(P(x,A), P(f(z),z), { }) UNIFY-INTERNAL((x A), (f(z) z), UNIFY-INTERNAL(P, P, { })) { } UNIFY-INTERNAL((x A), (f(z) z), { }) UNIFY-INTERNAL((A), (z), UNIFY-INTERNAL(x, f(z), { }))

UNIFY-VAR(x, f(z), { }) {x/f(z)} {x/f(z)} UNIFY-INTERNAL((A), (z), {x/f(z)}) UNIFY-INTERNAL((), (), UNIFY-INTERNAL(A, z, {x/f(z)})) UNIFY-VAR(z, A, {x/f(z)}) {x/f(A), z/A} {x/f(A), z/A} UNIFY-INTERNAL((), (),{x/f(A), z/A}) {x/f(A), z/A} {x/f(A), z/A} {x/f(A), z/A} {x/f(A), z/A} {x/f(A), z/A} (c) {P(f(y)), P(f(g(z)))} UNIFY(P(f(y)), P(f(g(z)))) UNIFY-INTERNAL(P(f(y)), P(f(g(z))), { }) UNIFY-INTERNAL((f(y)), (f(g(z))), UNIFY-INTERNAL(P, P, { })) { } UNIFY-INTERNAL((f(y)), (f(g(z))), { }) UNIFY-INTERNAL((y), (g(z)), UNIFY-INTERNAL(f, f, { })) { } UNIFY-INTERNAL((y), (g(z)), { }) UNIFY-INTERNAL((), (), UNIFY-INTERNAL(y, g(z), { })) UNIFY-VAR(y, g(z), { }) {y/g(z)} {y/g(z)} UNIFY-INTERNAL((), (), {y/g(z)}) {y/g(z)} {y/g(z)} {y/g(z)} {y/g(z)} {y/g(z)}

(e) {P(f(y), y, x), P(x, f(A), f(z))} UNIFY(P(f(y), y, x), P(x, f(A), f(z))) UNIFY-INTERNAL(P(f(y), y, x), P(x, f(A), f(z)), { }) UNIFY-INTERNAL((f(y) y x), (x f(A) f(z)), UNIFY-INTERNAL(P, P, { })) { } UNIFY-INTERNAL((f(y) y x), (x f(A) f(z)), { }) UNIFY-INTERNAL((y x), (f(A) f(z)), UNIFY-INTERNAL(f(y), x, { })) UNIFY-VAR(x, f(y), { }) {x/f(y)} {x/f(y)} UNIFY-INTERNAL((y x), (f(A) f(z)), {x/f(y)}) UNIFY-INTERNAL((x), (f(z)), UNIFY-INTERNAL(y, f(A), {x/f(y)})) UNIFY-VAR(y, f(A), {x/f(y)}) {x/f(f(A)), y/f(A)} {x/f(f(A)), y/f(A)} UNIFY-INTERNAL((x), (f(z)), {x/f(f(A)), y/f(A)}) UNIFY-INTERNAL((), (), UNIFY-INTERNAL(x, f(z), {x/f(f(A)), y/f(A)})) calls UNIFY-VAR(x, f(z), {x/f(f(A)), y/f(A)}) UNIFY-INTERNAL(f(f(A)), f(z), {x/f(f(A)), y/f(A)}) UNIFY-INTERNAL((f(A)),(z),UNIFY-INTERNAL(f, f,{x/f(f(A)),y/f(A)})) {x/f(f(A)), y/f(A)} UNIFY-INTERNAL((f(A)),(z),{x/f(f(A)), y/f(A)}) UNIFY-INTERNAL((),(),UNIFY-INTERNAL(f(A), z, {x/f(f(A)), y/f(A)})) UNIFY-VAR(z, f(A), {x/f(f(A)), y/f(A)}) {x/f(f(A)), y/f(A), z/f(A)} {x/f(f(A)), y/f(A), z/f(A)} {x/f(f(A)), y/f(A), z/f(A)} {x/f(f(A)), y/f(A), z/f(A)} . . . . . {x/f(f(A)), y/f(A), z/f(A)}

QUESTION 2

Interpretation of predicate symbols used: CollegeStudent(x,y) : x is a student of college y InFootballConf(x,y) : College x is in the football conference y NewsAbout(x,y) : x is news about y; y can be a team or a conference Likes(x,y) : x likes news y Football(x) : x is a football team Sports(x) : x is a sports team NBA(x) : The team x is part of NBA Constant symbols used: Steve, TAMU, Big12-SW, ChicagoBulls (a) Translation of sentences into formulas in predicate logic

  1. Steve is a College Student of Texas A&M University: CollegeStudent(Steve, TAMU)
  2. Texas A&M University belongs to the Big 12 South-West conference: InFootballConf(TAMU, Big12-SW)
  3. All college students like college football news about the conference to which their university belongs: x,y,z,w CollegeStudent(x,y)  InFootballConf(y,z)  NewsAbout(w,z)  Likes(x,w)
  4. Among sports news, Steve only likes football news: x,y Likes(Steve,x)  NewsAbout(x,y)  Sports(y)  Football(y)
  5. NBA is a sports; NBA is not football (i.e. all teams in NBA are sports team, but they are not football teams): x NBA(x)  Sports(x)  Football(x)
  6. Chicago Bulls is in NBA: NBA(ChicagoBulls) (b) Formulas in clause form A clause is a disjunction of positive or negative literals, where the variables are assumed to be universally quantified and different variable names are used in different formulas. Note that P  Q can be re-written as P  Q
  7. CollegeStudent(Steve, TAMU)
  8. InFootballConf(TAMU, Big12-SW)
  9. CollegeStudent(x 1 ,y 1 )  InFootballConf(y 1 ,z 1 )  NewsAbout(w 1 ,z 1 )  Likes(x 1 ,w 1 )
  10. Likes(Steve,x 2 )  NewsAbout(x 2 ,y 2 )  Sports(y 2 )  Football(y 2 ) 5a. NBA(x 3 )  Sports(x 3 ) 5b. NBA(x 4 )  Football(x 4 )
  11. NBA(ChicagoBulls)