30 (if ! ProofContext.debug then |
30 (if ! ProofContext.debug then |
31 Pretty.quote (Pretty.big_list "proof context:" (ProofContext.pretty_context ctxt)) |
31 Pretty.quote (Pretty.big_list "proof context:" (ProofContext.pretty_context ctxt)) |
32 else Pretty.str "<context>"); |
32 else Pretty.str "<context>"); |
33 |
33 |
34 fun pp_thm th = |
34 fun pp_thm th = |
35 let val thy = Thm.theory_of_thm th |
35 let |
36 in Display.pretty_thm_aux (Syntax.pp_global thy) true false [] th end; |
36 val thy = Thm.theory_of_thm th; |
|
37 val flags = {quote = true, show_hyps = false, show_status = true}; |
|
38 in Display.pretty_thm_aux (Syntax.pp_global thy) flags [] th end; |
37 |
39 |
38 val pp_typ = Pretty.quote oo Syntax.pretty_typ_global; |
40 val pp_typ = Pretty.quote oo Syntax.pretty_typ_global; |
39 val pp_term = Pretty.quote oo Syntax.pretty_term_global; |
41 val pp_term = Pretty.quote oo Syntax.pretty_term_global; |
40 |
42 |
41 fun pp_ctyp cT = pp_typ (Thm.theory_of_ctyp cT) (Thm.typ_of cT); |
43 fun pp_ctyp cT = pp_typ (Thm.theory_of_ctyp cT) (Thm.typ_of cT); |
64 |
66 |
65 (* refinement rule *) |
67 (* refinement rule *) |
66 |
68 |
67 fun pretty_rule ctxt s thm = |
69 fun pretty_rule ctxt s thm = |
68 Pretty.block [Pretty.str (s ^ " attempt to solve goal by exported rule:"), |
70 Pretty.block [Pretty.str (s ^ " attempt to solve goal by exported rule:"), |
69 Pretty.fbrk, ProofContext.pretty_thm ctxt thm]; |
71 Pretty.fbrk, ProofContext.pretty_thm_aux ctxt false thm]; |
70 |
72 |
71 val string_of_rule = Pretty.string_of ooo pretty_rule; |
73 val string_of_rule = Pretty.string_of ooo pretty_rule; |
72 |
74 |
73 |
75 |
74 (* results *) |
76 (* results *) |
79 | pretty_fact_name (kind, name) = Pretty.block [Pretty.str kind, Pretty.brk 1, |
81 | pretty_fact_name (kind, name) = Pretty.block [Pretty.str kind, Pretty.brk 1, |
80 Pretty.str (Long_Name.base_name name), Pretty.str ":"]; |
82 Pretty.str (Long_Name.base_name name), Pretty.str ":"]; |
81 |
83 |
82 fun pretty_facts ctxt = |
84 fun pretty_facts ctxt = |
83 flat o (separate [Pretty.fbrk, Pretty.str "and "]) o |
85 flat o (separate [Pretty.fbrk, Pretty.str "and "]) o |
84 map (single o ProofContext.pretty_fact ctxt); |
86 map (single o ProofContext.pretty_fact_aux ctxt false); |
85 |
87 |
86 in |
88 in |
87 |
89 |
88 fun print_results do_print ctxt ((kind, name), facts) = |
90 fun print_results do_print ctxt ((kind, name), facts) = |
89 if not do_print orelse kind = "" orelse kind = Thm.internalK then () |
91 if not do_print orelse kind = "" orelse kind = Thm.internalK then () |
90 else if name = "" then |
92 else if name = "" then |
91 Pretty.writeln (Pretty.block (Pretty.str kind :: Pretty.brk 1 :: pretty_facts ctxt facts)) |
93 Pretty.writeln (Pretty.block (Pretty.str kind :: Pretty.brk 1 :: pretty_facts ctxt facts)) |
92 else Pretty.writeln |
94 else Pretty.writeln |
93 (case facts of |
95 (case facts of |
94 [fact] => Pretty.blk (1, [pretty_fact_name (kind, name), Pretty.fbrk, |
96 [fact] => Pretty.blk (1, [pretty_fact_name (kind, name), Pretty.fbrk, |
95 ProofContext.pretty_fact ctxt fact]) |
97 ProofContext.pretty_fact_aux ctxt false fact]) |
96 | _ => Pretty.blk (1, [pretty_fact_name (kind, name), Pretty.fbrk, |
98 | _ => Pretty.blk (1, [pretty_fact_name (kind, name), Pretty.fbrk, |
97 Pretty.blk (1, Pretty.str "(" :: pretty_facts ctxt facts @ [Pretty.str ")"])])); |
99 Pretty.blk (1, Pretty.str "(" :: pretty_facts ctxt facts @ [Pretty.str ")"])])); |
98 |
100 |
99 end; |
101 end; |
100 |
102 |