Add utils.lua

* src/pf/utils.lua: New file.
* src/Makefile: Wire up self-test.
expand.lua uses utils.lua

* src/pf/expand.lua: Use utils.lua.
Split optimize.lua out from expand.lua

* src/pf/optimize.lua: Split out from expand.lua.

* src/pf/expand.lua:
* src/pf.lua:
* src/Makefile: Adapt