src/Pure/Isar/attrib.ML
changeset 46775 6287653e63ec
parent 46512 4f9f61f9b535
child 46903 3d44892ac0d6
equal deleted inserted replaced
46774:38f113b052b1 46775:6287653e63ec
   189     fun get_named pos name = get (Facts.Named ((name, pos), NONE));
   189     fun get_named pos name = get (Facts.Named ((name, pos), NONE));
   190   in
   190   in
   191     Parse.$$$ "[" |-- Args.attribs (intern thy) --| Parse.$$$ "]" >> (fn srcs =>
   191     Parse.$$$ "[" |-- Args.attribs (intern thy) --| Parse.$$$ "]" >> (fn srcs =>
   192       let
   192       let
   193         val atts = map (attribute_i thy) srcs;
   193         val atts = map (attribute_i thy) srcs;
   194         val (context', th') =
   194         val (th', context') = fold (uncurry o Thm.apply_attribute) atts (Drule.dummy_thm, context);
   195           Library.apply (map Thm.apply_attribute atts) (context, Drule.dummy_thm);
       
   196       in (context', pick "" [th']) end)
   195       in (context', pick "" [th']) end)
   197     ||
   196     ||
   198     (Scan.ahead Args.alt_name -- Args.named_fact get_fact
   197     (Scan.ahead Args.alt_name -- Args.named_fact get_fact
   199       >> (fn (s, fact) => ("", Facts.Fact s, fact)) ||
   198       >> (fn (s, fact) => ("", Facts.Fact s, fact)) ||
   200      Scan.ahead (Parse.position fact_name) :|-- (fn (name, pos) =>
   199      Scan.ahead (Parse.position fact_name) :|-- (fn (name, pos) =>
   202         >> (fn (fact, sel) => (name, Facts.Named ((name, pos), sel), fact))))
   201         >> (fn (fact, sel) => (name, Facts.Named ((name, pos), sel), fact))))
   203     -- Args.opt_attribs (intern thy) >> (fn ((name, thmref, fact), srcs) =>
   202     -- Args.opt_attribs (intern thy) >> (fn ((name, thmref, fact), srcs) =>
   204       let
   203       let
   205         val ths = Facts.select thmref fact;
   204         val ths = Facts.select thmref fact;
   206         val atts = map (attribute_i thy) srcs;
   205         val atts = map (attribute_i thy) srcs;
   207         val (context', ths') =
   206         val (ths', context') =
   208           Library.foldl_map (Library.apply (map Thm.apply_attribute atts)) (context, ths);
   207           fold_map (curry (fold (uncurry o Thm.apply_attribute) atts)) ths context;
   209       in (context', pick name ths') end)
   208       in (context', pick name ths') end)
   210   end);
   209   end);
   211 
   210 
   212 in
   211 in
   213 
   212