You can trace Prolog's computations by giving the command ?-trace. This will put Prolog in trace mode, showing every single resolution step (except for the predicates that have been compiled rather than consulted). Trace mode is switched off by the command ?-notrace. An example of a trace is given here.
These three predicates have the disadvantage that the empty list is generated
n+1 times, where n is the length of the second argument.
Change each of the definitions to avoid this.
(Hint: treat the empty sublist as special case, making sure that the given
clauses don't succeed for the emtpy list.)
?-subsequence([c,d,e],[a,b,c,d,e,f]). yes ?-subsequence([c,e],[a,b,c,d,e,f]). yes ?-subsequence([f,a],[a,b,c,d,e,f]). no
Does your definition generate all solutions of the query ?-element1(X,[a,b,b,c]).? If not, why not?