2 let rec convert_term k = function (* pass k along *)
3 | NCic.Rel i -> Cic.Rel i
4 | NCic.Meta _ -> assert false
5 | NCic.Appl l -> Cic.Appl (List.map (convert_term k) l)
6 | NCic.Prod (n,s,t) -> Cic.Prod (Cic.Name n,convert_term k s, convert_term k t)
7 | NCic.Lambda (n,s,t) -> Cic.Lambda(Cic.Name n,convert_term k s, convert_term k t)
8 | NCic.LetIn (n,_,s,t) -> Cic.LetIn (Cic.Name n,convert_term k s, convert_term k t)
9 | NCic.Sort NCic.Prop -> Cic.Sort Cic.Prop
10 | NCic.Sort NCic.CProp -> Cic.Sort Cic.CProp
11 | NCic.Sort NCic.Set -> Cic.Sort Cic.Set
12 | NCic.Sort (NCic.Type _) -> Cic.Sort (Cic.Type (CicUniv.fresh ()))
13 | NCic.Implicit _ -> assert false
14 | NCic.Const (NReference.Ref (_,u,NReference.Ind i)) ->
15 Cic.MutInd (NUri.ouri_of_nuri u,i,[])
16 | NCic.Const (NReference.Ref (_,u,NReference.Con (i,j))) ->
17 Cic.MutConstruct (NUri.ouri_of_nuri u,i,j,[])
18 | NCic.Const (NReference.Ref (_,u,NReference.Def))
19 | NCic.Const (NReference.Ref (_,u,NReference.Decl)) ->
20 Cic.Const (NUri.ouri_of_nuri u,[])
21 | NCic.Match (NReference.Ref (_,u,NReference.Ind i),oty,t,pl) ->
22 Cic.MutCase (NUri.ouri_of_nuri u,i, convert_term k oty, convert_term k t,
23 List.map (convert_term k) pl)
24 | NCic.Const (NReference.Ref (_,u,NReference.Fix (i,_))) -> assert false
25 (* map to rel if is the self-fix, otherwise explode *)
26 | NCic.Const (NReference.Ref (_,u,NReference.CoFix i)) -> assert false
27 (* map to rel if is the self-fix, otherwise explode *)
31 let convert_fix k fl =
32 let n_fl = List.length fl in
35 (fun (_, name,recno,ty,bo) ->
36 name, recno, convert_term 0 ty, convert_term 0 bo)
42 let convert_nobj = function
43 | _,_,_,_,NCic.Constant (rel, name, Some bo, ty, _) ->
44 Cic.Constant (name, Some (convert_term 0 bo), convert_term 0 ty, [],[])
45 | _,_,_,_,NCic.Constant (rel, name, None, ty, _) ->
46 Cic.Constant (name, None, convert_term 0 ty, [],[])
47 | _,_,_,_,NCic.Fixpoint (is_fix, fl, _) ->
48 Cic.Constant ("pippo", Some (convert_fix 0 fl),
49 convert_term 0 (let _,_,_,ty,_ = List.hd fl in ty), [], [])
50 | _,_,_,_,NCic.Inductive _ -> assert false