src/Tools/Code/code_preproc.ML
changeset 34893 ecdc526af73a
parent 34891 99b9a6290446
child 34895 19fd499cddff
equal deleted inserted replaced
34892:6144d233b99a 34893:ecdc526af73a
    12   val add_unfold: thm -> theory -> theory
    12   val add_unfold: thm -> theory -> theory
    13   val add_functrans: string * (theory -> (thm * bool) list -> (thm * bool) list option) -> theory -> theory
    13   val add_functrans: string * (theory -> (thm * bool) list -> (thm * bool) list option) -> theory -> theory
    14   val del_functrans: string -> theory -> theory
    14   val del_functrans: string -> theory -> theory
    15   val simple_functrans: (theory -> thm list -> thm list option)
    15   val simple_functrans: (theory -> thm list -> thm list option)
    16     -> theory -> (thm * bool) list -> (thm * bool) list option
    16     -> theory -> (thm * bool) list -> (thm * bool) list option
       
    17   val preprocess_functrans: theory -> (thm * bool) list -> (thm * bool) list
    17   val print_codeproc: theory -> unit
    18   val print_codeproc: theory -> unit
    18 
    19 
    19   type code_algebra
    20   type code_algebra
    20   type code_graph
    21   type code_graph
    21   val cert: code_graph -> string -> Code.cert
    22   val cert: code_graph -> string -> Code.cert
   118   #> f
   119   #> f
   119   #> Thm.prop_of
   120   #> Thm.prop_of
   120   #> Logic.dest_equals
   121   #> Logic.dest_equals
   121   #> snd;
   122   #> snd;
   122 
   123 
   123 fun preprocess thy eqns =
   124 fun preprocess_functrans thy = 
   124   let
   125   let
   125     val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy;
       
   126     val functrans = (map (fn (_, (_, f)) => f thy) o #functrans
   126     val functrans = (map (fn (_, (_, f)) => f thy) o #functrans
   127       o the_thmproc) thy;
   127       o the_thmproc) thy;
   128   in
   128   in perhaps (perhaps_loop (perhaps_apply functrans)) end;
   129     eqns
   129 
   130     |> perhaps (perhaps_loop (perhaps_apply functrans))
   130 fun preprocess thy =
   131     |> (map o apfst) (rewrite_eqn pre)
   131   let
       
   132     val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy;
       
   133   in
       
   134     preprocess_functrans thy
       
   135     #> (map o apfst) (rewrite_eqn pre)
   132   end;
   136   end;
   133 
   137 
   134 fun preprocess_conv thy ct =
   138 fun preprocess_conv thy ct =
   135   let
   139   let
   136     val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy;
   140     val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy;