aboutsummaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorAmin Timany2017-04-06 19:03:24 +0200
committerEmilio Jesus Gallego Arias2017-06-16 04:45:20 +0200
commitc07215582ab75faeea864827b153eed80a28527a (patch)
treee54ac354dad67269d709f065890e373822d7d2b6 /library
parentbef2e53ae2286d0a7c61697f7a7a71bfdc0a3c99 (diff)
Change the place of inference after sect discharge
Diffstat (limited to 'library')
-rw-r--r--library/declare.ml18
1 files changed, 17 insertions, 1 deletions
diff --git a/library/declare.ml b/library/declare.ml
index f3150174c9..fcaadaa6e0 100644
--- a/library/declare.ml
+++ b/library/declare.ml
@@ -356,6 +356,21 @@ let dummy_inductive_entry (_,m) = ([],{
mind_entry_private = None;
})
+(* reinfer subtyping constraints for inductive after section is dischared. *)
+let infer_inductive_subtyping (pth, mind_ent) =
+ if mind_ent.mind_entry_polymorphic then
+ begin
+ let env = Global.env () in
+ let env' =
+ Environ.push_context (Univ.UInfoInd.univ_context mind_ent.mind_entry_universes) env
+ in
+ let (env'', typed_params) = Typeops.infer_local_decls env' (mind_ent.mind_entry_params) in
+ let evd = Evd.from_env env'' in
+ (pth, Inductiveops.infer_inductive_subtyping env'' evd mind_ent)
+ end
+ else (pth, mind_ent)
+
+
type inductive_obj = Dischargedhypsmap.discharged_hyps * mutual_inductive_entry
let inInductive : inductive_obj -> obj =
@@ -365,7 +380,8 @@ let inInductive : inductive_obj -> obj =
open_function = open_inductive;
classify_function = (fun a -> Substitute (dummy_inductive_entry a));
subst_function = ident_subst_function;
- discharge_function = discharge_inductive }
+ discharge_function = discharge_inductive;
+ rebuild_function = infer_inductive_subtyping }
let declare_projections mind =
let spec,_ = Inductive.lookup_mind_specif (Global.env ()) (mind,0) in