From 3eb1e805be574064225e832bffb01f2410c41518 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Tue, 7 Jun 2016 22:55:50 -0400 Subject: Add is_ind, is_constructor, is_proj --- ltac/extratactics.ml4 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ltac/extratactics.ml4 b/ltac/extratactics.ml4 index 5d3c149ab9..4903d50d17 100644 --- a/ltac/extratactics.ml4 +++ b/ltac/extratactics.ml4 @@ -866,6 +866,27 @@ TACTIC EXTEND is_cofix | _ -> Tacticals.New.tclFAIL 0 (Pp.str "not a cofix definition") ] END;; +TACTIC EXTEND is_ind +| [ "is_ind" constr(x) ] -> + [ match kind_of_term x with + | Ind _ -> Proofview.tclUNIT () + | _ -> Tacticals.New.tclFAIL 0 (Pp.str "not an (co)inductive datatype") ] +END;; + +TACTIC EXTEND is_constructor +| [ "is_constructor" constr(x) ] -> + [ match kind_of_term x with + | Construct _ -> Proofview.tclUNIT () + | _ -> Tacticals.New.tclFAIL 0 (Pp.str "not a constructor") ] +END;; + +TACTIC EXTEND is_proj +| [ "is_proj" constr(x) ] -> + [ match kind_of_term x with + | Proj _ -> Proofview.tclUNIT () + | _ -> Tacticals.New.tclFAIL 0 (Pp.str "not a primitive projection") ] +END;; + (* Command to grab the evars left unresolved at the end of a proof. *) (* spiwack: I put it in extratactics because it is somewhat tied with the semantics of the LCF-style tactics, hence with the classic tactic -- cgit v1.2.3