src/HOL/Tools/Function/fun_cases.ML
changeset 53995 1d457fc83f5c
parent 53994 4237859c186d
child 55997 9dc5ce83202c
equal deleted inserted replaced
53994:4237859c186d 53995:1d457fc83f5c
     7 
     7 
     8 signature FUN_CASES =
     8 signature FUN_CASES =
     9 sig
     9 sig
    10   val mk_fun_cases: Proof.context -> term -> thm
    10   val mk_fun_cases: Proof.context -> term -> thm
    11   val fun_cases: (Attrib.binding * term list) list -> local_theory ->
    11   val fun_cases: (Attrib.binding * term list) list -> local_theory ->
    12     thm list list * local_theory
    12     (string * thm list) list * local_theory
    13   val fun_cases_cmd: (Attrib.binding * string list) list -> local_theory ->
    13   val fun_cases_cmd: (Attrib.binding * string list) list -> local_theory ->
    14     thm list list * local_theory
    14     (string * thm list) list * local_theory
    15 end;
    15 end;
    16 
    16 
    17 structure Fun_Cases : FUN_CASES =
    17 structure Fun_Cases : FUN_CASES =
    18 struct
    18 struct
    19 
    19 
    48       map snd args
    48       map snd args
    49       |> burrow (grouped 10 Par_List.map (mk_fun_cases lthy o prep_prop lthy));
    49       |> burrow (grouped 10 Par_List.map (mk_fun_cases lthy o prep_prop lthy));
    50     val facts =
    50     val facts =
    51       map2 (fn ((a, atts), _) => fn thms => ((a, map (prep_att thy) atts), [(thms, [])]))
    51       map2 (fn ((a, atts), _) => fn thms => ((a, map (prep_att thy) atts), [(thms, [])]))
    52         args thmss;
    52         args thmss;
    53   in lthy |> Local_Theory.notes facts |>> map snd end;
    53   in lthy |> Local_Theory.notes facts end;
    54 
    54 
    55 val fun_cases = gen_fun_cases (K I) Syntax.check_prop;
    55 val fun_cases = gen_fun_cases (K I) Syntax.check_prop;
    56 val fun_cases_cmd = gen_fun_cases Attrib.intern_src Syntax.read_prop;
    56 val fun_cases_cmd = gen_fun_cases Attrib.intern_src Syntax.read_prop;
    57 
    57 
    58 val _ =
    58 val _ =
    59   Outer_Syntax.local_theory @{command_spec "fun_cases"}
    59   Outer_Syntax.local_theory @{command_spec "fun_cases"}
    60     "automatic derivation of simplified elimination rules for function equations"
    60     "create simplified instances of elimination rules for function equations"
    61     (Parse.and_list1 Parse_Spec.specs >> (snd oo fun_cases_cmd));
    61     (Parse.and_list1 Parse_Spec.specs >> (snd oo fun_cases_cmd));
    62 
    62 
    63 end;
    63 end;
    64 
    64