src/Pure/Isar/proof_context.ML
changeset 21648 c8a0370c9b93
parent 21643 bdf3e74727df
child 21667 ce813b82c88b
equal deleted inserted replaced
21647:fccafa917a68 21648:c8a0370c9b93
   764 
   764 
   765 
   765 
   766 (* put_thms *)
   766 (* put_thms *)
   767 
   767 
   768 fun update_thms _ ("", NONE) ctxt = ctxt
   768 fun update_thms _ ("", NONE) ctxt = ctxt
   769   | update_thms do_index ("", SOME ths) ctxt = ctxt |> map_thms (fn (facts, index) =>
   769   | update_thms opts ("", SOME ths) ctxt = ctxt |> map_thms (fn (facts, index) =>
   770       let
   770       let
   771         val index' = FactIndex.add_local do_index ("", ths) index;
   771         val index' = uncurry FactIndex.add_local opts ("", ths) index;
   772       in (facts, index') end)
   772       in (facts, index') end)
   773   | update_thms _ (bname, NONE) ctxt = ctxt |> map_thms (fn ((space, tab), index) =>
   773   | update_thms _ (bname, NONE) ctxt = ctxt |> map_thms (fn ((space, tab), index) =>
   774       let
   774       let
   775         val name = full_name ctxt bname;
   775         val name = full_name ctxt bname;
   776         val tab' = Symtab.delete_safe name tab;
   776         val tab' = Symtab.delete_safe name tab;
   777       in ((space, tab'), index) end)
   777       in ((space, tab'), index) end)
   778   | update_thms do_index (bname, SOME ths) ctxt = ctxt |> map_thms (fn ((space, tab), index) =>
   778   | update_thms opts (bname, SOME ths) ctxt = ctxt |> map_thms (fn ((space, tab), index) =>
   779       let
   779       let
   780         val name = full_name ctxt bname;
   780         val name = full_name ctxt bname;
   781         val space' = NameSpace.declare (naming_of ctxt) name space;
   781         val space' = NameSpace.declare (naming_of ctxt) name space;
   782         val tab' = Symtab.update (name, ths) tab;
   782         val tab' = Symtab.update (name, ths) tab;
   783         val index' = FactIndex.add_local do_index (name, ths) index;
   783         val index' = uncurry FactIndex.add_local opts (name, ths) index;
   784       in ((space', tab'), index') end);
   784       in ((space', tab'), index') end);
   785 
   785 
   786 fun put_thms thms ctxt =
   786 fun put_thms thms ctxt =
   787   ctxt |> map_naming (K local_naming) |> update_thms false thms |> restore_naming ctxt;
   787   ctxt |> map_naming (K local_naming) |> update_thms (true, false) thms |> restore_naming ctxt;
   788 
   788 
   789 
   789 
   790 (* note_thmss *)
   790 (* note_thmss *)
   791 
   791 
   792 local
   792 local
   797     val facts = PureThy.name_thmss false name (map (apfst (get ctxt)) raw_facts);
   797     val facts = PureThy.name_thmss false name (map (apfst (get ctxt)) raw_facts);
   798     fun app (th, attrs) x =
   798     fun app (th, attrs) x =
   799       swap (foldl_map (Thm.proof_attributes (attrs @ more_attrs @ [PureThy.kind k])) (x, th));
   799       swap (foldl_map (Thm.proof_attributes (attrs @ more_attrs @ [PureThy.kind k])) (x, th));
   800     val (res, ctxt') = fold_map app facts ctxt;
   800     val (res, ctxt') = fold_map app facts ctxt;
   801     val thms = PureThy.name_thms false false name (flat res);
   801     val thms = PureThy.name_thms false false name (flat res);
   802   in ((bname, thms), ctxt' |> update_thms (is_stmt ctxt) (bname, SOME thms)) end);
   802   in ((bname, thms), ctxt' |> update_thms (is_stmt ctxt, true) (bname, SOME thms)) end);
   803 
   803 
   804 in
   804 in
   805 
   805 
   806 fun note_thmss k = gen_note_thmss get_thms k;
   806 fun note_thmss k = gen_note_thmss get_thms k;
   807 fun note_thmss_i k = gen_note_thmss (K I) k;
   807 fun note_thmss_i k = gen_note_thmss (K I) k;