X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_kernel%2FoCic2NCic.ml;h=2b59549d6178a36063c7feaebdea4275a08c5150;hb=dff76b5e1557ff32872f4e48854daaa6c42e5ad2;hp=2f95d663cb8c061686ac02cd5992c0626ff697c0;hpb=b059fe5ee46d45bc2985b0f46f6a69b4b3be248b;p=helm.git diff --git a/helm/software/components/ng_kernel/oCic2NCic.ml b/helm/software/components/ng_kernel/oCic2NCic.ml index 2f95d663c..2b59549d6 100644 --- a/helm/software/components/ng_kernel/oCic2NCic.ml +++ b/helm/software/components/ng_kernel/oCic2NCic.ml @@ -77,7 +77,7 @@ let convert_term uri t = (fun (name,ty,_) (ctx, fixpoints, tys, idx) -> let ty, fixpoints_ty = aux octx ctx n_fix uri ty in let r = NReference.reference_of_ouri buri(NReference.CoFix idx) in - ctx @ [Fix (r,name,ty)], fixpoints_ty @ fixpoints,ty::tys,idx+1) + Fix (r,name,ty) :: ctx, fixpoints_ty @ fixpoints,ty::tys,idx+1) fl ([], [], [], 0) in let bctx = bctx @ ctx in @@ -119,7 +119,7 @@ let convert_term uri t = let r = NReference.reference_of_ouri buri (NReference.Fix (idx,recno)) in - ctx @ [Fix (r,name,ty)], fixpoints_ty@fixpoints,ty::tys,idx+1) + Fix (r,name,ty) :: ctx, fixpoints_ty@fixpoints,ty::tys,idx+1) fl ([], [], [], 0) in let bctx = bctx @ ctx in @@ -182,9 +182,9 @@ let convert_term uri t = let ty, fixpoints_ty = aux octx ctx n_fix uri ty in NCic.LetIn ("cast", ty, t, NCic.Rel 1), fixpoints_t @ fixpoints_ty | Cic.Sort Cic.Prop -> NCic.Sort NCic.Prop,[] - | Cic.Sort Cic.Set -> NCic.Sort NCic.Set,[] | 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 = @@ -233,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 ;;