src/Pure/simplifier.ML
changeset 53171 a5e54d4d9081
parent 52458 210bca64b894
child 54388 8b165615ffe3
equal deleted inserted replaced
53170:96f7adb55d72 53171:a5e54d4d9081
   127 
   127 
   128 
   128 
   129 (* global simprocs *)
   129 (* global simprocs *)
   130 
   130 
   131 fun Addsimprocs args =
   131 fun Addsimprocs args =
   132   Context.>> (Context.map_theory (map_theory_simpset (fn ctxt => ctxt addsimprocs args)));
   132   Theory.setup (map_theory_simpset (fn ctxt => ctxt addsimprocs args));
   133 
   133 
   134 fun Delsimprocs args =
   134 fun Delsimprocs args =
   135   Context.>> (Context.map_theory (map_theory_simpset (fn ctxt => ctxt delsimprocs args)));
   135   Theory.setup (map_theory_simpset (fn ctxt => ctxt delsimprocs args));
   136 
   136 
   137 
   137 
   138 
   138 
   139 (** named simprocs **)
   139 (** named simprocs **)
   140 
   140 
   152 val get_simprocs = Simprocs.get o Context.Proof;
   152 val get_simprocs = Simprocs.get o Context.Proof;
   153 
   153 
   154 fun check_simproc ctxt = Name_Space.check (Context.Proof ctxt) (get_simprocs ctxt) #> #1;
   154 fun check_simproc ctxt = Name_Space.check (Context.Proof ctxt) (get_simprocs ctxt) #> #1;
   155 val the_simproc = Name_Space.get o get_simprocs;
   155 val the_simproc = Name_Space.get o get_simprocs;
   156 
   156 
   157 val _ =
   157 val _ = Theory.setup
   158   Context.>> (Context.map_theory
   158   (ML_Antiquote.value (Binding.name "simproc")
   159    (ML_Antiquote.value (Binding.name "simproc")
   159     (Args.context -- Scan.lift (Parse.position Args.name)
   160       (Args.context -- Scan.lift (Parse.position Args.name)
   160       >> (fn (ctxt, name) =>
   161         >> (fn (ctxt, name) =>
   161         "Simplifier.the_simproc ML_context " ^ ML_Syntax.print_string (check_simproc ctxt name))));
   162           "Simplifier.the_simproc ML_context " ^
       
   163             ML_Syntax.print_string (check_simproc ctxt name)))));
       
   164 
   162 
   165 
   163 
   166 (* define simprocs *)
   164 (* define simprocs *)
   167 
   165 
   168 local
   166 local
   325 end;
   323 end;
   326 
   324 
   327 
   325 
   328 (* setup attributes *)
   326 (* setup attributes *)
   329 
   327 
   330 val _ = Context.>> (Context.map_theory
   328 val _ = Theory.setup
   331  (Attrib.setup (Binding.name simpN) (Attrib.add_del simp_add simp_del)
   329  (Attrib.setup (Binding.name simpN) (Attrib.add_del simp_add simp_del)
   332     "declaration of Simplifier rewrite rule" #>
   330     "declaration of Simplifier rewrite rule" #>
   333   Attrib.setup (Binding.name congN) (Attrib.add_del cong_add cong_del)
   331   Attrib.setup (Binding.name congN) (Attrib.add_del cong_add cong_del)
   334     "declaration of Simplifier congruence rule" #>
   332     "declaration of Simplifier congruence rule" #>
   335   Attrib.setup (Binding.name "simproc") simproc_att
   333   Attrib.setup (Binding.name "simproc") simproc_att
   336     "declaration of simplification procedures" #>
   334     "declaration of simplification procedures" #>
   337   Attrib.setup (Binding.name "simplified") simplified "simplified rule"));
   335   Attrib.setup (Binding.name "simplified") simplified "simplified rule");
   338 
   336 
   339 
   337 
   340 
   338 
   341 (** method syntax **)
   339 (** method syntax **)
   342 
   340