General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Solution

%% If the list L can be constructed by concatenating P with something,
%% then P is a prefix of L.
prefix(P,L) :- append(P,_,L).
    

Back to the exercise.