]> matita.cs.unibo.it Git - helm.git/commitdiff
reduce with path
authorEnrico Tassi <enrico.tassi@inria.fr>
Wed, 1 Jun 2005 14:34:55 +0000 (14:34 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Wed, 1 Jun 2005 14:34:55 +0000 (14:34 +0000)
helm/matita/matita.txt
helm/matita/matitaEngine.ml
helm/matita/tests/match.ma

index 454a13029382f07c7cf72a618ae9dd2f397ee14f..adf0e1cf1651cc353a24e461c926adf0b82b63c1 100644 (file)
@@ -9,10 +9,10 @@ TODO
 - controllo per script modificato o meno prima di uscire  ->
 - riattaccare hbugs (brrr...)                             -> Zack
 - tattica clear ?                                         -> Gares
-- intro = intros 1                                        -> Gares
-- timetravel                                              -> gares
 
 DONE
+- intro = intros 1                                        -> Gares
+- timetravel (urimanager)                                 -> Gares
 - implementare macro in matitaScript.ml                   -> Gares
 - history deve aggiornare anche la whelp bar              -> Gares
 - commenti exeguibili (forse devono essere una lista e non 
index 10fe24030d00c27951d49580f499fbd5c2c49754..7471e4546e7db2c5841bc1ea2d85884ea910c444 100644 (file)
@@ -62,6 +62,46 @@ let tactic_of_ast = function
   | TacticAst.LetIn of 'term * 'ident
   | TacticAst.Replace_pattern of 'term pattern * 'term
 *)
+  | TacticAst.ReduceAt (_,reduction_kind,ident,path) ->
+      ProofEngineTypes.mk_tactic 
+      (fun (((_,metasenv,_,_),goal) as status) ->
+         let metano,context,ty = CicUtil.lookup_meta goal metasenv in
+         let where, also_in_hypotheses = 
+           if ident = "goal" then
+             ty, false
+           else
+             let hyp = 
+               try 
+                 List.find (function 
+                   | Some (Cic.Name name,entry) when name = ident -> true
+                   | _ -> false) 
+                 context
+               with 
+                 Not_found -> raise (ProofEngineTypes.Fail (ident ^ " is not an hypothesis"))  
+             in 
+             (match hyp with
+             | Some (_, Cic.Decl term) -> term
+             | Some (_, Cic.Def (term,ty)) -> term
+             | None -> assert false),true
+         in
+         let pointers = CicUtil.select ~term:where ~context:path in
+          (match reduction_kind with
+          | `Normalize -> 
+              ProofEngineTypes.apply_tactic 
+                (Tactics.normalize ~also_in_hypotheses ~terms:(Some pointers)) 
+                status
+          | `Reduce -> 
+              ProofEngineTypes.apply_tactic 
+                (Tactics.reduce ~also_in_hypotheses ~terms:(Some pointers)) 
+                status
+          | `Simpl -> 
+              ProofEngineTypes.apply_tactic 
+                (Tactics.simpl ~also_in_hypotheses ~terms:(Some pointers)) 
+                status
+          | `Whd -> 
+              ProofEngineTypes.apply_tactic 
+                (Tactics.whd ~also_in_hypotheses ~terms:(Some pointers)) 
+                status)) 
   | TacticAst.Reduce (_,reduction_kind,opts) ->
       let terms, also_in_hypotheses = 
         match opts with
@@ -70,6 +110,7 @@ let tactic_of_ast = function
         | None -> None, false
       in
       (match reduction_kind with
+      | `Normalize -> Tactics.normalize ~also_in_hypotheses ~terms
       | `Reduce -> Tactics.reduce ~also_in_hypotheses ~terms
       | `Simpl -> Tactics.simpl ~also_in_hypotheses ~terms
       | `Whd -> Tactics.whd ~also_in_hypotheses ~terms) 
@@ -366,6 +407,9 @@ let disambiguate_tactic status = function
   | TacticAst.LetIn of 'term * 'ident
   | TacticAst.Replace_pattern of 'term pattern * 'term
 *)
+  | TacticAst.ReduceAt (loc, reduction_kind, ident, path) ->
+      let path = Disambiguate.interpretate [] status.aliases path in
+      status, TacticAst.ReduceAt(loc, reduction_kind, ident, path)
   | TacticAst.Reduce (loc, reduction_kind, opts) ->
       let status, opts = 
         match opts with
index 732e96fa01c781b2b70e09e9c579e8ef01f5db0c..21bad46a9f8ab8d2c0e5d2c236860c9805c3eaec 100644 (file)
@@ -290,3 +290,16 @@ intros 2.simplify.elim (leb n1 m1).
 simplify.apply le_n_S.apply H.
 simplify.intros.apply H.apply le_S_n.assumption.
 qed.
+
+theorem prova :
+let three \def (S (S (S O))) in
+let nine \def (times three three) in
+let eightyone \def (times nine nine) in 
+let square \def (times eightyone eightyone) in
+(eq nat square O).
+intro.
+intro.
+intro.intro.
+normalize goal at (? ? % ?).
+
+