Add initial implementation of function declarations

Now,
fun f 0 = 1
  | f x = x `times` (f (pred x))

is getting desugared to

letrec f = (fn x => case x of
       0 -> 1
       x -> x `times` (f (pred x))) in f

This isn't very pretty but works just fine