src/Pure/Isar/local_theory.ML
changeset 19991 0c9650664d47
parent 19913 3f844845ecb8
child 20032 2087e5634598
equal deleted inserted replaced
19990:837f1b10722c 19991:0c9650664d47
   130 (* init -- restore -- exit *)
   130 (* init -- restore -- exit *)
   131 
   131 
   132 fun init_i NONE thy = ProofContext.init thy
   132 fun init_i NONE thy = ProofContext.init thy
   133   | init_i (SOME loc) thy =
   133   | init_i (SOME loc) thy =
   134       thy
   134       thy
   135       |> Locale.init loc
   135       |> (fn thy => ([], Locale.init loc thy))
   136       ||>> ProofContext.inferred_fixes
   136       ||>> ProofContext.inferred_fixes
   137       |> (fn ((view, params), ctxt) => Data.put
   137       |> (fn ((view, params), ctxt) => Data.put
   138           {locale = SOME (loc, (view, ctxt)),
   138           {locale = SOME (loc, (view, ctxt)),
   139            params = params,
   139            params = params,
   140            hyps = ProofContext.assms_of ctxt,
   140            hyps = ProofContext.assms_of ctxt,
   214   in
   214   in
   215     ctxt |>
   215     ctxt |>
   216     (case locale_of ctxt of
   216     (case locale_of ctxt of
   217       NONE => theory_result (PureThy.note_thmss_i kind (Attrib.map_facts attrib facts'))
   217       NONE => theory_result (PureThy.note_thmss_i kind (Attrib.map_facts attrib facts'))
   218     | SOME (loc, _) =>
   218     | SOME (loc, _) =>
   219         locale_result (apfst #1 o Locale.add_thmss kind loc facts'))
   219         locale_result (apfst #1 o (fn (_, ctxt) => Locale.add_thmss kind loc facts' ctxt)))
   220     ||> (#2 o ProofContext.note_thmss_i (Attrib.map_facts attrib facts))
   220     ||> (#2 o ProofContext.note_thmss_i (Attrib.map_facts attrib facts))
   221   end;
   221   end;
   222 
   222 
   223 fun note (a, ths) ctxt =
   223 fun note (a, ths) ctxt =
   224   ctxt |> notes PureThy.theoremK [(a, [(ths, [])])] |>> hd;
   224   ctxt |> notes PureThy.theoremK [(a, [(ths, [])])] |>> hd;