]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_kernel/oCic2NCic.ml
today it seems that the substituted should be lifted by k-1+lift_args and not k+lift_...
[helm.git] / helm / software / components / ng_kernel / oCic2NCic.ml
index ac9ba639a624bafebdce0c3517b4a929c96f09c5..2b59549d6178a36063c7feaebdea4275a08c5150 100644 (file)
@@ -184,6 +184,7 @@ let convert_term uri t =
     | Cic.Sort Cic.Prop -> NCic.Sort NCic.Prop,[]
     | Cic.Sort Cic.CProp -> NCic.Sort NCic.CProp,[]
     | Cic.Sort (Cic.Type _) -> NCic.Sort (NCic.Type 0),[] 
+    | Cic.Sort Cic.Set -> NCic.Sort (NCic.Type 0),[] 
        (* calculate depth in the univ_graph*)
     | Cic.Appl l -> 
         let l, fixpoints =
@@ -232,16 +233,24 @@ let convert_obj_aux uri = function
      assert(fixpoints_ty = []);
      NCic.Constant ([], name, Some nbo, nty, (`Provided,`Theorem,`Regular)),
      fixpoints_bo @ fixpoints_ty
- | Cic.InductiveDefinition (_,_,_,_) -> assert false (*
+ | Cic.InductiveDefinition (itl,_,leftno,_) -> 
      let ind = let _,x,_,_ = List.hd itl in x in
-     let itl = 
-       List.map 
-         (fun name, _, ty, cl ->
-            [], name, convert_term ty, 
-              List.map (fun name, ty -> [], name, convert_term ty) cl) 
-         itl        
+     let itl, fix_itl = 
+       List.fold_right
+         (fun (name, _, ty, cl) (itl,acc) ->
+            let ty, fix_ty = convert_term uri ty in
+            let cl, fix_cl = 
+              List.fold_right
+               (fun (name, ty) (cl,acc) -> 
+                 let ty, fix_ty = convert_term uri ty in
+                 ([], name, ty)::cl, acc @ fix_ty)
+               cl ([],[])
+            in
+            ([], name, ty, cl)::itl, fix_ty @ fix_cl @ acc)
+         itl ([],[])
      in
-     NCic.Inductive (ind, leftno, itl, (`Provided, `Regular)) *)
+     NCic.Inductive (ind, leftno, itl, (`Provided, `Regular)),
+     fix_itl
  | Cic.Variable _ 
  | Cic.CurrentProof _ -> assert false
 ;;