Solution
%% To get a sublist of a list L, first take a suffix S of L. This cuts %% off something from the front end of the list. Then take a prefix of %% S. This cuts off something from the end of the list. In other %% words, a sublist of a list is a prefix of a suffix of that list. sublist(SubL,L) :- suffix(S,L),prefix(SubL,S).