src/Pure/name.ML
author wenzelm
Thu, 22 Jul 2010 14:59:27 +0200
changeset 37906 4195727a1f6c
parent 34307 9074aa7d06e0
child 40627 becf5d5187cc
permissions -rw-r--r--
eliminated some unreferenced identifiers;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/name.ML
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     3
28965
1de908189869 cleaned up binding module and related code
haftmann
parents: 28941
diff changeset
     4
Names of basic logical entities (variables etc.).
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     5
*)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     6
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     7
signature NAME =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
     8
sig
24849
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
     9
  val uu: string
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    10
  val aT: string
30584
7e839627b9e7 Name.of_binding: proper full_name (with checks) before projecting base name;
wenzelm
parents: 29006
diff changeset
    11
  val of_binding: binding -> string
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    12
  val bound: int -> string
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    13
  val is_bound: string -> bool
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    14
  val internal: string -> string
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    15
  val dest_internal: string -> string
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    16
  val skolem: string -> string
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    17
  val dest_skolem: string -> string
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    18
  val clean_index: string * int -> string * int
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    19
  val clean: string -> string
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    20
  type context
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    21
  val context: context
20158
b71f4f4c6b1e export make_context, is_declared;
wenzelm
parents: 20121
diff changeset
    22
  val make_context: string list -> context
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    23
  val declare: string -> context -> context
20158
b71f4f4c6b1e export make_context, is_declared;
wenzelm
parents: 20121
diff changeset
    24
  val is_declared: context -> string -> bool
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    25
  val invents: context -> string -> int -> string list
20192
956cd30ef3be renamed Name.give_names to Name.names and moved Name.alphanum to Symbol.alphanum
haftmann
parents: 20174
diff changeset
    26
  val names: context -> string -> 'a list -> (string * 'a) list
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    27
  val invent_list: string list -> string -> int -> string list
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    28
  val variants: string list -> context -> string list * context
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    29
  val variant_list: string list -> string list -> string list
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    30
  val variant: string list -> string -> string
31035
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
    31
  val desymbolize: bool -> string -> string
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    32
end;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    33
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    34
structure Name: NAME =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    35
struct
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    36
24849
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    37
(** common defaults **)
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    38
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    39
val uu = "uu";
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    40
val aT = "'a";
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    41
193a10e6bf90 added uu, aT;
wenzelm
parents: 21565
diff changeset
    42
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    43
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    44
(** special variable names **)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    45
30584
7e839627b9e7 Name.of_binding: proper full_name (with checks) before projecting base name;
wenzelm
parents: 29006
diff changeset
    46
(* checked binding *)
7e839627b9e7 Name.of_binding: proper full_name (with checks) before projecting base name;
wenzelm
parents: 29006
diff changeset
    47
33095
bbd52d2f8696 renamed NameSpace to Name_Space -- also to emphasize its subtle change in semantics;
wenzelm
parents: 31035
diff changeset
    48
val of_binding = Long_Name.base_name o Name_Space.full_name Name_Space.default_naming;
30584
7e839627b9e7 Name.of_binding: proper full_name (with checks) before projecting base name;
wenzelm
parents: 29006
diff changeset
    49
7e839627b9e7 Name.of_binding: proper full_name (with checks) before projecting base name;
wenzelm
parents: 29006
diff changeset
    50
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    51
(* encoded bounds *)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    52
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    53
(*names for numbered variables --
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    54
  preserves order wrt. int_ord vs. string_ord, avoids allocating new strings*)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    55
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    56
val small_int = Vector.tabulate (1000, fn i =>
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    57
  let val leading = if i < 10 then "00" else if i < 100 then "0" else ""
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    58
  in ":" ^ leading ^ string_of_int i end);
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    59
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    60
fun bound n =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    61
  if n < 1000 then Vector.sub (small_int, n)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    62
  else ":" ^ bound (n div 1000) ^ Vector.sub (small_int, n mod 1000);
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    63
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    64
val is_bound = String.isPrefix ":";
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    65
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    66
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    67
(* internal names *)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    68
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    69
val internal = suffix "_";
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    70
val dest_internal = unsuffix "_";
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    71
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    72
val skolem = suffix "__";
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    73
val dest_skolem = unsuffix "__";
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    74
20099
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    75
fun clean_index (x, i) =
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    76
  (case try dest_internal x of
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    77
    NONE => (x, i)
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    78
  | SOME x' => clean_index (x', i + 1));
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    79
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    80
fun clean x = #1 (clean_index (x, 0));
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    81
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    82
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    83
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    84
(** generating fresh names **)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    85
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    86
(* context *)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    87
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    88
datatype context =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    89
  Context of string option Symtab.table;    (*declared names with latest renaming*)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    90
20099
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    91
fun declare x (Context tab) =
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    92
  Context (Symtab.default (clean x, NONE) tab);
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    93
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    94
fun declare_renaming (x, x') (Context tab) =
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
    95
  Context (Symtab.update (clean x, SOME (clean x')) tab);
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    96
20158
b71f4f4c6b1e export make_context, is_declared;
wenzelm
parents: 20121
diff changeset
    97
fun is_declared (Context tab) = Symtab.defined tab;
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    98
fun declared (Context tab) = Symtab.lookup tab;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
    99
20121
848fc1a1d355 do not export make_context;
wenzelm
parents: 20104
diff changeset
   100
val context = Context Symtab.empty |> fold declare ["", "'"];
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   101
fun make_context used = fold declare used context;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   102
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   103
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   104
(* invents *)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   105
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   106
fun invents ctxt =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   107
  let
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   108
    fun invs _ 0 = []
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   109
      | invs x n =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   110
          let val x' = Symbol.bump_string x in
20158
b71f4f4c6b1e export make_context, is_declared;
wenzelm
parents: 20121
diff changeset
   111
            if is_declared ctxt x then invs x' n
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   112
            else x :: invs x' (n - 1)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   113
          end;
20099
bc3f9cb33645 clean: no special treatment of empty name;
wenzelm
parents: 20089
diff changeset
   114
  in invs o clean end;
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   115
20198
wenzelm
parents: 20192
diff changeset
   116
fun names ctxt x xs = invents ctxt x (length xs) ~~ xs;
wenzelm
parents: 20192
diff changeset
   117
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   118
val invent_list = invents o make_context;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   119
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   120
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   121
(* variants *)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   122
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   123
(*makes a variant of a name distinct from already used names in a
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   124
  context; preserves a suffix of underscores "_"*)
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   125
val variants = fold_map (fn name => fn ctxt =>
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   126
  let
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   127
    fun vary x =
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   128
      (case declared ctxt x of
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   129
        NONE => x
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   130
      | SOME x' => vary (Symbol.bump_string (the_default x x')));
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   131
20121
848fc1a1d355 do not export make_context;
wenzelm
parents: 20104
diff changeset
   132
    val (x, n) = clean_index (name, 0);
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   133
    val (x', ctxt') =
20158
b71f4f4c6b1e export make_context, is_declared;
wenzelm
parents: 20121
diff changeset
   134
      if not (is_declared ctxt x) then (x, declare x ctxt)
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   135
      else
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   136
        let
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   137
          val x0 = Symbol.bump_init x;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   138
          val x' = vary x0;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   139
          val ctxt' = ctxt
21565
bd28361f4c5b simplified '?' operator;
wenzelm
parents: 20198
diff changeset
   140
            |> x0 <> x' ? declare_renaming (x0, x')
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   141
            |> declare x';
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   142
        in (x', ctxt') end;
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   143
  in (x' ^ replicate_string n "_", ctxt') end);
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   144
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   145
fun variant_list used names = #1 (make_context used |> variants names);
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   146
fun variant used = singleton (variant_list used);
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   147
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   148
31035
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   149
(* names conforming to typical requirements of identifiers in the world outside *)
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   150
31035
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   151
fun desymbolize upper "" = if upper then "X" else "x"
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   152
  | desymbolize upper s =
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   153
      let
31035
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   154
        val xs as (x :: _) = Symbol.explode s;
33547
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   155
        val ys =
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   156
          if Symbol.is_ascii_letter x orelse Symbol.is_symbolic x then xs
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   157
          else "x" :: xs;
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   158
        fun is_valid x =
34307
9074aa7d06e0 single quote is not a valid letter any more
haftmann
parents: 33547
diff changeset
   159
          Symbol.is_ascii_letter x orelse Symbol.is_ascii_digit x;
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   160
        fun sep [] = []
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   161
          | sep (xs as "_" :: _) = xs
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   162
          | sep xs = "_" :: xs;
31035
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   163
        fun desep ("_" :: xs) = xs
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   164
          | desep xs = xs;
33547
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   165
        fun desymb x xs =
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   166
          if is_valid x then x :: xs
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   167
          else
33547
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   168
            (case Symbol.decode x of
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   169
              Symbol.Sym name => "_" :: explode name @ sep xs
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   170
            | _ => sep xs);
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   171
        fun upper_lower cs =
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   172
          if upper then nth_map 0 Symbol.to_ascii_upper cs
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   173
          else
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   174
            (if forall Symbol.is_ascii_upper cs then map else nth_map 0)
edfc35dcfe31 desymbolize: use Symbol.decode directly;
wenzelm
parents: 33095
diff changeset
   175
              Symbol.to_ascii_lower cs;
31035
de0a20a030fd desymbolization with case selection
haftmann
parents: 31013
diff changeset
   176
      in fold_rev desymb ys [] |> desep |> upper_lower |> implode end;
31013
69a476d6fea6 Symbol.name_of and Name.desymbolize
haftmann
parents: 30584
diff changeset
   177
20089
d757ebadb0a2 Names of basic logical entities (variables etc.).
wenzelm
parents:
diff changeset
   178
end;