aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/environ.ml
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <mattam@mattam.org>2013-10-31 11:56:30 +0100
committerGravatar Matthieu Sozeau <mattam@mattam.org>2014-05-06 09:58:54 +0200
commit05c87ba330a9b4d02b150c196e390b9dd30be341 (patch)
treefc19f68a21198754134aee6fe68a5cb5516b41b7 /kernel/environ.ml
parent1c1accf7186438228be9c426db9071aa95a7e992 (diff)
Fix interface for template polymorphism, cleaning up code in all typing algorithms.
Diffstat (limited to 'kernel/environ.ml')
-rw-r--r--kernel/environ.ml24
1 files changed, 24 insertions, 0 deletions
diff --git a/kernel/environ.ml b/kernel/environ.ml
index 1f29fd67a..ef0f0ca4d 100644
--- a/kernel/environ.ml
+++ b/kernel/environ.ml
@@ -315,6 +315,18 @@ let evaluable_constant kn env =
| OpaqueDef _ -> false
| Undef _ -> false
+let template_polymorphic_constant (cst,u) env =
+ if not (Univ.Instance.is_empty u) then false
+ else
+ match (lookup_constant cst env).const_type with
+ | TemplateArity _ -> true
+ | RegularArity _ -> false
+
+let polymorphic_constant (cst,u) env =
+ if Univ.Instance.is_empty u then false
+ else
+ (lookup_constant cst env).const_polymorphic
+
let lookup_projection cst env =
match (lookup_constant cst env).const_proj with
| Some pb -> pb
@@ -328,6 +340,18 @@ let is_projection cst env =
(* Mutual Inductives *)
let lookup_mind = lookup_mind
+let template_polymorphic_ind ((mind,i),u) env =
+ if not (Univ.Instance.is_empty u) then false
+ else
+ match (lookup_mind mind env).mind_packets.(i).mind_arity with
+ | TemplateArity _ -> true
+ | RegularArity _ -> false
+
+let polymorphic_ind ((mind,i),u) env =
+ if Univ.Instance.is_empty u then false
+ else
+ (lookup_mind mind env).mind_polymorphic
+
let add_mind_key kn mind_key env =
let new_inds = Mindmap_env.add kn mind_key env.env_globals.env_inductives in
let new_globals =