I want to write a prolog program that checks if a list is included in other list.
Multiple elements matter
This is what I wrote but it fails for the input - inclusion([a,b,b,d],[a,b,b,c,c,d,d]).
This should return true. other examples - inclusion([a, b, b, b, d], [a, b, b, c, c, d, d])
should return false.
inclusion([],_).
inclusion([X|L],Set):-
member(X,Set),delete(Set,X,Set2), inclusion(L,Set2).
Above is the code that I wrote. The logic was check if the first element is in Set.
Then delete that element from the set and check if the remaining list is in the Set.
But this doesn't seem to work