src/Pure/Isar/theory_target.ML
author haftmann
Wed Nov 28 09:01:42 2007 +0100 (2007-11-28)
changeset 25485 33840a854e63
parent 25462 dad0291cb76a
child 25514 4b508bb31a6c
permissions -rw-r--r--
tuned interfaces of class module
wenzelm@20894
     1
(*  Title:      Pure/Isar/theory_target.ML
wenzelm@20894
     2
    ID:         $Id$
wenzelm@20894
     3
    Author:     Makarius
wenzelm@20894
     4
haftmann@25462
     5
Common theory/locale/class/instantiation targets.
wenzelm@20894
     6
*)
wenzelm@20894
     7
wenzelm@20894
     8
signature THEORY_TARGET =
wenzelm@20894
     9
sig
haftmann@25462
    10
  val peek: local_theory -> {target: string, is_locale: bool,
haftmann@25462
    11
    is_class: bool, instantiation: arity list}
haftmann@25269
    12
  val init: string option -> theory -> local_theory
wenzelm@24935
    13
  val begin: string -> Proof.context -> local_theory
wenzelm@25291
    14
  val context: xstring -> theory -> local_theory
haftmann@25462
    15
  val instantiation: arity list -> theory -> local_theory
wenzelm@20894
    16
end;
wenzelm@20894
    17
wenzelm@20894
    18
structure TheoryTarget: THEORY_TARGET =
wenzelm@20894
    19
struct
wenzelm@20894
    20
wenzelm@21006
    21
(* context data *)
wenzelm@21006
    22
haftmann@25462
    23
datatype target = Target of {target: string, is_locale: bool,
haftmann@25462
    24
  is_class: bool, instantiation: arity list};
wenzelm@25012
    25
haftmann@25462
    26
fun make_target target is_locale is_class instantiation =
haftmann@25462
    27
  Target {target = target, is_locale = is_locale,
haftmann@25462
    28
    is_class = is_class, instantiation = instantiation};
wenzelm@25291
    29
haftmann@25462
    30
val global_target = make_target "" false false [];
wenzelm@25012
    31
wenzelm@21006
    32
structure Data = ProofDataFun
wenzelm@21006
    33
(
wenzelm@25012
    34
  type T = target;
wenzelm@25291
    35
  fun init _ = global_target;
wenzelm@21006
    36
);
wenzelm@21006
    37
wenzelm@25012
    38
val peek = (fn Target args => args) o Data.get;
wenzelm@21006
    39
wenzelm@21006
    40
wenzelm@20894
    41
(* pretty *)
wenzelm@20894
    42
haftmann@25462
    43
fun pretty (Target {target, is_locale, is_class, instantiation}) ctxt =
wenzelm@20894
    44
  let
wenzelm@20894
    45
    val thy = ProofContext.theory_of ctxt;
wenzelm@25012
    46
    val target_name = (if is_class then "class " else "locale ") ^ Locale.extern thy target;
wenzelm@20894
    47
    val fixes = map (fn (x, T) => (x, SOME T, NoSyn)) (#1 (ProofContext.inferred_fixes ctxt));
wenzelm@21585
    48
    val assumes = map (fn A => (("", []), [(A, [])])) (map Thm.term_of (Assumption.assms_of ctxt));
wenzelm@20894
    49
    val elems =
wenzelm@20894
    50
      (if null fixes then [] else [Element.Fixes fixes]) @
wenzelm@20894
    51
      (if null assumes then [] else [Element.Assumes assumes]);
wenzelm@20894
    52
  in
wenzelm@24939
    53
    Pretty.block [Pretty.str "theory", Pretty.brk 1, Pretty.str (Context.theory_name thy)] ::
wenzelm@25012
    54
     (if target = "" then []
wenzelm@25012
    55
      else if null elems then [Pretty.str target_name]
wenzelm@25012
    56
      else [Pretty.big_list (target_name ^ " =")
wenzelm@24939
    57
        (map (Pretty.chunks o Element.pretty_ctxt ctxt) elems)])
wenzelm@20894
    58
  end;
wenzelm@20894
    59
wenzelm@20894
    60
haftmann@24838
    61
(* target declarations *)
haftmann@24838
    62
wenzelm@25012
    63
fun target_decl add (Target {target, ...}) d lthy =
haftmann@24838
    64
  let
wenzelm@24935
    65
    val d' = Morphism.transform (LocalTheory.target_morphism lthy) d;
haftmann@24838
    66
    val d0 = Morphism.form d';
haftmann@24838
    67
  in
wenzelm@25012
    68
    if target = "" then
haftmann@24838
    69
      lthy
haftmann@24838
    70
      |> LocalTheory.theory (Context.theory_map d0)
haftmann@24838
    71
      |> LocalTheory.target (Context.proof_map d0)
haftmann@24838
    72
    else
haftmann@24838
    73
      lthy
wenzelm@25012
    74
      |> LocalTheory.target (add target d')
haftmann@24838
    75
  end;
haftmann@24838
    76
haftmann@24838
    77
val type_syntax = target_decl Locale.add_type_syntax;
haftmann@24838
    78
val term_syntax = target_decl Locale.add_term_syntax;
haftmann@24838
    79
val declaration = target_decl Locale.add_declaration;
haftmann@24838
    80
wenzelm@25105
    81
fun class_target (Target {target, ...}) f =
wenzelm@25105
    82
  LocalTheory.raw_theory f #>
wenzelm@25105
    83
  LocalTheory.target (Class.refresh_syntax target);
haftmann@24838
    84
wenzelm@21611
    85
wenzelm@20894
    86
(* notes *)
wenzelm@20894
    87
wenzelm@21611
    88
fun import_export_proof ctxt (name, raw_th) =
wenzelm@21594
    89
  let
wenzelm@21611
    90
    val thy = ProofContext.theory_of ctxt;
wenzelm@21611
    91
    val thy_ctxt = ProofContext.init thy;
wenzelm@21611
    92
    val certT = Thm.ctyp_of thy;
wenzelm@21611
    93
    val cert = Thm.cterm_of thy;
wenzelm@21594
    94
wenzelm@21611
    95
    (*export assumes/defines*)
wenzelm@21611
    96
    val th = Goal.norm_result raw_th;
wenzelm@21611
    97
    val (defs, th') = LocalDefs.export ctxt thy_ctxt th;
wenzelm@21708
    98
    val concl_conv = MetaSimplifier.rewrite true defs (Thm.cprop_of th);
wenzelm@21708
    99
    val assms = map (MetaSimplifier.rewrite_rule defs o Thm.assume) (Assumption.assms_of ctxt);
wenzelm@21611
   100
    val nprems = Thm.nprems_of th' - Thm.nprems_of th;
wenzelm@21611
   101
wenzelm@21611
   102
    (*export fixes*)
wenzelm@22692
   103
    val tfrees = map TFree (Thm.fold_terms Term.add_tfrees th' []);
wenzelm@22692
   104
    val frees = map Free (Thm.fold_terms Term.add_frees th' []);
wenzelm@21611
   105
    val (th'' :: vs) = (th' :: map (Drule.mk_term o cert) (map Logic.mk_type tfrees @ frees))
wenzelm@21611
   106
      |> Variable.export ctxt thy_ctxt
wenzelm@21611
   107
      |> Drule.zero_var_indexes_list;
wenzelm@21611
   108
wenzelm@21611
   109
    (*thm definition*)
wenzelm@21644
   110
    val result = th''
wenzelm@21644
   111
      |> PureThy.name_thm true true ""
wenzelm@21644
   112
      |> Goal.close_result
wenzelm@24779
   113
      |> fold PureThy.tag_rule (ContextPosition.properties_of ctxt)
wenzelm@21644
   114
      |> PureThy.name_thm true true name;
wenzelm@21611
   115
wenzelm@21611
   116
    (*import fixes*)
wenzelm@21611
   117
    val (tvars, vars) =
wenzelm@21611
   118
      chop (length tfrees) (map (Thm.term_of o Drule.dest_term) vs)
wenzelm@21611
   119
      |>> map Logic.dest_type;
wenzelm@21611
   120
wenzelm@21611
   121
    val instT = map_filter (fn (TVar v, T) => SOME (v, T) | _ => NONE) (tvars ~~ tfrees);
wenzelm@21611
   122
    val inst = filter (is_Var o fst) (vars ~~ frees);
wenzelm@21611
   123
    val cinstT = map (pairself certT o apfst TVar) instT;
wenzelm@21611
   124
    val cinst = map (pairself (cert o Term.map_types (TermSubst.instantiateT instT))) inst;
wenzelm@21611
   125
    val result' = Thm.instantiate (cinstT, cinst) result;
wenzelm@21611
   126
wenzelm@21611
   127
    (*import assumes/defines*)
wenzelm@21594
   128
    val assm_tac = FIRST' (map (fn assm => Tactic.compose_tac (false, assm, 0)) assms);
wenzelm@21611
   129
    val result'' =
wenzelm@21611
   130
      (case SINGLE (Seq.INTERVAL assm_tac 1 nprems) result' of
wenzelm@21611
   131
        NONE => raise THM ("Failed to re-import result", 0, [result'])
wenzelm@21845
   132
      | SOME res => LocalDefs.trans_props ctxt [res, Thm.symmetric concl_conv])
wenzelm@21644
   133
      |> Goal.norm_result
wenzelm@21644
   134
      |> PureThy.name_thm false false name;
wenzelm@21611
   135
wenzelm@21611
   136
  in (result'', result) end;
wenzelm@21611
   137
wenzelm@25022
   138
fun notes (Target {target, is_locale, ...}) kind facts lthy =
wenzelm@21585
   139
  let
wenzelm@21594
   140
    val thy = ProofContext.theory_of lthy;
wenzelm@21615
   141
    val full = LocalTheory.full_name lthy;
wenzelm@21585
   142
wenzelm@21594
   143
    val facts' = facts
wenzelm@21615
   144
      |> map (fn (a, bs) => (a, PureThy.burrow_fact (PureThy.name_multi (full (fst a))) bs))
wenzelm@21615
   145
      |> PureThy.map_facts (import_export_proof lthy);
wenzelm@21611
   146
    val local_facts = PureThy.map_facts #1 facts'
wenzelm@21611
   147
      |> Attrib.map_facts (Attrib.attribute_i thy);
wenzelm@21611
   148
    val target_facts = PureThy.map_facts #1 facts'
wenzelm@25012
   149
      |> is_locale ? Element.facts_map (Element.morph_ctxt (LocalTheory.target_morphism lthy));
wenzelm@21611
   150
    val global_facts = PureThy.map_facts #2 facts'
wenzelm@25012
   151
      |> Attrib.map_facts (if is_locale then K I else Attrib.attribute_i thy);
wenzelm@21594
   152
  in
wenzelm@21611
   153
    lthy |> LocalTheory.theory
wenzelm@21611
   154
      (Sign.qualified_names
wenzelm@21611
   155
        #> PureThy.note_thmss_i kind global_facts #> snd
wenzelm@21611
   156
        #> Sign.restore_naming thy)
wenzelm@21585
   157
wenzelm@25012
   158
    |> is_locale ? LocalTheory.target (Locale.add_thmss target kind target_facts)
wenzelm@21594
   159
wenzelm@20894
   160
    |> ProofContext.qualified_names
wenzelm@21611
   161
    |> ProofContext.note_thmss_i kind local_facts
wenzelm@20894
   162
    ||> ProofContext.restore_naming lthy
wenzelm@20894
   163
  end;
wenzelm@20894
   164
wenzelm@20894
   165
wenzelm@25105
   166
(* declare_const *)
wenzelm@24939
   167
wenzelm@25105
   168
fun fork_mixfix (Target {is_locale, is_class, ...}) mx =
wenzelm@25105
   169
  if not is_locale then (NoSyn, NoSyn, mx)
wenzelm@25105
   170
  else if not is_class then (NoSyn, mx, NoSyn)
wenzelm@25105
   171
  else (mx, NoSyn, NoSyn);
wenzelm@25068
   172
wenzelm@25212
   173
fun locale_const (Target {target, is_class, ...}) (prmode as (mode, _)) pos ((c, mx), rhs) phi =
wenzelm@24939
   174
  let
wenzelm@24939
   175
    val c' = Morphism.name phi c;
wenzelm@24939
   176
    val rhs' = Morphism.term phi rhs;
wenzelm@25053
   177
    val legacy_arg = (c', Term.close_schematic_term (Logic.legacy_varify rhs'));
wenzelm@25053
   178
    val arg = (c', Term.close_schematic_term rhs');
wenzelm@25372
   179
    val similar_body = Type.similar_types (rhs, rhs');
wenzelm@25212
   180
    (* FIXME workaround based on educated guess *)
wenzelm@25372
   181
    val class_global = c' = NameSpace.qualified (Class.class_prefix target) c;
wenzelm@24939
   182
  in
wenzelm@25372
   183
    not (is_class andalso (similar_body orelse class_global)) ?
wenzelm@25212
   184
      (Context.mapping_result
wenzelm@25212
   185
        (Sign.add_abbrev PrintMode.internal pos legacy_arg)
wenzelm@25212
   186
        (ProofContext.add_abbrev PrintMode.internal pos arg)
wenzelm@25212
   187
      #-> (fn (lhs' as Const (d, _), _) =>
wenzelm@25372
   188
          similar_body ?
wenzelm@25212
   189
            (Context.mapping (Sign.revert_abbrev mode d) (ProofContext.revert_abbrev mode d) #>
wenzelm@25212
   190
             Morphism.form (ProofContext.target_notation true prmode [(lhs', mx)]))))
wenzelm@24939
   191
  end;
wenzelm@24939
   192
haftmann@25485
   193
fun declare_const (ta as Target {target, is_locale, is_class, ...}) depends ((c, T), mx) lthy =
wenzelm@24939
   194
  let
wenzelm@25053
   195
    val pos = ContextPosition.properties_of lthy;
wenzelm@24939
   196
    val xs = filter depends (#1 (ProofContext.inferred_fixes (LocalTheory.target_of lthy)));
wenzelm@25105
   197
    val U = map #2 xs ---> T;
wenzelm@25105
   198
    val (mx1, mx2, mx3) = fork_mixfix ta mx;
haftmann@25485
   199
    val declare_const = case Class.instantiation_param lthy c
haftmann@25485
   200
       of SOME c' => LocalTheory.theory_result (Class.overloaded_const (c', U, mx3))
haftmann@25485
   201
            ##> Class.confirm_declaration c
haftmann@25485
   202
        | NONE => LocalTheory.theory_result (Sign.declare_const pos (c, U, mx3));
haftmann@25485
   203
    val (const, lthy') = lthy |> declare_const;
wenzelm@25105
   204
    val t = Term.list_comb (const, map Free xs);
wenzelm@24939
   205
  in
wenzelm@24939
   206
    lthy'
wenzelm@25212
   207
    |> is_locale ? term_syntax ta (locale_const ta Syntax.mode_default pos ((c, mx2), t))
haftmann@25485
   208
    |> is_class ? class_target ta (Class.logical_const target pos ((c, mx1), t))
wenzelm@25105
   209
    |> LocalDefs.add_def ((c, NoSyn), t)
wenzelm@24939
   210
  end;
wenzelm@24939
   211
wenzelm@24939
   212
wenzelm@24939
   213
(* abbrev *)
wenzelm@24939
   214
haftmann@25485
   215
fun abbrev (ta as Target {target, is_locale, is_class, ...}) prmode ((c, mx), t) lthy =
wenzelm@24939
   216
  let
wenzelm@25053
   217
    val pos = ContextPosition.properties_of lthy;
wenzelm@25053
   218
    val thy_ctxt = ProofContext.init (ProofContext.theory_of lthy);
wenzelm@25012
   219
    val target_ctxt = LocalTheory.target_of lthy;
wenzelm@25105
   220
wenzelm@25105
   221
    val (mx1, mx2, mx3) = fork_mixfix ta mx;
wenzelm@25105
   222
    val t' = Assumption.export_term lthy target_ctxt t;
wenzelm@25105
   223
    val xs = map Free (rev (Variable.add_fixed target_ctxt t' []));
wenzelm@25105
   224
    val u = fold_rev lambda xs t';
wenzelm@25105
   225
    val global_rhs =
wenzelm@25105
   226
      singleton (Variable.export_terms (Variable.declare_term u target_ctxt) thy_ctxt) u;
wenzelm@25121
   227
  in
wenzelm@25121
   228
    lthy |>
wenzelm@25121
   229
     (if is_locale then
wenzelm@25395
   230
        LocalTheory.theory_result (Sign.add_abbrev PrintMode.internal pos (c, global_rhs))
wenzelm@25121
   231
        #-> (fn (lhs, _) =>
wenzelm@25105
   232
          let val lhs' = Term.list_comb (Logic.unvarify lhs, xs) in
wenzelm@25212
   233
            term_syntax ta (locale_const ta prmode pos ((c, mx2), lhs')) #>
haftmann@25485
   234
            is_class ? class_target ta (Class.syntactic_const target prmode pos ((c, mx1), t'))
wenzelm@25105
   235
          end)
wenzelm@25105
   236
      else
wenzelm@25121
   237
        LocalTheory.theory
wenzelm@25105
   238
          (Sign.add_abbrev (#1 prmode) pos (c, global_rhs) #-> (fn (lhs, _) =>
wenzelm@25121
   239
           Sign.notation true prmode [(lhs, mx3)])))
wenzelm@25121
   240
    |> ProofContext.add_abbrev PrintMode.internal pos (c, t) |> snd
wenzelm@25121
   241
    |> LocalDefs.fixed_abbrev ((c, NoSyn), t)
wenzelm@24939
   242
  end;
wenzelm@24939
   243
wenzelm@24939
   244
wenzelm@25022
   245
(* define *)
wenzelm@24939
   246
haftmann@25485
   247
fun define (ta as Target {target, is_locale, is_class, ...})
wenzelm@25012
   248
    kind ((c, mx), ((name, atts), rhs)) lthy =
wenzelm@24939
   249
  let
wenzelm@24987
   250
    val thy = ProofContext.theory_of lthy;
wenzelm@24939
   251
    val thy_ctxt = ProofContext.init thy;
wenzelm@24939
   252
wenzelm@25022
   253
    val name' = Thm.def_name_optional c name;
wenzelm@24987
   254
    val (rhs', rhs_conv) =
wenzelm@24987
   255
      LocalDefs.export_cterm lthy thy_ctxt (Thm.cterm_of thy rhs) |>> Thm.term_of;
wenzelm@24987
   256
    val xs = Variable.add_fixed (LocalTheory.target_of lthy) rhs' [];
wenzelm@24939
   257
    val T = Term.fastype_of rhs;
wenzelm@24939
   258
wenzelm@25105
   259
    (*const*)
wenzelm@25105
   260
    val ((lhs, local_def), lthy2) = lthy |> declare_const ta (member (op =) xs) ((c, T), mx);
wenzelm@25022
   261
    val (_, lhs') = Logic.dest_equals (Thm.prop_of local_def);
wenzelm@24939
   262
wenzelm@24939
   263
    (*def*)
haftmann@25485
   264
    val define_const = if is_none (Class.instantiation_param lthy c)
haftmann@25462
   265
      then (fn name => fn eq => Thm.add_def false (name, Logic.mk_equals eq))
haftmann@25485
   266
      else (fn name => fn (Const (c, _), rhs) => Class.overloaded_def name (c, rhs));
wenzelm@25022
   267
    val (global_def, lthy3) = lthy2
haftmann@25462
   268
      |> LocalTheory.theory_result (define_const name' (lhs', rhs'));
haftmann@25485
   269
    val def = LocalDefs.trans_terms lthy3
wenzelm@25022
   270
      [(*c == global.c xs*)     local_def,
wenzelm@25022
   271
       (*global.c xs == rhs'*)  global_def,
haftmann@25485
   272
       (*rhs' == rhs*)          Thm.symmetric rhs_conv];
wenzelm@24939
   273
wenzelm@25105
   274
    (*note*)
wenzelm@24939
   275
    val ([(res_name, [res])], lthy4) = lthy3
wenzelm@25022
   276
      |> notes ta kind [((name', atts), [([def], [])])];
wenzelm@24939
   277
  in ((lhs, (res_name, res)), lthy4) end;
wenzelm@24939
   278
wenzelm@24939
   279
wenzelm@24939
   280
(* axioms *)
wenzelm@24939
   281
wenzelm@25022
   282
fun axioms ta kind (vars, specs) lthy =
wenzelm@24939
   283
  let
wenzelm@25022
   284
    val thy_ctxt = ProofContext.init (ProofContext.theory_of lthy);
wenzelm@25022
   285
    val expanded_props = map (Assumption.export_term lthy thy_ctxt) (maps snd specs);
wenzelm@25022
   286
    val xs = fold Term.add_frees expanded_props [];
wenzelm@24989
   287
wenzelm@25022
   288
    (*consts*)
wenzelm@25105
   289
    val (consts, lthy') = fold_map (declare_const ta (member (op =) xs)) vars lthy;
wenzelm@25022
   290
    val global_consts = map (Term.dest_Const o Term.head_of o Thm.term_of o Thm.rhs_of o #2) consts;
wenzelm@25022
   291
wenzelm@25022
   292
    (*axioms*)
haftmann@25485
   293
    val resubst_instparams = map_aterms (fn t as Free (v, T) =>
haftmann@25485
   294
      (case Class.instantiation_param lthy' v
haftmann@25485
   295
       of NONE => t
haftmann@25485
   296
        | SOME c => Const (c, T)) | t => t)
haftmann@25485
   297
    val hyps = map Thm.term_of (Assumption.assms_of lthy')
haftmann@25485
   298
      |> map resubst_instparams;
wenzelm@24939
   299
    fun axiom ((name, atts), props) thy = thy
wenzelm@24983
   300
      |> fold_map (Thm.add_axiom hyps) (PureThy.name_multi name props)
wenzelm@24939
   301
      |-> (fn ths => pair ((name, atts), [(ths, [])]));
wenzelm@24939
   302
  in
wenzelm@24987
   303
    lthy'
wenzelm@25022
   304
    |> fold Variable.declare_term expanded_props
wenzelm@25022
   305
    |> LocalTheory.theory (fold (fn c => Theory.add_deps "" c []) global_consts)
wenzelm@24939
   306
    |> LocalTheory.theory_result (fold_map axiom specs)
wenzelm@25022
   307
    |-> notes ta kind
wenzelm@24987
   308
    |>> pair (map #1 consts)
wenzelm@24939
   309
  end;
wenzelm@24939
   310
wenzelm@24939
   311
wenzelm@25291
   312
(* init *)
wenzelm@25291
   313
wenzelm@25291
   314
local
wenzelm@20894
   315
wenzelm@25291
   316
fun init_target _ NONE = global_target
haftmann@25462
   317
  | init_target thy (SOME target) = make_target target true (Class.is_class thy target) [];
haftmann@25462
   318
haftmann@25462
   319
fun init_instantiaton arities = make_target "" false false arities
wenzelm@25291
   320
haftmann@25462
   321
fun init_ctxt (Target {target, is_locale, is_class, instantiation}) =
haftmann@25485
   322
  if not (null instantiation) then Class.init_instantiation instantiation
haftmann@25485
   323
  else if not is_locale then ProofContext.init
haftmann@25485
   324
  else if not is_class then Locale.init target
haftmann@25485
   325
  else Class.init target;
haftmann@25269
   326
haftmann@25462
   327
fun init_lthy (ta as Target {target, instantiation, ...}) =
wenzelm@25291
   328
  Data.put ta #>
wenzelm@25291
   329
  LocalTheory.init (NameSpace.base target)
wenzelm@25291
   330
   {pretty = pretty ta,
wenzelm@25291
   331
    axioms = axioms ta,
wenzelm@25291
   332
    abbrev = abbrev ta,
wenzelm@25291
   333
    define = define ta,
wenzelm@25291
   334
    notes = notes ta,
wenzelm@25291
   335
    type_syntax = type_syntax ta,
wenzelm@25291
   336
    term_syntax = term_syntax ta,
wenzelm@25291
   337
    declaration = declaration ta,
wenzelm@25291
   338
    reinit = fn lthy => init_lthy_ctxt ta (ProofContext.theory_of lthy),
haftmann@25485
   339
    exit = if null instantiation then LocalTheory.target_of
haftmann@25485
   340
      else Class.conclude_instantiation #> LocalTheory.target_of}
wenzelm@25291
   341
and init_lthy_ctxt ta = init_lthy ta o init_ctxt ta;
wenzelm@20894
   342
wenzelm@25291
   343
in
wenzelm@20894
   344
wenzelm@25291
   345
fun init target thy = init_lthy_ctxt (init_target thy target) thy;
wenzelm@25291
   346
fun begin target ctxt = init_lthy (init_target (ProofContext.theory_of ctxt) (SOME target)) ctxt;
haftmann@25269
   347
wenzelm@25291
   348
fun context "-" thy = init NONE thy
wenzelm@25291
   349
  | context target thy = init (SOME (Locale.intern thy target)) thy;
wenzelm@20894
   350
haftmann@25485
   351
fun instantiation arities thy =
haftmann@25485
   352
  init_lthy_ctxt (init_instantiaton arities) thy;
haftmann@25462
   353
wenzelm@20894
   354
end;
wenzelm@25291
   355
wenzelm@25291
   356
end;
wenzelm@25291
   357