No need to put predicate names in quotation marks (unless you use spaces or some other non-alphabet characters, but usually you shouldn't do it).
And it's better to use ISO-standard atom_codes
instead of name
.
Here is a somewhat high-level implementation of what you want:
contain(X, Y) :-
atom_codes(X, Xcodes),
atom_codes(Y, Ycodes),
append(_, End, Xcodes),
append(Ycodes, _, End).
Test run (I use contain(progressive, progress).
instead of contain([progressive, progress]).
given in your example because it makes more sense to me. If you need to conform the example exactly, just change the head of the predicate contain(X, Y)
to contain([X, Y])
):
?- contain(progressive, progress).
true
?- contain(progressive, progrev).
false.