Add definitions of flatMap and flatten
Implement Option lifting and catamorphism

- All extension methods are implemented (based on `fold` and `flatMap`).
  They all translate to OptionFold nodes.

- encodeRef (in various places) needs to take a Node, not just Path.
  We’ll get other kinds of nodes in OptionApply.

- The new expandSums phase handles the translation of OptionApply for
  Options of primitive column types to make the existing operations
  work with the new encoding.