 <p>In the wording in which you've posed the problem, the only correct solution is a double iteration over A and B and filter, as you've suggested. That's because you've stated the problem as to "construct the set C", which lacking other information, generally means to <em>enumerate</em> the set C. The only way to do that and get the exact enumeration of C, at least with the information provided, is to evaluate F on each element in A &times; B.</p> <p>In another way of interpreting the problem, you can say you have a definition of C if you have a characteristic function, but that's just F. So I'll assume that's not what you mean.</p> <p>The key seems to be that you need to elucidate the relevant properties of F, since that's the algorithmic hook for an enumeration of C. What I mean by this is that you should propose an axiom about F that allows you some shortcut over direct filtration. That could mean, for example, the existence of some auxiliary function G that allows a shorter algorithm. Assuming such a G, an enumeration algorithm would evaluate both F and G, rather than F alone.</p>