Logic Programming Qualifying Examination
January 12th, 1999 -- 12-14pm
interpret(true).
interpret((Goal1,Goal2)) :-
interpret(Goal1),
interpret(Goal2).
interpret(Goal) :-
clause(Goal,Body),
interpret(Body).
Extend the Vanilla meta-interpreter to produce a sound implementation of negation as failure. Your meta-interpreter should delay the execution of non-ground negative goals and signal an error when floundering occurs.
Do not worry about the finer details of the implementation, focus on providing the general structure of the metainterpreter
Discuss the relations between the execution strategy used by Prolog and the soundness and completeness of negation as failure.
p(a).
p(b).
p(a).
the goal setof(X,p(X),L) produces the list
Describe how you would produce the same result of setof without using setof. I.e., describe (if possible) a Prolog program that implements setof without using any of the all-solutions predicates of Prolog (i.e., no findall, bagof, etc.). Your solution should also guarantee that no repetitions of solutions occur.