2) (2 points) Consider the following meta-interpreter:
Code: Selecteer alles
prove(true) :- !.
prove((A,B)) :- !, prove(A), prove(B).
prove(not(Goal)) :- !, not(prove(;Goal)).
prove(A) :- clause(A,B), prove(B)
Extend the interpreter to support "universal implication", i.e. forall(P,Q) should be interpreted as for all x, P(x) => Q(x).
(Hint: the solution takes one line)
3) (5 points) Explain: anti-unification, give examples. What is the relation with unification?
4) (5 points) How can DCGs be implemented in prolog? Show the basic mechanism, e.g. using an example.