From 35f7ca38fc9b8894bce4fea92194f0e676ce9375 Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Tue, 23 Feb 2016 20:05:51 +0100
Subject: [PATCH] prove a tactic for canceling with pattern matching, and use
 it in a few (test-)places

---
 theories/tactics.v | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/theories/tactics.v b/theories/tactics.v
index 9fd53fa0..5b68110b 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
-- 
GitLab