src/HOL/Tools/Predicate_Compile/predicate_compile_fun.ML
changeset 35845 e5980f0ad025
parent 35411 cafb74a131da
child 35873 d09a58c890e3
equal deleted inserted replaced
35844:65258d2c3214 35845:e5980f0ad025
    85 
    85 
    86 (* creates the list of premises for every intro rule *)
    86 (* creates the list of premises for every intro rule *)
    87 (* theory -> term -> (string list, term list list) *)
    87 (* theory -> term -> (string list, term list list) *)
    88 
    88 
    89 fun dest_code_eqn eqn = let
    89 fun dest_code_eqn eqn = let
    90   val (lhs, rhs) = Logic.dest_equals (Logic.unvarify (Thm.prop_of eqn))
    90   val (lhs, rhs) = Logic.dest_equals (Logic.unvarify_global (Thm.prop_of eqn))
    91   val (func, args) = strip_comb lhs
    91   val (func, args) = strip_comb lhs
    92 in ((func, args), rhs) end;
    92 in ((func, args), rhs) end;
    93 
    93 
    94 (* TODO: does not work with higher order functions yet *)
    94 (* TODO: does not work with higher order functions yet *)
    95 fun mk_rewr_eq (func, pred) =
    95 fun mk_rewr_eq (func, pred) =
   370             (*
   370             (*
   371             val thy'' = Pred_Compile_Preproc.map (fold Symtab.update_new (consts ~~ prednames)) thy'
   371             val thy'' = Pred_Compile_Preproc.map (fold Symtab.update_new (consts ~~ prednames)) thy'
   372             *)
   372             *)
   373             
   373             
   374             val thy'' = Fun_Pred.map
   374             val thy'' = Fun_Pred.map
   375               (fold Item_Net.update (map (apfst Logic.varify)
   375               (fold Item_Net.update (map (apfst Logic.varify_global)
   376                 (distinct (op =) funs ~~ (#preds ind_result)))) thy'
   376                 (distinct (op =) funs ~~ (#preds ind_result)))) thy'
   377             (*val _ = print_specs thy'' specs*)
   377             (*val _ = print_specs thy'' specs*)
   378           in
   378           in
   379             (specs, thy'')
   379             (specs, thy'')
   380           end
   380           end
   395         SOME c => SOME (Const (c, pred_type T))
   395         SOME c => SOME (Const (c, pred_type T))
   396       | NONE => NONE)
   396       | NONE => NONE)
   397     | lookup_pred _ = NONE
   397     | lookup_pred _ = NONE
   398     *)
   398     *)
   399     fun lookup_pred t = lookup thy (Fun_Pred.get thy) t
   399     fun lookup_pred t = lookup thy (Fun_Pred.get thy) t
   400     val intro_t = (Logic.unvarify o prop_of) intro
   400     val intro_t = Logic.unvarify_global (prop_of intro)
   401     val (prems, concl) = Logic.strip_horn intro_t
   401     val (prems, concl) = Logic.strip_horn intro_t
   402     val frees = map fst (Term.add_frees intro_t [])
   402     val frees = map fst (Term.add_frees intro_t [])
   403     fun rewrite prem names =
   403     fun rewrite prem names =
   404       let
   404       let
   405         (*val _ = tracing ("Rewriting premise " ^ Syntax.string_of_term_global thy prem ^ "...")*)
   405         (*val _ = tracing ("Rewriting premise " ^ Syntax.string_of_term_global thy prem ^ "...")*)