allsame([]).
  allsame([A]).
  allsame([A,A|R]) :- allsame([A|R]).

Notice that you only include axioms to say when two lists make the predicate true. You do not say what makes the predicate false.

If you are restricted to [A|R], you can write it as follows.

  allsame([]).
  allsame([A]).
  allsame([A|S]) :- S = [A|R], allsame([A|R]).