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.
Simplify codegen to work on expanded expressions

* src/pf/codegen.lua: Update to work on expanded expressions.
Better conditional folding

* src/pf/expand.lua: Rotate asserts out of test position to expose test
  expressions to conditional folding.
New compiler has length argument

* src/pf/codegen.lua: Add length argument to predicates.
* src/pf/expand.lua: Print less.
Remove prints

* src/pf/codegen.lua:
* src/pf/expand.lua: Remove more prints.
Simple codegen-time CSE.

* src/pf/codegen.lua: Add a simple emit-time CSE.
Add "port" expander.

* src/pf/expand.lua: Add expander for "port".
Simplify IR

* src/pf/expand.lua:
* src/pf/codegen.lua: Change "constant" to "true"/"false", and transform
  "and" and "or" to "if".
Fixes

* src/pf/expand.lua: Tweak debug printing.
* src/pf/codegen.lua: Fix true/false/fail.
Better if code generation

* src/pf/codegen.lua: Better code generation for if.