src/Tools/Code/code_preproc.ML
changeset 42361 23f352990944
parent 41346 6673f6fa94ca
child 42383 0ae4ad40d7b5
equal deleted inserted replaced
42360:da8817d01e7c 42361:23f352990944
    88 val add_post = map_post o Simplifier.add_simp;
    88 val add_post = map_post o Simplifier.add_simp;
    89 val del_post = map_post o Simplifier.del_simp;
    89 val del_post = map_post o Simplifier.del_simp;
    90 
    90 
    91 fun add_unfold_post raw_thm thy =
    91 fun add_unfold_post raw_thm thy =
    92   let
    92   let
    93     val thm = Local_Defs.meta_rewrite_rule (ProofContext.init_global thy) raw_thm;
    93     val thm = Local_Defs.meta_rewrite_rule (Proof_Context.init_global thy) raw_thm;
    94     val thm_sym = Thm.symmetric thm;
    94     val thm_sym = Thm.symmetric thm;
    95   in
    95   in
    96     thy |> map_pre_post (fn (pre, post) =>
    96     thy |> map_pre_post (fn (pre, post) =>
    97       (pre |> Simplifier.add_simp thm, post |> Simplifier.add_simp thm_sym))
    97       (pre |> Simplifier.add_simp thm, post |> Simplifier.add_simp thm_sym))
    98   end;
    98   end;
   163     #> (map o apfst) (rewrite_eqn pre)
   163     #> (map o apfst) (rewrite_eqn pre)
   164   end;
   164   end;
   165 
   165 
   166 fun preprocess_conv thy =
   166 fun preprocess_conv thy =
   167   let
   167   let
   168     val ctxt = ProofContext.init_global thy;
   168     val ctxt = Proof_Context.init_global thy;
   169     val pre = (Simplifier.global_context thy o #pre o the_thmproc) thy;
   169     val pre = (Simplifier.global_context thy o #pre o the_thmproc) thy;
   170   in
   170   in
   171     Simplifier.rewrite pre
   171     Simplifier.rewrite pre
   172     #> trans_conv_rule (AxClass.unoverload_conv thy)
   172     #> trans_conv_rule (AxClass.unoverload_conv thy)
   173   end;
   173   end;
   184 
   184 
   185 fun postprocess_term thy = term_of_conv thy (postprocess_conv thy);
   185 fun postprocess_term thy = term_of_conv thy (postprocess_conv thy);
   186 
   186 
   187 fun print_codeproc thy =
   187 fun print_codeproc thy =
   188   let
   188   let
   189     val ctxt = ProofContext.init_global thy;
   189     val ctxt = Proof_Context.init_global thy;
   190     val pre = (#pre o the_thmproc) thy;
   190     val pre = (#pre o the_thmproc) thy;
   191     val post = (#post o the_thmproc) thy;
   191     val post = (#post o the_thmproc) thy;
   192     val functrans = (map fst o #functrans o the_thmproc) thy;
   192     val functrans = (map fst o #functrans o the_thmproc) thy;
   193   in
   193   in
   194     (Pretty.writeln o Pretty.chunks) [
   194     (Pretty.writeln o Pretty.chunks) [