216 ProofContext.setmp_verbose |
216 ProofContext.setmp_verbose |
217 ProofContext.print_binds (Proof.context_of (Toplevel.proof_of state))); |
217 ProofContext.print_binds (Proof.context_of (Toplevel.proof_of state))); |
218 |
218 |
219 val print_lthms = Toplevel.unknown_proof o Toplevel.keep (fn state => |
219 val print_lthms = Toplevel.unknown_proof o Toplevel.keep (fn state => |
220 ProofContext.setmp_verbose |
220 ProofContext.setmp_verbose |
221 ProofContext.print_thms (Proof.context_of (Toplevel.proof_of state))); |
221 ProofContext.print_lthms (Proof.context_of (Toplevel.proof_of state))); |
222 |
222 |
223 val print_cases = Toplevel.unknown_proof o Toplevel.keep (fn state => |
223 val print_cases = Toplevel.unknown_proof o Toplevel.keep (fn state => |
224 ProofContext.setmp_verbose |
224 ProofContext.setmp_verbose |
225 ProofContext.print_cases (Proof.context_of (Toplevel.proof_of state))); |
225 ProofContext.print_cases (Proof.context_of (Toplevel.proof_of state))); |
226 |
226 |
227 |
227 |
228 (* print theorems / types / terms / props *) |
228 (* print theorems / types / terms / props *) |
229 |
229 |
230 fun string_of_thms state ms args = with_modes ms (fn () => |
230 fun string_of_thms state ms args = with_modes ms (fn () => |
231 Pretty.string_of (Proof.pretty_thms (IsarThy.get_thmss args state))); |
231 Pretty.string_of (ProofContext.pretty_thms (Proof.context_of state) |
|
232 (IsarThy.get_thmss args state))); |
232 |
233 |
233 fun string_of_prfs full state ms args = with_modes ms (fn () => |
234 fun string_of_prfs full state ms args = with_modes ms (fn () => |
234 Pretty.string_of (Pretty.chunks |
235 Pretty.string_of (Pretty.chunks (* FIXME context syntax!? *) |
235 (map (ProofSyntax.pretty_proof_of full) (IsarThy.get_thmss args state)))); |
236 (map (ProofSyntax.pretty_proof_of full) (IsarThy.get_thmss args state)))); |
236 |
237 |
237 fun string_of_prop state ms s = |
238 fun string_of_prop state ms s = |
238 let |
239 let |
239 val sign = Proof.sign_of state; |
240 val ctxt = Proof.context_of state; |
240 val prop = ProofContext.read_prop (Proof.context_of state) s; |
241 val prop = ProofContext.read_prop ctxt s; |
241 in with_modes ms (fn () => Pretty.string_of (Pretty.quote (Sign.pretty_term sign prop))) end; |
242 in |
|
243 with_modes ms (fn () => Pretty.string_of (Pretty.quote (ProofContext.pretty_term ctxt prop))) |
|
244 end; |
242 |
245 |
243 fun string_of_term state ms s = |
246 fun string_of_term state ms s = |
244 let |
247 let |
245 val sign = Proof.sign_of state; |
248 val ctxt = Proof.context_of state; |
246 val t = ProofContext.read_term (Proof.context_of state) s; |
249 val t = ProofContext.read_term ctxt s; |
247 val T = Term.type_of t; |
250 val T = Term.type_of t; |
248 in |
251 in |
249 with_modes ms (fn () => Pretty.string_of |
252 with_modes ms (fn () => Pretty.string_of |
250 (Pretty.block [Pretty.quote (Sign.pretty_term sign t), Pretty.fbrk, |
253 (Pretty.block [Pretty.quote (ProofContext.pretty_term ctxt t), Pretty.fbrk, |
251 Pretty.str "::", Pretty.brk 1, Pretty.quote (Sign.pretty_typ sign T)])) |
254 Pretty.str "::", Pretty.brk 1, Pretty.quote (ProofContext.pretty_typ ctxt T)])) |
252 end; |
255 end; |
253 |
256 |
254 fun string_of_type state ms s = |
257 fun string_of_type state ms s = |
255 let |
258 let |
256 val sign = Proof.sign_of state; |
259 val ctxt = Proof.context_of state; |
257 val T = ProofContext.read_typ (Proof.context_of state) s; |
260 val T = ProofContext.read_typ ctxt s; |
258 in with_modes ms (fn () => Pretty.string_of (Pretty.quote (Sign.pretty_typ sign T))) end; |
261 in with_modes ms (fn () => Pretty.string_of (Pretty.quote (ProofContext.pretty_typ ctxt T))) end; |
259 |
262 |
260 fun print_item string_of (x, y) = Toplevel.keep (fn state => |
263 fun print_item string_of (x, y) = Toplevel.keep (fn state => |
261 writeln (string_of (Toplevel.enter_forward_proof state) x y)); |
264 writeln (string_of (Toplevel.enter_forward_proof state) x y)); |
262 |
265 |
263 val print_thms = print_item string_of_thms o Comment.ignore; |
266 val print_thms = print_item string_of_thms o Comment.ignore; |