427 fun tweak_line s = |
427 fun tweak_line s = |
428 if ! display then s else Symbol.strip_blanks s; |
428 if ! display then s else Symbol.strip_blanks s; |
429 |
429 |
430 val pretty_text = Pretty.chunks o map Pretty.str o map tweak_line o Library.split_lines; |
430 val pretty_text = Pretty.chunks o map Pretty.str o map tweak_line o Library.split_lines; |
431 |
431 |
432 fun pretty_term ctxt = ProofContext.pretty_term ctxt o ProofContext.revert_skolems ctxt; |
432 fun pretty_term ctxt = Syntax.pretty_term ctxt o ProofContext.revert_skolems ctxt; |
|
433 |
433 fun pretty_term_abbrev ctxt = |
434 fun pretty_term_abbrev ctxt = |
434 ProofContext.pretty_term_abbrev ctxt o ProofContext.revert_skolems ctxt; |
435 ProofContext.pretty_term_abbrev ctxt o ProofContext.revert_skolems ctxt; |
435 |
436 |
436 fun pretty_term_typ ctxt t = |
437 fun pretty_term_typ ctxt t = |
437 ProofContext.pretty_term ctxt (TypeInfer.constrain (Term.fastype_of t) t); |
438 Syntax.pretty_term ctxt (TypeInfer.constrain (Term.fastype_of t) t); |
438 |
439 |
439 fun pretty_term_typeof ctxt = ProofContext.pretty_typ ctxt o Term.fastype_of; |
440 fun pretty_term_typeof ctxt = Syntax.pretty_typ ctxt o Term.fastype_of; |
440 |
441 |
441 fun pretty_term_const ctxt t = |
442 fun pretty_term_const ctxt t = |
442 if Term.is_Const t then pretty_term ctxt t |
443 if Term.is_Const t then pretty_term ctxt t |
443 else error ("Logical constant expected: " ^ ProofContext.string_of_term ctxt t); |
444 else error ("Logical constant expected: " ^ Syntax.string_of_term ctxt t); |
444 |
445 |
445 fun pretty_abbrev ctxt t = |
446 fun pretty_abbrev ctxt t = |
446 let |
447 let |
447 fun err () = error ("Abbreviated constant expected: " ^ ProofContext.string_of_term ctxt t); |
448 fun err () = error ("Abbreviated constant expected: " ^ Syntax.string_of_term ctxt t); |
448 val (head, args) = Term.strip_comb t; |
449 val (head, args) = Term.strip_comb t; |
449 val (c, T) = Term.dest_Const head handle TERM _ => err (); |
450 val (c, T) = Term.dest_Const head handle TERM _ => err (); |
450 val (U, (u, _)) = Consts.the_abbreviation (ProofContext.consts_of ctxt) c |
451 val (U, (u, _)) = Consts.the_abbreviation (ProofContext.consts_of ctxt) c |
451 handle TYPE _ => err (); |
452 handle TYPE _ => err (); |
452 val t' = Term.betapplys (Envir.expand_atom T (U, u), args); |
453 val t' = Term.betapplys (Envir.expand_atom T (U, u), args); |
517 ("term_style", args (Scan.lift Args.liberal_name -- Args.term) (output pretty_term_style)), |
518 ("term_style", args (Scan.lift Args.liberal_name -- Args.term) (output pretty_term_style)), |
518 ("term_type", args Args.term (output pretty_term_typ)), |
519 ("term_type", args Args.term (output pretty_term_typ)), |
519 ("typeof", args Args.term (output pretty_term_typeof)), |
520 ("typeof", args Args.term (output pretty_term_typeof)), |
520 ("const", args Args.term (output pretty_term_const)), |
521 ("const", args Args.term (output pretty_term_const)), |
521 ("abbrev", args Args.term_abbrev (output pretty_abbrev)), |
522 ("abbrev", args Args.term_abbrev (output pretty_abbrev)), |
522 ("typ", args Args.typ_abbrev (output ProofContext.pretty_typ)), |
523 ("typ", args Args.typ_abbrev (output Syntax.pretty_typ)), |
523 ("text", args (Scan.lift Args.name) (output (K pretty_text))), |
524 ("text", args (Scan.lift Args.name) (output (K pretty_text))), |
524 ("goals", output_goals true), |
525 ("goals", output_goals true), |
525 ("subgoals", output_goals false), |
526 ("subgoals", output_goals false), |
526 ("prf", args Attrib.thms (output (pretty_prf false))), |
527 ("prf", args Attrib.thms (output (pretty_prf false))), |
527 ("full_prf", args Attrib.thms (output (pretty_prf true))), |
528 ("full_prf", args Attrib.thms (output (pretty_prf true))), |