]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_proof_checking/cicElim.ml
ocaml 3.09 transition
[helm.git] / helm / ocaml / cic_proof_checking / cicElim.ml
index 60cf5af2e60031a37579b791985b287a63576a98..c668d1c9be33420a1b9222a8646c8c3408b7a436 100644 (file)
@@ -255,7 +255,7 @@ let branch (uri, typeno) insource liftno paramsno t fix head args =
   let t = strip_left_params liftno paramsno t in
   branch (uri, typeno) insource paramsno t fix head args
 
-let elim_of ?(sort = Cic.Type (CicUniv.fresh ())) uri typeno =
+let elim_of ~sort uri typeno =
   counter := ~-1;
   let (obj, univ) = (CicEnvironment.get_obj CicUniv.empty_ugraph uri) in
   match obj with
@@ -268,10 +268,14 @@ let elim_of ?(sort = Cic.Type (CicUniv.fresh ())) uri typeno =
       let paramsno = count_pi ty in (* number of (left or right) parameters *)
       let rightno = paramsno - leftno in
       let dependent = (strip_pi ty <> Cic.Sort Cic.Prop) in
+let head = match strip_pi ty with Cic.Sort s -> s in
       let conslen = List.length constructors in
       let consno = ref (conslen + 1) in
-      if (not dependent) && (sort <> Cic.Prop) && (conslen > 1) then
-        raise Can_t_eliminate;
+      if
+       not
+        (CicTypeChecker.check_allowed_sort_elimination uri typeno head sort)
+      then
+       raise Can_t_eliminate;
       let indty =
         let indty = Cic.MutInd (uri, typeno, []) in
         if paramsno = 0 then