eliminated obsolete old-style goal stack package, which was considered the main Isabelle user interface at some point;
authorwenzelm
Wed Sep 01 23:03:31 2010 +0200 (2010-09-01)
changeset 389784bf80c23320e
parent 38977 e71e2c56479c
child 38979 60dbf0b3f6c7
child 38981 7cf8beb31e0f
child 39013 c79e6d536267
child 39025 582546cc49a1
eliminated obsolete old-style goal stack package, which was considered the main Isabelle user interface at some point;
src/Pure/IsaMakefile
src/Pure/ROOT.ML
src/Pure/old_goals.ML
     1.1 --- a/src/Pure/IsaMakefile	Wed Sep 01 22:59:11 2010 +0200
     1.2 +++ b/src/Pure/IsaMakefile	Wed Sep 01 23:03:31 2010 +0200
     1.3 @@ -230,7 +230,6 @@
     1.4    morphism.ML						\
     1.5    name.ML						\
     1.6    net.ML						\
     1.7 -  old_goals.ML						\
     1.8    old_term.ML						\
     1.9    pattern.ML						\
    1.10    primitive_defs.ML					\
     2.1 --- a/src/Pure/ROOT.ML	Wed Sep 01 22:59:11 2010 +0200
     2.2 +++ b/src/Pure/ROOT.ML	Wed Sep 01 23:03:31 2010 +0200
     2.3 @@ -238,7 +238,6 @@
     2.4  use "Thy/term_style.ML";
     2.5  use "Thy/thy_output.ML";
     2.6  use "Thy/thy_syntax.ML";
     2.7 -use "old_goals.ML";
     2.8  use "Isar/outer_syntax.ML";
     2.9  use "PIDE/document.ML";
    2.10  use "Thy/thy_info.ML";
     3.1 --- a/src/Pure/old_goals.ML	Wed Sep 01 22:59:11 2010 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,440 +0,0 @@
     3.4 -(*  Title:      Pure/old_goals.ML
     3.5 -    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     3.6 -    Copyright   1993  University of Cambridge
     3.7 -
     3.8 -Old-style goal stack package.  The goal stack initially holds a dummy
     3.9 -proof, and can never become empty.  Each goal stack consists of a list
    3.10 -of levels.  The undo list is a list of goal stacks.  Finally, there
    3.11 -may be a stack of pending proofs.
    3.12 -*)
    3.13 -
    3.14 -signature OLD_GOALS =
    3.15 -sig
    3.16 -  type proof
    3.17 -  val premises: unit -> thm list
    3.18 -  val reset_goals: unit -> unit
    3.19 -  val result_error_fn: (thm -> string -> thm) Unsynchronized.ref
    3.20 -  val print_sign_exn: theory -> exn -> 'a
    3.21 -  val prove_goalw_cterm: thm list->cterm->(thm list->tactic list)->thm
    3.22 -  val prove_goalw_cterm_nocheck: thm list->cterm->(thm list->tactic list)->thm
    3.23 -  val prove_goalw: theory -> thm list -> string -> (thm list -> tactic list) -> thm
    3.24 -  val prove_goal: theory -> string -> (thm list -> tactic list) -> thm
    3.25 -  val topthm: unit -> thm
    3.26 -  val result: unit -> thm
    3.27 -  val uresult: unit -> thm
    3.28 -  val getgoal: int -> term
    3.29 -  val print_exn: exn -> 'a
    3.30 -  val filter_goal: (term*term->bool) -> thm list -> int -> thm list
    3.31 -  val prlev: int -> unit
    3.32 -  val pr: unit -> unit
    3.33 -  val prlim: int -> unit
    3.34 -  val goalw_cterm: thm list -> cterm -> thm list
    3.35 -  val goalw: theory -> thm list -> string -> thm list
    3.36 -  val goal: theory -> string -> thm list
    3.37 -  val Goalw: thm list -> string -> thm list
    3.38 -  val Goal: string -> thm list
    3.39 -  val simple_prove_goal_cterm: cterm->(thm list->tactic list)->thm
    3.40 -  val by: tactic -> unit
    3.41 -  val byev: tactic list -> unit
    3.42 -  val back: unit -> unit
    3.43 -  val choplev: int -> unit
    3.44 -  val chop: unit -> unit
    3.45 -  val undo: unit -> unit
    3.46 -  val save_proof: unit -> proof
    3.47 -  val restore_proof: proof -> thm list
    3.48 -  val push_proof: unit -> unit
    3.49 -  val pop_proof: unit -> thm list
    3.50 -  val rotate_proof: unit -> thm list
    3.51 -  val qed: string -> unit
    3.52 -  val qed_goal: string -> theory -> string -> (thm list -> tactic list) -> unit
    3.53 -  val qed_goalw: string -> theory -> thm list -> string
    3.54 -    -> (thm list -> tactic list) -> unit
    3.55 -  val qed_spec_mp: string -> unit
    3.56 -  val qed_goal_spec_mp: string -> theory -> string -> (thm list -> tactic list) -> unit
    3.57 -  val qed_goalw_spec_mp: string -> theory -> thm list -> string
    3.58 -    -> (thm list -> tactic list) -> unit
    3.59 -end;
    3.60 -
    3.61 -structure OldGoals: OLD_GOALS =
    3.62 -struct
    3.63 -
    3.64 -
    3.65 -(*** Goal package ***)
    3.66 -
    3.67 -(*Each level of goal stack includes a proof state and alternative states,
    3.68 -  the output of the tactic applied to the preceeding level.  *)
    3.69 -type gstack = (thm * thm Seq.seq) list;
    3.70 -
    3.71 -datatype proof = Proof of gstack list * thm list * (bool*thm->thm);
    3.72 -
    3.73 -
    3.74 -(*** References ***)
    3.75 -
    3.76 -(*Current assumption list -- set by "goal".*)
    3.77 -val curr_prems = Unsynchronized.ref([] : thm list);
    3.78 -
    3.79 -(*Return assumption list -- useful if you didn't save "goal"'s result. *)
    3.80 -fun premises() = !curr_prems;
    3.81 -
    3.82 -(*Current result maker -- set by "goal", used by "result".  *)
    3.83 -fun init_mkresult _ = error "No goal has been supplied in subgoal module";
    3.84 -val curr_mkresult = Unsynchronized.ref (init_mkresult: bool*thm->thm);
    3.85 -
    3.86 -(*List of previous goal stacks, for the undo operation.  Set by setstate.
    3.87 -  A list of lists!*)
    3.88 -val undo_list = Unsynchronized.ref([[(asm_rl, Seq.empty)]] : gstack list);
    3.89 -
    3.90 -(* Stack of proof attempts *)
    3.91 -val proofstack = Unsynchronized.ref([]: proof list);
    3.92 -
    3.93 -(*reset all refs*)
    3.94 -fun reset_goals () =
    3.95 -  (curr_prems := []; curr_mkresult := init_mkresult;
    3.96 -    undo_list := [[(asm_rl, Seq.empty)]]);
    3.97 -
    3.98 -
    3.99 -(*** Setting up goal-directed proof ***)
   3.100 -
   3.101 -(*Generates the list of new theories when the proof state's theory changes*)
   3.102 -fun thy_error (thy,thy') =
   3.103 -  let val names = subtract (op =) (Context.display_names thy) (Context.display_names thy')
   3.104 -  in  case names of
   3.105 -        [name] => "\nNew theory: " ^ name
   3.106 -      | _       => "\nNew theories: " ^ space_implode ", " names
   3.107 -  end;
   3.108 -
   3.109 -(*Default action is to print an error message; could be suppressed for
   3.110 -  special applications.*)
   3.111 -fun result_error_default state msg : thm =
   3.112 -  Pretty.str "Bad final proof state:" ::
   3.113 -      Goal_Display.pretty_goals_without_context (!goals_limit) state @
   3.114 -    [Pretty.str msg, Pretty.str "Proof failed!"] |> Pretty.chunks |> Pretty.string_of |> error;
   3.115 -
   3.116 -val result_error_fn = Unsynchronized.ref result_error_default;
   3.117 -
   3.118 -
   3.119 -(*Common treatment of "goal" and "prove_goal":
   3.120 -  Return assumptions, initial proof state, and function to make result.
   3.121 -  "atomic" indicates if the goal should be wrapped up in the function
   3.122 -  "Goal::prop=>prop" to avoid assumptions being returned separately.
   3.123 -*)
   3.124 -fun prepare_proof atomic rths chorn =
   3.125 -  let
   3.126 -      val thy = Thm.theory_of_cterm chorn;
   3.127 -      val horn = Thm.term_of chorn;
   3.128 -      val _ = Term.no_dummy_patterns horn handle TERM (msg, _) => error msg;
   3.129 -      val (As, B) = Logic.strip_horn horn;
   3.130 -      val atoms = atomic andalso
   3.131 -            forall (fn t => not (can Logic.dest_implies t orelse Logic.is_all t)) As;
   3.132 -      val (As,B) = if atoms then ([],horn) else (As,B);
   3.133 -      val cAs = map (cterm_of thy) As;
   3.134 -      val prems = map (rewrite_rule rths o Thm.forall_elim_vars 0 o Thm.assume) cAs;
   3.135 -      val cB = cterm_of thy B;
   3.136 -      val st0 = let val st = Goal.init cB |> fold Thm.weaken cAs
   3.137 -                in  rewrite_goals_rule rths st end
   3.138 -      (*discharges assumptions from state in the order they appear in goal;
   3.139 -        checks (if requested) that resulting theorem is equivalent to goal. *)
   3.140 -      fun mkresult (check,state) =
   3.141 -        let val state = Seq.hd (Thm.flexflex_rule state)
   3.142 -                        handle THM _ => state   (*smash flexflex pairs*)
   3.143 -            val ngoals = nprems_of state
   3.144 -            val ath = implies_intr_list cAs state
   3.145 -            val th = Goal.conclude ath
   3.146 -            val thy' = Thm.theory_of_thm th
   3.147 -            val {hyps, prop, ...} = Thm.rep_thm th
   3.148 -            val final_th = Drule.export_without_context th
   3.149 -        in  if not check then final_th
   3.150 -            else if not (Theory.eq_thy(thy,thy')) then !result_error_fn state
   3.151 -                ("Theory of proof state has changed!" ^
   3.152 -                 thy_error (thy,thy'))
   3.153 -            else if ngoals>0 then !result_error_fn state
   3.154 -                (string_of_int ngoals ^ " unsolved goals!")
   3.155 -            else if not (null hyps) then !result_error_fn state
   3.156 -                ("Additional hypotheses:\n" ^
   3.157 -                 cat_lines (map (Syntax.string_of_term_global thy) hyps))
   3.158 -            else if Pattern.matches thy
   3.159 -                                    (Envir.beta_norm (term_of chorn), Envir.beta_norm prop)
   3.160 -                 then final_th
   3.161 -            else  !result_error_fn state "proved a different theorem"
   3.162 -        end
   3.163 -  in
   3.164 -     if Theory.eq_thy(thy, Thm.theory_of_thm st0)
   3.165 -     then (prems, st0, mkresult)
   3.166 -     else error ("Definitions would change the proof state's theory" ^
   3.167 -                 thy_error (thy, Thm.theory_of_thm st0))
   3.168 -  end
   3.169 -  handle THM(s,_,_) => error("prepare_proof: exception THM was raised!\n" ^ s);
   3.170 -
   3.171 -(*Prints exceptions readably to users*)
   3.172 -fun print_sign_exn_unit thy e =
   3.173 -  case e of
   3.174 -     THM (msg,i,thms) =>
   3.175 -         (writeln ("Exception THM " ^ string_of_int i ^ " raised:\n" ^ msg);
   3.176 -          List.app (writeln o Display.string_of_thm_global thy) thms)
   3.177 -   | THEORY (msg,thys) =>
   3.178 -         (writeln ("Exception THEORY raised:\n" ^ msg);
   3.179 -          List.app (writeln o Context.str_of_thy) thys)
   3.180 -   | TERM (msg,ts) =>
   3.181 -         (writeln ("Exception TERM raised:\n" ^ msg);
   3.182 -          List.app (writeln o Syntax.string_of_term_global thy) ts)
   3.183 -   | TYPE (msg,Ts,ts) =>
   3.184 -         (writeln ("Exception TYPE raised:\n" ^ msg);
   3.185 -          List.app (writeln o Syntax.string_of_typ_global thy) Ts;
   3.186 -          List.app (writeln o Syntax.string_of_term_global thy) ts)
   3.187 -   | e => raise e;
   3.188 -
   3.189 -(*Prints an exception, then fails*)
   3.190 -fun print_sign_exn thy e = (print_sign_exn_unit thy e; raise ERROR "");
   3.191 -
   3.192 -(** the prove_goal.... commands
   3.193 -    Prove theorem using the listed tactics; check it has the specified form.
   3.194 -    Augment theory with all type assignments of goal.
   3.195 -    Syntax is similar to "goal" command for easy keyboard use. **)
   3.196 -
   3.197 -(*Version taking the goal as a cterm*)
   3.198 -fun prove_goalw_cterm_general check rths chorn tacsf =
   3.199 -  let val (prems, st0, mkresult) = prepare_proof false rths chorn
   3.200 -      val tac = EVERY (tacsf prems)
   3.201 -      fun statef() =
   3.202 -          (case Seq.pull (tac st0) of
   3.203 -               SOME(st,_) => st
   3.204 -             | _ => error ("prove_goal: tactic failed"))
   3.205 -  in  mkresult (check, cond_timeit (!Output.timing) "" statef)  end;
   3.206 -
   3.207 -(*Two variants: one checking the result, one not.
   3.208 -  Neither prints runtime messages: they are for internal packages.*)
   3.209 -fun prove_goalw_cterm rths chorn =
   3.210 -        setmp_CRITICAL Output.timing false (prove_goalw_cterm_general true rths chorn)
   3.211 -and prove_goalw_cterm_nocheck rths chorn =
   3.212 -        setmp_CRITICAL Output.timing false (prove_goalw_cterm_general false rths chorn);
   3.213 -
   3.214 -
   3.215 -(*Version taking the goal as a string*)
   3.216 -fun prove_goalw thy rths agoal tacsf =
   3.217 -  let val chorn = cterm_of thy (Syntax.read_prop_global thy agoal)
   3.218 -  in prove_goalw_cterm_general true rths chorn tacsf end
   3.219 -  handle ERROR msg => cat_error msg (*from read_prop?*)
   3.220 -                ("The error(s) above occurred for " ^ quote agoal);
   3.221 -
   3.222 -(*String version with no meta-rewrite-rules*)
   3.223 -fun prove_goal thy = prove_goalw thy [];
   3.224 -
   3.225 -
   3.226 -
   3.227 -(*** Commands etc ***)
   3.228 -
   3.229 -(*Return the current goal stack, if any, from undo_list*)
   3.230 -fun getstate() : gstack = case !undo_list of
   3.231 -      []   => error"No current state in subgoal module"
   3.232 -    | x::_ => x;
   3.233 -
   3.234 -(*Pops the given goal stack*)
   3.235 -fun pop [] = error"Cannot go back past the beginning of the proof!"
   3.236 -  | pop (pair::pairs) = (pair,pairs);
   3.237 -
   3.238 -
   3.239 -(* Print a level of the goal stack *)
   3.240 -
   3.241 -fun print_top ((th, _), pairs) =
   3.242 -  let
   3.243 -    val n = length pairs;
   3.244 -    val m = (! goals_limit);
   3.245 -    val ngoals = nprems_of th;
   3.246 -  in
   3.247 -    [Pretty.str ("Level " ^ string_of_int n ^
   3.248 -      (if ngoals > 0 then " (" ^ string_of_int ngoals ^ " subgoal" ^
   3.249 -        (if ngoals <> 1 then "s" else "") ^ ")"
   3.250 -      else ""))] @
   3.251 -    Goal_Display.pretty_goals_without_context m th
   3.252 -  end |> Pretty.chunks |> Pretty.writeln;
   3.253 -
   3.254 -(*Printing can raise exceptions, so the assignment occurs last.
   3.255 -  Can do   setstate[(st,Seq.empty)]  to set st as the state.  *)
   3.256 -fun setstate newgoals =
   3.257 -  (print_top (pop newgoals);  undo_list := newgoals :: !undo_list);
   3.258 -
   3.259 -(*Given a proof state transformation, return a command that updates
   3.260 -    the goal stack*)
   3.261 -fun make_command com = setstate (com (pop (getstate())));
   3.262 -
   3.263 -(*Apply a function on proof states to the current goal stack*)
   3.264 -fun apply_fun f = f (pop(getstate()));
   3.265 -
   3.266 -(*Return the top theorem, representing the proof state*)
   3.267 -fun topthm () = apply_fun  (fn ((th,_), _) => th);
   3.268 -
   3.269 -(*Return the final result.  *)
   3.270 -fun result () = !curr_mkresult (true, topthm());
   3.271 -
   3.272 -(*Return the result UNCHECKED that it equals the goal -- for synthesis,
   3.273 -  answer extraction, or other instantiation of Vars *)
   3.274 -fun uresult () = !curr_mkresult (false, topthm());
   3.275 -
   3.276 -(*Get subgoal i from goal stack*)
   3.277 -fun getgoal i = Logic.get_goal (prop_of (topthm())) i;
   3.278 -
   3.279 -(*Prints exceptions nicely at top level;
   3.280 -  raises the exception in order to have a polymorphic type!*)
   3.281 -fun print_exn e = (print_sign_exn_unit (Thm.theory_of_thm (topthm())) e;  raise e);
   3.282 -
   3.283 -(*Which thms could apply to goal i? (debugs tactics involving filter_thms) *)
   3.284 -fun filter_goal could ths i = filter_thms could (999, getgoal i, ths);
   3.285 -
   3.286 -(*For inspecting earlier levels of the backward proof*)
   3.287 -fun chop_level n (pair,pairs) =
   3.288 -  let val level = length pairs
   3.289 -  in  if n<0 andalso ~n <= level
   3.290 -      then  List.drop (pair::pairs, ~n)
   3.291 -      else if 0<=n andalso n<= level
   3.292 -      then  List.drop (pair::pairs, level - n)
   3.293 -      else  error ("Level number must lie between 0 and " ^
   3.294 -                   string_of_int level)
   3.295 -  end;
   3.296 -
   3.297 -(*Print the given level of the proof; prlev ~1 prints previous level*)
   3.298 -fun prlev n = apply_fun (print_top o pop o (chop_level n));
   3.299 -fun pr () = apply_fun print_top;
   3.300 -
   3.301 -(*Set goals_limit and print again*)
   3.302 -fun prlim n = (goals_limit:=n; pr());
   3.303 -
   3.304 -(** the goal.... commands
   3.305 -    Read main goal.  Set global variables curr_prems, curr_mkresult.
   3.306 -    Initial subgoal and premises are rewritten using rths. **)
   3.307 -
   3.308 -(*Version taking the goal as a cterm; if you have a term t and theory thy, use
   3.309 -    goalw_cterm rths (cterm_of thy t);      *)
   3.310 -fun agoalw_cterm atomic rths chorn =
   3.311 -  let val (prems, st0, mkresult) = prepare_proof atomic rths chorn
   3.312 -  in  undo_list := [];
   3.313 -      setstate [ (st0, Seq.empty) ];
   3.314 -      curr_prems := prems;
   3.315 -      curr_mkresult := mkresult;
   3.316 -      prems
   3.317 -  end;
   3.318 -
   3.319 -val goalw_cterm = agoalw_cterm false;
   3.320 -
   3.321 -(*Version taking the goal as a string*)
   3.322 -fun agoalw atomic thy rths agoal =
   3.323 -    agoalw_cterm atomic rths (cterm_of thy (Syntax.read_prop_global thy agoal))
   3.324 -    handle ERROR msg => cat_error msg (*from type_assign, etc via prepare_proof*)
   3.325 -        ("The error(s) above occurred for " ^ quote agoal);
   3.326 -
   3.327 -val goalw = agoalw false;
   3.328 -fun goal thy = goalw thy [];
   3.329 -
   3.330 -(*now the versions that wrap the goal up in `Goal' to make it atomic*)
   3.331 -fun Goalw thms s = agoalw true (ML_Context.the_global_context ()) thms s;
   3.332 -val Goal = Goalw [];
   3.333 -
   3.334 -(*simple version with minimal amount of checking and postprocessing*)
   3.335 -fun simple_prove_goal_cterm G f =
   3.336 -  let
   3.337 -    val As = Drule.strip_imp_prems G;
   3.338 -    val B = Drule.strip_imp_concl G;
   3.339 -    val asms = map Assumption.assume As;
   3.340 -    fun check NONE = error "prove_goal: tactic failed"
   3.341 -      | check (SOME (thm, _)) = (case nprems_of thm of
   3.342 -            0 => thm
   3.343 -          | i => !result_error_fn thm (string_of_int i ^ " unsolved goals!"))
   3.344 -  in
   3.345 -    Drule.export_without_context (implies_intr_list As
   3.346 -      (check (Seq.pull (EVERY (f asms) (Thm.trivial B)))))
   3.347 -  end;
   3.348 -
   3.349 -
   3.350 -(*Proof step "by" the given tactic -- apply tactic to the proof state*)
   3.351 -fun by_com tac ((th,ths), pairs) : gstack =
   3.352 -  (case  Seq.pull(tac th)  of
   3.353 -     NONE      => error"by: tactic failed"
   3.354 -   | SOME(th2,ths2) =>
   3.355 -       (if Thm.eq_thm(th,th2)
   3.356 -          then warning "Warning: same as previous level"
   3.357 -          else if Thm.eq_thm_thy(th,th2) then ()
   3.358 -          else warning ("Warning: theory of proof state has changed" ^
   3.359 -                       thy_error (Thm.theory_of_thm th, Thm.theory_of_thm th2));
   3.360 -       ((th2,ths2)::(th,ths)::pairs)));
   3.361 -
   3.362 -fun by tac = cond_timeit (!Output.timing) ""
   3.363 -    (fn() => make_command (by_com tac));
   3.364 -
   3.365 -(* byev[tac1,...,tacn] applies tac1 THEN ... THEN tacn.
   3.366 -   Good for debugging proofs involving prove_goal.*)
   3.367 -val byev = by o EVERY;
   3.368 -
   3.369 -
   3.370 -(*Backtracking means find an alternative result from a tactic.
   3.371 -  If none at this level, try earlier levels*)
   3.372 -fun backtrack [] = error"back: no alternatives"
   3.373 -  | backtrack ((th,thstr) :: pairs) =
   3.374 -     (case Seq.pull thstr of
   3.375 -          NONE      => (writeln"Going back a level..."; backtrack pairs)
   3.376 -        | SOME(th2,thstr2) =>
   3.377 -           (if Thm.eq_thm(th,th2)
   3.378 -              then warning "Warning: same as previous choice at this level"
   3.379 -              else if Thm.eq_thm_thy(th,th2) then ()
   3.380 -              else warning "Warning: theory of proof state has changed";
   3.381 -            (th2,thstr2)::pairs));
   3.382 -
   3.383 -fun back() = setstate (backtrack (getstate()));
   3.384 -
   3.385 -(*Chop back to previous level of the proof*)
   3.386 -fun choplev n = make_command (chop_level n);
   3.387 -
   3.388 -(*Chopping back the goal stack*)
   3.389 -fun chop () = make_command (fn (_,pairs) => pairs);
   3.390 -
   3.391 -(*Restore the previous proof state;  discard current state. *)
   3.392 -fun undo() = case !undo_list of
   3.393 -      [] => error"No proof state"
   3.394 -    | [_] => error"Already at initial state"
   3.395 -    | _::newundo =>  (undo_list := newundo;  pr()) ;
   3.396 -
   3.397 -
   3.398 -(*** Managing the proof stack ***)
   3.399 -
   3.400 -fun save_proof() = Proof(!undo_list, !curr_prems, !curr_mkresult);
   3.401 -
   3.402 -fun restore_proof(Proof(ul,prems,mk)) =
   3.403 - (undo_list:= ul;  curr_prems:= prems;  curr_mkresult := mk;  prems);
   3.404 -
   3.405 -
   3.406 -fun top_proof() = case !proofstack of
   3.407 -        [] => error("Stack of proof attempts is empty!")
   3.408 -    | p::ps => (p,ps);
   3.409 -
   3.410 -(*  push a copy of the current proof state on to the stack *)
   3.411 -fun push_proof() = (proofstack := (save_proof() :: !proofstack));
   3.412 -
   3.413 -(* discard the top proof state of the stack *)
   3.414 -fun pop_proof() =
   3.415 -  let val (p,ps) = top_proof()
   3.416 -      val prems = restore_proof p
   3.417 -  in proofstack := ps;  pr();  prems end;
   3.418 -
   3.419 -(* rotate the stack so that the top element goes to the bottom *)
   3.420 -fun rotate_proof() =
   3.421 -  let val (p,ps) = top_proof()
   3.422 -  in proofstack := ps@[save_proof()];
   3.423 -     restore_proof p;
   3.424 -     pr();
   3.425 -     !curr_prems
   3.426 -  end;
   3.427 -
   3.428 -
   3.429 -(** theorem bindings **)
   3.430 -
   3.431 -fun qed name = ML_Context.ml_store_thm (name, result ());
   3.432 -fun qed_goal name thy goal tacsf = ML_Context.ml_store_thm (name, prove_goal thy goal tacsf);
   3.433 -fun qed_goalw name thy rews goal tacsf =
   3.434 -  ML_Context.ml_store_thm (name, prove_goalw thy rews goal tacsf);
   3.435 -fun qed_spec_mp name =
   3.436 -  ML_Context.ml_store_thm (name, Object_Logic.rulify_no_asm (result ()));
   3.437 -fun qed_goal_spec_mp name thy s p =
   3.438 -  bind_thm (name, Object_Logic.rulify_no_asm (prove_goal thy s p));
   3.439 -fun qed_goalw_spec_mp name thy defs s p =
   3.440 -  bind_thm (name, Object_Logic.rulify_no_asm (prove_goalw thy defs s p));
   3.441 -
   3.442 -end;
   3.443 -