src/Pure/Isar/proof.ML
changeset 32145 220c9e439d39
parent 32091 30e2ffbba718
child 32167 d32817dda0e6
equal deleted inserted replaced
32144:183c1010ac14 32145:220c9e439d39
   316 (** pretty_state **)
   316 (** pretty_state **)
   317 
   317 
   318 val show_main_goal = ref false;
   318 val show_main_goal = ref false;
   319 val verbose = ProofContext.verbose;
   319 val verbose = ProofContext.verbose;
   320 
   320 
   321 val pretty_goals_local = Display_Goal.pretty_goals_aux o Syntax.pp;
       
   322 
       
   323 fun pretty_facts _ _ NONE = []
   321 fun pretty_facts _ _ NONE = []
   324   | pretty_facts s ctxt (SOME ths) =
   322   | pretty_facts s ctxt (SOME ths) =
   325       [Pretty.big_list (s ^ "this:") (map (Display.pretty_thm ctxt) ths), Pretty.str ""];
   323       [Pretty.big_list (s ^ "this:") (map (Display.pretty_thm ctxt) ths), Pretty.str ""];
   326 
   324 
   327 fun pretty_state nr state =
   325 fun pretty_state nr state =
   344       {statement = ((_, pos), _, _), messages, using, goal, before_qed = _, after_qed = _}))) =
   342       {statement = ((_, pos), _, _), messages, using, goal, before_qed = _, after_qed = _}))) =
   345           pretty_facts "using " ctxt
   343           pretty_facts "using " ctxt
   346             (if mode <> Backward orelse null using then NONE else SOME using) @
   344             (if mode <> Backward orelse null using then NONE else SOME using) @
   347           [Pretty.str ("goal" ^
   345           [Pretty.str ("goal" ^
   348             description [levels_up (i div 2), subgoals (Thm.nprems_of goal)] ^ ":")] @
   346             description [levels_up (i div 2), subgoals (Thm.nprems_of goal)] ^ ":")] @
   349           pretty_goals_local ctxt Markup.subgoal
   347           Display_Goal.pretty_goals ctxt Markup.subgoal
   350             (true, ! show_main_goal) (! Display.goals_limit) goal @
   348             (true, ! show_main_goal) (! Display.goals_limit) goal @
   351           (map (fn msg => Position.setmp_thread_data pos msg ()) (rev messages))
   349           (map (fn msg => Position.setmp_thread_data pos msg ()) (rev messages))
   352       | prt_goal NONE = [];
   350       | prt_goal NONE = [];
   353 
   351 
   354     val prt_ctxt =
   352     val prt_ctxt =
   366      else prt_goal (try find_goal state))
   364      else prt_goal (try find_goal state))
   367   end;
   365   end;
   368 
   366 
   369 fun pretty_goals main state =
   367 fun pretty_goals main state =
   370   let val (ctxt, (_, goal)) = get_goal state
   368   let val (ctxt, (_, goal)) = get_goal state
   371   in pretty_goals_local ctxt Markup.none (false, main) (! Display.goals_limit) goal end;
   369   in Display_Goal.pretty_goals ctxt Markup.none (false, main) (! Display.goals_limit) goal end;
   372 
   370 
   373 
   371 
   374 
   372 
   375 (** proof steps **)
   373 (** proof steps **)
   376 
   374 
   472     val string_of_term = Syntax.string_of_term ctxt;
   470     val string_of_term = Syntax.string_of_term ctxt;
   473     val string_of_thm = Display.string_of_thm ctxt;
   471     val string_of_thm = Display.string_of_thm ctxt;
   474 
   472 
   475     val ngoals = Thm.nprems_of goal;
   473     val ngoals = Thm.nprems_of goal;
   476     val _ = ngoals = 0 orelse error (Pretty.string_of (Pretty.chunks
   474     val _ = ngoals = 0 orelse error (Pretty.string_of (Pretty.chunks
   477       (pretty_goals_local ctxt Markup.none (true, ! show_main_goal) (! Display.goals_limit) goal @
   475       (Display_Goal.pretty_goals ctxt Markup.none
       
   476           (true, ! show_main_goal) (! Display.goals_limit) goal @
   478         [Pretty.str (string_of_int ngoals ^ " unsolved goal(s)!")])));
   477         [Pretty.str (string_of_int ngoals ^ " unsolved goal(s)!")])));
   479 
   478 
   480     val extra_hyps = Assumption.extra_hyps ctxt goal;
   479     val extra_hyps = Assumption.extra_hyps ctxt goal;
   481     val _ = null extra_hyps orelse
   480     val _ = null extra_hyps orelse
   482       error ("Additional hypotheses:\n" ^ cat_lines (map string_of_term extra_hyps));
   481       error ("Additional hypotheses:\n" ^ cat_lines (map string_of_term extra_hyps));