5 *) |
5 *) |
6 |
6 |
7 signature PROOF_DISPLAY = |
7 signature PROOF_DISPLAY = |
8 sig |
8 sig |
9 val pp_context: Proof.context -> Pretty.T |
9 val pp_context: Proof.context -> Pretty.T |
10 val pp_thm: (unit -> theory) -> thm -> Pretty.T |
10 val guess_context: unit -> Proof.context |
11 val pp_typ: (unit -> theory) -> typ -> Pretty.T |
11 val pp_thm: thm -> Pretty.T |
12 val pp_term: (unit -> theory) -> term -> Pretty.T |
12 val pp_typ: typ -> Pretty.T |
13 val pp_ctyp: (unit -> theory) -> ctyp -> Pretty.T |
13 val pp_term: term -> Pretty.T |
14 val pp_cterm: (unit -> theory) -> cterm -> Pretty.T |
14 val pp_ctyp: ctyp -> Pretty.T |
15 val pp_ztyp: (unit -> theory) -> ztyp -> Pretty.T |
15 val pp_cterm: cterm -> Pretty.T |
|
16 val pp_ztyp: ztyp -> Pretty.T |
16 val pretty_theory: bool -> Proof.context -> Pretty.T |
17 val pretty_theory: bool -> Proof.context -> Pretty.T |
17 val pretty_definitions: bool -> Proof.context -> Pretty.T |
18 val pretty_definitions: bool -> Proof.context -> Pretty.T |
18 val pretty_theorems_diff: bool -> theory list -> Proof.context -> Pretty.T list |
19 val pretty_theorems_diff: bool -> theory list -> Proof.context -> Pretty.T list |
19 val pretty_theorems: bool -> Proof.context -> Pretty.T list |
20 val pretty_theorems: bool -> Proof.context -> Pretty.T list |
20 val string_of_rule: Proof.context -> string -> thm -> string |
21 val string_of_rule: Proof.context -> string -> thm -> string |
43 fun pp_context ctxt = |
44 fun pp_context ctxt = |
44 (if Config.get ctxt Proof_Context.debug then |
45 (if Config.get ctxt Proof_Context.debug then |
45 Pretty.quote (Pretty.big_list "proof context:" (Proof_Context.pretty_context ctxt)) |
46 Pretty.quote (Pretty.big_list "proof context:" (Proof_Context.pretty_context ctxt)) |
46 else Pretty.str "<context>"); |
47 else Pretty.str "<context>"); |
47 |
48 |
48 fun default_context mk_thy = |
49 fun guess_context () = |
49 let |
50 let |
50 fun global_context () = |
51 fun global_context () = |
51 Config.put_global Name_Space.names_long true (mk_thy ()); |
52 Config.put_global Name_Space.names_long true (Theory.get_pure ()); |
52 in |
53 in |
53 (case Context.get_generic_context () of |
54 (case Context.get_generic_context () of |
54 SOME (Context.Proof ctxt) => ctxt |
55 SOME (Context.Proof ctxt) => ctxt |
55 | SOME (Context.Theory thy) => |
56 | SOME (Context.Theory thy) => |
56 try Syntax.init_pretty_global thy |
57 try Syntax.init_pretty_global thy |
57 |> \<^if_none>\<open>Syntax.init_pretty_global (global_context ())\<close> |
58 |> \<^if_none>\<open>Syntax.init_pretty_global (global_context ())\<close> |
58 | NONE => Syntax.init_pretty_global (global_context ())) |
59 | NONE => Syntax.init_pretty_global (global_context ())) |
59 end; |
60 end; |
60 |
61 |
61 fun pp_thm mk_thy th = |
62 fun pp_thm th = Thm.pretty_thm_raw (guess_context ()) {quote = true, show_hyps = false} th; |
62 Thm.pretty_thm_raw (default_context mk_thy) {quote = true, show_hyps = false} th; |
63 |
63 |
64 fun pp_typ T = Pretty.quote (Syntax.pretty_typ (guess_context ()) T); |
64 fun pp_typ mk_thy T = Pretty.quote (Syntax.pretty_typ (default_context mk_thy) T); |
65 fun pp_term t = Pretty.quote (Syntax.pretty_term (guess_context ()) t); |
65 fun pp_term mk_thy t = Pretty.quote (Syntax.pretty_term (default_context mk_thy) t); |
66 |
66 |
67 val pp_ctyp = pp_typ o Thm.typ_of; |
67 fun pp_ctyp mk_thy cT = pp_typ mk_thy (Thm.typ_of cT); |
68 val pp_cterm = pp_term o Thm.term_of; |
68 fun pp_cterm mk_thy ct = pp_term mk_thy (Thm.term_of ct); |
69 |
69 |
70 fun pp_ztyp T = Pretty.quote (Syntax.pretty_typ (guess_context ()) (ZTerm.typ_of T)); |
70 fun pp_ztyp mk_thy T = Pretty.quote (Syntax.pretty_typ (default_context mk_thy) (ZTerm.typ_of T)); |
|
71 |
71 |
72 |
72 |
73 |
73 |
74 (** theory content **) |
74 (** theory content **) |
75 |
75 |