Also draw box-and- arrow diagram the difference list
Please see the separate scan of the hand-drawn tree. Also try running the goal with the Prolog trace facility.
2. Consider mymember and also the member_cut rule defined in the notes on controlling search. What are all the answers that Prolog returns for the following goals?
(Note that you get the same answer twice!)
?- member_cut(X,[1,2]), mymember(X,[0,2,2]). false.
1
?- not(mymember(5,[1,2,3])).
true.append([],Ys,Ys).
append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs).
(b) Give an example of a query that has exactly the same behavior for both the standard version and the version with a cut.
append([1,2],[3,4,5],X).
[1,2|T]\T -- valid, represented [1,2] [1,2,3]\[] -- valid, represents [1,2,3] [1,2,3]\[1,2] -- not valid
[1,2,3|T]\[3|T] -- valid, represents [1,2] [1,2,3]\[1,2,3] -- valid, represents []7. Write the list [squid,clam] as a difference list (in the most general possible way). Also draw a box-and- arrow diagram of the difference list.