From: Andrea Asperti Date: Wed, 21 Sep 2011 15:51:06 +0000 (+0000) Subject: Map in NCicUtils now takes an optional boolea to disable head beta reduction. X-Git-Tag: make_still_working~2271 X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=commitdiff_plain;h=c3f800643c30f4202164788deda575a40ff2eb8e Map in NCicUtils now takes an optional boolea to disable head beta reduction. We normalize cic terms in the paramodulation blob by stripping out names in binders. --- diff --git a/matitaB/components/ng_kernel/nCicUtils.ml b/matitaB/components/ng_kernel/nCicUtils.ml index 400d69363..13fbb586f 100644 --- a/matitaB/components/ng_kernel/nCicUtils.ml +++ b/matitaB/components/ng_kernel/nCicUtils.ml @@ -56,7 +56,7 @@ let fold g k f acc = function | C.Match (_,oty,t,pl) -> List.fold_left (f k) (f k (f k acc oty) t) pl ;; -let map status g k f = function +let map ?(hbr=true) status g k f = function | C.Meta _ -> assert false | C.Implicit _ | C.Sort _ @@ -74,7 +74,7 @@ let map status g k f = function | C.Appl l :: tl -> C.Appl (l@tl) | l1 -> C.Appl l1 in - if fire_beta then !head_beta_reduce (status :> NCicEnvironment.status) ~upto t + if fire_beta & hbr then !head_beta_reduce (status :> NCicEnvironment.status) ~upto t else t | C.Prod (n,s,t) as orig -> let s1 = f k s in let t1 = f (g (n,C.Decl s) k) t in diff --git a/matitaB/components/ng_kernel/nCicUtils.mli b/matitaB/components/ng_kernel/nCicUtils.mli index de56c4e1f..91bc2fe75 100644 --- a/matitaB/components/ng_kernel/nCicUtils.mli +++ b/matitaB/components/ng_kernel/nCicUtils.mli @@ -25,6 +25,7 @@ val fold: (NCic.hypothesis -> 'k -> 'k) -> 'k -> ('k -> 'a -> NCic.term -> 'a) -> 'a -> NCic.term -> 'a val map: + ?hbr:bool -> #NCicEnvironment.status -> (NCic.hypothesis -> 'k -> 'k) -> 'k -> ('k -> NCic.term -> NCic.term) -> NCic.term -> NCic.term diff --git a/matitaB/components/ng_paramodulation/nCicBlob.ml b/matitaB/components/ng_paramodulation/nCicBlob.ml index 14454c58b..59d57a854 100644 --- a/matitaB/components/ng_paramodulation/nCicBlob.ml +++ b/matitaB/components/ng_paramodulation/nCicBlob.ml @@ -84,6 +84,20 @@ with type t = NCic.term and type input = NCic.term = struct ;; + let rec alpha_norm k = function + | NCic.Lambda (_,ty,t) -> + NCic.Lambda("_",alpha_norm k ty,alpha_norm k t) + | NCic.Prod (_,ty,t) -> + NCic.Prod("_",alpha_norm k ty,alpha_norm k t) + | NCic.LetIn (_,ty,t,b) -> + NCic.LetIn("_",alpha_norm k ty,alpha_norm k t,alpha_norm k b) + | NCic.Meta (_,(_,NCic.Irl _)) as t -> t + | NCic.Meta (n,(s,NCic.Ctx tl)) as t -> + let tl' = HExtlib.sharing_map (alpha_norm k) tl in + if tl == tl' then t else NCic.Meta (n,(s,NCic.Ctx tl')) + | t -> NCicUtils.map ~hbr:false (new NCicPp.status None) + (fun _ _ -> ()) () alpha_norm t + (* let compare x y = (* CSC: NCicPp.status is the best I can put here *) (* WR: and I can't guess a user id, so I must put None *) @@ -122,7 +136,7 @@ with type t = NCic.term and type input = NCic.term = struct let res,vars = List.fold_left (fun (r,v) t -> let r1,v1 = embed t in (r1::r),aux [] v v1) ([],[]) l in (Terms.Node (List.rev res)), vars - | t -> Terms.Leaf t, [] + | t -> Terms.Leaf (alpha_norm () t), [] ;; let embed t = fst (embed t) ;;