src/Pure/Isar/proof_display.ML
changeset 51584 98029ceda8ce
parent 50126 3dec88149176
child 51601 8e80ecfa3652
equal deleted inserted replaced
51583:9100c8e66b69 51584:98029ceda8ce
    17   val pretty_full_theory: bool -> theory -> Pretty.T
    17   val pretty_full_theory: bool -> theory -> Pretty.T
    18   val print_theory: theory -> unit
    18   val print_theory: theory -> unit
    19   val string_of_rule: Proof.context -> string -> thm -> string
    19   val string_of_rule: Proof.context -> string -> thm -> string
    20   val pretty_goal_header: thm -> Pretty.T
    20   val pretty_goal_header: thm -> Pretty.T
    21   val string_of_goal: Proof.context -> thm -> string
    21   val string_of_goal: Proof.context -> thm -> string
       
    22   val pretty_goal_facts: Proof.context -> string -> thm list -> Pretty.T
    22   val method_error: string -> Position.T ->
    23   val method_error: string -> Position.T ->
    23     {context: Proof.context, facts: thm list, goal: thm} -> 'a Seq.result
    24     {context: Proof.context, facts: thm list, goal: thm} -> 'a Seq.result
    24   val print_results: Markup.T -> bool -> Proof.context ->
    25   val print_results: Markup.T -> bool -> Proof.context ->
    25     ((string * string) * (string * thm list) list) -> unit
    26     ((string * string) * (string * thm list) list) -> unit
    26   val print_consts: bool -> Proof.context -> (string * typ -> bool) -> (string * typ) list -> unit
    27   val print_consts: bool -> Proof.context -> (string * typ -> bool) -> (string * typ) list -> unit
   106 fun string_of_goal ctxt goal =
   107 fun string_of_goal ctxt goal =
   107   Pretty.string_of (Pretty.chunks
   108   Pretty.string_of (Pretty.chunks
   108     [pretty_goal_header goal, Goal_Display.pretty_goal {main = true, limit = false} ctxt goal]);
   109     [pretty_goal_header goal, Goal_Display.pretty_goal {main = true, limit = false} ctxt goal]);
   109 
   110 
   110 
   111 
       
   112 (* goal facts *)
       
   113 
       
   114 fun pretty_goal_facts ctxt s ths =
       
   115   (Pretty.block o Pretty.fbreaks)
       
   116     ((if s = "" then Pretty.str "this:"
       
   117       else Pretty.block [Pretty.command s, Pretty.brk 1, Pretty.str "this:"]) ::
       
   118       map (Display.pretty_thm_item ctxt) ths);
       
   119 
       
   120 
   111 (* method_error *)
   121 (* method_error *)
   112 
   122 
   113 fun method_error kind pos {context = ctxt, facts, goal} = Seq.Error (fn () =>
   123 fun method_error kind pos {context = ctxt, facts, goal} = Seq.Error (fn () =>
   114   let
   124   let
   115     val pr_header =
   125     val pr_header =
   116       "Failed to apply " ^ (if kind = "" then "" else kind ^ " ") ^
   126       "Failed to apply " ^ (if kind = "" then "" else kind ^ " ") ^
   117       "proof method" ^ Position.here pos ^ ":\n";
   127       "proof method" ^ Position.here pos ^ ":\n";
   118     val pr_facts =
   128     val pr_facts =
   119       if null facts then ""
   129       if null facts then ""
   120       else
   130       else Pretty.string_of (pretty_goal_facts ctxt "using" facts) ^ "\n";
   121         (Pretty.string_of o Pretty.block o Pretty.fbreaks)
       
   122           (Pretty.block [Pretty.command "using", Pretty.brk 1, Pretty.str "this:"] ::
       
   123             map (Display.pretty_thm ctxt) facts) ^ "\n";
       
   124     val pr_goal = string_of_goal ctxt goal;
   131     val pr_goal = string_of_goal ctxt goal;
   125   in pr_header ^ pr_facts ^ pr_goal end);
   132   in pr_header ^ pr_facts ^ pr_goal end);
   126 
   133 
   127 
   134 
   128 (* results *)
   135 (* results *)