Question: In Prolog, suppose we have a predicate supervisor ( x , Y ) that is true just when x is the direct supervisor of Y

In Prolog, suppose we have a predicate supervisor (x,Y) that is true just when x is the direct supervisor of Y.
a) Define a predicate higherup (x,Y) that is true just when x is above or equal to Y in a chain of supervisors. For example if supervisor(a,b), supervisor(b,c) and supervisor(c,d) are true then higherup(a,a), higherup(a,b), higherup(a,c) and higherup(a,d) would all be true.
b) Define a predicate shared_boss (x,Y,Z) that is true just when Z is higherup than both x and Y.
c) Define a predicate closest_shared_boss (x,Y,Z) that's true just when Z is a shared_boss of x and Y and there is no W, distinct from Z, such that W is a shared boss of x, and Y and Z is higher up than W..
d) Draw a tree diagram of a hierarchy in which sup(a,b), sup(b,c), sup(c,d), sup(c,e), sup(e,f) are all true. Then explain how your rules for shared_boss would find all the shared bosses d and f. Also show how your rules would find the nearest shared boss of d and f.
 In Prolog, suppose we have a predicate supervisor (x,Y) that is

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!