expand.lua does constant folding

* src/pf/expand.lua: Implement some simple constant folding, as we
  introduce a fair bit of duplication.
More simplification of expanded expressions

* src/pf/expand.lua: More algebraic simplification.
Add conditional-folding pass

* src/pf/expand.lua: Add a pass to fold conditionals.