diff options
| author | Hugo Herbelin | 2018-10-06 11:04:03 +0200 |
|---|---|---|
| committer | Hugo Herbelin | 2018-10-11 23:07:42 +0200 |
| commit | 23fc1c59d78ffb524265caa1908503f50816335a (patch) | |
| tree | 5fa5f94db7c8453179f574480029884724d932f6 | |
| parent | c4d3daaeb75a746b2a2717d2aaf21a65ebcc7775 (diff) | |
A state-free version of is_polymorphic.
| -rw-r--r-- | kernel/environ.ml | 10 | ||||
| -rw-r--r-- | kernel/environ.mli | 2 | ||||
| -rw-r--r-- | library/global.ml | 8 |
3 files changed, 12 insertions, 8 deletions
diff --git a/kernel/environ.ml b/kernel/environ.ml index dffcd70282..2fa33eb1cd 100644 --- a/kernel/environ.ml +++ b/kernel/environ.ml @@ -680,6 +680,16 @@ let remove_hyps ids check_context check_value ctxt = in fst (remove_hyps ctxt) +(* A general request *) + +let is_polymorphic env r = + let open Names.GlobRef in + match r with + | VarRef _id -> false + | ConstRef c -> polymorphic_constant c env + | IndRef ind -> polymorphic_ind ind env + | ConstructRef cstr -> polymorphic_ind (inductive_of_constructor cstr) env + (*spiwack: the following functions assemble the pieces of the retroknowledge note that the "consistent" register function is available in the module Safetyping, Environ only synchronizes the proactive and the reactive parts*) diff --git a/kernel/environ.mli b/kernel/environ.mli index 55ff7ff162..031e7968d7 100644 --- a/kernel/environ.mli +++ b/kernel/environ.mli @@ -315,7 +315,7 @@ val apply_to_hyp : named_context_val -> variable -> val remove_hyps : Id.Set.t -> (Constr.named_declaration -> Constr.named_declaration) -> (lazy_val -> lazy_val) -> named_context_val -> named_context_val - +val is_polymorphic : env -> Names.GlobRef.t -> bool open Retroknowledge (** functions manipulating the retroknowledge diff --git a/library/global.ml b/library/global.ml index 53a72a4e49..769a4bea38 100644 --- a/library/global.ml +++ b/library/global.ml @@ -227,13 +227,7 @@ let universes_of_global env r = let universes_of_global gr = universes_of_global (env ()) gr -let is_polymorphic r = - let env = env() in - match r with - | VarRef id -> false - | ConstRef c -> Environ.polymorphic_constant c env - | IndRef ind -> Environ.polymorphic_ind ind env - | ConstructRef cstr -> Environ.polymorphic_ind (inductive_of_constructor cstr) env +let is_polymorphic r = Environ.is_polymorphic (env()) r let is_template_polymorphic r = let env = env() in |
