Suppose that we have these (and only these) facts about knows/2.
knows(jim,fred).How do we find all the solutions of the form knows(X,Y)? Now the goal knows(X,Y) is equivalent to asking ``does there exist some X and some Y such that knows(X,Y)''. For all solutions we want to ask something like ``for what set of values of X and set of values of Y is it true that for all X and all Y then knows(X,Y)''.
setof([X,Y],knows(X,Y),Z).where Z is the set of all solution pairs [X,Y] such that knows(X,Y).
Z = [[jim,fred],[alf,bert]] [-5pt]