Suppose I have a second-order match such as
match H with
| let x : nat := ?y in @?z x => (* ... *)
end
and I want to get the application z 0. (Preferably beta-reduced once so that I actually get the body of the let with 0 substituted for x.) How can I do this?
Similarly, is it possible to get the body of the let with the free variable x in it? (As if I had matched it as ?z instead of @?z x.) How about if I want to rename the free variable to y instead?
(IIRC this is the trick involving a seemingly useless match f with | f' => ... end but I can’t remember or find the details.)