Question: Question 5 [10] Consider the Prolog database and procedures given below distance (X,Y,D) - d(X,Y,D); d(Y,X,D). d(pta, bfn, 455) d(bfn,ct,990) a(bfn,pe, 680) a(jhb, kby, 470).
![Question 5 [10] Consider the Prolog database and procedures given below](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f30345bbaf0_11766f303453cbae.jpg)
Question 5 [10] Consider the Prolog database and procedures given below distance (X,Y,D) - d(X,Y,D); d(Y,X,D). d(pta, bfn, 455) d(bfn,ct,990) a(bfn,pe, 680) a(jhb, kby, 470). a(ct, kby,970) coastal(ct) coastal (pe) interior(X):- not(coastal(x)) (2) collecti(L) - bagof(x, distance(X,Y,D),L) collect2(L):- setof (X,D\distance (X,Y,D),L) (a) Give the value of L returned by the following query 7- collect1(L). (b) Give the value of L returned by the following query 7- collect2(L). (c) Give all the results of the following query ?- coastal(x), once (distance (X,Y,D)), interior (Y) (d) Give all the results of the following query: ?- coastal(x), not((distance (X,Y,D),coastal(Y))) (2) (3) (3) Question 5 [10] Consider the Prolog database and procedures given below distance (X,Y,D) - d(X,Y,D); d(Y,X,D). d(pta, bfn, 455) d(bfn,ct,990) a(bfn,pe, 680) a(jhb, kby, 470). a(ct, kby,970) coastal(ct) coastal (pe) interior(X):- not(coastal(x)) (2) collecti(L) - bagof(x, distance(X,Y,D),L) collect2(L):- setof (X,D\distance (X,Y,D),L) (a) Give the value of L returned by the following query 7- collect1(L). (b) Give the value of L returned by the following query 7- collect2(L). (c) Give all the results of the following query ?- coastal(x), once (distance (X,Y,D)), interior (Y) (d) Give all the results of the following query: ?- coastal(x), not((distance (X,Y,D),coastal(Y))) (2) (3) (3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
