aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Tactics
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2017-07-08 15:59:53 -0400
committerGravatar Jason Gross <jgross@mit.edu>2017-07-08 16:01:19 -0400
commit5aa6b0a6b2ac0561125716710662adab6ad6f333 (patch)
treedcd50d5c9e51bca63566e10a48a824f0e197e42f /src/Util/Tactics
parentc13b59e4e416b308f709bf5e901f29580fb04f5a (diff)
Add UnfoldArg
Diffstat (limited to 'src/Util/Tactics')
-rw-r--r--src/Util/Tactics/ChangeInAll.v4
-rw-r--r--src/Util/Tactics/UnfoldArg.v11
2 files changed, 15 insertions, 0 deletions
diff --git a/src/Util/Tactics/ChangeInAll.v b/src/Util/Tactics/ChangeInAll.v
index 39a031207..c18055962 100644
--- a/src/Util/Tactics/ChangeInAll.v
+++ b/src/Util/Tactics/ChangeInAll.v
@@ -5,3 +5,7 @@ Ltac change_in_all from to :=
repeat match goal with
| [ H : _ |- _ ] => progress change from with to in H
end.
+
+Ltac change_with_compute_in_all c :=
+ let c' := (eval compute in c) in
+ change c with c' in *.
diff --git a/src/Util/Tactics/UnfoldArg.v b/src/Util/Tactics/UnfoldArg.v
new file mode 100644
index 000000000..5f7772578
--- /dev/null
+++ b/src/Util/Tactics/UnfoldArg.v
@@ -0,0 +1,11 @@
+Require Import Crypto.Util.Tactics.ChangeInAll.
+
+(** fully reduces the first argument to [t], wherever it appears *)
+Ltac unfold_first_arg t :=
+ repeat match goal with
+ | [ H : context[t ?x] |- _ ] => progress change_with_compute_in_all x
+ | [ |- context[t ?x] ] => progress change_with_compute_in_all x
+ end.
+
+(* use uconstr so we can have underscores *)
+Tactic Notation "unfold_first_arg" uconstr(t) := unfold_first_arg t.