aboutsummaryrefslogtreecommitdiff
path: root/kernel/constr.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-02-12 17:08:24 +0100
committerPierre-Marie Pédrot2020-02-12 17:08:24 +0100
commit713f8a1af8c5e053ea6dc7b58a4a2b04a1e67c2f (patch)
tree430b6be9f424f3055f12c7754ed444d2d8e9fb75 /kernel/constr.ml
parent99a0e8f01fd2570672e5e9d133d5a9472eef406b (diff)
parenta5f9b0ea89c9a595ce47c549a2ebb976b0ac3aa2 (diff)
Merge PR #11544: Cleanup some globref related manipulations
Reviewed-by: herbelin Reviewed-by: ppedrot
Diffstat (limited to 'kernel/constr.ml')
-rw-r--r--kernel/constr.ml15
1 files changed, 14 insertions, 1 deletions
diff --git a/kernel/constr.ml b/kernel/constr.ml
index 15e5c512ed..84eacb196c 100644
--- a/kernel/constr.ml
+++ b/kernel/constr.ml
@@ -253,7 +253,7 @@ let mkFloat f = Float f
least one argument and the function is not itself an applicative
term *)
-let kind c = c
+let kind (c:t) = c
let rec kind_nocast_gen kind c =
match kind c with
@@ -338,6 +338,19 @@ let isProj c = match kind c with Proj _ -> true | _ -> false
let isFix c = match kind c with Fix _ -> true | _ -> false
let isCoFix c = match kind c with CoFix _ -> true | _ -> false
+let isRef c = match kind c with
+ | Const _ | Ind _ | Construct _ | Var _ -> true
+ | _ -> false
+
+let isRefX x c =
+ let open GlobRef in
+ match x, kind c with
+ | ConstRef c, Const (c', _) -> Constant.equal c c'
+ | IndRef i, Ind (i', _) -> eq_ind i i'
+ | ConstructRef i, Construct (i', _) -> eq_constructor i i'
+ | VarRef id, Var id' -> Id.equal id id'
+ | _ -> false
+
(* Destructs a de Bruijn index *)
let destRel c = match kind c with
| Rel n -> n