Normalize predicates before plan building

To plan predicate selection well, predicates
are now rewritten to conjunctive normal form
before planning starts.

Another difference is that And and Or expressions
are replaced with Ands and Ors so these can be
worked with as collections instead of trees.
Merge pull request #2328 from systay/boolean-normalization

Normalize predicates before plan building