equal
deleted
inserted
replaced
656 map_exec_purge (SOME cs) (map_funcs |
656 map_exec_purge (SOME cs) (map_funcs |
657 (fold (fn (c, thm) => Consttab.map_default |
657 (fold (fn (c, thm) => Consttab.map_default |
658 (c, (Susp.value [], [])) (add_thm thm)) funcs)) thy |
658 (c, (Susp.value [], [])) (add_thm thm)) funcs)) thy |
659 end; |
659 end; |
660 |
660 |
|
661 fun delete_force msg key xs = |
|
662 if AList.defined (op =) xs key then AList.delete (op =) key xs |
|
663 else error ("No such " ^ msg ^ ": " ^ quote key); |
|
664 |
661 val add_func = gen_add_func true; |
665 val add_func = gen_add_func true; |
662 val add_func_legacy = gen_add_func false; |
666 val add_func_legacy = gen_add_func false; |
663 |
667 |
664 fun del_func thm thy = |
668 fun del_func thm thy = |
665 let |
669 let |
708 |
712 |
709 fun add_inline_proc (name, f) = |
713 fun add_inline_proc (name, f) = |
710 (map_exec_purge NONE o map_preproc o apfst o apsnd) (AList.update (op =) (name, (serial (), f))); |
714 (map_exec_purge NONE o map_preproc o apfst o apsnd) (AList.update (op =) (name, (serial (), f))); |
711 |
715 |
712 fun del_inline_proc name = |
716 fun del_inline_proc name = |
713 (map_exec_purge NONE o map_preproc o apfst o apsnd) (AList.delete (op =) name); |
717 (map_exec_purge NONE o map_preproc o apfst o apsnd) (delete_force "inline procedure" name); |
714 |
718 |
715 fun add_preproc (name, f) = |
719 fun add_preproc (name, f) = |
716 (map_exec_purge NONE o map_preproc o apsnd) (AList.update (op =) (name, (serial (), f))); |
720 (map_exec_purge NONE o map_preproc o apsnd) (AList.update (op =) (name, (serial (), f))); |
717 |
721 |
718 fun del_preproc name = |
722 fun del_preproc name = |
719 (map_exec_purge NONE o map_preproc o apsnd) (AList.delete (op =) name); |
723 (map_exec_purge NONE o map_preproc o apsnd) (delete_force "preprocessor" name); |
720 |
724 |
721 local |
725 local |
722 |
726 |
723 fun gen_apply_inline_proc prep post thy f x = |
727 fun gen_apply_inline_proc prep post thy f x = |
724 let |
728 let |
761 fun preprocess_cterm ct = |
765 fun preprocess_cterm ct = |
762 let |
766 let |
763 val thy = Thm.theory_of_cterm ct; |
767 val thy = Thm.theory_of_cterm ct; |
764 in |
768 in |
765 ct |
769 ct |
766 |> Thm.reflexive |
770 |> MetaSimplifier.rewrite false ((#inlines o the_preproc o get_exec) thy) |
767 |> fold (rhs_conv o MetaSimplifier.rewrite false o single) |
|
768 ((#inlines o the_preproc o get_exec) thy) |
|
769 |> fold (fn (_, (_, f)) => rhs_conv (apply_inline_proc_cterm thy f)) |
771 |> fold (fn (_, (_, f)) => rhs_conv (apply_inline_proc_cterm thy f)) |
770 ((#inline_procs o the_preproc o get_exec) thy) |
772 ((#inline_procs o the_preproc o get_exec) thy) |
771 end; |
773 end; |
772 |
774 |
773 end; (*local*) |
775 end; (*local*) |