src/HOL/Tools/inductive.ML
changeset 33726 0878aecbf119
parent 33671 4b0f2599ed48
child 33766 c679f05600cd
equal deleted inserted replaced
33725:a8481da77270 33726:0878aecbf119
    49     (binding * string option * mixfix) list ->
    49     (binding * string option * mixfix) list ->
    50     (binding * string option * mixfix) list ->
    50     (binding * string option * mixfix) list ->
    51     (Attrib.binding * string) list ->
    51     (Attrib.binding * string) list ->
    52     (Facts.ref * Attrib.src list) list ->
    52     (Facts.ref * Attrib.src list) list ->
    53     bool -> local_theory -> inductive_result * local_theory
    53     bool -> local_theory -> inductive_result * local_theory
    54   val add_inductive_global: serial -> inductive_flags ->
    54   val add_inductive_global: inductive_flags ->
    55     ((binding * typ) * mixfix) list -> (string * typ) list -> (Attrib.binding * term) list ->
    55     ((binding * typ) * mixfix) list -> (string * typ) list -> (Attrib.binding * term) list ->
    56     thm list -> theory -> inductive_result * theory
    56     thm list -> theory -> inductive_result * theory
    57   val arities_of: thm -> (string * int) list
    57   val arities_of: thm -> (string * int) list
    58   val params_of: thm -> term list
    58   val params_of: thm -> term list
    59   val partition_rules: thm -> thm list -> (string * thm list) list
    59   val partition_rules: thm -> thm list -> (string * thm list) list
   884     val monos = Attrib.eval_thms lthy raw_monos;
   884     val monos = Attrib.eval_thms lthy raw_monos;
   885     val flags = {quiet_mode = false, verbose = verbose, alt_name = Binding.empty,
   885     val flags = {quiet_mode = false, verbose = verbose, alt_name = Binding.empty,
   886       coind = coind, no_elim = false, no_ind = false, skip_mono = false, fork_mono = not int};
   886       coind = coind, no_elim = false, no_ind = false, skip_mono = false, fork_mono = not int};
   887   in
   887   in
   888     lthy
   888     lthy
   889     |> Local_Theory.set_group (serial ())
       
   890     |> gen_add_inductive_i mk_def flags cs (map (apfst Binding.name_of o fst) ps) intrs monos
   889     |> gen_add_inductive_i mk_def flags cs (map (apfst Binding.name_of o fst) ps) intrs monos
   891   end;
   890   end;
   892 
   891 
   893 val add_inductive_i = gen_add_inductive_i add_ind_def;
   892 val add_inductive_i = gen_add_inductive_i add_ind_def;
   894 val add_inductive = gen_add_inductive add_ind_def;
   893 val add_inductive = gen_add_inductive add_ind_def;
   895 
   894 
   896 fun add_inductive_global group flags cnames_syn pnames pre_intros monos thy =
   895 fun add_inductive_global flags cnames_syn pnames pre_intros monos thy =
   897   let
   896   let
   898     val name = Sign.full_name thy (fst (fst (hd cnames_syn)));
   897     val name = Sign.full_name thy (fst (fst (hd cnames_syn)));
   899     val ctxt' = thy
   898     val ctxt' = thy
   900       |> Theory_Target.init NONE
   899       |> Theory_Target.init NONE
   901       |> Local_Theory.set_group group
       
   902       |> add_inductive_i flags cnames_syn pnames pre_intros monos |> snd
   900       |> add_inductive_i flags cnames_syn pnames pre_intros monos |> snd
   903       |> Local_Theory.exit;
   901       |> Local_Theory.exit;
   904     val info = #2 (the_inductive ctxt' name);
   902     val info = #2 (the_inductive ctxt' name);
   905   in (info, ProofContext.theory_of ctxt') end;
   903   in (info, ProofContext.theory_of ctxt') end;
   906 
   904