src/Pure/type_infer.ML
author wenzelm
Wed Apr 16 18:15:32 1997 +0200 (1997-04-16)
changeset 2957 d35fca99b3be
child 2979 db6941221197
permissions -rw-r--r--
Type inference (isolated from type.ML, completely reimplemented).
wenzelm@2957
     1
(*  Title:      Pure/type_infer.ML
wenzelm@2957
     2
    ID:         $Id$
wenzelm@2957
     3
    Author:     Stefan Berghofer and Markus Wenzel, TU Muenchen
wenzelm@2957
     4
wenzelm@2957
     5
Type inference.
wenzelm@2957
     6
*)
wenzelm@2957
     7
wenzelm@2957
     8
signature TYPE_INFER =
wenzelm@2957
     9
sig
wenzelm@2957
    10
  val infer_types: (string -> typ option) -> Sorts.classrel -> Sorts.arities
wenzelm@2957
    11
    -> string list -> bool -> (indexname -> bool) -> term list -> typ list
wenzelm@2957
    12
    -> term list * typ list * (indexname * typ) list
wenzelm@2957
    13
end;
wenzelm@2957
    14
wenzelm@2957
    15
structure TypeInfer: TYPE_INFER =
wenzelm@2957
    16
struct
wenzelm@2957
    17
wenzelm@2957
    18
wenzelm@2957
    19
(** generic utils **)
wenzelm@2957
    20
wenzelm@2957
    21
fun seq2 _ [] [] = ()
wenzelm@2957
    22
  | seq2 f (x :: xs) (y :: ys) = (f x y; seq2 f xs ys)
wenzelm@2957
    23
  | seq2 _ _ _ = raise LIST "seq2";
wenzelm@2957
    24
wenzelm@2957
    25
fun scan _ (xs, []) = (xs, [])
wenzelm@2957
    26
  | scan f (xs, y :: ys) =
wenzelm@2957
    27
      let
wenzelm@2957
    28
        val (xs', y') = f (xs, y);
wenzelm@2957
    29
        val (xs'', ys') = scan f (xs', ys);
wenzelm@2957
    30
      in (xs'', y' :: ys') end;
wenzelm@2957
    31
wenzelm@2957
    32
wenzelm@2957
    33
wenzelm@2957
    34
(** term encodings **)
wenzelm@2957
    35
wenzelm@2957
    36
(*
wenzelm@2957
    37
  Flavours of term encodings:
wenzelm@2957
    38
wenzelm@2957
    39
    parse trees (type term):
wenzelm@2957
    40
      A very complicated structure produced by the syntax module's
wenzelm@2957
    41
      read functions.  Encodes types and sorts as terms; may contain
wenzelm@2957
    42
      explicit constraints and partial typing information (where
wenzelm@2957
    43
      dummyT serves as wildcard).
wenzelm@2957
    44
wenzelm@2957
    45
      Parse trees are INTERNAL! Users should never encounter them,
wenzelm@2957
    46
      except in parse / print translation functions.
wenzelm@2957
    47
wenzelm@2957
    48
    raw terms (type term):
wenzelm@2957
    49
      Provide the user interface to type inferences.  They may contain
wenzelm@2957
    50
      partial type information (dummyT is wildcard) or explicit type
wenzelm@2957
    51
      constraints (introduced via constrain: term -> typ -> term).
wenzelm@2957
    52
wenzelm@2957
    53
      The type inference function also lets users specify a certain
wenzelm@2957
    54
      subset of TVars to be treated as non-rigid inference parameters.
wenzelm@2957
    55
wenzelm@2957
    56
    preterms (type preterm):
wenzelm@2957
    57
      The internal representation for type inference.
wenzelm@2957
    58
wenzelm@2957
    59
    well-typed term (type term):
wenzelm@2957
    60
      Fully typed lambda terms to be accepted by appropriate
wenzelm@2957
    61
      certification functions.
wenzelm@2957
    62
*)
wenzelm@2957
    63
wenzelm@2957
    64
wenzelm@2957
    65
wenzelm@2957
    66
(** pretyps and preterms **)
wenzelm@2957
    67
wenzelm@2957
    68
(*links to parameters may get instantiated, anything else is rigid*)
wenzelm@2957
    69
datatype pretyp =
wenzelm@2957
    70
  PType of string * pretyp list |
wenzelm@2957
    71
  PTFree of string * sort |
wenzelm@2957
    72
  PTVar of indexname * sort |
wenzelm@2957
    73
  Param of sort |
wenzelm@2957
    74
  Link of pretyp ref;
wenzelm@2957
    75
wenzelm@2957
    76
datatype preterm =
wenzelm@2957
    77
  PConst of string * pretyp |
wenzelm@2957
    78
  PFree of string * pretyp |
wenzelm@2957
    79
  PVar of indexname * pretyp |
wenzelm@2957
    80
  PBound of int |
wenzelm@2957
    81
  PAbs of string * pretyp * preterm |
wenzelm@2957
    82
  PAppl of preterm * preterm |
wenzelm@2957
    83
  Constraint of preterm * pretyp;
wenzelm@2957
    84
wenzelm@2957
    85
wenzelm@2957
    86
(* utils *)
wenzelm@2957
    87
wenzelm@2957
    88
val mk_param = Link o ref o Param;
wenzelm@2957
    89
wenzelm@2957
    90
fun deref (T as Link (ref (Param _))) = T
wenzelm@2957
    91
  | deref (Link (ref T)) = deref T
wenzelm@2957
    92
  | deref T = T;
wenzelm@2957
    93
wenzelm@2957
    94
fun foldl_pretyps f (x, PConst (_, T)) = f (x, T)
wenzelm@2957
    95
  | foldl_pretyps f (x, PFree (_, T)) = f (x, T)
wenzelm@2957
    96
  | foldl_pretyps f (x, PVar (_, T)) = f (x, T)
wenzelm@2957
    97
  | foldl_pretyps _ (x, PBound _) = x
wenzelm@2957
    98
  | foldl_pretyps f (x, PAbs (_, T, t)) = foldl_pretyps f (f (x, T), t)
wenzelm@2957
    99
  | foldl_pretyps f (x, PAppl (t, u)) = foldl_pretyps f (foldl_pretyps f (x, t), u)
wenzelm@2957
   100
  | foldl_pretyps f (x, Constraint (t, T)) = f (foldl_pretyps f (x, t), T);
wenzelm@2957
   101
wenzelm@2957
   102
wenzelm@2957
   103
wenzelm@2957
   104
(** raw typs/terms to pretyps/preterms **)
wenzelm@2957
   105
wenzelm@2957
   106
(* pretyp(s)_of *)
wenzelm@2957
   107
wenzelm@2957
   108
fun pretyp_of is_param (params, typ) =
wenzelm@2957
   109
  let
wenzelm@2957
   110
    fun add_parms (ps, TVar (xi as (x, _), S)) =
wenzelm@2957
   111
          if is_param xi andalso is_none (assoc (ps, xi))
wenzelm@2957
   112
          then (xi, mk_param S) :: ps else ps
wenzelm@2957
   113
      | add_parms (ps, TFree _) = ps
wenzelm@2957
   114
      | add_parms (ps, Type (_, Ts)) = foldl add_parms (ps, Ts);
wenzelm@2957
   115
wenzelm@2957
   116
    val params' = add_parms (params, typ);
wenzelm@2957
   117
wenzelm@2957
   118
    fun pre_of (TVar (v as (xi, _))) =
wenzelm@2957
   119
          (case assoc (params', xi) of
wenzelm@2957
   120
            None => PTVar v
wenzelm@2957
   121
          | Some p => p)
wenzelm@2957
   122
      | pre_of (TFree v) = PTFree v
wenzelm@2957
   123
      | pre_of (T as Type (a, Ts)) =
wenzelm@2957
   124
          if T = dummyT then mk_param []
wenzelm@2957
   125
          else PType (a, map pre_of Ts);
wenzelm@2957
   126
  in (params', pre_of typ) end;
wenzelm@2957
   127
wenzelm@2957
   128
fun pretyps_of is_param = scan (pretyp_of is_param);
wenzelm@2957
   129
wenzelm@2957
   130
wenzelm@2957
   131
(* preterm(s)_of *)
wenzelm@2957
   132
wenzelm@2957
   133
fun preterm_of const_type is_param ((vparams, params), tm) =
wenzelm@2957
   134
  let
wenzelm@2957
   135
    fun add_vparm (ps, xi) =
wenzelm@2957
   136
      if is_none (assoc (ps, xi)) then
wenzelm@2957
   137
        (xi, mk_param []) :: ps
wenzelm@2957
   138
      else ps;
wenzelm@2957
   139
wenzelm@2957
   140
    fun add_vparms (ps, Var (xi, _)) = add_vparm (ps, xi)
wenzelm@2957
   141
      | add_vparms (ps, Free (x, _)) = add_vparm (ps, (x, ~1))
wenzelm@2957
   142
      | add_vparms (ps, Abs (_, _, t)) = add_vparms (ps, t)
wenzelm@2957
   143
      | add_vparms (ps, t $ u) = add_vparms (add_vparms (ps, t), u)
wenzelm@2957
   144
      | add_vparms (ps, _) = ps;
wenzelm@2957
   145
wenzelm@2957
   146
    val vparams' = add_vparms (vparams, tm);
wenzelm@2957
   147
    fun var_param xi = the (assoc (vparams', xi));
wenzelm@2957
   148
wenzelm@2957
   149
wenzelm@2957
   150
    val preT_of = pretyp_of is_param;
wenzelm@2957
   151
wenzelm@2957
   152
    fun constrain (ps, t) T =
wenzelm@2957
   153
      if T = dummyT then (ps, t)
wenzelm@2957
   154
      else
wenzelm@2957
   155
        let val (ps', T') = preT_of (ps, T) in
wenzelm@2957
   156
          (ps', Constraint (t, T'))
wenzelm@2957
   157
        end;
wenzelm@2957
   158
wenzelm@2957
   159
    fun pre_of (ps, Const (c, T)) =
wenzelm@2957
   160
          (case const_type c of
wenzelm@2957
   161
            Some U => constrain (ps, PConst (c, snd (pretyp_of (K true) ([], U)))) T
wenzelm@2957
   162
          | None => raise_type ("No such constant: " ^ quote c) [] [])
wenzelm@2957
   163
      | pre_of (ps, Free (x, T)) = constrain (ps, PFree (x, var_param (x, ~1))) T
wenzelm@2957
   164
      | pre_of (ps, Var (xi, T)) = constrain (ps, PVar (xi, var_param xi)) T
wenzelm@2957
   165
      | pre_of (ps, Const ("_type_constraint_", T) $ t) = constrain (pre_of (ps, t)) T
wenzelm@2957
   166
      | pre_of (ps, Bound i) = (ps, PBound i)
wenzelm@2957
   167
      | pre_of (ps, Abs (x, T, t)) =
wenzelm@2957
   168
          let
wenzelm@2957
   169
            val (ps', T') = preT_of (ps, T);
wenzelm@2957
   170
            val (ps'', t') = pre_of (ps', t);
wenzelm@2957
   171
          in (ps'', PAbs (x, T', t')) end
wenzelm@2957
   172
      | pre_of (ps, t $ u) =
wenzelm@2957
   173
          let
wenzelm@2957
   174
            val (ps', t') = pre_of (ps, t);
wenzelm@2957
   175
            val (ps'', u') = pre_of (ps', u);
wenzelm@2957
   176
          in (ps'', PAppl (t', u')) end;
wenzelm@2957
   177
wenzelm@2957
   178
wenzelm@2957
   179
    val (params', tm') = pre_of (params, tm);
wenzelm@2957
   180
  in
wenzelm@2957
   181
    ((vparams', params'), tm')
wenzelm@2957
   182
  end;
wenzelm@2957
   183
wenzelm@2957
   184
fun preterms_of const_type is_param = scan (preterm_of const_type is_param);
wenzelm@2957
   185
wenzelm@2957
   186
wenzelm@2957
   187
wenzelm@2957
   188
(** pretyps/terms to typs/terms **)
wenzelm@2957
   189
wenzelm@2957
   190
(* add_parms *)
wenzelm@2957
   191
wenzelm@2957
   192
fun add_parmsT (rs, PType (_, Ts)) = foldl add_parmsT (rs, Ts)
wenzelm@2957
   193
  | add_parmsT (rs, Link (r as ref (Param _))) = r ins rs
wenzelm@2957
   194
  | add_parmsT (rs, Link (ref T)) = add_parmsT (rs, T)
wenzelm@2957
   195
  | add_parmsT (rs, _) = rs;
wenzelm@2957
   196
wenzelm@2957
   197
val add_parms = foldl_pretyps add_parmsT;
wenzelm@2957
   198
wenzelm@2957
   199
wenzelm@2957
   200
(* add_names *)
wenzelm@2957
   201
wenzelm@2957
   202
fun add_namesT (xs, PType (_, Ts)) = foldl add_namesT (xs, Ts)
wenzelm@2957
   203
  | add_namesT (xs, PTFree (x, _)) = x ins xs
wenzelm@2957
   204
  | add_namesT (xs, PTVar ((x, _), _)) = x ins xs
wenzelm@2957
   205
  | add_namesT (xs, Link (ref T)) = add_namesT (xs, T)
wenzelm@2957
   206
  | add_namesT (xs, Param _) = xs;
wenzelm@2957
   207
wenzelm@2957
   208
val add_names = foldl_pretyps add_namesT;
wenzelm@2957
   209
wenzelm@2957
   210
wenzelm@2957
   211
(* simple_typ/term_of *)
wenzelm@2957
   212
wenzelm@2957
   213
(*deref links, fail on params*)
wenzelm@2957
   214
fun simple_typ_of (PType (a, Ts)) = Type (a, map simple_typ_of Ts)
wenzelm@2957
   215
  | simple_typ_of (PTFree v) = TFree v
wenzelm@2957
   216
  | simple_typ_of (PTVar v) = TVar v
wenzelm@2957
   217
  | simple_typ_of (Link (ref T)) = simple_typ_of T
wenzelm@2957
   218
  | simple_typ_of (Param _) = sys_error "simple_typ_of: illegal Param";
wenzelm@2957
   219
wenzelm@2957
   220
(*convert types, drop constraints*)
wenzelm@2957
   221
fun simple_term_of (PConst (c, T)) = Const (c, simple_typ_of T)
wenzelm@2957
   222
  | simple_term_of (PFree (x, T)) = Free (x, simple_typ_of T)
wenzelm@2957
   223
  | simple_term_of (PVar (xi, T)) = Var (xi, simple_typ_of T)
wenzelm@2957
   224
  | simple_term_of (PBound i) = Bound i
wenzelm@2957
   225
  | simple_term_of (PAbs (x, T, t)) = Abs (x, simple_typ_of T, simple_term_of t)
wenzelm@2957
   226
  | simple_term_of (PAppl (t, u)) = simple_term_of t $ simple_term_of u
wenzelm@2957
   227
  | simple_term_of (Constraint (t, _)) = simple_term_of t;
wenzelm@2957
   228
wenzelm@2957
   229
wenzelm@2957
   230
(* typs_terms_of *)                             (*DESTRUCTIVE*)
wenzelm@2957
   231
wenzelm@2957
   232
fun typs_terms_of used mk_var prfx (Ts, ts) =
wenzelm@2957
   233
  let
wenzelm@2957
   234
    fun elim (r as ref (Param S)) x = r := mk_var (x, S)
wenzelm@2957
   235
      | elim _ _ = ();
wenzelm@2957
   236
wenzelm@2957
   237
    val used' = foldl add_names (foldl add_namesT (used, Ts), ts);
wenzelm@2957
   238
    val parms = rev (foldl add_parms (foldl add_parmsT ([], Ts), ts));
wenzelm@2957
   239
    val pre_names = replicate (length parms) (prfx ^ "'");
wenzelm@2957
   240
    val names = variantlist (pre_names, prfx ^ "'" :: used');
wenzelm@2957
   241
  in
wenzelm@2957
   242
    seq2 elim parms names;
wenzelm@2957
   243
    (map simple_typ_of Ts, map simple_term_of ts)
wenzelm@2957
   244
  end;
wenzelm@2957
   245
wenzelm@2957
   246
wenzelm@2957
   247
wenzelm@2957
   248
(** order-sorted unification of types **)       (*DESTRUCTIVE*)
wenzelm@2957
   249
wenzelm@2957
   250
exception NO_UNIFIER of string;
wenzelm@2957
   251
wenzelm@2957
   252
wenzelm@2957
   253
fun unify classrel arities =
wenzelm@2957
   254
  let
wenzelm@2957
   255
wenzelm@2957
   256
    (* adjust sorts of parameters *)
wenzelm@2957
   257
wenzelm@2957
   258
    fun not_in_sort x S' S =
wenzelm@2957
   259
      "Type variable " ^ x ^ "::" ^ Sorts.str_of_sort S' ^ " not in sort " ^
wenzelm@2957
   260
        Sorts.str_of_sort S;
wenzelm@2957
   261
wenzelm@2957
   262
    fun meet _ [] = ()
wenzelm@2957
   263
      | meet (Link (r as (ref (Param S')))) S =
wenzelm@2957
   264
          if Sorts.sort_le classrel (S', S) then ()
wenzelm@2957
   265
          else r := mk_param (Sorts.inter_sort classrel (S', S))
wenzelm@2957
   266
      | meet (Link (ref T)) S = meet T S
wenzelm@2957
   267
      | meet (PType (a, Ts)) S =
wenzelm@2957
   268
          seq2 meet Ts (Sorts.mg_domain classrel arities a S
wenzelm@2957
   269
            handle TYPE (msg, _, _) => raise NO_UNIFIER msg)
wenzelm@2957
   270
      | meet (PTFree (x, S')) S =
wenzelm@2957
   271
          if Sorts.sort_le classrel (S', S) then ()
wenzelm@2957
   272
          else raise NO_UNIFIER (not_in_sort x S' S)
wenzelm@2957
   273
      | meet (PTVar (xi, S')) S =
wenzelm@2957
   274
          if Sorts.sort_le classrel (S', S) then ()
wenzelm@2957
   275
          else raise NO_UNIFIER (not_in_sort (Syntax.string_of_vname xi) S' S)
wenzelm@2957
   276
      | meet (Param _) _ = sys_error "meet";
wenzelm@2957
   277
wenzelm@2957
   278
wenzelm@2957
   279
    (* occurs check and assigment *)
wenzelm@2957
   280
wenzelm@2957
   281
    fun occurs_check r (Link (r' as ref T)) =
wenzelm@2957
   282
          if r = r' then raise NO_UNIFIER "Occurs check!"
wenzelm@2957
   283
          else occurs_check r T
wenzelm@2957
   284
      | occurs_check r (PType (_, Ts)) = seq (occurs_check r) Ts
wenzelm@2957
   285
      | occurs_check _ _ = ();
wenzelm@2957
   286
wenzelm@2957
   287
    fun assign r T S =
wenzelm@2957
   288
      (case deref T of
wenzelm@2957
   289
        T' as Link (r' as ref (Param _)) =>
wenzelm@2957
   290
          if r = r' then () else (r := T'; meet T' S)
wenzelm@2957
   291
      | T' => (occurs_check r T'; r := T'; meet T' S));
wenzelm@2957
   292
wenzelm@2957
   293
wenzelm@2957
   294
    (* unification *)
wenzelm@2957
   295
wenzelm@2957
   296
    fun unif (Link (r as ref (Param S))) T = assign r T S
wenzelm@2957
   297
      | unif T (Link (r as ref (Param S))) = assign r T S
wenzelm@2957
   298
      | unif (Link (ref T)) U = unif T U
wenzelm@2957
   299
      | unif T (Link (ref U)) = unif T U
wenzelm@2957
   300
      | unif (PType (a, Ts)) (PType (b, Us)) =
wenzelm@2957
   301
          if a <> b then raise NO_UNIFIER ("Clash of " ^ a ^ ", " ^ b ^ "!")
wenzelm@2957
   302
          else seq2 unif Ts Us
wenzelm@2957
   303
      | unif T U = if T = U then () else raise NO_UNIFIER "Unification failed!";
wenzelm@2957
   304
wenzelm@2957
   305
  in unif end;
wenzelm@2957
   306
wenzelm@2957
   307
wenzelm@2957
   308
wenzelm@2957
   309
(** type inference **)
wenzelm@2957
   310
wenzelm@2957
   311
(* infer *)                                     (*DESTRUCTIVE*)
wenzelm@2957
   312
wenzelm@2957
   313
fun infer classrel arities =
wenzelm@2957
   314
  let
wenzelm@2957
   315
    val unif = unify classrel arities;
wenzelm@2957
   316
wenzelm@2957
   317
    fun err msg1 msg2 bs ts Ts =
wenzelm@2957
   318
      let
wenzelm@2957
   319
        val (Ts_bTs', ts') = typs_terms_of [] PTFree "??" (Ts @ map snd bs, ts);
wenzelm@2957
   320
        val len = length Ts;
wenzelm@2957
   321
        val Ts' = take (len, Ts_bTs');
wenzelm@2957
   322
        val xs = map Free (map fst bs ~~ drop (len, Ts_bTs'));
wenzelm@2957
   323
        val ts'' = map (fn t => subst_bounds (xs, t)) ts';
wenzelm@2957
   324
      in
wenzelm@2957
   325
        raise_type (msg1 ^ " " ^ msg2) Ts' ts''
wenzelm@2957
   326
      end;
wenzelm@2957
   327
wenzelm@2957
   328
    fun inf _ (PConst (_, T)) = T
wenzelm@2957
   329
      | inf _ (PFree (_, T)) = T
wenzelm@2957
   330
      | inf _ (PVar (_, T)) = T
wenzelm@2957
   331
      | inf bs (PBound i) = snd (nth_elem (i, bs)
wenzelm@2957
   332
          handle LIST _ => raise_type "Loose bound variable" [] [Bound i])
wenzelm@2957
   333
      | inf bs (PAbs (x, T, t)) = PType ("fun", [T, inf ((x, T) :: bs) t])
wenzelm@2957
   334
      | inf bs (PAppl (t, u)) =
wenzelm@2957
   335
          let
wenzelm@2957
   336
            val T = inf bs t;
wenzelm@2957
   337
            val U = inf bs u;
wenzelm@2957
   338
            val V = mk_param [];
wenzelm@2957
   339
            val U_to_V = PType ("fun", [U, V]);
wenzelm@2957
   340
            val _ = unif U_to_V T handle NO_UNIFIER msg =>
wenzelm@2957
   341
              err msg "Bad function application." bs [PAppl (t, u)] [U_to_V, U];
wenzelm@2957
   342
          in V end
wenzelm@2957
   343
      | inf bs (Constraint (t, U)) =
wenzelm@2957
   344
          let val T = inf bs t in
wenzelm@2957
   345
            unif T U handle NO_UNIFIER msg =>
wenzelm@2957
   346
              err msg "Cannot meet type constraint." bs [t] [T, U];
wenzelm@2957
   347
            T
wenzelm@2957
   348
          end;
wenzelm@2957
   349
wenzelm@2957
   350
  in inf [] end;
wenzelm@2957
   351
wenzelm@2957
   352
wenzelm@2957
   353
(* infer_types *)
wenzelm@2957
   354
wenzelm@2957
   355
fun infer_types const_type classrel arities used freeze is_param ts Ts =
wenzelm@2957
   356
  let
wenzelm@2957
   357
    (*convert to preterms/typs*)
wenzelm@2957
   358
    val (Tps, Ts') = pretyps_of (K true) ([], Ts);
wenzelm@2957
   359
    val ((vps, ps), ts') = preterms_of const_type is_param (([], Tps), ts);
wenzelm@2957
   360
wenzelm@2957
   361
    (*run type inference*)
wenzelm@2957
   362
    val tTs' = ListPair.map Constraint (ts', Ts');
wenzelm@2957
   363
    val _ = seq (fn t => (infer classrel arities t; ())) tTs';
wenzelm@2957
   364
wenzelm@2957
   365
    (*collect result unifier*)
wenzelm@2957
   366
    fun ch_var (xi, Link (r as ref (Param S))) = (r := PTVar (xi, S); None)
wenzelm@2957
   367
      | ch_var xi_T = Some xi_T;
wenzelm@2957
   368
    val env = mapfilter ch_var Tps;
wenzelm@2957
   369
wenzelm@2957
   370
    (*convert back to terms/typs*)
wenzelm@2957
   371
    val mk_var =
wenzelm@2957
   372
      if freeze then PTFree
wenzelm@2957
   373
      else (fn (x, S) => PTVar ((x, 0), S));
wenzelm@2957
   374
    val (final_Ts, final_ts) = typs_terms_of used mk_var "" (Ts', ts');
wenzelm@2957
   375
    val final_env = map (apsnd simple_typ_of) env;
wenzelm@2957
   376
  in
wenzelm@2957
   377
    (final_ts, final_Ts, final_env)
wenzelm@2957
   378
  end;
wenzelm@2957
   379
wenzelm@2957
   380
end;