src/HOL/Tools/BNF/bnf_fp_util.ML
changeset 70494 41108e3e9ca5
parent 69593 3dda49e08b9d
child 71245 e5664a75f4b5
equal deleted inserted replaced
70493:a9053fa30909 70494:41108e3e9ca5
   565 
   565 
   566     val concl = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj
   566     val concl = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj
   567       (map2 (flip mk_leq) relphis pre_phis));
   567       (map2 (flip mk_leq) relphis pre_phis));
   568   in
   568   in
   569     Goal.prove_sorry lthy (map (fst o dest_Free) (phis @ pre_phis)) prems concl tac
   569     Goal.prove_sorry lthy (map (fst o dest_Free) (phis @ pre_phis)) prems concl tac
   570     |> Thm.close_derivation
   570     |> Thm.close_derivation \<^here>
   571     |> (fn thm => thm OF (replicate (length pre_rels) @{thm allI[OF allI[OF impI]]}))
   571     |> (fn thm => thm OF (replicate (length pre_rels) @{thm allI[OF allI[OF impI]]}))
   572   end;
   572   end;
   573 
   573 
   574 fun mk_xtor_co_iter_transfer_thms fp pre_rels pre_iphis pre_ophis rels phis un_folds un_folds' tac lthy =
   574 fun mk_xtor_co_iter_transfer_thms fp pre_rels pre_iphis pre_ophis rels phis un_folds un_folds' tac lthy =
   575   let
   575   let
   584 
   584 
   585     val goal = fold_rev Logic.all (phis @ pre_ophis)
   585     val goal = fold_rev Logic.all (phis @ pre_ophis)
   586       (HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj transfers));
   586       (HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj transfers));
   587   in
   587   in
   588     Goal.prove_sorry lthy [] [] goal tac
   588     Goal.prove_sorry lthy [] [] goal tac
   589     |> Thm.close_derivation
   589     |> Thm.close_derivation \<^here>
   590     |> split_conj_thm
   590     |> split_conj_thm
   591   end;
   591   end;
   592 
   592 
   593 fun mk_xtor_co_iter_o_map_thms fp is_rec m un_fold_unique xtor_maps xtor_un_folds sym_map_comps
   593 fun mk_xtor_co_iter_o_map_thms fp is_rec m un_fold_unique xtor_maps xtor_un_folds sym_map_comps
   594     map_cong0s =
   594     map_cong0s =
   794         val vars = Variable.add_free_names lthy goal [];
   794         val vars = Variable.add_free_names lthy goal [];
   795       in
   795       in
   796         Goal.prove_sorry lthy vars [] goal
   796         Goal.prove_sorry lthy vars [] goal
   797           (fn {context = ctxt, prems = _} => mk_xtor_co_rec_id_tac ctxt xtor_un_fold_xtor_thms
   797           (fn {context = ctxt, prems = _} => mk_xtor_co_rec_id_tac ctxt xtor_un_fold_xtor_thms
   798             xtor_un_fold_unique xtor_un_folds map_comps)
   798             xtor_un_fold_unique xtor_un_folds map_comps)
   799         |> Thm.close_derivation
   799         |> Thm.close_derivation \<^here>
   800         |> split_conj_thm
   800         |> split_conj_thm
   801       end;
   801       end;
   802 
   802 
   803     val co_rec_app_ss = map (fn co_rec => list_comb (co_rec, co_rec_ss)) co_recs;
   803     val co_rec_app_ss = map (fn co_rec => list_comb (co_rec, co_rec_ss)) co_recs;
   804     val co_products = @{map 2} (fn T => mk_co_product (HOLogic.id_const T)) Ts co_rec_app_ss;
   804     val co_products = @{map 2} (fn T => mk_co_product (HOLogic.id_const T)) Ts co_rec_app_ss;
   823         map2 (fn goal => fn un_fold =>
   823         map2 (fn goal => fn un_fold =>
   824           Variable.add_free_names lthy goal []
   824           Variable.add_free_names lthy goal []
   825           |> (fn vars => Goal.prove_sorry lthy vars [] goal
   825           |> (fn vars => Goal.prove_sorry lthy vars [] goal
   826             (fn {context = ctxt, prems = _} =>
   826             (fn {context = ctxt, prems = _} =>
   827               mk_xtor_co_rec_tac ctxt un_fold co_rec_defs co_rec_expand_thms))
   827               mk_xtor_co_rec_tac ctxt un_fold co_rec_defs co_rec_expand_thms))
   828           |> Thm.close_derivation)
   828           |> Thm.close_derivation \<^here>)
   829         goals xtor_un_folds
   829         goals xtor_un_folds
   830       end;
   830       end;
   831 
   831 
   832     val co_product_fs = @{map 2} (fn T => mk_co_product (HOLogic.id_const T)) Ts fs;
   832     val co_product_fs = @{map 2} (fn T => mk_co_product (HOLogic.id_const T)) Ts fs;
   833     val co_rec_expand'_thms = map (fn thm =>
   833     val co_rec_expand'_thms = map (fn thm =>
   854         val inverses = maps mk_inverses absT_info_opts;
   854         val inverses = maps mk_inverses absT_info_opts;
   855       in
   855       in
   856         Goal.prove_sorry lthy vars [] goal
   856         Goal.prove_sorry lthy vars [] goal
   857           (fn {context = ctxt, prems = _} => mk_xtor_co_rec_unique_tac ctxt fp co_rec_defs
   857           (fn {context = ctxt, prems = _} => mk_xtor_co_rec_unique_tac ctxt fp co_rec_defs
   858             co_rec_expand'_thms xtor_un_fold_unique map_id0s sym_map_comp0s inverses)
   858             co_rec_expand'_thms xtor_un_fold_unique map_id0s sym_map_comp0s inverses)
   859         |> Thm.close_derivation
   859         |> Thm.close_derivation \<^here>
   860       end;
   860       end;
   861 
   861 
   862     val xtor_co_rec_o_map_thms = if forall is_none absT_info_opts
   862     val xtor_co_rec_o_map_thms = if forall is_none absT_info_opts
   863       then
   863       then
   864         mk_xtor_co_iter_o_map_thms fp true m xtor_co_rec_unique_thm
   864         mk_xtor_co_iter_o_map_thms fp true m xtor_co_rec_unique_thm