I am abstracting a real world problem into the following question:
F is expensive and X is huge. What is the most efficient way to extract as many results from Y as possible? False positives are ok.
Introduce another function G which is cheap and also tests whether x belongs to y. G must return true whenever F returns true, and may return true when F returns false. First test with G, testing with F only if G returns true.
I don't see how to say anything more specific, considering the generality of your formulation.