src/HOL/BNF/Tools/bnf_lfp.ML
changeset 51758 55963309557b
parent 51757 7babcb61aa5c
child 51761 4c9f08836d87
equal deleted inserted replaced
51757:7babcb61aa5c 51758:55963309557b
     6 Datatype construction.
     6 Datatype construction.
     7 *)
     7 *)
     8 
     8 
     9 signature BNF_LFP =
     9 signature BNF_LFP =
    10 sig
    10 sig
    11   val construct_lfp: mixfix list -> (string * sort) list option -> binding list ->
    11   val construct_lfp: mixfix list -> (string * sort) list option -> binding list -> binding list ->
    12     binding list list -> typ list * typ list list -> BNF_Def.BNF list -> local_theory ->
    12     binding list list -> typ list * typ list list -> BNF_Def.BNF list -> local_theory ->
    13     BNF_FP.fp_result * local_theory
    13     BNF_FP.fp_result * local_theory
    14 end;
    14 end;
    15 
    15 
    16 structure BNF_LFP : BNF_LFP =
    16 structure BNF_LFP : BNF_LFP =
    24 open BNF_FP_Def_Sugar
    24 open BNF_FP_Def_Sugar
    25 open BNF_LFP_Util
    25 open BNF_LFP_Util
    26 open BNF_LFP_Tactics
    26 open BNF_LFP_Tactics
    27 
    27 
    28 (*all BNFs have the same lives*)
    28 (*all BNFs have the same lives*)
    29 fun construct_lfp mixfixes resBs bs set_bss (resDs, Dss) bnfs lthy =
    29 fun construct_lfp mixfixes resBs bs map_bs set_bss (resDs, Dss) bnfs lthy =
    30   let
    30   let
    31     val timer = time (Timer.startRealTimer ());
    31     val timer = time (Timer.startRealTimer ());
    32 
    32 
    33     val note_all = Config.get lthy bnf_note_all;
    33     val note_all = Config.get lthy bnf_note_all;
    34 
    34 
  1732           end;
  1732           end;
  1733 
  1733 
  1734         fun wit_tac _ = mk_wit_tac n (flat ctor_set_thmss) (maps wit_thms_of_bnf bnfs);
  1734         fun wit_tac _ = mk_wit_tac n (flat ctor_set_thmss) (maps wit_thms_of_bnf bnfs);
  1735 
  1735 
  1736         val (Ibnfs, lthy) =
  1736         val (Ibnfs, lthy) =
  1737           fold_map7 (fn tacs => fn b => fn set_bs => fn mapx => fn sets => fn T => fn wits =>
  1737           fold_map8 (fn tacs => fn b => fn map_b => fn set_bs => fn mapx => fn sets => fn T =>
  1738               fn lthy =>
  1738               fn wits => fn lthy =>
  1739             bnf_def Dont_Inline (user_policy Note_Some) I tacs wit_tac (SOME deads) set_bs
  1739             bnf_def Dont_Inline (user_policy Note_Some) I tacs wit_tac (SOME deads) map_b set_bs
  1740               (((((b, fold_rev Term.absfree fs' mapx), sets), absdummy T bd), wits), NONE) lthy
  1740               (((((b, fold_rev Term.absfree fs' mapx), sets), absdummy T bd), wits), NONE) lthy
  1741             |> register_bnf (Local_Theory.full_name lthy b))
  1741             |> register_bnf (Local_Theory.full_name lthy b))
  1742           tacss bs set_bss fs_maps setss_by_bnf Ts ctor_witss lthy;
  1742           tacss bs map_bs set_bss fs_maps setss_by_bnf Ts ctor_witss lthy;
  1743 
  1743 
  1744         val fold_maps = fold_thms lthy (map (fn bnf =>
  1744         val fold_maps = fold_thms lthy (map (fn bnf =>
  1745           mk_unabs_def m (map_def_of_bnf bnf RS meta_eq_to_obj_eq)) Ibnfs);
  1745           mk_unabs_def m (map_def_of_bnf bnf RS meta_eq_to_obj_eq)) Ibnfs);
  1746 
  1746 
  1747         val fold_sets = fold_thms lthy (maps (fn bnf =>
  1747         val fold_sets = fold_thms lthy (maps (fn bnf =>