aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorMaxime Dénès2017-09-15 10:38:45 +0200
committerMaxime Dénès2017-09-15 10:38:45 +0200
commitd6d7a12eb49c997dd83298477e216349fad74c7f (patch)
treeaa4648227f0b1a5c5e9c1b5e6e2f17818db73413 /engine
parentd2406149554812a01ac615af43af6b7b2a3efd72 (diff)
parenta1efd8080465eb49b30b5bab61cf3861899876e4 (diff)
Merge PR #1048: 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 2bd0c06d6d..e2bdf72387 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 2624afd30d..ef2c52a455 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 *)