src/Pure/attribute.ML
changeset 6000 aa84c30c1f61
parent 5901 a8e1ca1b2ec6
equal deleted inserted replaced
5999:84fe61a08c17 6000:aa84c30c1f61
     8 signature BASIC_ATTRIBUTE =
     8 signature BASIC_ATTRIBUTE =
     9 sig
     9 sig
    10   type tag
    10   type tag
    11   type tthm
    11   type tthm
    12   type 'a attribute
    12   type 'a attribute
       
    13   val show_tags: bool ref
    13 end;
    14 end;
    14 
    15 
    15 signature ATTRIBUTE =
    16 signature ATTRIBUTE =
    16 sig
    17 sig
    17   include BASIC_ATTRIBUTE
    18   include BASIC_ATTRIBUTE
    68 fun applys (x_ths, atts) = foldl_map (Library.apply atts) x_ths;
    69 fun applys (x_ths, atts) = foldl_map (Library.apply atts) x_ths;
    69 
    70 
    70 
    71 
    71 (* display tagged theorems *)
    72 (* display tagged theorems *)
    72 
    73 
       
    74 val show_tags = ref false;
       
    75 
    73 fun pretty_tag (name, args) = Pretty.strs (name :: args);
    76 fun pretty_tag (name, args) = Pretty.strs (name :: args);
    74 val pretty_tags = Pretty.list "[" "]" o map pretty_tag;
    77 val pretty_tags = Pretty.list "[" "]" o map pretty_tag;
    75 
    78 
    76 fun pretty_tthm (thm, []) = Pretty.quote (Display.pretty_thm thm)
    79 fun pretty_tthm (thm, tags) =
    77   | pretty_tthm (thm, tags) = Pretty.block
    80   if null tags orelse not (! show_tags) then Pretty.quote (Display.pretty_thm thm)
    78       [Pretty.quote (Display.pretty_thm thm), Pretty.brk 1, pretty_tags tags];
    81   else Pretty.block [Pretty.quote (Display.pretty_thm thm), Pretty.brk 1, pretty_tags tags];
    79 
    82 
    80 fun pretty_tthms [th] = pretty_tthm th
    83 fun pretty_tthms [th] = pretty_tthm th
    81   | pretty_tthms ths = Pretty.block (Pretty.fbreaks (map pretty_tthm ths));
    84   | pretty_tthms ths = Pretty.block (Pretty.fbreaks (map pretty_tthm ths));
    82 
    85 
    83 val print_tthm = Pretty.writeln o pretty_tthm;
    86 val print_tthm = Pretty.writeln o pretty_tthm;