X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Finterface%2FcicCooking.ml;h=fcd67bd95efa15e249197aeaba79daee1aee1865;hb=ba64642ca7771cd9cc7b9f73476c8f608ffeeda5;hp=4d72fb3cbf6295b490fc8b6dad7d0c896cadb8d1;hpb=c01d2aaea05f7385bee46addd900cd0397756389;p=helm.git diff --git a/helm/interface/cicCooking.ml b/helm/interface/cicCooking.ml index 4d72fb3cb..fcd67bd95 100644 --- a/helm/interface/cicCooking.ml +++ b/helm/interface/cicCooking.ml @@ -1,3 +1,28 @@ +(* 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;; @@ -31,6 +56,7 @@ let cook curi cookingsno var = | 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 @@ -105,21 +131,30 @@ let cook_gen add_binder curi cookingsno ty vars = 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 *)