Question: PROLOG: Please answer a and b (a) try to trace through search process for Q2; (b) try to trace through Q1, but with sub-goals reversed.

PROLOG: Please answer a and b

(a) try to trace through search process for Q2;

(b) try to trace through Q1, but with sub-goals reversed.

Who teaches what.

f1: teaches(john, database, s1).

f2: teaches(john, ai, s1).

f3: teaches(mary, os, s1).

f4: teaches(mary, ai, s2).

f5: teaches(paul, compiler, s1).

Query 1: Whats the course taught by John and Mary?

?- teaches(john, X, _), teaches(mary, X, _).

Query 2: Who teaches both os and compiler?

?- teaches(X, os, _), teaches(X, compiler, _).

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!