fill in most of the pattern-match compiler implementation

it remains now to be completely filled in and
typechecked/tested/debugged.

after that happens, we can start on its internal proofs of correctness,
and on linking it in to the rest of the compiler.