Consider the following development:
Definition done {T : Type} (x : T) := True.
Goal Test.
pose 1 as n.
assert (done n) by constructor.
Fail ltac:(
match goal with
| [ H : done _ |- _ ] => fail
| [ H : _ |- _ ] =>
match goal with
| [ _: done H |- _ ] => idtac "H == n"
| [ _: done n |- _ ] => idtac "H != n"; fail 2
end
end
).
Abort.
This prints H != n
. I'm finding this very surprising, since the only hypothesis in scope are n
and done n
- and done n
was already dispatched by the first branch of the top-level match.
How can I match done n
without explicitly referring to n
, as in the first branch of the second match?