Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following Prolog program: edge(a, b). edge(c, d). edge(a, c). edge(c, b). edge(X, Y) :- edge(Y, X). path(X, X). path(X, Y) :- edge(Z, Y),

Consider the following Prolog program:

edge(a, b).

edge(c, d).

edge(a, c).

edge(c, b).

edge(X, Y) :- edge(Y, X).

path(X, X).

path(X, Y) :- edge(Z, Y),

path(X, Z).

Note that this program is nearly identical to one presented in lecture except for the inclusion of the extra rule: edge(X, Y) :- edge(Y, X).

The intent is that, with this additional rule, the program should model an undirected (as opposed to directed) graph.

(a) Execute the query: ?- edge(a,b). What response do you get?

(b) Execute the query ?- edge(b,a). What response do you get?

(c) Execute the query ?- edge(a, d). What response do you get? And why?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago