rich(john). healthy(john). healthy(tim). happy(X) :- rich(X), healthy(X).These statements encode the facts that John is rich, John and Tim are both healthy, and everyone who is both healthy and rich is also happy. Create a new Prolog file that encodes the following:
in(X, [X | T]). in(X, [H | T]) :- in(X, T).Load these rules, and try them out with a few queries. Then create a new set of rules to that can check to see if an item appears in two consecutive locations in a list. Example queries might look like the following:
| ?- in_double(c, [a, b, c, c, d]). true ? yes | ?- in_double(c, [a, b, c, d]). no | ?- in_double(b, [a, X, X, c, d]). X = b ? yes