src/HOL/Tools/BNF/bnf_fp_util.ML
changeset 55701 38f75365fc2a
parent 55642 63beb38e9258
child 55703 a21069381ba5
equal deleted inserted replaced
55700:cf6a029b28d8 55701:38f75365fc2a
   178 
   178 
   179   val mk_strong_coinduct_thm: thm -> thm list -> thm list -> Proof.context -> thm
   179   val mk_strong_coinduct_thm: thm -> thm list -> thm list -> Proof.context -> thm
   180 
   180 
   181   val fp_bnf: (binding list -> (string * sort) list -> typ list * typ list list ->
   181   val fp_bnf: (binding list -> (string * sort) list -> typ list * typ list list ->
   182       BNF_Def.bnf list -> local_theory -> 'a) ->
   182       BNF_Def.bnf list -> local_theory -> 'a) ->
   183     binding list -> (string * sort) list -> ((string * sort) * typ) list -> local_theory ->
   183     binding list -> (string * sort) list -> (string * sort) list -> ((string * sort) * typ) list ->
   184     BNF_Def.bnf list * 'a
   184     local_theory -> BNF_Def.bnf list * 'a
   185 end;
   185 end;
   186 
   186 
   187 structure BNF_FP_Util : BNF_FP_UTIL =
   187 structure BNF_FP_Util : BNF_FP_UTIL =
   188 struct
   188 struct
   189 
   189 
   560   in
   560   in
   561     Thm.instantiate ([], insts) coind
   561     Thm.instantiate ([], insts) coind
   562     |> unfold_thms ctxt unfolds
   562     |> unfold_thms ctxt unfolds
   563   end;
   563   end;
   564 
   564 
   565 fun fp_bnf construct_fp bs resBs fp_eqs lthy =
   565 fun fp_bnf construct_fp bs resBs Ds0 fp_eqs lthy =
   566   let
   566   let
   567     val time = time lthy;
   567     val time = time lthy;
   568     val timer = time (Timer.startRealTimer ());
   568     val timer = time (Timer.startRealTimer ());
   569     val (Xs, rhsXs) = split_list fp_eqs;
   569     val (Xs, rhsXs) = split_list fp_eqs;
   570 
   570 
   588     fun norm_qualify i = Binding.qualify true (Binding.name_of (nth bs (Int.max (0, i - 1))))
   588     fun norm_qualify i = Binding.qualify true (Binding.name_of (nth bs (Int.max (0, i - 1))))
   589       #> Binding.conceal;
   589       #> Binding.conceal;
   590 
   590 
   591     val Ass = map (map dest_TFree) livess;
   591     val Ass = map (map dest_TFree) livess;
   592     val resDs = fold (subtract (op =)) Ass resBs;
   592     val resDs = fold (subtract (op =)) Ass resBs;
   593     val Ds = fold (fold Term.add_tfreesT) deadss [];
   593     val Ds = fold (fold Term.add_tfreesT) deadss Ds0;
   594 
   594 
   595     val timer = time (timer "Construction of BNFs");
   595     val timer = time (timer "Construction of BNFs");
   596 
   596 
   597     val ((kill_poss, _), (bnfs', (unfold_set', lthy'))) =
   597     val ((kill_poss, _), (bnfs', (unfold_set', lthy'))) =
   598       normalize_bnfs norm_qualify Ass Ds fp_sort bnfs unfold_set lthy;
   598       normalize_bnfs norm_qualify Ass Ds fp_sort bnfs unfold_set lthy;