]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/library/cicElim.ml
old bug in mtime computation fixed
[helm.git] / helm / software / components / library / cicElim.ml
index f919d2875e2d7674ff4b4d13facae24a47ffd1c9..aacace7b5614e975d718cb7bf8750683f205b7f2 100644 (file)
@@ -217,7 +217,7 @@ let rec branch (uri, typeno) insource paramsno t fix head args =
       if insource then
         (match args with
         | [arg] -> Cic.Appl (fix :: args)
-        | _ -> Cic.Appl (head :: [Cic.Appl args]))
+        | _ -> Cic.Appl (fix :: [Cic.Appl args]))
       else
         (match args with
         | [] -> head
@@ -259,7 +259,7 @@ let branch (uri, typeno) insource liftno paramsno t fix head args =
 
 let elim_of ~sort uri typeno =
   counter := ~-1;
-  let (obj, univ) = (CicEnvironment.get_obj CicUniv.empty_ugraph uri) in
+  let (obj, univ) = (CicEnvironment.get_obj CicUniv.oblivion_ugraph uri) in
   match obj with
   | Cic.InductiveDefinition (indTypes, params, leftno, _) ->
       let (name, inductive, ty, constructors) =
@@ -267,6 +267,10 @@ let elim_of ~sort uri typeno =
           List.nth indTypes typeno
         with Failure _ -> assert false
       in
+      let ty = Unshare.unshare ~fresh_univs:true ty in
+      let constructors = 
+        List.map (fun (name,c)-> name,Unshare.unshare ~fresh_univs:true c) constructors 
+      in
       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
@@ -357,7 +361,7 @@ let elim_of ~sort uri typeno =
             in
             (* rightno is the decreasing argument, i.e. the argument of
              * inductive type *)
-            Cic.Fix (0, ["f", rightno, final_ty, fixfun])
+            Cic.Fix (0, ["aux", rightno, final_ty, fixfun])
           else
             add_right_lambda dependent leftno (conslen + 1) 1 rightno indty
               mutcase ty
@@ -390,7 +394,8 @@ debug_print (lazy (CicPp.ppterm eliminator_body));
 *)
       let (computed_type, ugraph) =
         try
-          CicTypeChecker.type_of_aux' [] [] eliminator_body CicUniv.empty_ugraph
+          CicTypeChecker.type_of_aux' [] [] eliminator_body
+          CicUniv.oblivion_ugraph
         with CicTypeChecker.TypeCheckerFailure msg ->
           raise (Elim_failure (lazy (sprintf 
             "type checker failure while type checking:\n%s\nerror:\n%s"