aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/inductiveops.ml
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2015-07-04 14:22:08 +0200
committerGravatar Maxime Dénès <mail@maximedenes.fr>2015-07-05 02:00:07 +0200
commita51cce369b9c634a93120092d4c7685a242d55b1 (patch)
treedd68ea8dadf86f9a6eb400839f515ed5b9cf8f95 /pretyping/inductiveops.ml
parent31c7542731a62f56bd60f443a84d68813f8780a8 (diff)
Fix handling of primitive projections in VM.
I'm pushing this patch now because the previous treatment of such projections in the VM was already unsound. It should however be carefully reviewed.
Diffstat (limited to 'pretyping/inductiveops.ml')
-rw-r--r--pretyping/inductiveops.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index dfdc24d48..90aa8000a 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -584,6 +584,15 @@ let type_of_inductive_knowing_conclusion env sigma ((mib,mip),u) conclty =
env evdref scl ar.template_level (ctx,ar.template_param_levels) in
!evdref, mkArity (List.rev ctx,scl)
+let type_of_projection_knowing_arg env sigma p c ty =
+ let IndType(pars,realargs) =
+ try find_rectype env sigma ty
+ with Not_found ->
+ raise (Invalid_argument "type_of_projection_knowing_arg_type: not an inductive type")
+ in
+ let (_,u), pars = dest_ind_family pars in
+ substl (c :: List.rev pars) (Typeops.type_of_projection env (p,u))
+
(***********************************************)
(* Guard condition *)