Question: Consider the following Prolog facts and rules: membr ( H , [ H | _ ] ) . membr ( H , [ _ |

Consider the following Prolog facts and rules:
membr(H,[H|_]).
membr(H,[_|T]) :- membr(H, T).
unique(X,[H|T]) :- not(X=H), unique(X, T).
unique(H,[H|T]) :- not(membr(H, T)).
Draw the Prolog tree corresponding to each of the following queries, explaining the effect of each
cut:
(a)(15pt)
?- membr(a,[a,b,a]).
true ;
true ;
false.
(b)(17pt)
?- unique(a,[b,a,c]).
true ;
false.
(c)(18pt)
?- unique(a,[a,b,a]).
false.

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 Programming Questions!