src/Pure/old_goals.ML
changeset 26626 c6231d64d264
parent 26429 1afbc0139b1b
child 26653 60e0cf6bef89
equal deleted inserted replaced
26625:e0cc4169626e 26626:c6231d64d264
   149   "Goal::prop=>prop" to avoid assumptions being returned separately.
   149   "Goal::prop=>prop" to avoid assumptions being returned separately.
   150 *)
   150 *)
   151 fun prepare_proof atomic rths chorn =
   151 fun prepare_proof atomic rths chorn =
   152   let
   152   let
   153       val _ = legacy_feature "Old goal command";
   153       val _ = legacy_feature "Old goal command";
   154       val {thy, t=horn,...} = rep_cterm chorn;
   154       val thy = Thm.theory_of_cterm chorn;
       
   155       val horn = Thm.term_of chorn;
   155       val _ = Term.no_dummy_patterns horn handle TERM (msg, _) => error msg;
   156       val _ = Term.no_dummy_patterns horn handle TERM (msg, _) => error msg;
   156       val (As, B) = Logic.strip_horn horn;
   157       val (As, B) = Logic.strip_horn horn;
   157       val atoms = atomic andalso
   158       val atoms = atomic andalso
   158             forall (fn t => not (can Logic.dest_implies t orelse can Logic.dest_all t)) As;
   159             forall (fn t => not (can Logic.dest_implies t orelse can Logic.dest_all t)) As;
   159       val (As,B) = if atoms then ([],horn) else (As,B);
   160       val (As,B) = if atoms then ([],horn) else (As,B);
   168         let val state = Seq.hd (flexflex_rule state)
   169         let val state = Seq.hd (flexflex_rule state)
   169                         handle THM _ => state   (*smash flexflex pairs*)
   170                         handle THM _ => state   (*smash flexflex pairs*)
   170             val ngoals = nprems_of state
   171             val ngoals = nprems_of state
   171             val ath = implies_intr_list cAs state
   172             val ath = implies_intr_list cAs state
   172             val th = Goal.conclude ath
   173             val th = Goal.conclude ath
   173             val {hyps,prop,thy=thy',...} = rep_thm th
   174             val thy' = Thm.theory_of_thm th
       
   175             val {hyps, prop, ...} = Thm.rep_thm th
   174             val final_th = standard th
   176             val final_th = standard th
   175         in  if not check then final_th
   177         in  if not check then final_th
   176             else if not (eq_thy(thy,thy')) then !result_error_fn state
   178             else if not (eq_thy(thy,thy')) then !result_error_fn state
   177                 ("Theory of proof state has changed!" ^
   179                 ("Theory of proof state has changed!" ^
   178                  thy_error (thy,thy'))
   180                  thy_error (thy,thy'))
   227       fun statef() =
   229       fun statef() =
   228           (case Seq.pull (tac st0) of
   230           (case Seq.pull (tac st0) of
   229                SOME(st,_) => st
   231                SOME(st,_) => st
   230              | _ => error ("prove_goal: tactic failed"))
   232              | _ => error ("prove_goal: tactic failed"))
   231   in  mkresult (check, cond_timeit (!Output.timing) "" statef)  end
   233   in  mkresult (check, cond_timeit (!Output.timing) "" statef)  end
   232   handle e => (print_sign_exn_unit (#thy (rep_cterm chorn)) e;
   234   handle e => (print_sign_exn_unit (Thm.theory_of_cterm chorn) e;
   233                writeln ("The exception above was raised for\n" ^
   235                writeln ("The exception above was raised for\n" ^
   234                       Display.string_of_cterm chorn); raise e);
   236                       Display.string_of_cterm chorn); raise e);
   235 
   237 
   236 (*Two variants: one checking the result, one not.
   238 (*Two variants: one checking the result, one not.
   237   Neither prints runtime messages: they are for internal packages.*)
   239   Neither prints runtime messages: they are for internal packages.*)