src/Pure/Isar/bundle.ML
changeset 72450 24bd1316eaae
parent 72449 e1ee4a9902bd
child 72452 9017dfa56367
equal deleted inserted replaced
72449:e1ee4a9902bd 72450:24bd1316eaae
    25   val including_cmd: (xstring * Position.T) list -> Proof.state -> Proof.state
    25   val including_cmd: (xstring * Position.T) list -> Proof.state -> Proof.state
    26   val context: string list -> Element.context_i list ->
    26   val context: string list -> Element.context_i list ->
    27     local_theory -> Binding.scope * local_theory
    27     local_theory -> Binding.scope * local_theory
    28   val context_cmd: (xstring * Position.T) list -> Element.context list ->
    28   val context_cmd: (xstring * Position.T) list -> Element.context list ->
    29     local_theory -> Binding.scope * local_theory
    29     local_theory -> Binding.scope * local_theory
    30   val begin_nested: Context.generic -> local_theory
    30   val begin_nested_target: Context.generic -> local_theory
    31   val end_nested: local_theory -> Context.generic
    31   val end_nested_target: local_theory -> Context.generic
    32 end;
    32 end;
    33 
    33 
    34 structure Bundle: BUNDLE =
    34 structure Bundle: BUNDLE =
    35 struct
    35 struct
    36 
    36 
   211 fun gen_context get prep_decl raw_incls raw_elems lthy =
   211 fun gen_context get prep_decl raw_incls raw_elems lthy =
   212   lthy
   212   lthy
   213   |> gen_includes get raw_incls
   213   |> gen_includes get raw_incls
   214   |> prep_decl ([], []) I raw_elems
   214   |> prep_decl ([], []) I raw_elems
   215   |> (#4 o fst)
   215   |> (#4 o fst)
   216   |> Local_Theory.begin_target;
   216   |> Local_Theory.begin_nested;
   217 
   217 
   218 in
   218 in
   219 
   219 
   220 val unbundle = gen_activate Local_Theory.notes get_bundle;
   220 val unbundle = gen_activate Local_Theory.notes get_bundle;
   221 val unbundle_cmd = gen_activate Local_Theory.notes get_bundle_cmd;
   221 val unbundle_cmd = gen_activate Local_Theory.notes get_bundle_cmd;
   232 
   232 
   233 val context = gen_context get_bundle Expression.cert_declaration;
   233 val context = gen_context get_bundle Expression.cert_declaration;
   234 
   234 
   235 val context_cmd = gen_context get_bundle_cmd Expression.read_declaration;
   235 val context_cmd = gen_context get_bundle_cmd Expression.read_declaration;
   236 
   236 
   237 val begin_nested =
   237 val begin_nested_target =
   238   Context.cases Named_Target.theory_init Local_Theory.assert;
   238   Context.cases Named_Target.theory_init Local_Theory.assert;
   239 
   239 
   240 fun end_nested lthy = 
   240 fun end_nested_target lthy = 
   241   if Named_Target.is_theory lthy
   241   if Named_Target.is_theory lthy
   242   then Context.Theory (Local_Theory.exit_global lthy)
   242   then Context.Theory (Local_Theory.exit_global lthy)
   243   else Context.Proof lthy;
   243   else Context.Proof lthy;
   244 
   244 
   245 end;
   245 end;