I think we should leave the and/or folding to a dedicated optimizer pass (IIRC that's "expression simplification") instead of re-implementing it here again. It's unnecessarily complex, potentially slow, requires more tests to write and maintain, and is a potential source of additional bugs.