98 | subgoals n = [Pretty.brk 1, Pretty.str ("(" ^ string_of_int n ^ " subgoals)")]; |
98 | subgoals n = [Pretty.brk 1, Pretty.str ("(" ^ string_of_int n ^ " subgoals)")]; |
99 |
99 |
100 in |
100 in |
101 |
101 |
102 fun pretty_goal_header goal = |
102 fun pretty_goal_header goal = |
103 Pretty.block ([Pretty.command "goal"] @ subgoals (Thm.nprems_of goal) @ [Pretty.str ":"]); |
103 Pretty.block ([Pretty.keyword1 "goal"] @ subgoals (Thm.nprems_of goal) @ [Pretty.str ":"]); |
104 |
104 |
105 end; |
105 end; |
106 |
106 |
107 fun string_of_goal ctxt goal = |
107 fun string_of_goal ctxt goal = |
108 Pretty.string_of (Pretty.chunks [pretty_goal_header goal, Goal_Display.pretty_goal ctxt goal]); |
108 Pretty.string_of (Pretty.chunks [pretty_goal_header goal, Goal_Display.pretty_goal ctxt goal]); |
111 (* goal facts *) |
111 (* goal facts *) |
112 |
112 |
113 fun pretty_goal_facts ctxt s ths = |
113 fun pretty_goal_facts ctxt s ths = |
114 (Pretty.block o Pretty.fbreaks) |
114 (Pretty.block o Pretty.fbreaks) |
115 [if s = "" then Pretty.str "this:" |
115 [if s = "" then Pretty.str "this:" |
116 else Pretty.block [Pretty.command s, Pretty.brk 1, Pretty.str "this:"], |
116 else Pretty.block [Pretty.keyword1 s, Pretty.brk 1, Pretty.str "this:"], |
117 Proof_Context.pretty_fact ctxt ("", ths)]; |
117 Proof_Context.pretty_fact ctxt ("", ths)]; |
118 |
118 |
119 |
119 |
120 (* method_error *) |
120 (* method_error *) |
121 |
121 |
133 |
133 |
134 (* results *) |
134 (* results *) |
135 |
135 |
136 local |
136 local |
137 |
137 |
138 fun pretty_fact_name (kind, "") = Pretty.command kind |
138 fun pretty_fact_name (kind, "") = Pretty.keyword1 kind |
139 | pretty_fact_name (kind, name) = |
139 | pretty_fact_name (kind, name) = |
140 Pretty.block [Pretty.command kind, Pretty.brk 1, |
140 Pretty.block [Pretty.keyword1 kind, Pretty.brk 1, |
141 Pretty.str (Long_Name.base_name name), Pretty.str ":"]; |
141 Pretty.str (Long_Name.base_name name), Pretty.str ":"]; |
142 |
142 |
143 fun pretty_facts ctxt = |
143 fun pretty_facts ctxt = |
144 flat o (separate [Pretty.fbrk, Pretty.keyword "and", Pretty.str " "]) o |
144 flat o (separate [Pretty.fbrk, Pretty.keyword2 "and", Pretty.str " "]) o |
145 map (single o Proof_Context.pretty_fact ctxt); |
145 map (single o Proof_Context.pretty_fact ctxt); |
146 |
146 |
147 in |
147 in |
148 |
148 |
149 fun print_results markup do_print ctxt ((kind, name), facts) = |
149 fun print_results markup do_print ctxt ((kind, name), facts) = |
150 if not do_print orelse kind = "" then () |
150 if not do_print orelse kind = "" then () |
151 else if name = "" then |
151 else if name = "" then |
152 (Pretty.writeln o Pretty.mark markup) |
152 (Pretty.writeln o Pretty.mark markup) |
153 (Pretty.block (Pretty.command kind :: Pretty.brk 1 :: pretty_facts ctxt facts)) |
153 (Pretty.block (Pretty.keyword1 kind :: Pretty.brk 1 :: pretty_facts ctxt facts)) |
154 else |
154 else |
155 (Pretty.writeln o Pretty.mark markup) |
155 (Pretty.writeln o Pretty.mark markup) |
156 (case facts of |
156 (case facts of |
157 [fact] => Pretty.blk (1, [pretty_fact_name (kind, name), Pretty.fbrk, |
157 [fact] => Pretty.blk (1, [pretty_fact_name (kind, name), Pretty.fbrk, |
158 Proof_Context.pretty_fact ctxt fact]) |
158 Proof_Context.pretty_fact ctxt fact]) |