src/Pure/Isar/isar_thy.ML
author wenzelm
Thu Apr 22 13:16:22 1999 +0200 (1999-04-22)
changeset 6483 3e5d450c2b31
parent 6404 2daaf2943c79
child 6501 392333eb31cb
permissions -rw-r--r--
switch_theory: Context.pass;
wenzelm@5830
     1
(*  Title:      Pure/Isar/isar_thy.ML
wenzelm@5830
     2
    ID:         $Id$
wenzelm@5830
     3
    Author:     Markus Wenzel, TU Muenchen
wenzelm@5830
     4
wenzelm@6371
     5
Pure/Isar derived theory operations.
wenzelm@5830
     6
wenzelm@5830
     7
TODO:
wenzelm@5830
     8
  - 'methods' section (proof macros, ML method defs) (!?);
wenzelm@5882
     9
  - next_block: ProofHistory open / close (!?);
wenzelm@5830
    10
*)
wenzelm@5830
    11
wenzelm@5830
    12
signature ISAR_THY =
wenzelm@5830
    13
sig
wenzelm@5959
    14
  val add_text: string -> theory -> theory
wenzelm@6354
    15
  val add_title: string -> string -> string -> theory -> theory
wenzelm@5959
    16
  val add_chapter: string -> theory -> theory
wenzelm@5959
    17
  val add_section: string -> theory -> theory
wenzelm@5959
    18
  val add_subsection: string -> theory -> theory
wenzelm@5959
    19
  val add_subsubsection: string -> theory -> theory
wenzelm@5830
    20
  val add_axioms: ((bstring * string) * Args.src list) list -> theory -> theory
wenzelm@6371
    21
  val add_axioms_i: ((bstring * term) * theory attribute list) list -> theory -> theory
wenzelm@5830
    22
  val add_defs: ((bstring * string) * Args.src list) list -> theory -> theory
wenzelm@6371
    23
  val add_defs_i: ((bstring * term) * theory attribute list) list -> theory -> theory
wenzelm@6371
    24
  val add_constdefs: ((bstring * string * mixfix) * string) list -> theory -> theory
wenzelm@6371
    25
  val add_constdefs_i: ((bstring * typ * mixfix) * term) list -> theory -> theory
wenzelm@6371
    26
  val apply_theorems: (xstring * Args.src list) list -> theory -> theory * thm list
wenzelm@6371
    27
  val apply_theorems_i: (thm * theory attribute list) list -> theory -> theory * thm list
wenzelm@5915
    28
  val have_theorems: (bstring * Args.src list) * (xstring * Args.src list) list
wenzelm@5915
    29
    -> theory -> theory
wenzelm@6371
    30
  val have_theorems_i: (bstring * theory attribute list) * (thm * theory attribute list) list
wenzelm@6371
    31
    -> theory -> theory
wenzelm@5915
    32
  val have_lemmas: (bstring * Args.src list) * (xstring * Args.src list) list
wenzelm@5915
    33
    -> theory -> theory
wenzelm@6371
    34
  val have_lemmas_i: (bstring * theory attribute list) * (thm * theory attribute list) list
wenzelm@6371
    35
    -> theory -> theory
wenzelm@5915
    36
  val have_facts: (string * Args.src list) * (string * Args.src list) list
wenzelm@5915
    37
    -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    38
  val have_facts_i: (string * Proof.context attribute list) *
wenzelm@6371
    39
    (thm * Proof.context attribute list) list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    40
  val from_facts: (string * Args.src list) list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    41
  val from_facts_i: (thm * Proof.context attribute list) list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    42
  val chain: ProofHistory.T -> ProofHistory.T
wenzelm@5830
    43
  val fix: (string * string option) list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    44
  val fix_i: (string * typ) list -> ProofHistory.T -> ProofHistory.T
wenzelm@5938
    45
  val match_bind: (string list * string) list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    46
  val match_bind_i: (term list * term) list -> ProofHistory.T -> ProofHistory.T
wenzelm@5938
    47
  val theorem: string -> Args.src list -> string * string list -> theory -> ProofHistory.T
wenzelm@6371
    48
  val theorem_i: bstring -> theory attribute list -> term * term list -> theory -> ProofHistory.T
wenzelm@5938
    49
  val lemma: string -> Args.src list -> string * string list -> theory -> ProofHistory.T
wenzelm@6371
    50
  val lemma_i: bstring -> theory attribute list -> term * term list -> theory -> ProofHistory.T
wenzelm@5938
    51
  val assume: string -> Args.src list -> (string * string list) list
wenzelm@5938
    52
    -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    53
  val assume_i: string -> Proof.context attribute list -> (term * term list) list
wenzelm@6371
    54
    -> ProofHistory.T -> ProofHistory.T
wenzelm@5938
    55
  val show: string -> Args.src list -> string * string list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    56
  val show_i: string -> Proof.context attribute list -> term * term list
wenzelm@6371
    57
    -> ProofHistory.T -> ProofHistory.T
wenzelm@5938
    58
  val have: string -> Args.src list -> string * string list -> ProofHistory.T -> ProofHistory.T
wenzelm@6371
    59
  val have_i: string -> Proof.context attribute list -> term * term list
wenzelm@6371
    60
    -> ProofHistory.T -> ProofHistory.T
wenzelm@5830
    61
  val begin_block: ProofHistory.T -> ProofHistory.T
wenzelm@5830
    62
  val next_block: ProofHistory.T -> ProofHistory.T
wenzelm@5830
    63
  val end_block: ProofHistory.T -> ProofHistory.T
wenzelm@5830
    64
  val tac: Method.text -> ProofHistory.T -> ProofHistory.T
wenzelm@5882
    65
  val then_tac: Method.text -> ProofHistory.T -> ProofHistory.T
wenzelm@5830
    66
  val proof: Method.text option -> ProofHistory.T -> ProofHistory.T
wenzelm@6404
    67
  val kill_proof: ProofHistory.T -> theory
wenzelm@6404
    68
  val global_qed_with: bstring option * Args.src list option -> Method.text option
wenzelm@6404
    69
    -> Toplevel.transition -> Toplevel.transition
wenzelm@6404
    70
  val global_qed_with_i: bstring option * theory attribute list option -> Method.text option
wenzelm@6404
    71
    -> Toplevel.transition -> Toplevel.transition
wenzelm@6404
    72
  val qed: Method.text option -> Toplevel.transition -> Toplevel.transition
wenzelm@6404
    73
  val terminal_proof: Method.text -> Toplevel.transition -> Toplevel.transition
wenzelm@6404
    74
  val immediate_proof: Toplevel.transition -> Toplevel.transition
wenzelm@6404
    75
  val default_proof: Toplevel.transition -> Toplevel.transition
wenzelm@5830
    76
  val use_mltext: string -> theory option -> theory option
wenzelm@5830
    77
  val use_mltext_theory: string -> theory -> theory
wenzelm@5830
    78
  val use_setup: string -> theory -> theory
wenzelm@5830
    79
  val parse_ast_translation: string -> theory -> theory
wenzelm@5830
    80
  val parse_translation: string -> theory -> theory
wenzelm@5830
    81
  val print_translation: string -> theory -> theory
wenzelm@5830
    82
  val typed_print_translation: string -> theory -> theory
wenzelm@5830
    83
  val print_ast_translation: string -> theory -> theory
wenzelm@5830
    84
  val token_translation: string -> theory -> theory
wenzelm@5830
    85
  val add_oracle: bstring * string -> theory -> theory
wenzelm@6331
    86
  val begin_theory: string -> string list -> (string * bool) list -> theory
wenzelm@6331
    87
  val end_theory: theory -> theory
wenzelm@6246
    88
  val theory: string * string list * (string * bool) list
wenzelm@6246
    89
    -> Toplevel.transition -> Toplevel.transition
wenzelm@6246
    90
  val context: string -> Toplevel.transition -> Toplevel.transition
wenzelm@6246
    91
  val update_context: string -> Toplevel.transition -> Toplevel.transition
wenzelm@5830
    92
end;
wenzelm@5830
    93
wenzelm@5830
    94
structure IsarThy: ISAR_THY =
wenzelm@5830
    95
struct
wenzelm@5830
    96
wenzelm@5830
    97
wenzelm@5830
    98
(** derived theory and proof operations **)
wenzelm@5830
    99
wenzelm@6371
   100
(* formal comments *)   (* FIXME dummy *)
wenzelm@5959
   101
wenzelm@5959
   102
fun add_text (txt:string) (thy:theory) = thy;
wenzelm@6354
   103
fun add_title title author date thy = thy;
wenzelm@5959
   104
val add_chapter = add_text;
wenzelm@5959
   105
val add_section = add_text;
wenzelm@5959
   106
val add_subsection = add_text;
wenzelm@5959
   107
val add_subsubsection = add_text;
wenzelm@5959
   108
wenzelm@5959
   109
wenzelm@5830
   110
(* axioms and defs *)
wenzelm@5830
   111
wenzelm@5915
   112
fun add_axms f args thy =
wenzelm@5915
   113
  f (map (fn (x, srcs) => (x, map (Attrib.global_attribute thy) srcs)) args) thy;
wenzelm@5915
   114
wenzelm@5915
   115
val add_axioms = add_axms PureThy.add_axioms;
wenzelm@6371
   116
val add_axioms_i = PureThy.add_axioms_i;
wenzelm@5915
   117
val add_defs = add_axms PureThy.add_defs;
wenzelm@6371
   118
val add_defs_i = PureThy.add_defs_i;
wenzelm@6371
   119
wenzelm@6371
   120
wenzelm@6371
   121
(* constdefs *)
wenzelm@6371
   122
wenzelm@6371
   123
fun gen_add_constdefs consts defs args thy =
wenzelm@6371
   124
  thy
wenzelm@6371
   125
  |> consts (map fst args)
wenzelm@6371
   126
  |> defs (map (fn ((c, _, mx), s) => ((Thm.def_name (Syntax.const_name c mx), s), [])) args);
wenzelm@6371
   127
wenzelm@6371
   128
val add_constdefs = gen_add_constdefs Theory.add_consts add_defs;
wenzelm@6371
   129
val add_constdefs_i = gen_add_constdefs Theory.add_consts_i add_defs_i;
wenzelm@5915
   130
wenzelm@5915
   131
wenzelm@5915
   132
(* theorems *)
wenzelm@5915
   133
wenzelm@5915
   134
fun gen_have_thmss get attrib f ((name, more_srcs), th_srcs) x =
wenzelm@5915
   135
  f name (map (attrib x) more_srcs)
wenzelm@5915
   136
    (map (fn (s, srcs) => (get x s, map (attrib x) srcs)) th_srcs) x;
wenzelm@5915
   137
wenzelm@6371
   138
fun global_have_thmss x = gen_have_thmss PureThy.get_thms Attrib.global_attribute x;
wenzelm@5915
   139
wenzelm@6371
   140
fun local_have_thmss x =
wenzelm@6371
   141
  gen_have_thmss (ProofContext.get_thms o Proof.context_of)
wenzelm@6371
   142
    (Attrib.local_attribute o Proof.theory_of) x;
wenzelm@6371
   143
wenzelm@6371
   144
fun have_thmss_i f ((name, more_atts), th_atts) =
wenzelm@6371
   145
  f name more_atts (map (apfst single) th_atts);
wenzelm@6371
   146
wenzelm@6371
   147
fun have_lemss name atts = PureThy.have_thmss name (atts @ [Drule.tag_lemma]);
wenzelm@5915
   148
wenzelm@5915
   149
wenzelm@6371
   150
fun apply_theorems th_srcs = global_have_thmss PureThy.have_thmss ((None, []), th_srcs);
wenzelm@6371
   151
fun apply_theorems_i th_srcs = have_thmss_i PureThy.have_thmss ((None, []), th_srcs);
wenzelm@6371
   152
val have_theorems = #1 oo global_have_thmss (PureThy.have_thmss o Some);
wenzelm@6371
   153
val have_theorems_i = #1 oo have_thmss_i (PureThy.have_thmss o Some);
wenzelm@6371
   154
val have_lemmas = #1 oo global_have_thmss (have_lemss o Some);
wenzelm@6371
   155
val have_lemmas_i = #1 oo have_thmss_i (have_lemss o Some);
wenzelm@6371
   156
val have_facts = ProofHistory.apply o local_have_thmss Proof.have_thmss;
wenzelm@6371
   157
val have_facts_i = ProofHistory.apply o have_thmss_i Proof.have_thmss;
wenzelm@6371
   158
wenzelm@5915
   159
wenzelm@6371
   160
(* forward chaining *)
wenzelm@6371
   161
wenzelm@6371
   162
val from_facts =
wenzelm@6371
   163
  ProofHistory.apply o (Proof.chain oo curry (local_have_thmss Proof.have_thmss) ("", []));
wenzelm@6371
   164
wenzelm@6371
   165
val from_facts_i =
wenzelm@6371
   166
  ProofHistory.apply o (Proof.chain oo curry (have_thmss_i Proof.have_thmss) ("", []));
wenzelm@6371
   167
wenzelm@6371
   168
val chain = ProofHistory.apply Proof.chain;
wenzelm@5830
   169
wenzelm@5830
   170
wenzelm@5830
   171
(* context *)
wenzelm@5830
   172
wenzelm@5830
   173
val fix = ProofHistory.apply o Proof.fix;
wenzelm@6371
   174
val fix_i = ProofHistory.apply o Proof.fix_i;
wenzelm@5830
   175
val match_bind = ProofHistory.apply o Proof.match_bind;
wenzelm@6371
   176
val match_bind_i = ProofHistory.apply o Proof.match_bind_i;
wenzelm@5830
   177
wenzelm@5830
   178
wenzelm@5830
   179
(* statements *)
wenzelm@5830
   180
wenzelm@6371
   181
fun global_statement f name src s thy =
wenzelm@6371
   182
  ProofHistory.init (f name (map (Attrib.global_attribute thy) src) s thy);
wenzelm@5830
   183
wenzelm@6371
   184
fun local_statement do_open f name src s = ProofHistory.apply_cond_open do_open (fn state =>
wenzelm@6371
   185
  f name (map (Attrib.local_attribute (Proof.theory_of state)) src) s state);
wenzelm@6371
   186
wenzelm@6371
   187
fun global_statement_i f name atts t thy = ProofHistory.init (f name atts t thy);
wenzelm@6371
   188
fun local_statement_i do_open f name atts t = ProofHistory.apply_cond_open do_open (f name atts t);
wenzelm@5830
   189
wenzelm@5830
   190
val theorem = global_statement Proof.theorem;
wenzelm@6371
   191
val theorem_i = global_statement_i Proof.theorem_i;
wenzelm@5830
   192
val lemma = global_statement Proof.lemma;
wenzelm@6371
   193
val lemma_i = global_statement_i Proof.lemma_i;
wenzelm@6371
   194
val assume = local_statement false Proof.assume;
wenzelm@6371
   195
val assume_i = local_statement_i false Proof.assume_i;
wenzelm@6371
   196
val show = local_statement true Proof.show;
wenzelm@6371
   197
val show_i = local_statement_i true Proof.show_i;
wenzelm@6371
   198
val have = local_statement true Proof.have;
wenzelm@6371
   199
val have_i = local_statement_i true Proof.have_i;
wenzelm@5830
   200
wenzelm@5830
   201
wenzelm@5830
   202
(* blocks *)
wenzelm@5830
   203
wenzelm@5830
   204
val begin_block = ProofHistory.apply_open Proof.begin_block;
wenzelm@5830
   205
val next_block = ProofHistory.apply Proof.next_block;
wenzelm@6404
   206
val end_block = ProofHistory.apply_close Proof.end_block;
wenzelm@5830
   207
wenzelm@5830
   208
wenzelm@5830
   209
(* backward steps *)
wenzelm@5830
   210
wenzelm@5830
   211
val tac = ProofHistory.applys o Method.tac;
wenzelm@5882
   212
val then_tac = ProofHistory.applys o Method.then_tac;
wenzelm@5830
   213
val proof = ProofHistory.applys o Method.proof;
wenzelm@6404
   214
wenzelm@6404
   215
wenzelm@6404
   216
(* local endings *)
wenzelm@6404
   217
wenzelm@6404
   218
val local_qed = Toplevel.proof o ProofHistory.applys_close o Method.local_qed;
wenzelm@6404
   219
val local_terminal_proof = Toplevel.proof o ProofHistory.applys_close o Method.local_terminal_proof;
wenzelm@6404
   220
val local_immediate_proof = Toplevel.proof (ProofHistory.applys_close Method.local_immediate_proof);
wenzelm@6404
   221
val local_default_proof = Toplevel.proof (ProofHistory.applys_close Method.local_default_proof);
wenzelm@6404
   222
wenzelm@6404
   223
wenzelm@6404
   224
(* global endings *)
wenzelm@6404
   225
wenzelm@6404
   226
val kill_proof = Proof.theory_of o ProofHistory.current;
wenzelm@6404
   227
wenzelm@6404
   228
fun global_result finish = Toplevel.proof_to_theory (fn prf =>
wenzelm@6404
   229
  let
wenzelm@6404
   230
    val state = ProofHistory.current prf;
wenzelm@6404
   231
    val _ = if Proof.at_bottom state then () else raise Toplevel.UNDEF;
wenzelm@6404
   232
    val (thy, (kind, name, thm)) = finish state;
wenzelm@6404
   233
wenzelm@6404
   234
    val prt_result = Pretty.block
wenzelm@6404
   235
      [Pretty.str (kind ^ " " ^ name ^ ":"), Pretty.fbrk, Display.pretty_thm thm];
wenzelm@6404
   236
  in Pretty.writeln prt_result; thy end);
wenzelm@6404
   237
wenzelm@6404
   238
fun gen_global_qed_with prep_att (alt_name, raw_atts) opt_text state =
wenzelm@6404
   239
  let
wenzelm@6404
   240
    val thy = Proof.theory_of state;
wenzelm@6404
   241
    val alt_atts = apsome (map (prep_att thy)) raw_atts;
wenzelm@6404
   242
  in Method.global_qed alt_name alt_atts opt_text state end;
wenzelm@6404
   243
wenzelm@6404
   244
val global_qed_with = global_result oo gen_global_qed_with Attrib.global_attribute;
wenzelm@6404
   245
val global_qed_with_i = global_result oo gen_global_qed_with (K I);
wenzelm@6404
   246
val global_qed = global_qed_with (None, None);
wenzelm@6404
   247
wenzelm@6404
   248
val global_terminal_proof = global_result o Method.global_terminal_proof;
wenzelm@6404
   249
val global_immediate_proof = global_result Method.global_immediate_proof;
wenzelm@6404
   250
val global_default_proof = global_result Method.global_default_proof;
wenzelm@6404
   251
wenzelm@6404
   252
wenzelm@6404
   253
(* common endings *)
wenzelm@6404
   254
wenzelm@6404
   255
fun qed opt_text = local_qed opt_text o global_qed opt_text;
wenzelm@6404
   256
fun terminal_proof opt_text = local_terminal_proof opt_text o global_terminal_proof opt_text;
wenzelm@6404
   257
val immediate_proof = local_immediate_proof o global_immediate_proof;
wenzelm@6404
   258
val default_proof = local_default_proof o global_default_proof;
wenzelm@5830
   259
wenzelm@5830
   260
wenzelm@5830
   261
(* use ML text *)
wenzelm@5830
   262
wenzelm@6331
   263
fun use_mltext txt opt_thy = #2 (Context.pass opt_thy (use_text false) txt);
wenzelm@6331
   264
fun use_mltext_theory txt thy = #2 (Context.pass_theory thy (use_text false) txt);
wenzelm@5830
   265
wenzelm@5830
   266
fun use_context txt = use_mltext_theory ("Context.>> (" ^ txt ^ ");");
wenzelm@5830
   267
wenzelm@5830
   268
fun use_let name body txt =
wenzelm@5830
   269
  use_context ("let val " ^ name ^ " = " ^ txt ^ " in\n" ^ body ^ " end");
wenzelm@5830
   270
wenzelm@5830
   271
val use_setup =
wenzelm@5915
   272
  use_let "setup: (theory -> theory) list" "Library.apply setup";
wenzelm@5830
   273
wenzelm@5830
   274
wenzelm@5830
   275
(* translation functions *)
wenzelm@5830
   276
wenzelm@5830
   277
val parse_ast_translation =
wenzelm@5830
   278
  use_let "parse_ast_translation: (string * (Syntax.ast list -> Syntax.ast)) list"
wenzelm@5830
   279
    "Theory.add_trfuns (parse_ast_translation, [], [], [])";
wenzelm@5830
   280
wenzelm@5830
   281
val parse_translation =
wenzelm@5830
   282
  use_let "parse_translation: (string * (term list -> term)) list"
wenzelm@5830
   283
    "Theory.add_trfuns ([], parse_translation, [], [])";
wenzelm@5830
   284
wenzelm@5830
   285
val print_translation =
wenzelm@5830
   286
  use_let "print_translation: (string * (term list -> term)) list"
wenzelm@5830
   287
    "Theory.add_trfuns ([], [], print_translation, [])";
wenzelm@5830
   288
wenzelm@5830
   289
val print_ast_translation =
wenzelm@5830
   290
  use_let "print_ast_translation: (string * (Syntax.ast list -> Syntax.ast)) list"
wenzelm@5830
   291
    "Theory.add_trfuns ([], [], [], print_ast_translation)";
wenzelm@5830
   292
wenzelm@5830
   293
val typed_print_translation =
wenzelm@5830
   294
  use_let "typed_print_translation: (string * (bool -> typ -> term list -> term)) list"
wenzelm@5830
   295
    "Theory.add_trfunsT typed_print_translation";
wenzelm@5830
   296
wenzelm@5830
   297
val token_translation =
wenzelm@5830
   298
  use_let "token_translation: (string * string * (string -> string * int)) list"
wenzelm@5830
   299
    "Theory.add_tokentrfuns token_translation";
wenzelm@5830
   300
wenzelm@5830
   301
wenzelm@5830
   302
(* add_oracle *)
wenzelm@5830
   303
wenzelm@5830
   304
fun add_oracle (name, txt) =
wenzelm@5830
   305
  use_let
wenzelm@5830
   306
    "oracle: bstring * (Sign.sg * Object.T -> term)"
wenzelm@5830
   307
    "Theory.add_oracle oracle"
wenzelm@5830
   308
    ("(" ^ quote name ^ ", " ^ txt ^ ")");
wenzelm@5830
   309
wenzelm@5830
   310
wenzelm@6371
   311
(* theory init and exit *)      (* FIXME move? rearrange? *)
wenzelm@5830
   312
wenzelm@6331
   313
fun begin_theory name parents files =
wenzelm@6266
   314
  let
wenzelm@6331
   315
    val paths = map (apfst Path.unpack) files;
wenzelm@6331
   316
    val thy = ThyInfo.begin_theory name parents paths;
wenzelm@6331
   317
  in Present.begin_theory name parents paths; thy end;
wenzelm@5830
   318
wenzelm@6331
   319
wenzelm@6331
   320
(* FIXME
wenzelm@5830
   321
fun end_theory thy =
wenzelm@5830
   322
  let val thy' = PureThy.end_theory thy in
wenzelm@6331
   323
    Present.end_theory (PureThy.get_name thy');
wenzelm@6198
   324
    transform_error ThyInfo.put_theory thy'
wenzelm@5830
   325
      handle exn => raise PureThy.ROLLBACK (thy', Some exn)     (* FIXME !!?? *)
wenzelm@5830
   326
  end;
wenzelm@6331
   327
*)
wenzelm@5830
   328
wenzelm@6331
   329
fun end_theory thy =
wenzelm@6331
   330
  (Present.end_theory (PureThy.get_name thy); ThyInfo.end_theory thy);
wenzelm@6331
   331
wenzelm@6331
   332
fun bg_theory (name, parents, files) () = begin_theory name parents files;
wenzelm@6331
   333
fun en_theory thy = (end_theory thy; ());
wenzelm@6331
   334
wenzelm@6331
   335
fun theory spec = Toplevel.init_theory (bg_theory spec) en_theory;
wenzelm@6246
   336
wenzelm@6246
   337
wenzelm@6246
   338
(* context switch *)
wenzelm@6246
   339
wenzelm@6483
   340
fun switch_theory load s =
wenzelm@6483
   341
  Toplevel.init_theory (fn () => (the (#2 (Context.pass None load s)))) (K ());
wenzelm@6246
   342
wenzelm@6246
   343
val context = switch_theory ThyInfo.use_thy;
wenzelm@6246
   344
val update_context = switch_theory ThyInfo.update_thy;
wenzelm@6246
   345
wenzelm@5830
   346
wenzelm@5830
   347
end;