** Next:** Stage 2
**Up:** Powerful Features ---Finding
** Previous:** setof/3

Suppose that we have these (and only these) facts about ** knows/2**.

`
knows(jim,fred).
`
knows(alf,bert).
[-5pt]

`
`

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).
`
Z = [[jim,fred],[alf,bert]]
[-5pt]

`
`

where ** Z** is the set of all solution pairs ** [X,Y]** such that
** knows(X,Y)**.

*Paul Brna *

Mon May 24 20:14:48 BST 1999