Extract a predicate that checks whether is the index valid