aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorletouzey2011-10-07 14:24:01 +0000
committerletouzey2011-10-07 14:24:01 +0000
commit34a02fb37167a302fb05a4d2eb01321a02a0ffa9 (patch)
tree81e30ee3ec8155af45a2a833efc14bcb512982dc
parent1f84b509851f3eead190eac2300ee77611ed9ff4 (diff)
A new tactic is_var to check whether a term is a goal/section variable
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14524 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--doc/refman/RefMan-tac.tex9
-rw-r--r--tactics/extratactics.ml47
2 files changed, 16 insertions, 0 deletions
diff --git a/doc/refman/RefMan-tac.tex b/doc/refman/RefMan-tac.tex
index e027794f81..24ff5793c0 100644
--- a/doc/refman/RefMan-tac.tex
+++ b/doc/refman/RefMan-tac.tex
@@ -1025,6 +1025,15 @@ including those under binders.
\ErrMsg \errindex{No evars}
+\subsection{\tt is\_var \term
+\tacindex{is\_var}
+\label{isvar}}
+
+This tactic applies to any goal. It checks whether its argument is a
+variable or hypothesis in the current goal context or in the opened sections.
+
+\ErrMsg \errindex{Not a variable or hypothesis}
+
\subsection{Bindings list
\index{Binding list}
\label{Binding-list}}
diff --git a/tactics/extratactics.ml4 b/tactics/extratactics.ml4
index e25e551353..4af1bce7de 100644
--- a/tactics/extratactics.ml4
+++ b/tactics/extratactics.ml4
@@ -754,3 +754,10 @@ TACTIC EXTEND has_evar
| [ "has_evar" constr(x) ] ->
[ if has_evar x then tclIDTAC else tclFAIL 0 (str "No evars") ]
END
+
+TACTIC EXTEND is_hyp
+| [ "is_var" constr(x) ] ->
+ [ match kind_of_term x with
+ | Var _ -> tclIDTAC
+ | _ -> tclFAIL 0 (str "Not a variable or hypothesis") ]
+END