X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FgTopLevel%2Fcic2acic.ml;h=93277121428a9b7bc1346d817e9452ec191c6d5e;hb=a9e833b37216b225262450fd4e3fa5bf79ae4c3a;hp=8d849634dd0726fba35c6f0aaca9c3b7e1b92e89;hpb=7074f0403d1bec7f4d60715e50a0fe0ef0993567;p=helm.git diff --git a/helm/gTopLevel/cic2acic.ml b/helm/gTopLevel/cic2acic.ml index 8d849634d..932771214 100644 --- a/helm/gTopLevel/cic2acic.ml +++ b/helm/gTopLevel/cic2acic.ml @@ -23,8 +23,6 @@ * http://cs.unibo.it/helm/. *) -exception NotImplemented;; - type anntypes = {annsynthesized : Cic.annterm ; annexpected : Cic.annterm option} ;; @@ -303,8 +301,19 @@ let acic_object_of_cic_object obj = let aty = acic_term_of_cic_term' ty None in C.AConstant ("mettereaposto",Some "mettereaposto2",id,Some abo,aty, params) - | C.Constant (id,None,ty,params) -> raise NotImplemented - | C.Variable (id,bo,ty,params) -> raise NotImplemented + | C.Constant (id,None,ty,params) -> + let aty = acic_term_of_cic_term' ty None in + C.AConstant + ("mettereaposto",None,id,None,aty, params) + | C.Variable (id,bo,ty,params) -> + let abo = + match bo with + None -> None + | Some bo -> Some (acic_term_of_cic_term' bo (Some ty)) + in + let aty = acic_term_of_cic_term' ty None in + C.AVariable + ("mettereaposto",id,abo,aty, params) | C.CurrentProof (id,conjectures,bo,ty,params) -> let aconjectures = List.map @@ -357,7 +366,25 @@ let acic_object_of_cic_object obj = let aty = acic_term_of_cic_term_context' conjectures [] [] ty None in C.ACurrentProof ("mettereaposto","mettereaposto2",id,aconjectures,abo,aty,params) - | C.InductiveDefinition (tys,params,paramsno) -> raise NotImplemented + | C.InductiveDefinition (tys,params,paramsno) -> + let context = + List.map + (fun (name,_,arity,_) -> Some (C.Name name, C.Decl arity)) tys in + let idrefs = List.map (function _ -> gen_id seed) tys in + let atys = + List.map2 + (fun id (name,inductive,ty,cons) -> + let acons = + List.map + (function (name,ty) -> + (name, + acic_term_of_cic_term_context' [] context idrefs ty None) + ) cons + in + (id,name,inductive,acic_term_of_cic_term' ty None,acons) + ) (List.rev idrefs) tys + in + C.AInductiveDefinition ("mettereaposto",atys,params,paramsno) in aobj,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,ids_to_inner_types, ids_to_conjectures,ids_to_hypotheses