]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/gTopLevel/ring.ml
Initial revision
[helm.git] / helm / gTopLevel / ring.ml
index 0b5cfadd27acbf686ecbb71ce1620d62d32de5f8..953ed64445d7bbbf7d9cf7a2f3d4efd464ddcb7a 100644 (file)
@@ -369,48 +369,6 @@ let build_segments ~terms ~proof =
         [lxy_false; varmap; rtheory; t]))
     aterms
 
-(** AUX TACTIC{,AL}S *)
-
-  (**
-    naive implementation of ORELSE tactical, try a sequence of tactics in turn:
-    if one fails pass to the next one and so on, eventually raises (failure "no
-    tactics left")
-    TODO warning: not tail recursive due to "try .. with" boxing
-  *)
-let rec try_tactics ~(tactics: (string * tactic) list) ~status =
-  warn "in Ring.try_tactics";
-  match tactics with
-  | (descr, tac)::tactics ->
-      warn ("Ring.try_tactics IS TRYING " ^ descr);
-      (try
-        let res = tac ~status in
-        warn ("Ring.try_tactics: " ^ descr ^ " succedeed!!!");
-        res
-       with
-        e ->
-         match e with
-            (Fail _)
-          | (CicTypeChecker.NotWellTyped _)
-          | (CicUnification.UnificationFailed) ->
-              warn (
-                "Ring.try_tactics failed with exn: " ^
-                Printexc.to_string e);
-              try_tactics ~tactics ~status
-        | _ -> raise e (* [e] must not be caught ; let's re-raise it *)
-      )
-  | [] -> raise (Fail "try_tactics: no tactics left")
-
-let thens ~start ~continuations ~status =
- let (proof,new_goals) = start ~status in
-  try
-   List.fold_left2
-    (fun (proof,goals) goal tactic ->
-      let (proof',new_goals') = tactic ~status:(proof,goal) in
-       (proof',goals@new_goals')
-    ) (proof,[]) new_goals continuations
-  with
-   Invalid_argument _ -> raise (Fail "thens: wrong number of new goals")
-
 let id_tac ~status:(proof,goal) =
  (proof,[goal])
 
@@ -427,7 +385,7 @@ let status_of_single_goal_tactic_result =
   *)
 let elim_type_tac ~term ~status =
   warn "in Ring.elim_type_tac";
-  thens ~start:(cut_tac ~term)
+  Tacticals.thens ~start:(cut_tac ~term)
    ~continuations:[elim_intros_simpl_tac ~term:(Cic.Rel 1) ; id_tac] ~status
 
   (**
@@ -438,7 +396,7 @@ let elim_type_tac ~term ~status =
   *)
 let elim_type2_tac ~term ~proof ~status =
   warn "in Ring.elim_type2";
-  thens ~start:(elim_type_tac ~term)
+  Tacticals.thens ~start:(elim_type_tac ~term)
    ~continuations:[id_tac ; exact_tac ~term:proof] ~status
 
   (**
@@ -510,7 +468,7 @@ let ring_tac ~status:(proof, goal) =
            t2; t2'; t2''; t2'_eq_t2'']);
       try
         let new_hyps = ref 0 in  (* number of new hypotheses created *)
-        try_tactics
+        Tacticals.try_tactics
           ~status
           ~tactics:[
             "reflexivity", reflexivity_tac;
@@ -543,7 +501,7 @@ let ring_tac ~status:(proof, goal) =
                 lift 1 (t1,t1',t1'',t1'_eq_t1'', t2,t2',t2'',t2'_eq_t2'')
               in
               let status'' =
-                try_tactics (* try to solve 1st subgoal *)
+                Tacticals.try_tactics (* try to solve 1st subgoal *)
                   ~status:status'
                   ~tactics:[
                     "exact t2'_eq_t2''", exact_tac ~term:t2'_eq_t2'';