From 5aa6b0a6b2ac0561125716710662adab6ad6f333 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Sat, 8 Jul 2017 15:59:53 -0400 Subject: Add UnfoldArg --- _CoqProject | 1 + src/Util/Tactics.v | 1 + src/Util/Tactics/ChangeInAll.v | 4 ++++ src/Util/Tactics/UnfoldArg.v | 11 +++++++++++ 4 files changed, 17 insertions(+) create mode 100644 src/Util/Tactics/UnfoldArg.v diff --git a/_CoqProject b/_CoqProject index aadb4a93d..430e377a6 100644 --- a/_CoqProject +++ b/_CoqProject @@ -357,6 +357,7 @@ src/Util/Tactics/SubstEvars.v src/Util/Tactics/SubstLet.v src/Util/Tactics/Test.v src/Util/Tactics/TransparentAssert.v +src/Util/Tactics/UnfoldArg.v src/Util/Tactics/UnifyAbstractReflexivity.v src/Util/Tactics/UniquePose.v src/Util/Tactics/VM.v diff --git a/src/Util/Tactics.v b/src/Util/Tactics.v index 4d39d4954..af75b4f50 100644 --- a/src/Util/Tactics.v +++ b/src/Util/Tactics.v @@ -35,6 +35,7 @@ Require Export Crypto.Util.Tactics.SubstEvars. Require Export Crypto.Util.Tactics.SubstLet. Require Export Crypto.Util.Tactics.Test. Require Export Crypto.Util.Tactics.TransparentAssert. +Require Export Crypto.Util.Tactics.UnfoldArg. Require Export Crypto.Util.Tactics.UnifyAbstractReflexivity. Require Export Crypto.Util.Tactics.UniquePose. Require Export Crypto.Util.Tactics.VM. 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