+(* Copyright (C) 2000, HELM Team.
+ *
+ * This file is part of HELM, an Hypertextual, Electronic
+ * Library of Mathematics, developed at the Computer Science
+ * Department, University of Bologna, Italy.
+ *
+ * HELM is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * HELM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HELM; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ * For details, see the HELM World-Wide-Web page,
+ * http://cs.unibo.it/helm/.
+ *)
+
exception Impossible;;
exception NotImplemented of int * string;;
exception WrongUriToConstant;;
| C.Cast (te, ty) -> C.Cast (aux k te, aux k ty)
| C.Prod (n,s,t) -> C.Prod (n, aux k s, aux (k + 1) t)
| C.Lambda (n,s,t) -> C.Lambda (n, aux k s, aux (k + 1) t)
+ | C.LetIn (n,s,t) -> C.LetIn (n, aux k s, aux (k + 1) t)
| C.Appl (he::tl) ->
(* Get rid of C.Appl (C.Appl l1) l2 *)
let newtl = List.map (aux k) tl in
let rec cookrec ty =
function
var::tl ->
- let (varname, vartype) =
+ let (varname, varbody, vartype) =
match CicCache.get_obj var with
- C.Variable (varname, vartype) -> (varname, vartype)
+ C.Variable (varname, varbody, vartype) -> (varname, varbody, vartype)
| _ -> raise (WrongUriToVariable (U.string_of_uri var))
in
- cookrec (add_binder (C.Name varname) vartype (cook curi cookingsno var ty)) tl
+ cookrec (add_binder (C.Name varname) varbody vartype
+ (cook curi cookingsno var ty)) tl
| _ -> ty
in
cookrec ty vars
;;
let cook_prod =
- cook_gen (fun n s t -> Cic.Prod (n,s,t))
+ cook_gen (fun n b s t ->
+ match b with
+ None -> Cic.Prod (n,s,t)
+ | Some b -> Cic.LetIn (n,b,t)
+ )
and cook_lambda =
- cook_gen (fun n s t -> Cic.Lambda (n,s,t))
+ cook_gen (fun n b s t ->
+ match b with
+ None -> Cic.Lambda (n,s,t)
+ | Some b -> Cic.LetIn (n,b,t)
+ )
;;
(*CSC: sbagliato da rifare e completare *)