src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML
changeset 57962 0284a7d083be
parent 56245 84fc7dfa3cd4
child 59057 5b649fb2f2e1
equal deleted inserted replaced
57961:10b2f60b70f0 57962:0284a7d083be
   159 
   159 
   160 
   160 
   161 fun inline_equations thy th =
   161 fun inline_equations thy th =
   162   let
   162   let
   163     val ctxt = Proof_Context.init_global thy
   163     val ctxt = Proof_Context.init_global thy
   164     val inline_defs = Predicate_Compile_Inline_Defs.get ctxt
   164     val inline_defs = Named_Theorems.get ctxt @{named_theorems code_pred_inline}
   165     val th' = (Simplifier.full_simplify (put_simpset HOL_basic_ss ctxt addsimps inline_defs)) th
   165     val th' = Simplifier.full_simplify (put_simpset HOL_basic_ss ctxt addsimps inline_defs) th
   166     (*val _ = print_step options
   166     (*val _ = print_step options
   167       ("Inlining " ^ (Syntax.string_of_term_global thy (prop_of th))
   167       ("Inlining " ^ (Syntax.string_of_term_global thy (prop_of th))
   168        ^ "with " ^ (commas (map ((Syntax.string_of_term_global thy) o prop_of) inline_defs))
   168        ^ "with " ^ (commas (map ((Syntax.string_of_term_global thy) o prop_of) inline_defs))
   169        ^" to " ^ (Syntax.string_of_term_global thy (prop_of th')))*)
   169        ^" to " ^ (Syntax.string_of_term_global thy (prop_of th')))*)
   170   in
   170   in
   206           SOME th
   206           SOME th
   207         else
   207         else
   208           NONE
   208           NONE
   209     fun filter_defs ths = map_filter filtering (map (normalize thy o Thm.transfer thy) ths)
   209     fun filter_defs ths = map_filter filtering (map (normalize thy o Thm.transfer thy) ths)
   210     val spec =
   210     val spec =
   211       (case filter_defs (Predicate_Compile_Alternative_Defs.get ctxt) of
   211       (case filter_defs (Named_Theorems.get ctxt @{named_theorems code_pred_def}) of
   212         [] =>
   212         [] =>
   213           (case Spec_Rules.retrieve ctxt t of
   213           (case Spec_Rules.retrieve ctxt t of
   214             [] => error ("No specification for " ^ Syntax.string_of_term_global thy t)
   214             [] => error ("No specification for " ^ Syntax.string_of_term_global thy t)
   215           | ((_, (_, ths)) :: _) => filter_defs ths)
   215           | ((_, (_, ths)) :: _) => filter_defs ths)
   216       | ths => rev ths)
   216       | ths => ths)
   217     val _ =
   217     val _ =
   218       if show_intermediate_results options then
   218       if show_intermediate_results options then
   219         tracing ("Specification for " ^ (Syntax.string_of_term_global thy t) ^ ":\n" ^
   219         tracing ("Specification for " ^ (Syntax.string_of_term_global thy t) ^ ":\n" ^
   220           commas (map (Display.string_of_thm_global thy) spec))
   220           commas (map (Display.string_of_thm_global thy) spec))
   221       else ()
   221       else ()