diff options
Diffstat (limited to 'engine')
| -rw-r--r-- | engine/termops.ml | 9 | ||||
| -rw-r--r-- | engine/termops.mli | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/engine/termops.ml b/engine/termops.ml index f191e2dc12..e5db3c085b 100644 --- a/engine/termops.ml +++ b/engine/termops.ml @@ -818,6 +818,15 @@ let is_section_variable id = try let _ = Global.lookup_named id in true with Not_found -> false +let global_of_constr sigma c = + let open Globnames in + match EConstr.kind sigma c with + | Const (c, u) -> ConstRef c, u + | Ind (i, u) -> IndRef i, u + | Construct (c, u) -> ConstructRef c, u + | Var id -> VarRef id, Univ.Instance.empty + | _ -> raise Not_found + 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 4becca907c..c90fdf9c2e 100644 --- a/engine/termops.mli +++ b/engine/termops.mli @@ -264,6 +264,8 @@ val dependency_closure : env -> Evd.evar_map -> Context.Named.t -> Id.Set.t -> I (** Test if an identifier is the basename of a global reference *) val is_section_variable : Id.t -> bool +val global_of_constr : Evd.evar_map -> EConstr.constr -> Globnames.global_reference puniverses + val isGlobalRef : Evd.evar_map -> EConstr.t -> bool val is_template_polymorphic : env -> Evd.evar_map -> EConstr.t -> bool |
