diff --git a/theories/tactics.v b/theories/tactics.v index 9fd53fa0e2469bc0d1be8806755b95aa52f008a3..5b68110bc873473c438eefc94b3803d8216f02ef 100644 --- a/theories/tactics.v +++ b/theories/tactics.v @@ -298,6 +298,14 @@ Tactic Notation "feed" "destruct" constr(H) := Tactic Notation "feed" "destruct" constr(H) "as" simple_intropattern(IP) := feed (fun p => let H':=fresh in pose proof p as H'; destruct H' as IP) H. + +(** The following tactic can be used to add support for patterns to tactic notation: +It will search for the first subterm of the goal matching [pat], and then call [tac] +with that subterm. *) +Ltac find_pat pat tac := + match goal with |- context [?x] => unify pat x; tac x || fail 2 +end. + (** Coq's [firstorder] tactic fails or loops on rather small goals already. In particular, on those generated by the tactic [unfold_elem_ofs] which is used to solve propositions on collections. The [naive_solver] tactic implements an