Question: The following program shows who is sitting at some table. The predicate sits_right_of/2 represents who is sitting right of whom. The predicate sits_right_of(X,Y) is true

The following program shows who is sitting at some table. The predicate sits_right_of/2 represents who is sitting right of whom. The predicate sits_right_of(X,Y) is true if X is to the right of Y.

sits_right_of(ron,natalie). sits_right_of(hermione,ron). sits_right_of(harry,hermione). sits_right_of(colin,harry). sits_right_of(seamus,colin). sits_right_of(angelina,seamus). sits_right_of(ginny,angelina). sits_right_of(dean,ginny). sits_right_of(dennis,dean). sits_right_of(lee,dennis). sits_right_of(george,lee). sits_right_of(fred,george). sits_right_of(alicia,fred). sits_right_of(neville,alicia). sits_right_of(lavender,neville). sits_right_of(parvati,lavender). sits_right_of(katie,parvati). sits_right_of(natalie,katie). 

Based on the previous knowledge base, formulate the rules defining the following predicates:

sits_left_of/2: sits_left_of(X,Y) should be true if X is to the left of Y.

are_neighbors_of/3: are_neighbors_of(X,Y,Z) should be true if X is to the left of Z

and Y is to the right of Z.

next_to_each_other/2: next_to_each_other(X,Y) should be true if X is next to 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!