aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Tactics/NormalizeCommutativeIdentifier.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2018-10-10 10:14:08 -0400
committerGravatar Jason Gross <jgross@mit.edu>2018-10-10 10:14:08 -0400
commit02e50d0bd18f5fa2f173bb6ecc36da5c316ecaa1 (patch)
tree5bdf8fa2d7125b36c6cd6008eb2d34101c89e816 /src/Util/Tactics/NormalizeCommutativeIdentifier.v
parent222a8d9abf3724ab2458aecf445ad21c12da902e (diff)
Rename [normalize_commutative_identifier] file to match tactic name
Diffstat (limited to 'src/Util/Tactics/NormalizeCommutativeIdentifier.v')
-rw-r--r--src/Util/Tactics/NormalizeCommutativeIdentifier.v16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Util/Tactics/NormalizeCommutativeIdentifier.v b/src/Util/Tactics/NormalizeCommutativeIdentifier.v
new file mode 100644
index 000000000..00af95566
--- /dev/null
+++ b/src/Util/Tactics/NormalizeCommutativeIdentifier.v
@@ -0,0 +1,16 @@
+(** Rewrite with the commutative property to ensure that all appearences of an identifier show up the same way *)
+
+Ltac rewrite_with_comm id clem x y :=
+ first [ constr_eq x y; fail 1
+ | repeat match goal with
+ | [ H' : context[id y x] |- _ ]
+ => rewrite clem in H'
+ | [ |- context[id y x] ]
+ => rewrite clem
+ end ].
+
+Ltac normalize_commutative_identifier id id_comm :=
+ repeat match goal with
+ | [ |- context[id ?x ?y] ] => progress rewrite_with_comm id (id_comm y x) x y
+ | [ H : context[id ?x ?y] |- _ ] => progress rewrite_with_comm id (id_comm y x) x y
+ end.