Last active
February 9, 2020 04:41
-
-
Save dramforever/b670a2a7dd468be37fe9e2f2f547cb6d to your computer and use it in GitHub Desktop.
Coq: How do I match inside a binder properly?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ltac detect := | |
match goal with | |
| [ |- context G [ forall x : ?T, _ (* ?E *) ] ] => | |
idtac G T; fail | |
end. | |
Theorem test : (forall x, x = 1) = (forall x, x = 2). | |
Proof. | |
try detect. | |
(* As shown above: _ matches inside binders expectedly | |
(?CONTEXT-HOLE = (forall x : nat, x = 2)) nat | |
((forall x : nat, x = 1) = ?CONTEXT-HOLE) nat | |
*) | |
(* Change _ into ?E (no output) -> doesn't match anymore | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment