src/Pure/display.ML
author wenzelm
Mon, 09 Nov 1998 15:42:08 +0100
changeset 5840 e2d2b896c717
parent 5245 a6167c446b0b
child 5902 c39b23d752b6
permissions -rw-r--r--
Object logic specific operations.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     1
(*  Title:      Pure/display.ML
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     2
    ID:         $Id$
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     5
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     6
Printing of theories, theorems, etc.
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     7
*)
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     8
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
     9
signature DISPLAY =
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    10
sig
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    11
  val show_hyps		: bool ref
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    12
  val pretty_thm	: thm -> Pretty.T
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    13
  val string_of_thm	: thm -> string
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    14
  val pprint_thm	: thm -> pprint_args -> unit
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    15
  val print_thm		: thm -> unit
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    16
  val prth		: thm -> thm
4270
957c887b89b5 changed Sequence interface (now Seq, in seq.ML);
wenzelm
parents: 4256
diff changeset
    17
  val prthq		: thm Seq.seq -> thm Seq.seq
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    18
  val prths		: thm list -> thm list
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    19
  val pretty_ctyp	: ctyp -> Pretty.T
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    20
  val pprint_ctyp	: ctyp -> pprint_args -> unit
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    21
  val string_of_ctyp	: ctyp -> string
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    22
  val print_ctyp	: ctyp -> unit
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    23
  val pretty_cterm	: cterm -> Pretty.T
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    24
  val pprint_cterm	: cterm -> pprint_args -> unit
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    25
  val string_of_cterm	: cterm -> string
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    26
  val print_cterm	: cterm -> unit
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    27
  val pretty_theory	: theory -> Pretty.T
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    28
  val pprint_theory	: theory -> pprint_args -> unit
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    29
  val print_syntax	: theory -> unit
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    30
  val print_theory	: theory -> unit
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    31
  val pretty_name_space : string * NameSpace.T -> Pretty.T
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    32
  val show_consts	: bool ref
5245
a6167c446b0b moved print_goals to locale.ML;
wenzelm
parents: 4993
diff changeset
    33
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    34
end;
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    35
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
    36
structure Display: DISPLAY =
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    37
struct
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    38
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    39
(*If false, hypotheses are printed as dots*)
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    40
val show_hyps = ref true;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    41
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    42
fun pretty_thm th =
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    43
  let
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    44
    val {sign, hyps, prop, ...} = rep_thm th;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    45
    val xshyps = extra_shyps th;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    46
    val hlen = length xshyps + length hyps;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    47
    val hsymbs =
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    48
      if hlen = 0 then []
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    49
      else if ! show_hyps then
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    50
        [Pretty.brk 2, Pretty.list "[" "]"
3785
0830d11b8916 now uses new Sign.pretty_sort;
wenzelm
parents: 3669
diff changeset
    51
          (map (Sign.pretty_term sign) hyps @
0830d11b8916 now uses new Sign.pretty_sort;
wenzelm
parents: 3669
diff changeset
    52
           map (Sign.pretty_sort sign) xshyps)]
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    53
      else
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    54
        [Pretty.brk 2, Pretty.str ("[" ^ implode (replicate hlen ".") ^ "]")];
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    55
  in
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    56
    Pretty.block (Sign.pretty_term sign prop :: hsymbs)
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    57
  end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    58
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    59
val string_of_thm = Pretty.string_of o pretty_thm;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    60
val pprint_thm = Pretty.pprint o Pretty.quote o pretty_thm;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    61
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    62
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    63
(** Top-level commands for printing theorems **)
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    64
val print_thm = writeln o string_of_thm;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    65
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    66
fun prth th = (print_thm th; th);
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    67
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    68
(*Print and return a sequence of theorems, separated by blank lines. *)
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    69
fun prthq thseq =
4270
957c887b89b5 changed Sequence interface (now Seq, in seq.ML);
wenzelm
parents: 4256
diff changeset
    70
  (Seq.print (fn _ => print_thm) 100000 thseq; thseq);
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    71
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    72
(*Print and return a list of theorems, separated by blank lines. *)
4210
abce78c8a931 tuned prths;
wenzelm
parents: 4126
diff changeset
    73
fun prths ths = (seq (fn th => (print_thm th; writeln "")) ths; ths);
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    74
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    75
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    76
(* other printing commands *)
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    77
4126
c41846a38e20 added pretty_ctyp;
wenzelm
parents: 3990
diff changeset
    78
fun pretty_ctyp cT =
c41846a38e20 added pretty_ctyp;
wenzelm
parents: 3990
diff changeset
    79
  let val {sign, T} = rep_ctyp cT in Sign.pretty_typ sign T end;
c41846a38e20 added pretty_ctyp;
wenzelm
parents: 3990
diff changeset
    80
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    81
fun pprint_ctyp cT =
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    82
  let val {sign, T} = rep_ctyp cT in Sign.pprint_typ sign T end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    83
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    84
fun string_of_ctyp cT =
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    85
  let val {sign, T} = rep_ctyp cT in Sign.string_of_typ sign T end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    86
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    87
val print_ctyp = writeln o string_of_ctyp;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    88
3547
977d58464d7f added pretty_cterm;
wenzelm
parents: 3531
diff changeset
    89
fun pretty_cterm ct =
977d58464d7f added pretty_cterm;
wenzelm
parents: 3531
diff changeset
    90
  let val {sign, t, ...} = rep_cterm ct in Sign.pretty_term sign t end;
977d58464d7f added pretty_cterm;
wenzelm
parents: 3531
diff changeset
    91
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    92
fun pprint_cterm ct =
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    93
  let val {sign, t, ...} = rep_cterm ct in Sign.pprint_term sign t end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    94
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    95
fun string_of_cterm ct =
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    96
  let val {sign, t, ...} = rep_cterm ct in Sign.string_of_term sign t end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    97
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    98
val print_cterm = writeln o string_of_cterm;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
    99
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   100
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   101
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   102
(** print theory **)
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   103
4950
226f2cde9f4d tuned signature;
wenzelm
parents: 4782
diff changeset
   104
val pretty_theory = Sign.pretty_sg o sign_of;
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   105
val pprint_theory = Sign.pprint_sg o sign_of;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   106
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   107
val print_syntax = Syntax.print_syntax o syn_of;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   108
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   109
4498
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   110
(* pretty_name_space  *)
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   111
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   112
fun pretty_name_space (kind, space) =
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   113
  let
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   114
    fun prt_entry (name, accs) = Pretty.block
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   115
      (Pretty.str (quote name ^ " =") :: Pretty.brk 1 ::
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   116
        Pretty.commas (map (Pretty.str o quote) accs));
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   117
  in
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   118
    Pretty.fbreaks (Pretty.str (kind ^ ":") :: map prt_entry (NameSpace.dest space))
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   119
    |> Pretty.block
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   120
  end;
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   121
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   122
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   123
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   124
(* print signature *)
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   125
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   126
fun print_sign sg =
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   127
  let
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   128
    fun prt_cls c = Sign.pretty_sort sg [c];
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   129
    fun prt_sort S = Sign.pretty_sort sg S;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   130
    fun prt_arity t (c, Ss) = Sign.pretty_arity sg (t, Ss, [c]);
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   131
    fun prt_typ ty = Pretty.quote (Sign.pretty_typ sg ty);
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   132
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   133
    val ext_class = Sign.cond_extern sg Sign.classK;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   134
    val ext_tycon = Sign.cond_extern sg Sign.typeK;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   135
    val ext_const = Sign.cond_extern sg Sign.constK;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   136
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   137
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   138
    fun pretty_classes cs = Pretty.block
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   139
      (Pretty.breaks (Pretty.str "classes:" :: map prt_cls cs));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   140
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   141
    fun pretty_classrel (c, cs) = Pretty.block
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   142
      (prt_cls c :: Pretty.str " <" :: Pretty.brk 1 ::
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   143
        Pretty.commas (map prt_cls cs));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   144
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   145
    fun pretty_default S = Pretty.block
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   146
      [Pretty.str "default:", Pretty.brk 1, prt_sort S];
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   147
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   148
    fun pretty_ty (t, n) = Pretty.block
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   149
      [Pretty.str (ext_tycon t), Pretty.str (" " ^ string_of_int n)];
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   150
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   151
    fun pretty_abbr (t, (vs, rhs)) = Pretty.block
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   152
      [prt_typ (Type (t, map (fn v => TVar ((v, 0), [])) vs)),
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   153
        Pretty.str " =", Pretty.brk 1, prt_typ rhs];
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   154
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   155
    fun pretty_arities (t, ars) = map (prt_arity t) ars;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   156
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   157
    fun pretty_const (c, ty) = Pretty.block
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   158
      [Pretty.str c, Pretty.str " ::", Pretty.brk 1, prt_typ ty];
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   159
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   160
    val {self = _, tsig, const_tab, syn = _, path, spaces, data} = Sign.rep_sg sg;
4440
9ed4098074bc adapted to new sort function;
wenzelm
parents: 4270
diff changeset
   161
    val spaces' = sort_wrt fst spaces;
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   162
    val {classes, classrel, default, tycons, abbrs, arities} =
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   163
      Type.rep_tsig tsig;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   164
    val consts = sort_wrt fst (map (apfst ext_const) (Symtab.dest const_tab));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   165
  in
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   166
    Pretty.writeln (Pretty.strs ("stamps:" :: Sign.stamp_names_of sg));
4256
e768c42069bb removed data.ML (made part of sign.ML);
wenzelm
parents: 4250
diff changeset
   167
    Pretty.writeln (Pretty.strs ("data:" :: Sign.data_kinds data));
4782
9c0b31da51c6 tuned comments;
wenzelm
parents: 4498
diff changeset
   168
    Pretty.writeln (Pretty.strs ["name prefix:", NameSpace.pack path]);
4498
a088ec3e4f5e pretty_name_space;
wenzelm
parents: 4440
diff changeset
   169
    Pretty.writeln (Pretty.big_list "name spaces:" (map pretty_name_space spaces'));
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   170
    Pretty.writeln (pretty_classes classes);
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   171
    Pretty.writeln (Pretty.big_list "class relation:" (map pretty_classrel classrel));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   172
    Pretty.writeln (pretty_default default);
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   173
    Pretty.writeln (Pretty.big_list "type constructors:" (map pretty_ty tycons));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   174
    Pretty.writeln (Pretty.big_list "type abbreviations:" (map pretty_abbr abbrs));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   175
    Pretty.writeln (Pretty.big_list "type arities:" (flat (map pretty_arities arities)));
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   176
    Pretty.writeln (Pretty.big_list "consts:" (map pretty_const consts))
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   177
  end;
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   178
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   179
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   180
(* print axioms, oracles, theorems *)
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   181
3811
ec27ddb5104c print_theory: added oracles;
wenzelm
parents: 3785
diff changeset
   182
fun print_thy thy =
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   183
  let
3990
wenzelm
parents: 3936
diff changeset
   184
    val {sign, axioms, oracles, ...} = rep_theory thy;
wenzelm
parents: 3936
diff changeset
   185
    val axioms = Symtab.dest axioms;
3811
ec27ddb5104c print_theory: added oracles;
wenzelm
parents: 3785
diff changeset
   186
    val oras = map fst (Symtab.dest oracles);
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   187
3936
1954255c29ef tuned output;
wenzelm
parents: 3879
diff changeset
   188
    fun prt_axm (a, t) = Pretty.block
3990
wenzelm
parents: 3936
diff changeset
   189
      [Pretty.str (Sign.cond_extern sign Theory.axiomK a ^ ":"), Pretty.brk 1,
3936
1954255c29ef tuned output;
wenzelm
parents: 3879
diff changeset
   190
        Pretty.quote (Sign.pretty_term sign t)];
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   191
  in
3990
wenzelm
parents: 3936
diff changeset
   192
    Pretty.writeln (Pretty.big_list "axioms:" (map prt_axm axioms));
4993
2055bfbb186c print_data moved to theory.ML;
wenzelm
parents: 4950
diff changeset
   193
    Pretty.writeln (Pretty.strs ("oracles:" :: oras))
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   194
  end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   195
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   196
fun print_theory thy = (print_sign (sign_of thy); print_thy thy);
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   197
4250
3806a00677ff moved Sign.print_sg to display.ML;
wenzelm
parents: 4210
diff changeset
   198
(*also show consts in case of showing types?*)
3851
fe9932a7cd46 print_goals: optional output of const types (set show_consts);
wenzelm
parents: 3811
diff changeset
   199
val show_consts = ref false;
fe9932a7cd46 print_goals: optional output of const types (set show_consts);
wenzelm
parents: 3811
diff changeset
   200
1591
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   201
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   202
end;
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   203
7fa0265dcd13 New module for display/printing operations, taken from drule.ML
paulson
parents:
diff changeset
   204
open Display;