equal
deleted
inserted
replaced
274 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss) rhs |
274 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss) rhs |
275 end; |
275 end; |
276 |
276 |
277 val ((coalg_free, (_, coalg_def_free)), (lthy, lthy_old)) = |
277 val ((coalg_free, (_, coalg_def_free)), (lthy, lthy_old)) = |
278 lthy |
278 lthy |
279 |> Local_Theory.open_target |> snd |
279 |> Local_Theory.open_target |
280 |> Local_Theory.define ((coalg_bind, NoSyn), (coalg_def_bind, coalg_spec)) |
280 |> Local_Theory.define ((coalg_bind, NoSyn), (coalg_def_bind, coalg_spec)) |
281 ||> `Local_Theory.close_target; |
281 ||> `Local_Theory.close_target; |
282 |
282 |
283 val phi = Proof_Context.export_morphism lthy_old lthy; |
283 val phi = Proof_Context.export_morphism lthy_old lthy; |
284 val coalg = fst (Term.dest_Const (Morphism.term phi coalg_free)); |
284 val coalg = fst (Term.dest_Const (Morphism.term phi coalg_free)); |
363 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss @ B's @ s's @ fs) rhs |
363 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss @ B's @ s's @ fs) rhs |
364 end; |
364 end; |
365 |
365 |
366 val ((mor_free, (_, mor_def_free)), (lthy, lthy_old)) = |
366 val ((mor_free, (_, mor_def_free)), (lthy, lthy_old)) = |
367 lthy |
367 lthy |
368 |> Local_Theory.open_target |> snd |
368 |> Local_Theory.open_target |
369 |> Local_Theory.define ((mor_bind, NoSyn), (mor_def_bind, mor_spec)) |
369 |> Local_Theory.define ((mor_bind, NoSyn), (mor_def_bind, mor_spec)) |
370 ||> `Local_Theory.close_target; |
370 ||> `Local_Theory.close_target; |
371 |
371 |
372 val phi = Proof_Context.export_morphism lthy_old lthy; |
372 val phi = Proof_Context.export_morphism lthy_old lthy; |
373 val mor = fst (Term.dest_Const (Morphism.term phi mor_free)); |
373 val mor = fst (Term.dest_Const (Morphism.term phi mor_free)); |
518 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss @ B's @ s's @ Rs) rhs |
518 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss @ B's @ s's @ Rs) rhs |
519 end; |
519 end; |
520 |
520 |
521 val ((bis_free, (_, bis_def_free)), (lthy, lthy_old)) = |
521 val ((bis_free, (_, bis_def_free)), (lthy, lthy_old)) = |
522 lthy |
522 lthy |
523 |> Local_Theory.open_target |> snd |
523 |> Local_Theory.open_target |
524 |> Local_Theory.define ((bis_bind, NoSyn), (bis_def_bind, bis_spec)) |
524 |> Local_Theory.define ((bis_bind, NoSyn), (bis_def_bind, bis_spec)) |
525 ||> `Local_Theory.close_target; |
525 ||> `Local_Theory.close_target; |
526 |
526 |
527 val phi = Proof_Context.export_morphism lthy_old lthy; |
527 val phi = Proof_Context.export_morphism lthy_old lthy; |
528 val bis = fst (Term.dest_Const (Morphism.term phi bis_free)); |
528 val bis = fst (Term.dest_Const (Morphism.term phi bis_free)); |
664 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss) |
664 fold_rev (Term.absfree o Term.dest_Free) (Bs @ ss) |
665 (mk_UNION all_sbis (Term.absfree Rtuple' (mk_nthN n Rtuple i))); |
665 (mk_UNION all_sbis (Term.absfree Rtuple' (mk_nthN n Rtuple i))); |
666 |
666 |
667 val ((lsbis_frees, (_, lsbis_def_frees)), (lthy, lthy_old)) = |
667 val ((lsbis_frees, (_, lsbis_def_frees)), (lthy, lthy_old)) = |
668 lthy |
668 lthy |
669 |> Local_Theory.open_target |> snd |
669 |> Local_Theory.open_target |
670 |> fold_map (fn i => Local_Theory.define |
670 |> fold_map (fn i => Local_Theory.define |
671 ((lsbis_bind i, NoSyn), (lsbis_def_bind i, lsbis_spec i))) ks |
671 ((lsbis_bind i, NoSyn), (lsbis_def_bind i, lsbis_spec i))) ks |
672 |>> apsnd split_list o split_list |
672 |>> apsnd split_list o split_list |
673 ||> `Local_Theory.close_target; |
673 ||> `Local_Theory.close_target; |
674 |
674 |
766 |
766 |
767 val sbd_spec = mk_dir_image sum_bd Abs_sbdT; |
767 val sbd_spec = mk_dir_image sum_bd Abs_sbdT; |
768 |
768 |
769 val ((sbd_free, (_, sbd_def_free)), (lthy, lthy_old)) = |
769 val ((sbd_free, (_, sbd_def_free)), (lthy, lthy_old)) = |
770 lthy |
770 lthy |
771 |> Local_Theory.open_target |> snd |
771 |> Local_Theory.open_target |
772 |> Local_Theory.define ((sbd_bind, NoSyn), (sbd_def_bind, sbd_spec)) |
772 |> Local_Theory.define ((sbd_bind, NoSyn), (sbd_def_bind, sbd_spec)) |
773 ||> `Local_Theory.close_target; |
773 ||> `Local_Theory.close_target; |
774 |
774 |
775 val phi = Proof_Context.export_morphism lthy_old lthy; |
775 val phi = Proof_Context.export_morphism lthy_old lthy; |
776 |
776 |
870 fold_rev (Term.absfree o Term.dest_Free) [Kl, lab, kl] rhs |
870 fold_rev (Term.absfree o Term.dest_Free) [Kl, lab, kl] rhs |
871 end; |
871 end; |
872 |
872 |
873 val ((isNode_frees, (_, isNode_def_frees)), (lthy, lthy_old)) = |
873 val ((isNode_frees, (_, isNode_def_frees)), (lthy, lthy_old)) = |
874 lthy |
874 lthy |
875 |> Local_Theory.open_target |> snd |
875 |> Local_Theory.open_target |
876 |> @{fold_map 3} (fn i => fn x => fn sets => Local_Theory.define |
876 |> @{fold_map 3} (fn i => fn x => fn sets => Local_Theory.define |
877 ((isNode_bind i, NoSyn), (isNode_def_bind i, isNode_spec sets x i))) |
877 ((isNode_bind i, NoSyn), (isNode_def_bind i, isNode_spec sets x i))) |
878 ks xs isNode_setss |
878 ks xs isNode_setss |
879 |>> apsnd split_list o split_list |
879 |>> apsnd split_list o split_list |
880 ||> `Local_Theory.close_target; |
880 ||> `Local_Theory.close_target; |
910 (HOLogic.mk_conj (HOLogic.mk_eq (Kl_lab, HOLogic.mk_prod (Kl, lab)), |
910 (HOLogic.mk_conj (HOLogic.mk_eq (Kl_lab, HOLogic.mk_prod (Kl, lab)), |
911 HOLogic.mk_conj (isTree, mk_isNode (HOLogic.mk_list sum_sbdT []) i)))); |
911 HOLogic.mk_conj (isTree, mk_isNode (HOLogic.mk_list sum_sbdT []) i)))); |
912 |
912 |
913 val ((carT_frees, (_, carT_def_frees)), (lthy, lthy_old)) = |
913 val ((carT_frees, (_, carT_def_frees)), (lthy, lthy_old)) = |
914 lthy |
914 lthy |
915 |> Local_Theory.open_target |> snd |
915 |> Local_Theory.open_target |
916 |> fold_map (fn i => |
916 |> fold_map (fn i => |
917 Local_Theory.define ((carT_bind i, NoSyn), (carT_def_bind i, carT_spec i))) ks |
917 Local_Theory.define ((carT_bind i, NoSyn), (carT_def_bind i, carT_spec i))) ks |
918 |>> apsnd split_list o split_list |
918 |>> apsnd split_list o split_list |
919 ||> `Local_Theory.close_target; |
919 ||> `Local_Theory.close_target; |
920 |
920 |
943 (mk_case_sumN fs $ (lab $ HOLogic.mk_list sum_sbdT [])))) |
943 (mk_case_sumN fs $ (lab $ HOLogic.mk_list sum_sbdT [])))) |
944 end; |
944 end; |
945 |
945 |
946 val ((strT_frees, (_, strT_def_frees)), (lthy, lthy_old)) = |
946 val ((strT_frees, (_, strT_def_frees)), (lthy, lthy_old)) = |
947 lthy |
947 lthy |
948 |> Local_Theory.open_target |> snd |
948 |> Local_Theory.open_target |
949 |> @{fold_map 3} (fn i => fn mapFT => fn FT => Local_Theory.define |
949 |> @{fold_map 3} (fn i => fn mapFT => fn FT => Local_Theory.define |
950 ((strT_bind i, NoSyn), (strT_def_bind i, strT_spec mapFT FT i))) |
950 ((strT_bind i, NoSyn), (strT_def_bind i, strT_spec mapFT FT i))) |
951 ks tree_maps treeFTs |
951 ks tree_maps treeFTs |
952 |>> apsnd split_list o split_list |
952 |>> apsnd split_list o split_list |
953 ||> `Local_Theory.close_target; |
953 ||> `Local_Theory.close_target; |
1013 fold_rev (Term.absfree o Term.dest_Free) ss rhs |
1013 fold_rev (Term.absfree o Term.dest_Free) ss rhs |
1014 end; |
1014 end; |
1015 |
1015 |
1016 val ((Lev_free, (_, Lev_def_free)), (lthy, lthy_old)) = |
1016 val ((Lev_free, (_, Lev_def_free)), (lthy, lthy_old)) = |
1017 lthy |
1017 lthy |
1018 |> Local_Theory.open_target |> snd |
1018 |> Local_Theory.open_target |
1019 |> Local_Theory.define ((Lev_bind, NoSyn), (Lev_def_bind, Lev_spec)) |
1019 |> Local_Theory.define ((Lev_bind, NoSyn), (Lev_def_bind, Lev_spec)) |
1020 ||> `Local_Theory.close_target; |
1020 ||> `Local_Theory.close_target; |
1021 |
1021 |
1022 val phi = Proof_Context.export_morphism lthy_old lthy; |
1022 val phi = Proof_Context.export_morphism lthy_old lthy; |
1023 |
1023 |
1057 fold_rev (Term.absfree o Term.dest_Free) ss rhs |
1057 fold_rev (Term.absfree o Term.dest_Free) ss rhs |
1058 end; |
1058 end; |
1059 |
1059 |
1060 val ((rv_free, (_, rv_def_free)), (lthy, lthy_old)) = |
1060 val ((rv_free, (_, rv_def_free)), (lthy, lthy_old)) = |
1061 lthy |
1061 lthy |
1062 |> Local_Theory.open_target |> snd |
1062 |> Local_Theory.open_target |
1063 |> Local_Theory.define ((rv_bind, NoSyn), (rv_def_bind, rv_spec)) |
1063 |> Local_Theory.define ((rv_bind, NoSyn), (rv_def_bind, rv_spec)) |
1064 ||> `Local_Theory.close_target; |
1064 ||> `Local_Theory.close_target; |
1065 |
1065 |
1066 val phi = Proof_Context.export_morphism lthy_old lthy; |
1066 val phi = Proof_Context.export_morphism lthy_old lthy; |
1067 |
1067 |
1100 fold_rev (Term.absfree o Term.dest_Free) (ss @ [z]) rhs |
1100 fold_rev (Term.absfree o Term.dest_Free) (ss @ [z]) rhs |
1101 end; |
1101 end; |
1102 |
1102 |
1103 val ((beh_frees, (_, beh_def_frees)), (lthy, lthy_old)) = |
1103 val ((beh_frees, (_, beh_def_frees)), (lthy, lthy_old)) = |
1104 lthy |
1104 lthy |
1105 |> Local_Theory.open_target |> snd |
1105 |> Local_Theory.open_target |
1106 |> @{fold_map 2} (fn i => fn z => |
1106 |> @{fold_map 2} (fn i => fn z => |
1107 Local_Theory.define ((beh_bind i, NoSyn), (beh_def_bind i, beh_spec i z))) ks zs |
1107 Local_Theory.define ((beh_bind i, NoSyn), (beh_def_bind i, beh_spec i z))) ks zs |
1108 |>> apsnd split_list o split_list |
1108 |>> apsnd split_list o split_list |
1109 ||> `Local_Theory.close_target; |
1109 ||> `Local_Theory.close_target; |
1110 |
1110 |
1377 Term.absfree Jz' |
1377 Term.absfree Jz' |
1378 (Term.list_comb (map_FT, map HOLogic.id_const passiveAs @ Abs_Ts) $ (str $ (rep $ Jz))); |
1378 (Term.list_comb (map_FT, map HOLogic.id_const passiveAs @ Abs_Ts) $ (str $ (rep $ Jz))); |
1379 |
1379 |
1380 val ((dtor_frees, (_, dtor_def_frees)), (lthy, lthy_old)) = |
1380 val ((dtor_frees, (_, dtor_def_frees)), (lthy, lthy_old)) = |
1381 lthy |
1381 lthy |
1382 |> Local_Theory.open_target |> snd |
1382 |> Local_Theory.open_target |
1383 |> @{fold_map 6} (fn i => fn rep => fn str => fn mapx => fn Jz => fn Jz' => |
1383 |> @{fold_map 6} (fn i => fn rep => fn str => fn mapx => fn Jz => fn Jz' => |
1384 Local_Theory.define ((dtor_bind i, NoSyn), |
1384 Local_Theory.define ((dtor_bind i, NoSyn), |
1385 (dtor_def_bind i, dtor_spec rep str mapx Jz Jz'))) |
1385 (dtor_def_bind i, dtor_spec rep str mapx Jz Jz'))) |
1386 ks Rep_Ts str_finals map_FTs Jzs Jzs' |
1386 ks Rep_Ts str_finals map_FTs Jzs Jzs' |
1387 |>> apsnd split_list o split_list |
1387 |>> apsnd split_list o split_list |
1423 |
1423 |
1424 fun unfold_spec abs f z = fold_rev (Term.absfree o Term.dest_Free) (ss @ [z]) (abs $ (f $ z)); |
1424 fun unfold_spec abs f z = fold_rev (Term.absfree o Term.dest_Free) (ss @ [z]) (abs $ (f $ z)); |
1425 |
1425 |
1426 val ((unfold_frees, (_, unfold_def_frees)), (lthy, lthy_old)) = |
1426 val ((unfold_frees, (_, unfold_def_frees)), (lthy, lthy_old)) = |
1427 lthy |
1427 lthy |
1428 |> Local_Theory.open_target |> snd |
1428 |> Local_Theory.open_target |
1429 |> @{fold_map 4} (fn i => fn abs => fn f => fn z => |
1429 |> @{fold_map 4} (fn i => fn abs => fn f => fn z => |
1430 Local_Theory.define ((unfold_bind i, NoSyn), (unfold_def_bind i, unfold_spec abs f z))) |
1430 Local_Theory.define ((unfold_bind i, NoSyn), (unfold_def_bind i, unfold_spec abs f z))) |
1431 ks Abs_Ts (map (fn i => HOLogic.mk_comp |
1431 ks Abs_Ts (map (fn i => HOLogic.mk_comp |
1432 (mk_proj (nth lsbisAs (i - 1)), mk_beh ss i)) ks) zs |
1432 (mk_proj (nth lsbisAs (i - 1)), mk_beh ss i)) ks) zs |
1433 |>> apsnd split_list o split_list |
1433 |>> apsnd split_list o split_list |
1523 |
1523 |
1524 fun ctor_spec i = mk_unfold Ts map_dtors i; |
1524 fun ctor_spec i = mk_unfold Ts map_dtors i; |
1525 |
1525 |
1526 val ((ctor_frees, (_, ctor_def_frees)), (lthy, lthy_old)) = |
1526 val ((ctor_frees, (_, ctor_def_frees)), (lthy, lthy_old)) = |
1527 lthy |
1527 lthy |
1528 |> Local_Theory.open_target |> snd |
1528 |> Local_Theory.open_target |
1529 |> fold_map (fn i => |
1529 |> fold_map (fn i => |
1530 Local_Theory.define ((ctor_bind i, NoSyn), (ctor_def_bind i, ctor_spec i))) ks |
1530 Local_Theory.define ((ctor_bind i, NoSyn), (ctor_def_bind i, ctor_spec i))) ks |
1531 |>> apsnd split_list o split_list |
1531 |>> apsnd split_list o split_list |
1532 ||> `Local_Theory.close_target; |
1532 ||> `Local_Theory.close_target; |
1533 |
1533 |
1729 mk_rec_nat Zero Suc |
1729 mk_rec_nat Zero Suc |
1730 end; |
1730 end; |
1731 |
1731 |
1732 val ((col_frees, (_, col_def_frees)), (lthy, lthy_old)) = |
1732 val ((col_frees, (_, col_def_frees)), (lthy, lthy_old)) = |
1733 lthy |
1733 lthy |
1734 |> Local_Theory.open_target |> snd |
1734 |> Local_Theory.open_target |
1735 |> @{fold_map 4} (fn j => fn Zero => fn hrec => fn hrec' => Local_Theory.define |
1735 |> @{fold_map 4} (fn j => fn Zero => fn hrec => fn hrec' => Local_Theory.define |
1736 ((col_bind j, NoSyn), (col_def_bind j, col_spec j Zero hrec hrec'))) |
1736 ((col_bind j, NoSyn), (col_def_bind j, col_spec j Zero hrec hrec'))) |
1737 ls Zeros hrecs hrecs' |
1737 ls Zeros hrecs hrecs' |
1738 |>> apsnd split_list o split_list |
1738 |>> apsnd split_list o split_list |
1739 ||> `Local_Theory.close_target; |
1739 ||> `Local_Theory.close_target; |