diff options
author | Jason Gross <jgross@mit.edu> | 2018-10-10 10:12:45 -0400 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2018-10-10 10:12:45 -0400 |
commit | 222a8d9abf3724ab2458aecf445ad21c12da902e (patch) | |
tree | 675e5d9012eaebfa9b8a1a1af6efad9cae46d471 /src/Util | |
parent | e9aa3df50d5679fb20993b169bb345ee81ff0e07 (diff) |
Add [normalize_commutative_identifier] tactic
Diffstat (limited to 'src/Util')
-rw-r--r-- | src/Util/Tactics/RewriteWithCommutativity.v | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Util/Tactics/RewriteWithCommutativity.v b/src/Util/Tactics/RewriteWithCommutativity.v new file mode 100644 index 000000000..00af95566 --- /dev/null +++ b/src/Util/Tactics/RewriteWithCommutativity.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. |