From caaca5ed51e45a023ccb1244fd5cbbb32d233e2e Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 24 Jun 2005 17:22:56 +0000 Subject: [PATCH] new implementation (due to paths). terms found by select (that may be under some binders) are delifted to the context and, once reduced, lifted back. --- helm/ocaml/tactics/reductionTactics.ml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/helm/ocaml/tactics/reductionTactics.ml b/helm/ocaml/tactics/reductionTactics.ml index 975333fa9..c641cbf65 100644 --- a/helm/ocaml/tactics/reductionTactics.ml +++ b/helm/ocaml/tactics/reductionTactics.ml @@ -56,11 +56,19 @@ let reduction_tac ~reduction ~pattern:(hyp_patterns,goal_pattern) (proof,goal) = (*CSC: siamo nel contesto errato. Metto il try, ma che schifo!!!! *) (*CSC: Anche perche' cosi' catturo anche quelle del replace che non dovrei *) try - let terms' = List.map (reduction context) terms in + let terms, terms' = + List.split + (List.map + (fun i, t -> t, + (let x, _, _ = CicMetaSubst.delift_rels [] metasenv i t in + let t' = reduction context x in + CicSubstitution.lift i t')) + terms) + in ProofEngineReduction.replace ~equality:(==) ~what:terms ~with_what:terms' ~where:where - with - _ -> where + (* FIXME this is a catch ALL... bad thing *) + with exc -> (*prerr_endline (Printexc.to_string exc);*) where in let find_pattern_for name = try Some (snd(List.find (fun (n, pat) -> Cic.Name n = name) hyp_patterns)) @@ -68,10 +76,9 @@ let reduction_tac ~reduction ~pattern:(hyp_patterns,goal_pattern) (proof,goal) = in let ty' = match goal_pattern with - | None -> replace context ty [ty] + | None -> replace context ty [0,ty] | Some pat -> let terms = CicUtil.select ~term:ty ~context:pat in - let terms = List.map snd terms in replace context ty terms in let context' = @@ -84,7 +91,6 @@ let reduction_tac ~reduction ~pattern:(hyp_patterns,goal_pattern) (proof,goal) = | None -> entry::context | Some pat -> let terms = CicUtil.select ~term ~context:pat in - let terms = List.map snd terms in let where = replace context term terms in let entry = Some (name,Cic.Decl where) in entry::context) @@ -93,7 +99,6 @@ let reduction_tac ~reduction ~pattern:(hyp_patterns,goal_pattern) (proof,goal) = | None -> entry::context | Some pat -> let terms = CicUtil.select ~term ~context:pat in - let terms = List.map snd terms in let where = replace context term terms in let entry = Some (name,Cic.Def (where,None)) in entry::context) -- 2.39.2