Add efficient find for monotone predicates
Add efficient find for monotone predicates

Add a utility function, that, as long as `p` is monotone on `xs`
is the same as `find p xs`, however evaluating the predicate `p`
less often by using the monotonicity property. This is useful if
evaluating the predicate is an expensive operation. To use further
knowledge about the list to be searched through, the function is
monotonic in the heuristics. Examples of heuristics include
- taking `const 10` for constant-look-ahead guess and verify, and
- taking `\ x -> length x / 2` for binary search.

Signed-off-by: Klaus Aehlig <4ce51de36d9068cd7db2eec1151e0f3f95419008@google.com>
Reviewed-by: Petr Pudlak <9d19625f8ee825a2c398462ed335cbcf98f79c32@google.com>

onponomarev/ganeti,mbakke/ganeti,andir/ganeti,mbakke/ganeti,andir/ganeti,leshchevds/ganeti,leshchevds/ganeti,andir/ganeti,ganeti/ganeti,leshchevds/ganeti,onponomarev/ganeti,mbakke/ganeti,ganeti/ganeti,ganeti/ganeti