% Define a predicate `elem(E,L)` which is true if the first argument E % is contained in the second list argument L. % If E is the first element of L, then elem(E,L) holds. %elem(E,[E|_]). % If E is the second element of L, then elem(E,L) holds. %elem(E,[X,E|_]). % If E is the third element of L, then elem(E,L) holds. % ... % If E is the first element of L, then elem(E,L) holds. elem(E,[E|_]). % If E is an element of the rest of L, then elem(E,L) holds. elem(E,[_|R]) :- elem(E,R).