]> matita.cs.unibo.it Git - helm.git/commitdiff
new implementation (due to paths).
authorEnrico Tassi <enrico.tassi@inria.fr>
Fri, 24 Jun 2005 17:22:56 +0000 (17:22 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Fri, 24 Jun 2005 17:22:56 +0000 (17:22 +0000)
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

index 975333fa96da753d2cd40c1f43699043f5009777..c641cbf653af905c3b4689b5f4407dc6bdb6ecaa 100644 (file)
@@ -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)