src/Pure/Isar/proof.ML
changeset 76061 0982d0220b31
parent 76060 98610c8e9caa
child 76062 f1d758690222
equal deleted inserted replaced
76060:98610c8e9caa 76061:0982d0220b31
   367 
   367 
   368 (** pretty_state **)
   368 (** pretty_state **)
   369 
   369 
   370 local
   370 local
   371 
   371 
   372 fun pretty_facts _ _ NONE = []
       
   373   | pretty_facts ctxt s (SOME ths) = [Proof_Display.pretty_goal_facts ctxt s ths];
       
   374 
       
   375 fun pretty_sep prts [] = prts
   372 fun pretty_sep prts [] = prts
   376   | pretty_sep [] prts = prts
   373   | pretty_sep [] prts = prts
   377   | pretty_sep prts1 prts2 = prts1 @ [Pretty.str ""] @ prts2;
   374   | pretty_sep prts1 prts2 = prts1 @ [Pretty.str ""] @ prts2;
   378 
   375 
   379 in
   376 in
   381 fun pretty_state state =
   378 fun pretty_state state =
   382   let
   379   let
   383     val {context = ctxt, facts, mode, goal = _} = top state;
   380     val {context = ctxt, facts, mode, goal = _} = top state;
   384     val verbose = Config.get ctxt Proof_Context.verbose;
   381     val verbose = Config.get ctxt Proof_Context.verbose;
   385 
   382 
       
   383     val prt_facts = Proof_Display.pretty_goal_facts ctxt;
       
   384 
   386     fun prt_goal (SOME (_, {statement = _, using, goal, before_qed = _, after_qed = _})) =
   385     fun prt_goal (SOME (_, {statement = _, using, goal, before_qed = _, after_qed = _})) =
   387           pretty_sep
   386           pretty_sep
   388             (pretty_facts ctxt "using"
   387             (prt_facts "using" (if mode <> Backward orelse null using then NONE else SOME using))
   389               (if mode <> Backward orelse null using then NONE else SOME using))
       
   390             ([Proof_Display.pretty_goal_header goal] @ Goal_Display.pretty_goals ctxt goal)
   388             ([Proof_Display.pretty_goal_header goal] @ Goal_Display.pretty_goals ctxt goal)
   391       | prt_goal NONE = [];
   389       | prt_goal NONE = [];
   392 
   390 
   393     val prt_ctxt =
   391     val prt_ctxt =
   394       if verbose orelse mode = Forward then Proof_Context.pretty_context ctxt
   392       if verbose orelse mode = Forward then Proof_Context.pretty_context ctxt
   399   in
   397   in
   400     [Pretty.block
   398     [Pretty.block
   401       [Pretty.mark_str (position_markup, "proof"), Pretty.str (" (" ^ mode_name mode ^ ")")]] @
   399       [Pretty.mark_str (position_markup, "proof"), Pretty.str (" (" ^ mode_name mode ^ ")")]] @
   402     (if null prt_ctxt then [] else prt_ctxt @ [Pretty.str ""]) @
   400     (if null prt_ctxt then [] else prt_ctxt @ [Pretty.str ""]) @
   403     (if verbose orelse mode = Forward then
   401     (if verbose orelse mode = Forward then
   404        pretty_sep (pretty_facts ctxt "" (Option.map #1 facts)) (prt_goal (try find_goal state))
   402        pretty_sep (prt_facts "" (Option.map #1 facts)) (prt_goal (try find_goal state))
   405      else if mode = Chain then pretty_facts ctxt "picking" (Option.map #1 facts)
   403      else if mode = Chain then prt_facts "picking" (Option.map #1 facts)
   406      else prt_goal (try find_goal state))
   404      else prt_goal (try find_goal state))
   407   end;
   405   end;
   408 
   406 
   409 end;
   407 end;
   410 
   408