aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gross2016-06-07 22:55:50 -0400
committerJason Gross2016-06-07 22:59:14 -0400
commit3eb1e805be574064225e832bffb01f2410c41518 (patch)
tree7405012c05e1436db7ecfd55693f010c88ed689c
parentffba3c1cd397ecab2ad6e701a6ff693d93465744 (diff)
Add is_ind, is_constructor, is_proj
-rw-r--r--ltac/extratactics.ml421
1 files changed, 21 insertions, 0 deletions
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