Question: distance ( X , Y , D ) : - d ( X , Y , D ) ; d ( Y , X ,

distance(X,Y,D):- d(X,Y,D); d(Y,X,D).
d(pta,bfn,455).
d(bfn,ct,990).
d(bfn,pe,680).
d(jhb,kby,470).
d(ct,kby,970).
coastal(ct).
coastal(pe).
interior(X):- not(coastal(X)).
collect1(L):- bagof(X,distance(X,Y,D),L).
collect2(L):- setof(X,D\^distance(X,Y,D),L).
1. Give the value of L returned by the following query:
?- collect1(L).(2)
2. Give the value of L returned by the following query:
?- collect2(L).(2)
3. Give all the results of the following query:
?- coastal(X),once(distance(X,Y,D)),interior(Y).(3)
4. Give all the results of the following query:
?- coastal(X), not((distance(X,Y,D),coastal(Y))).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!