src/Pure/Isar/attrib.ML
changeset 15570 8d8c70b41bab
parent 15531 08c8dad8e399
child 15596 8665d08085df
equal deleted inserted replaced
15569:1b3115d1a8df 15570:8d8c70b41bab
   133 
   133 
   134 (* theorems *)
   134 (* theorems *)
   135 
   135 
   136 val thm_sel = Args.parens (Scan.pass () (Args.enum1 "," (Scan.lift
   136 val thm_sel = Args.parens (Scan.pass () (Args.enum1 "," (Scan.lift
   137   (   Args.nat --| Args.$$$ "-" -- Args.nat >> op upto
   137   (   Args.nat --| Args.$$$ "-" -- Args.nat >> op upto
   138    || Args.nat >> single)) >> flat));
   138    || Args.nat >> single)) >> List.concat));
   139 
   139 
   140 fun gen_thm get attrib app =
   140 fun gen_thm get attrib app =
   141   Scan.depend (fn st => Args.name -- Scan.option thm_sel -- Args.opt_attribs >>
   141   Scan.depend (fn st => Args.name -- Scan.option thm_sel -- Args.opt_attribs >>
   142     (fn (name, srcs) => app ((st, get st name), map (attrib st) srcs)));
   142     (fn (name, srcs) => app ((st, get st name), map (attrib st) srcs)));
   143 
   143 
   144 val global_thm = gen_thm PureThy.get_thm global_attribute Thm.apply_attributes;
   144 val global_thm = gen_thm PureThy.get_thm global_attribute Thm.apply_attributes;
   145 val global_thms = gen_thm PureThy.get_thms global_attribute Thm.applys_attributes;
   145 val global_thms = gen_thm PureThy.get_thms global_attribute Thm.applys_attributes;
   146 val global_thmss = Scan.repeat global_thms >> flat;
   146 val global_thmss = Scan.repeat global_thms >> List.concat;
   147 
   147 
   148 val local_thm = gen_thm ProofContext.get_thm local_attribute' Thm.apply_attributes;
   148 val local_thm = gen_thm ProofContext.get_thm local_attribute' Thm.apply_attributes;
   149 val local_thms = gen_thm ProofContext.get_thms local_attribute' Thm.applys_attributes;
   149 val local_thms = gen_thm ProofContext.get_thms local_attribute' Thm.applys_attributes;
   150 val local_thmss = Scan.repeat local_thms >> flat;
   150 val local_thmss = Scan.repeat local_thms >> List.concat;
   151 
   151 
   152 
   152 
   153 
   153 
   154 (** attribute syntax **)
   154 (** attribute syntax **)
   155 
   155 
   216         val _ = if exists has_type_var tinsts
   216         val _ = if exists has_type_var tinsts
   217               then error
   217               then error
   218                 "Type instantiations must occur before term instantiations."
   218                 "Type instantiations must occur before term instantiations."
   219               else ();
   219               else ();
   220 
   220 
   221         val Tinsts = filter has_type_var insts;
   221         val Tinsts = List.filter has_type_var insts;
   222         val tinsts = filter_out has_type_var insts;
   222         val tinsts = filter_out has_type_var insts;
   223 
   223 
   224         (* Type instantiations first *)
   224         (* Type instantiations first *)
   225         (* Process type insts: Tinsts_env *)
   225         (* Process type insts: Tinsts_env *)
   226         fun absent xi = error
   226         fun absent xi = error