From 3f6d0979aeef7ee0d322428ae8bce71c99a18aef Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Thu, 16 Nov 2017 14:28:00 -0800 Subject: [PATCH] feat(library/init/meta/tactic): add any_hyp tactic --- library/init/meta/tactic.lean | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/init/meta/tactic.lean b/library/init/meta/tactic.lean index d1859f07fa..dc4753bb67 100644 --- a/library/init/meta/tactic.lean +++ b/library/init/meta/tactic.lean @@ -648,6 +648,13 @@ format_result >>= trace meta def rexact (e : expr) : tactic unit := exact e reducible +meta def any_hyp_aux {α : Type} (f : expr → tactic α) : list expr → tactic α +| [] := failed +| (h :: hs) := f h <|> any_hyp_aux hs + +meta def any_hyp {α : Type} (f : expr → tactic α) : tactic α := +local_context >>= any_hyp_aux f + /-- `find_same_type t es` tries to find in es an expression with type definitionally equal to t -/ meta def find_same_type : expr → list expr → tactic expr | e [] := failed