equal
deleted
inserted
replaced
234 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss) rhs |
234 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss) rhs |
235 end; |
235 end; |
236 |
236 |
237 val ((alg_free, (_, alg_def_free)), (lthy, lthy_old)) = |
237 val ((alg_free, (_, alg_def_free)), (lthy, lthy_old)) = |
238 lthy |
238 lthy |
239 |> Local_Theory.open_target |> snd |
239 |> Local_Theory.open_target |
240 |> Local_Theory.define ((alg_bind, NoSyn), (alg_def_bind, alg_spec)) |
240 |> Local_Theory.define ((alg_bind, NoSyn), (alg_def_bind, alg_spec)) |
241 ||> `Local_Theory.close_target; |
241 ||> `Local_Theory.close_target; |
242 |
242 |
243 val phi = Proof_Context.export_morphism lthy_old lthy; |
243 val phi = Proof_Context.export_morphism lthy_old lthy; |
244 val alg = fst (Term.dest_Const (Morphism.term phi alg_free)); |
244 val alg = fst (Term.dest_Const (Morphism.term phi alg_free)); |
326 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss @ B's @ s's @ fs) rhs |
326 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss @ B's @ s's @ fs) rhs |
327 end; |
327 end; |
328 |
328 |
329 val ((mor_free, (_, mor_def_free)), (lthy, lthy_old)) = |
329 val ((mor_free, (_, mor_def_free)), (lthy, lthy_old)) = |
330 lthy |
330 lthy |
331 |> Local_Theory.open_target |> snd |
331 |> Local_Theory.open_target |
332 |> Local_Theory.define ((mor_bind, NoSyn), (mor_def_bind, mor_spec)) |
332 |> Local_Theory.define ((mor_bind, NoSyn), (mor_def_bind, mor_spec)) |
333 ||> `Local_Theory.close_target; |
333 ||> `Local_Theory.close_target; |
334 |
334 |
335 val phi = Proof_Context.export_morphism lthy_old lthy; |
335 val phi = Proof_Context.export_morphism lthy_old lthy; |
336 val mor = fst (Term.dest_Const (Morphism.term phi mor_free)); |
336 val mor = fst (Term.dest_Const (Morphism.term phi mor_free)); |
469 |
469 |
470 val sbd_spec = mk_dir_image sum_bd Abs_sbdT; |
470 val sbd_spec = mk_dir_image sum_bd Abs_sbdT; |
471 |
471 |
472 val ((sbd_free, (_, sbd_def_free)), (lthy, lthy_old)) = |
472 val ((sbd_free, (_, sbd_def_free)), (lthy, lthy_old)) = |
473 lthy |
473 lthy |
474 |> Local_Theory.open_target |> snd |
474 |> Local_Theory.open_target |
475 |> Local_Theory.define ((sbd_bind, NoSyn), (sbd_def_bind, sbd_spec)) |
475 |> Local_Theory.define ((sbd_bind, NoSyn), (sbd_def_bind, sbd_spec)) |
476 ||> `Local_Theory.close_target; |
476 ||> `Local_Theory.close_target; |
477 |
477 |
478 val phi = Proof_Context.export_morphism lthy_old lthy; |
478 val phi = Proof_Context.export_morphism lthy_old lthy; |
479 |
479 |
659 fold_rev (Term.absfree o Term.dest_Free) ss rhs |
659 fold_rev (Term.absfree o Term.dest_Free) ss rhs |
660 end; |
660 end; |
661 |
661 |
662 val ((min_alg_frees, (_, min_alg_def_frees)), (lthy, lthy_old)) = |
662 val ((min_alg_frees, (_, min_alg_def_frees)), (lthy, lthy_old)) = |
663 lthy |
663 lthy |
664 |> Local_Theory.open_target |> snd |
664 |> Local_Theory.open_target |
665 |> fold_map (fn i => Local_Theory.define |
665 |> fold_map (fn i => Local_Theory.define |
666 ((min_alg_bind i, NoSyn), (min_alg_def_bind i, min_alg_spec i))) ks |
666 ((min_alg_bind i, NoSyn), (min_alg_def_bind i, min_alg_spec i))) ks |
667 |>> apsnd split_list o split_list |
667 |>> apsnd split_list o split_list |
668 ||> `Local_Theory.close_target; |
668 ||> `Local_Theory.close_target; |
669 |
669 |
792 fold_rev (Term.absfree o Term.dest_Free) [init_xF, iidx] rhs |
792 fold_rev (Term.absfree o Term.dest_Free) [init_xF, iidx] rhs |
793 end; |
793 end; |
794 |
794 |
795 val ((str_init_frees, (_, str_init_def_frees)), (lthy, lthy_old)) = |
795 val ((str_init_frees, (_, str_init_def_frees)), (lthy, lthy_old)) = |
796 lthy |
796 lthy |
797 |> Local_Theory.open_target |> snd |
797 |> Local_Theory.open_target |
798 |> fold_map (fn i => Local_Theory.define |
798 |> fold_map (fn i => Local_Theory.define |
799 ((str_init_bind i, NoSyn), (str_init_def_bind i, str_init_spec i))) ks |
799 ((str_init_bind i, NoSyn), (str_init_def_bind i, str_init_spec i))) ks |
800 |>> apsnd split_list o split_list |
800 |>> apsnd split_list o split_list |
801 ||> `Local_Theory.close_target; |
801 ||> `Local_Theory.close_target; |
802 |
802 |
950 Library.foldl1 HOLogic.mk_comp [abs, str, |
950 Library.foldl1 HOLogic.mk_comp [abs, str, |
951 Term.list_comb (map_FT_init, map HOLogic.id_const passiveAs @ Rep_Ts)]; |
951 Term.list_comb (map_FT_init, map HOLogic.id_const passiveAs @ Rep_Ts)]; |
952 |
952 |
953 val ((ctor_frees, (_, ctor_def_frees)), (lthy, lthy_old)) = |
953 val ((ctor_frees, (_, ctor_def_frees)), (lthy, lthy_old)) = |
954 lthy |
954 lthy |
955 |> Local_Theory.open_target |> snd |
955 |> Local_Theory.open_target |
956 |> @{fold_map 4} (fn i => fn abs => fn str => fn mapx => |
956 |> @{fold_map 4} (fn i => fn abs => fn str => fn mapx => |
957 Local_Theory.define |
957 Local_Theory.define |
958 ((ctor_bind i, NoSyn), (ctor_def_bind i, ctor_spec abs str mapx))) |
958 ((ctor_bind i, NoSyn), (ctor_def_bind i, ctor_spec abs str mapx))) |
959 ks Abs_Ts str_inits map_FT_inits |
959 ks Abs_Ts str_inits map_FT_inits |
960 |>> apsnd split_list o split_list |
960 |>> apsnd split_list o split_list |
1003 |
1003 |
1004 fun fold_spec i = fold_rev (Term.absfree o Term.dest_Free) ss (mk_nthN n foldx i); |
1004 fun fold_spec i = fold_rev (Term.absfree o Term.dest_Free) ss (mk_nthN n foldx i); |
1005 |
1005 |
1006 val ((fold_frees, (_, fold_def_frees)), (lthy, lthy_old)) = |
1006 val ((fold_frees, (_, fold_def_frees)), (lthy, lthy_old)) = |
1007 lthy |
1007 lthy |
1008 |> Local_Theory.open_target |> snd |
1008 |> Local_Theory.open_target |
1009 |> fold_map (fn i => |
1009 |> fold_map (fn i => |
1010 Local_Theory.define ((fold_bind i, NoSyn), (fold_def_bind i, fold_spec i))) ks |
1010 Local_Theory.define ((fold_bind i, NoSyn), (fold_def_bind i, fold_spec i))) ks |
1011 |>> apsnd split_list o split_list |
1011 |>> apsnd split_list o split_list |
1012 ||> `Local_Theory.close_target; |
1012 ||> `Local_Theory.close_target; |
1013 |
1013 |
1121 |
1121 |
1122 fun dtor_spec i = mk_fold Ts map_ctors i; |
1122 fun dtor_spec i = mk_fold Ts map_ctors i; |
1123 |
1123 |
1124 val ((dtor_frees, (_, dtor_def_frees)), (lthy, lthy_old)) = |
1124 val ((dtor_frees, (_, dtor_def_frees)), (lthy, lthy_old)) = |
1125 lthy |
1125 lthy |
1126 |> Local_Theory.open_target |> snd |
1126 |> Local_Theory.open_target |
1127 |> fold_map (fn i => |
1127 |> fold_map (fn i => |
1128 Local_Theory.define ((dtor_bind i, NoSyn), (dtor_def_bind i, dtor_spec i))) ks |
1128 Local_Theory.define ((dtor_bind i, NoSyn), (dtor_def_bind i, dtor_spec i))) ks |
1129 |>> apsnd split_list o split_list |
1129 |>> apsnd split_list o split_list |
1130 ||> `Local_Theory.close_target; |
1130 ||> `Local_Theory.close_target; |
1131 |
1131 |
1396 |
1396 |
1397 val sbd0_spec = mk_dir_image sum_bd0 Abs_sbd0T; |
1397 val sbd0_spec = mk_dir_image sum_bd0 Abs_sbd0T; |
1398 |
1398 |
1399 val ((sbd0_free, (_, sbd0_def_free)), (lthy, lthy_old)) = |
1399 val ((sbd0_free, (_, sbd0_def_free)), (lthy, lthy_old)) = |
1400 lthy |
1400 lthy |
1401 |> Local_Theory.open_target |> snd |
1401 |> Local_Theory.open_target |
1402 |> Local_Theory.define ((sbd0_bind, NoSyn), (sbd0_def_bind, sbd0_spec)) |
1402 |> Local_Theory.define ((sbd0_bind, NoSyn), (sbd0_def_bind, sbd0_spec)) |
1403 ||> `Local_Theory.close_target; |
1403 ||> `Local_Theory.close_target; |
1404 |
1404 |
1405 val phi = Proof_Context.export_morphism lthy_old lthy; |
1405 val phi = Proof_Context.export_morphism lthy_old lthy; |
1406 |
1406 |