From 5aa6b0a6b2ac0561125716710662adab6ad6f333 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Sat, 8 Jul 2017 15:59:53 -0400 Subject: Add UnfoldArg --- src/Util/Tactics/ChangeInAll.v | 4 ++++ src/Util/Tactics/UnfoldArg.v | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/Util/Tactics/UnfoldArg.v (limited to 'src/Util/Tactics') 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. -- cgit v1.2.3