aboutsummaryrefslogtreecommitdiffhomepage
path: root/engine
diff options
context:
space:
mode:
authorGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2017-09-12 16:37:43 +0200
committerGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2017-09-12 16:37:43 +0200
commita1efd8080465eb49b30b5bab61cf3861899876e4 (patch)
tree2a84202fc27b668288f3e9b6a6b6773b79522447 /engine
parentcc94172036789cfef28007f59510b7f17df5d45d (diff)
Port is_Set and is_Type to EConstr, as was is_Prop already.
Diffstat (limited to 'engine')
-rw-r--r--engine/termops.ml18
-rw-r--r--engine/termops.mli2
2 files changed, 20 insertions, 0 deletions
diff --git a/engine/termops.ml b/engine/termops.ml
index 2bd0c06d6..e2bdf7238 100644
--- a/engine/termops.ml
+++ b/engine/termops.ml
@@ -1165,6 +1165,24 @@ let rec is_Prop sigma c = match EConstr.kind sigma c with
| Cast (c,_,_) -> is_Prop sigma c
| _ -> false
+let rec is_Set sigma c = match EConstr.kind sigma c with
+ | Sort u ->
+ begin match EConstr.ESorts.kind sigma u with
+ | Prop Pos -> true
+ | _ -> false
+ end
+ | Cast (c,_,_) -> is_Set sigma c
+ | _ -> false
+
+let rec is_Type sigma c = match EConstr.kind sigma c with
+ | Sort u ->
+ begin match EConstr.ESorts.kind sigma u with
+ | Type _ -> true
+ | _ -> false
+ end
+ | Cast (c,_,_) -> is_Type sigma c
+ | _ -> false
+
(* eq_constr extended with universe erasure *)
let compare_constr_univ sigma f cv_pb t1 t2 =
let open EConstr in
diff --git a/engine/termops.mli b/engine/termops.mli
index 2624afd30..ef2c52a45 100644
--- a/engine/termops.mli
+++ b/engine/termops.mli
@@ -267,6 +267,8 @@ val isGlobalRef : Evd.evar_map -> constr -> bool
val is_template_polymorphic : env -> Evd.evar_map -> constr -> bool
val is_Prop : Evd.evar_map -> constr -> bool
+val is_Set : Evd.evar_map -> constr -> bool
+val is_Type : Evd.evar_map -> constr -> bool
(** Combinators on judgments *)