Replaces expression from (age >= X and age <= Y) into (age between X Y)
It detects some predicates which are trivally false.
Imagine this: (age >= 5 and age <= 4) This predicate is always false.
It also eliminates some conditions. Imagine this: (age >= 10 and age <= 20 and age < 40).
In this case the condition (age < 40) can be eliminated safely and the predicate
be be rewritten as (age between 10 20)
When resulting AndPredicate contains only a single inner predicate then it returns
only the inner predicate. In other words: (and p) is rewritten as (p). I used prefix
notation here as it's easier to understand.