From 771be16883c8c47828f278ce49545716918764c4 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Sat, 12 Nov 2016 01:52:15 +0100 Subject: Hipattern API using EConstr. --- engine/termops.ml | 9 +++++++++ engine/termops.mli | 2 ++ 2 files changed, 11 insertions(+) (limited to 'engine') diff --git a/engine/termops.ml b/engine/termops.ml index 5581b16562..59dbb73f54 100644 --- a/engine/termops.ml +++ b/engine/termops.ml @@ -829,6 +829,15 @@ let global_of_constr sigma c = | Var id -> VarRef id, Univ.Instance.empty | _ -> raise Not_found +let is_global sigma c t = + let open Globnames in + match c, EConstr.kind sigma t 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 + let isGlobalRef sigma c = match EConstr.kind sigma c with | Const _ | Ind _ | Construct _ | Var _ -> true diff --git a/engine/termops.mli b/engine/termops.mli index 02e8dfeaea..abc9caa98e 100644 --- a/engine/termops.mli +++ b/engine/termops.mli @@ -268,6 +268,8 @@ val is_section_variable : Id.t -> bool val global_of_constr : Evd.evar_map -> EConstr.constr -> Globnames.global_reference puniverses +val is_global : Evd.evar_map -> Globnames.global_reference -> EConstr.constr -> bool + val isGlobalRef : Evd.evar_map -> EConstr.t -> bool val is_template_polymorphic : env -> Evd.evar_map -> EConstr.t -> bool -- cgit v1.2.3