src/Pure/Isar/proof_display.ML
changeset 78469 53b59fa42696
parent 78465 4dffc47b7e91
child 79127 830f68f92ad7
equal deleted inserted replaced
78468:33bc244eafdb 78469:53b59fa42696
    22   val pretty_goal_facts: Proof.context -> string -> thm list option -> Pretty.T list
    22   val pretty_goal_facts: Proof.context -> string -> thm list option -> Pretty.T list
    23   val pretty_goal_inst: Proof.context -> term list list -> thm -> Pretty.T list
    23   val pretty_goal_inst: Proof.context -> term list list -> thm -> Pretty.T list
    24   val method_error: string -> Position.T ->
    24   val method_error: string -> Position.T ->
    25     {context: Proof.context, facts: thm list, goal: thm} -> 'a Seq.result
    25     {context: Proof.context, facts: thm list, goal: thm} -> 'a Seq.result
    26   val show_results: bool Config.T
    26   val show_results: bool Config.T
    27   val print_results: bool -> Position.T -> Proof.context ->
    27   val print_results: {interactive: bool, pos: Position.T, proof_state: bool} -> Proof.context ->
    28     ((string * string) * (string * thm list) list) -> unit
    28     ((string * string) * (string * thm list) list) -> unit
    29   val print_theorem: Position.T -> Proof.context -> string * thm list -> unit
    29   val print_theorem: Position.T -> Proof.context -> string * thm list -> unit
    30   val print_consts: bool -> Position.T -> Proof.context ->
    30   val print_consts: bool -> Position.T -> Proof.context ->
    31     (string * typ -> bool) -> (string * typ) list -> unit
    31     (string * typ -> bool) -> (string * typ) list -> unit
    32   val markup_extern_label: Position.T -> (Markup.T * xstring) option
    32   val markup_extern_label: Position.T -> (Markup.T * xstring) option
   347   flat o (separate [Pretty.fbrk, Pretty.keyword2 "and", Pretty.str " "]) o
   347   flat o (separate [Pretty.fbrk, Pretty.keyword2 "and", Pretty.str " "]) o
   348     map (single o Proof_Context.pretty_fact ctxt);
   348     map (single o Proof_Context.pretty_fact ctxt);
   349 
   349 
   350 in
   350 in
   351 
   351 
   352 fun print_results int pos ctxt ((kind, name), facts) =
   352 fun print_results {interactive, pos, proof_state} ctxt ((kind, name), facts) =
   353   if kind = "" orelse no_print int ctxt then ()
   353   let val print = if proof_state then Output.state o Pretty.string_of else Pretty.writeln in
   354   else if name = "" then
   354     if kind = "" orelse no_print interactive ctxt then ()
   355     (Output.state o Pretty.string_of)
   355     else if name = "" then
   356       (Pretty.block (position_markup pos (Pretty.keyword1 kind) :: Pretty.brk 1 ::
   356       print
   357         pretty_facts ctxt facts))
   357         (Pretty.block (position_markup pos (Pretty.keyword1 kind) :: Pretty.brk 1 ::
   358   else
   358           pretty_facts ctxt facts))
   359     (Output.state o Pretty.string_of)
   359     else
   360       (case facts of
   360       print
   361         [fact] => Pretty.blk (1, [pretty_fact_name pos (kind, name), Pretty.fbrk,
   361         (case facts of
   362           Proof_Context.pretty_fact ctxt fact])
   362           [fact] => Pretty.blk (1, [pretty_fact_name pos (kind, name), Pretty.fbrk,
   363       | _ => Pretty.blk (1, [pretty_fact_name pos (kind, name), Pretty.fbrk,
   363             Proof_Context.pretty_fact ctxt fact])
   364           Pretty.blk (1, Pretty.str "(" :: pretty_facts ctxt facts @ [Pretty.str ")"])]));
   364         | _ => Pretty.blk (1, [pretty_fact_name pos (kind, name), Pretty.fbrk,
       
   365             Pretty.blk (1, Pretty.str "(" :: pretty_facts ctxt facts @ [Pretty.str ")"])]))
       
   366   end;
   365 
   367 
   366 fun print_theorem pos ctxt fact =
   368 fun print_theorem pos ctxt fact =
   367   print_results true pos ctxt ((Thm.theoremK, ""), [fact]);
   369   print_results {interactive = true, pos = pos, proof_state = false}
       
   370     ctxt ((Thm.theoremK, ""), [fact]);
   368 
   371 
   369 end;
   372 end;
   370 
   373 
   371 
   374 
   372 (* consts *)
   375 (* consts *)
   391 
   394 
   392 in
   395 in
   393 
   396 
   394 fun print_consts int pos ctxt pred cs =
   397 fun print_consts int pos ctxt pred cs =
   395   if null cs orelse no_print int ctxt then ()
   398   if null cs orelse no_print int ctxt then ()
   396   else Output.state (Pretty.string_of (pretty_consts pos ctxt pred cs));
   399   else Pretty.writeln (pretty_consts pos ctxt pred cs);
   397 
   400 
   398 end;
   401 end;
   399 
   402 
   400 
   403 
   401 (* position label *)
   404 (* position label *)