aux [] [] 0 uri t
;;
-let cook vars t =
+let cook mode vars t =
let t = CicSubstitution.lift (List.length vars) t in
snd (List.fold_right
(fun uri (n,t) ->
| _ -> assert false in
let id = Cic.Name (UriManager.name_of_uri uri) in
let t =
- match bo,ty with
- None,ty -> Cic.Lambda (id,ty,t)
- | Some bo,ty -> Cic.LetIn (id,bo,ty,t)
+ match bo,ty,mode with
+ None,ty,`Lambda -> Cic.Lambda (id,ty,t)
+ | None,ty,`Pi -> Cic.Prod (id,ty,t)
+ | Some bo,ty,_ -> Cic.LetIn (id,bo,ty,t)
in
n+1,t
) vars (1,t))
let convert_obj_aux uri = function
| Cic.Constant (name, None, ty, vars, _) ->
- let ty = cook vars ty in
+ let ty = cook `Pi vars ty in
let nty, fixpoints = convert_term uri ty in
assert(fixpoints = []);
NCic.Constant ([], name, None, nty, (`Provided,`Theorem,`Regular)),
fixpoints
| Cic.Constant (name, Some bo, ty, vars, _) ->
- let bo = cook vars bo in
- let ty = cook vars ty in
+ let bo = cook `Lambda vars bo in
+ let ty = cook `Pi vars ty in
let nbo, fixpoints_bo = convert_term uri bo in
let nty, fixpoints_ty = convert_term uri ty in
assert(fixpoints_ty = []);
let itl, fix_itl =
List.fold_right
(fun (name, _, ty, cl) (itl,acc) ->
- let ty = cook vars ty in
+ let ty = cook `Pi vars ty in
let ty, fix_ty = convert_term uri ty in
let cl, fix_cl =
List.fold_right
(fun (name, ty) (cl,acc) ->
- let ty = cook vars ty in
+ let ty = cook `Pi vars ty in
let ty, fix_ty = convert_term uri ty in
([], name, ty)::cl, acc @ fix_ty)
cl ([],[])