src/Pure/Isar/code.ML
changeset 26021 25d06476727e
parent 25968 66cfe1d00be0
child 26435 bdce320cd426
equal deleted inserted replaced
26020:ffe1a032d24b 26021:25d06476727e
    11   val add_func: thm -> theory -> theory
    11   val add_func: thm -> theory -> theory
    12   val add_liberal_func: thm -> theory -> theory
    12   val add_liberal_func: thm -> theory -> theory
    13   val add_default_func: thm -> theory -> theory
    13   val add_default_func: thm -> theory -> theory
    14   val add_default_func_attr: Attrib.src
    14   val add_default_func_attr: Attrib.src
    15   val del_func: thm -> theory -> theory
    15   val del_func: thm -> theory -> theory
       
    16   val del_funcs: string -> theory -> theory
    16   val add_funcl: string * thm list Susp.T -> theory -> theory
    17   val add_funcl: string * thm list Susp.T -> theory -> theory
    17   val add_inline: thm -> theory -> theory
    18   val add_inline: thm -> theory -> theory
    18   val del_inline: thm -> theory -> theory
    19   val del_inline: thm -> theory -> theory
    19   val add_inline_proc: string * (theory -> cterm list -> thm list) -> theory -> theory
    20   val add_inline_proc: string * (theory -> cterm list -> thm list) -> theory -> theory
    20   val del_inline_proc: string -> theory -> theory
    21   val del_inline_proc: string -> theory -> theory
   159   | add_lthms lthms (sels, dels) =
   160   | add_lthms lthms (sels, dels) =
   160       fold add_thm (Susp.force lthms) (sels, dels);
   161       fold add_thm (Susp.force lthms) (sels, dels);
   161 
   162 
   162 fun del_thm thm (sels, dels) =
   163 fun del_thm thm (sels, dels) =
   163   (Susp.value (remove Thm.eq_thm_prop thm (Susp.force sels)), thm :: dels);
   164   (Susp.value (remove Thm.eq_thm_prop thm (Susp.force sels)), thm :: dels);
       
   165 
       
   166 fun del_thms (sels, dels) =
       
   167   let
       
   168     val all_sels = Susp.force sels;
       
   169   in (Susp.value [], rev all_sels @ dels) end;
   164 
   170 
   165 fun pretty_sdthms ctxt (sels, _) = pretty_lthms ctxt sels;
   171 fun pretty_sdthms ctxt (sels, _) = pretty_lthms ctxt sels;
   166 
   172 
   167 
   173 
   168 (* fundamental melting operations *)
   174 (* fundamental melting operations *)
   768         in map_exec_purge (SOME [c]) (map_funcs
   774         in map_exec_purge (SOME [c]) (map_funcs
   769           (Symtab.map_entry c (apsnd (del_thm func)))) thy
   775           (Symtab.map_entry c (apsnd (del_thm func)))) thy
   770         end
   776         end
   771     | NONE => thy;
   777     | NONE => thy;
   772 
   778 
       
   779 fun del_funcs const = map_exec_purge (SOME [const])
       
   780   (map_funcs (Symtab.map_entry const (apsnd del_thms)));
       
   781 
   773 fun add_funcl (const, lthms) thy =
   782 fun add_funcl (const, lthms) thy =
   774   let
   783   let
   775     val lthms' = certificate thy (fn thy => certify_const thy const) lthms;
   784     val lthms' = certificate thy (fn thy => certify_const thy const) lthms;
   776       (*FIXME must check compatibility with sort algebra;
   785       (*FIXME must check compatibility with sort algebra;
   777         alas, naive checking results in non-termination!*)
   786         alas, naive checking results in non-termination!*)