Question: this program should be in PROLOG language Write a recursive predicate sublist/2 that checks if a list S is a sublist of list L, meaning

this program should be in PROLOG language

this program should be in PROLOG language Write a recursive predicate sublist/2

Write a recursive predicate sublist/2 that checks if a list S is a sublist of list L, meaning that all elements in S are also in L. Assume for now there are no repeated elements in S or in L. Some test queries: ?- sublist ([9, 2, a], [a, b, c, 2, 3, 9]). true. ?- sublist ([], [1, 2, 3]). true. ?- sublist ([1, 2], [1, 3, 4]). false. Now modify your program so that it works with repeated elements. Consider using the built-in predicate select/3. Some test queries: ?- sublist ([1, 2, 1], [1, 1, 2, 3]). true. ?- sublist ([a, a, c], [a, b, c]). false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!