211 val goal = mk_Trueprop_eq (lhs, rhs); |
211 val goal = mk_Trueprop_eq (lhs, rhs); |
212 val vars = Variable.add_free_names lthy goal []; |
212 val vars = Variable.add_free_names lthy goal []; |
213 in |
213 in |
214 Goal.prove_sorry lthy vars [] goal |
214 Goal.prove_sorry lthy vars [] goal |
215 (fn {context = ctxt, prems = _} => mk_map_comp_id_tac ctxt map_comp0) |
215 (fn {context = ctxt, prems = _} => mk_map_comp_id_tac ctxt map_comp0) |
216 |> Thm.close_derivation |
216 |> Thm.close_derivation \<^here> |
217 end; |
217 end; |
218 |
218 |
219 val map_comp_id_thms = @{map 5} mk_map_comp_id xFs mapsAsBs mapsBsCs' mapsAsCs' map_comps; |
219 val map_comp_id_thms = @{map 5} mk_map_comp_id xFs mapsAsBs mapsBsCs' mapsAsCs' map_comps; |
220 |
220 |
221 (*forall a : set(m+1) x. f(m+1) a = a; ...; forall a : set(m+n) x. f(m+n) a = a ==> |
221 (*forall a : set(m+1) x. f(m+1) a = a; ...; forall a : set(m+n) x. f(m+n) a = a ==> |
229 val goal = mk_Trueprop_eq (Term.list_comb (mapAsAs, passive_ids @ self_fs) $ x, x); |
229 val goal = mk_Trueprop_eq (Term.list_comb (mapAsAs, passive_ids @ self_fs) $ x, x); |
230 val vars = Variable.add_free_names lthy goal []; |
230 val vars = Variable.add_free_names lthy goal []; |
231 in |
231 in |
232 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal)) |
232 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal)) |
233 (fn {context = ctxt, prems = _} => mk_map_cong0L_tac ctxt m map_cong0 map_id) |
233 (fn {context = ctxt, prems = _} => mk_map_cong0L_tac ctxt m map_cong0 map_id) |
234 |> Thm.close_derivation |
234 |> Thm.close_derivation \<^here> |
235 end; |
235 end; |
236 |
236 |
237 val map_cong0L_thms = @{map 5} mk_map_cong0L xFs mapsAsAs setssAs map_cong0s map_ids; |
237 val map_cong0L_thms = @{map 5} mk_map_cong0L xFs mapsAsAs setssAs map_cong0s map_ids; |
238 val in_mono'_thms = map (fn thm => |
238 val in_mono'_thms = map (fn thm => |
239 (thm OF (replicate m subset_refl)) RS @{thm set_mp}) in_monos; |
239 (thm OF (replicate m subset_refl)) RS @{thm set_mp}) in_monos; |
249 in |
249 in |
250 map (fn goal => |
250 map (fn goal => |
251 Variable.add_free_names lthy goal [] |
251 Variable.add_free_names lthy goal [] |
252 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
252 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
253 (hyp_subst_tac ctxt THEN' rtac ctxt refl) 1)) |
253 (hyp_subst_tac ctxt THEN' rtac ctxt refl) 1)) |
254 |> Thm.close_derivation) |
254 |> Thm.close_derivation \<^here>) |
255 goals |
255 goals |
256 end; |
256 end; |
257 |
257 |
258 val timer = time (timer "Derived simple theorems"); |
258 val timer = time (timer "Derived simple theorems"); |
259 |
259 |
319 in |
319 in |
320 map (fn goals => map (fn goal => |
320 map (fn goals => map (fn goal => |
321 Variable.add_free_names lthy goal [] |
321 Variable.add_free_names lthy goal [] |
322 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
322 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
323 mk_coalg_set_tac ctxt coalg_def)) |
323 mk_coalg_set_tac ctxt coalg_def)) |
324 |> Thm.close_derivation) |
324 |> Thm.close_derivation \<^here>) |
325 goals) goalss |
325 goals) goalss |
326 end; |
326 end; |
327 |
327 |
328 fun mk_tcoalg BTs = mk_coalg (map HOLogic.mk_UNIV BTs); |
328 fun mk_tcoalg BTs = mk_coalg (map HOLogic.mk_UNIV BTs); |
329 |
329 |
334 in |
334 in |
335 Goal.prove_sorry lthy vars [] goal |
335 Goal.prove_sorry lthy vars [] goal |
336 (fn {context = ctxt, prems = _} => (rtac ctxt (coalg_def RS iffD2) 1 THEN CONJ_WRAP |
336 (fn {context = ctxt, prems = _} => (rtac ctxt (coalg_def RS iffD2) 1 THEN CONJ_WRAP |
337 (K (EVERY' [rtac ctxt ballI, rtac ctxt CollectI, |
337 (K (EVERY' [rtac ctxt ballI, rtac ctxt CollectI, |
338 CONJ_WRAP' (K (EVERY' [rtac ctxt @{thm subset_UNIV}])) allAs] 1)) ss)) |
338 CONJ_WRAP' (K (EVERY' [rtac ctxt @{thm subset_UNIV}])) allAs] 1)) ss)) |
339 |> Thm.close_derivation |
339 |> Thm.close_derivation \<^here> |
340 end; |
340 end; |
341 |
341 |
342 val timer = time (timer "Coalgebra definition & thms"); |
342 val timer = time (timer "Coalgebra definition & thms"); |
343 |
343 |
344 (* morphism *) |
344 (* morphism *) |
414 val elim_goals = @{map 6} mk_elim_goal Bs mapsAsBs fs ss s's zs; |
414 val elim_goals = @{map 6} mk_elim_goal Bs mapsAsBs fs ss s's zs; |
415 fun prove goal = |
415 fun prove goal = |
416 Variable.add_free_names lthy goal [] |
416 Variable.add_free_names lthy goal [] |
417 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
417 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
418 mk_mor_elim_tac ctxt mor_def)) |
418 mk_mor_elim_tac ctxt mor_def)) |
419 |> Thm.close_derivation; |
419 |> Thm.close_derivation \<^here>; |
420 in |
420 in |
421 (map prove image_goals, map prove elim_goals) |
421 (map prove image_goals, map prove elim_goals) |
422 end; |
422 end; |
423 |
423 |
424 val mor_image'_thms = map (fn thm => @{thm set_mp} OF [thm, imageI]) mor_image_thms; |
424 val mor_image'_thms = map (fn thm => @{thm set_mp} OF [thm, imageI]) mor_image_thms; |
429 val concl = HOLogic.mk_Trueprop (mk_mor Bs ss Bs_copy ss active_ids); |
429 val concl = HOLogic.mk_Trueprop (mk_mor Bs ss Bs_copy ss active_ids); |
430 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
430 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
431 in |
431 in |
432 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
432 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
433 (fn {context = ctxt, prems = _} => mk_mor_incl_tac ctxt mor_def map_ids) |
433 (fn {context = ctxt, prems = _} => mk_mor_incl_tac ctxt mor_def map_ids) |
434 |> Thm.close_derivation |
434 |> Thm.close_derivation \<^here> |
435 end; |
435 end; |
436 |
436 |
437 val mor_id_thm = mor_incl_thm OF (replicate n subset_refl); |
437 val mor_id_thm = mor_incl_thm OF (replicate n subset_refl); |
438 |
438 |
439 val mor_comp_thm = |
439 val mor_comp_thm = |
446 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
446 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
447 in |
447 in |
448 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
448 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
449 (fn {context = ctxt, prems = _} => |
449 (fn {context = ctxt, prems = _} => |
450 mk_mor_comp_tac ctxt mor_def mor_image'_thms morE_thms map_comp_id_thms) |
450 mk_mor_comp_tac ctxt mor_def mor_image'_thms morE_thms map_comp_id_thms) |
451 |> Thm.close_derivation |
451 |> Thm.close_derivation \<^here> |
452 end; |
452 end; |
453 |
453 |
454 val mor_cong_thm = |
454 val mor_cong_thm = |
455 let |
455 let |
456 val prems = map HOLogic.mk_Trueprop |
456 val prems = map HOLogic.mk_Trueprop |
458 val concl = HOLogic.mk_Trueprop (mk_mor Bs ss B's s's fs_copy); |
458 val concl = HOLogic.mk_Trueprop (mk_mor Bs ss B's s's fs_copy); |
459 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
459 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
460 in |
460 in |
461 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
461 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
462 (fn {context = ctxt, prems = _} => (hyp_subst_tac ctxt THEN' assume_tac ctxt) 1) |
462 (fn {context = ctxt, prems = _} => (hyp_subst_tac ctxt THEN' assume_tac ctxt) 1) |
463 |> Thm.close_derivation |
463 |> Thm.close_derivation \<^here> |
464 end; |
464 end; |
465 |
465 |
466 val mor_UNIV_thm = |
466 val mor_UNIV_thm = |
467 let |
467 let |
468 fun mk_conjunct mapAsBs f s s' = HOLogic.mk_eq |
468 fun mk_conjunct mapAsBs f s s' = HOLogic.mk_eq |
472 val rhs = Library.foldr1 HOLogic.mk_conj (@{map 4} mk_conjunct mapsAsBs fs ss s's); |
472 val rhs = Library.foldr1 HOLogic.mk_conj (@{map 4} mk_conjunct mapsAsBs fs ss s's); |
473 val vars = fold (Variable.add_free_names lthy) [lhs, rhs] []; |
473 val vars = fold (Variable.add_free_names lthy) [lhs, rhs] []; |
474 in |
474 in |
475 Goal.prove_sorry lthy vars [] (mk_Trueprop_eq (lhs, rhs)) |
475 Goal.prove_sorry lthy vars [] (mk_Trueprop_eq (lhs, rhs)) |
476 (fn {context = ctxt, prems = _} => mk_mor_UNIV_tac ctxt morE_thms mor_def) |
476 (fn {context = ctxt, prems = _} => mk_mor_UNIV_tac ctxt morE_thms mor_def) |
477 |> Thm.close_derivation |
477 |> Thm.close_derivation \<^here> |
478 end; |
478 end; |
479 |
479 |
480 val mor_str_thm = |
480 val mor_str_thm = |
481 let |
481 let |
482 val maps = map2 (fn Ds => fn bnf => Term.list_comb |
482 val maps = map2 (fn Ds => fn bnf => Term.list_comb |
484 val goal = HOLogic.mk_Trueprop (mk_mor active_UNIVs ss (map HOLogic.mk_UNIV FTsAs) maps ss); |
484 val goal = HOLogic.mk_Trueprop (mk_mor active_UNIVs ss (map HOLogic.mk_UNIV FTsAs) maps ss); |
485 val vars = Variable.add_free_names lthy goal []; |
485 val vars = Variable.add_free_names lthy goal []; |
486 in |
486 in |
487 Goal.prove_sorry lthy vars [] goal |
487 Goal.prove_sorry lthy vars [] goal |
488 (fn {context = ctxt, prems = _} => mk_mor_str_tac ctxt ks mor_UNIV_thm) |
488 (fn {context = ctxt, prems = _} => mk_mor_str_tac ctxt ks mor_UNIV_thm) |
489 |> Thm.close_derivation |
489 |> Thm.close_derivation \<^here> |
490 end; |
490 end; |
491 |
491 |
492 val timer = time (timer "Morphism definition & thms"); |
492 val timer = time (timer "Morphism definition & thms"); |
493 |
493 |
494 (* bisimulation *) |
494 (* bisimulation *) |
565 val concl = HOLogic.mk_Trueprop (mk_bis Bs ss B's s's Rs_copy); |
565 val concl = HOLogic.mk_Trueprop (mk_bis Bs ss B's s's Rs_copy); |
566 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
566 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
567 in |
567 in |
568 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
568 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
569 (fn {context = ctxt, prems = _} => (hyp_subst_tac ctxt THEN' assume_tac ctxt) 1) |
569 (fn {context = ctxt, prems = _} => (hyp_subst_tac ctxt THEN' assume_tac ctxt) 1) |
570 |> Thm.close_derivation |
570 |> Thm.close_derivation \<^here> |
571 end; |
571 end; |
572 |
572 |
573 val bis_rel_thm = |
573 val bis_rel_thm = |
574 let |
574 let |
575 fun mk_conjunct R s s' b1 b2 rel = |
575 fun mk_conjunct R s s' b1 b2 rel = |
584 val vars = Variable.add_free_names lthy goal []; |
584 val vars = Variable.add_free_names lthy goal []; |
585 in |
585 in |
586 Goal.prove_sorry lthy vars [] goal |
586 Goal.prove_sorry lthy vars [] goal |
587 (fn {context = ctxt, prems = _} => mk_bis_rel_tac ctxt m bis_def in_rels map_comps |
587 (fn {context = ctxt, prems = _} => mk_bis_rel_tac ctxt m bis_def in_rels map_comps |
588 map_cong0s set_mapss) |
588 map_cong0s set_mapss) |
589 |> Thm.close_derivation |
589 |> Thm.close_derivation \<^here> |
590 end; |
590 end; |
591 |
591 |
592 val bis_converse_thm = |
592 val bis_converse_thm = |
593 let |
593 let |
594 val goal = Logic.mk_implies (HOLogic.mk_Trueprop (mk_bis Bs ss B's s's Rs), |
594 val goal = Logic.mk_implies (HOLogic.mk_Trueprop (mk_bis Bs ss B's s's Rs), |
610 HOLogic.mk_Trueprop (mk_bis Bs ss B''s s''s (map2 (curry mk_rel_comp) Rs R's)); |
610 HOLogic.mk_Trueprop (mk_bis Bs ss B''s s''s (map2 (curry mk_rel_comp) Rs R's)); |
611 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
611 val vars = fold (Variable.add_free_names lthy) (concl :: prems) []; |
612 in |
612 in |
613 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
613 Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, concl)) |
614 (fn {context = ctxt, prems = _} => mk_bis_O_tac ctxt m bis_rel_thm rel_congs le_rel_OOs) |
614 (fn {context = ctxt, prems = _} => mk_bis_O_tac ctxt m bis_rel_thm rel_congs le_rel_OOs) |
615 |> Thm.close_derivation |
615 |> Thm.close_derivation \<^here> |
616 end; |
616 end; |
617 |
617 |
618 val bis_Gr_thm = |
618 val bis_Gr_thm = |
619 let |
619 let |
620 val concl = HOLogic.mk_Trueprop (mk_bis Bs ss B's s's (map2 mk_Gr Bs fs)); |
620 val concl = HOLogic.mk_Trueprop (mk_bis Bs ss B's s's (map2 mk_Gr Bs fs)); |
621 val vars = fold (Variable.add_free_names lthy) ([coalg_prem, mor_prem, concl]) []; |
621 val vars = fold (Variable.add_free_names lthy) ([coalg_prem, mor_prem, concl]) []; |
622 in |
622 in |
623 Goal.prove_sorry lthy vars [] (Logic.list_implies ([coalg_prem, mor_prem], concl)) |
623 Goal.prove_sorry lthy vars [] (Logic.list_implies ([coalg_prem, mor_prem], concl)) |
624 (fn {context = ctxt, prems = _} => mk_bis_Gr_tac ctxt bis_rel_thm rel_Grps mor_image_thms |
624 (fn {context = ctxt, prems = _} => mk_bis_Gr_tac ctxt bis_rel_thm rel_Grps mor_image_thms |
625 morE_thms coalg_in_thms) |
625 morE_thms coalg_in_thms) |
626 |> Thm.close_derivation |
626 |> Thm.close_derivation \<^here> |
627 end; |
627 end; |
628 |
628 |
629 val bis_image2_thm = bis_cong_thm OF |
629 val bis_image2_thm = bis_cong_thm OF |
630 ((bis_O_thm OF [bis_Gr_thm RS bis_converse_thm, bis_Gr_thm]) :: |
630 ((bis_O_thm OF [bis_Gr_thm RS bis_converse_thm, bis_Gr_thm]) :: |
631 replicate n @{thm image2_Gr}); |
631 replicate n @{thm image2_Gr}); |
642 HOLogic.mk_Trueprop (mk_bis Bs ss B's s's (map (mk_UNION Idx) Ris)); |
642 HOLogic.mk_Trueprop (mk_bis Bs ss B's s's (map (mk_UNION Idx) Ris)); |
643 val vars = fold (Variable.add_free_names lthy) [prem, concl] []; |
643 val vars = fold (Variable.add_free_names lthy) [prem, concl] []; |
644 in |
644 in |
645 Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, concl)) |
645 Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, concl)) |
646 (fn {context = ctxt, prems = _} => mk_bis_Union_tac ctxt bis_def in_mono'_thms) |
646 (fn {context = ctxt, prems = _} => mk_bis_Union_tac ctxt bis_def in_mono'_thms) |
647 |> Thm.close_derivation |
647 |> Thm.close_derivation \<^here> |
648 end; |
648 end; |
649 |
649 |
650 (* self-bisimulation *) |
650 (* self-bisimulation *) |
651 |
651 |
652 fun mk_sbis Bs ss Rs = mk_bis Bs ss Bs ss Rs; |
652 fun mk_sbis Bs ss Rs = mk_bis Bs ss Bs ss Rs; |
704 val vars = Variable.add_free_names lthy goal []; |
704 val vars = Variable.add_free_names lthy goal []; |
705 in |
705 in |
706 Goal.prove_sorry lthy vars [] goal |
706 Goal.prove_sorry lthy vars [] goal |
707 (fn {context = ctxt, prems = _} => |
707 (fn {context = ctxt, prems = _} => |
708 mk_sbis_lsbis_tac ctxt lsbis_defs bis_Union_thm bis_cong_thm) |
708 mk_sbis_lsbis_tac ctxt lsbis_defs bis_Union_thm bis_cong_thm) |
709 |> Thm.close_derivation |
709 |> Thm.close_derivation \<^here> |
710 end; |
710 end; |
711 |
711 |
712 val lsbis_incl_thms = map (fn i => sbis_lsbis_thm RS |
712 val lsbis_incl_thms = map (fn i => sbis_lsbis_thm RS |
713 (bis_def RS iffD1 RS conjunct1 RS mk_conjunctN n i)) ks; |
713 (bis_def RS iffD1 RS conjunct1 RS mk_conjunctN n i)) ks; |
714 val lsbisE_thms = map (fn i => (mk_specN 2 (sbis_lsbis_thm RS |
714 val lsbisE_thms = map (fn i => (mk_specN 2 (sbis_lsbis_thm RS |
721 in |
721 in |
722 @{map 3} (fn goal => fn i => fn def => |
722 @{map 3} (fn goal => fn i => fn def => |
723 Variable.add_free_names lthy goal [] |
723 Variable.add_free_names lthy goal [] |
724 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
724 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
725 mk_incl_lsbis_tac ctxt n i def)) |
725 mk_incl_lsbis_tac ctxt n i def)) |
726 |> Thm.close_derivation) |
726 |> Thm.close_derivation \<^here>) |
727 goals ks lsbis_defs |
727 goals ks lsbis_defs |
728 end; |
728 end; |
729 |
729 |
730 val equiv_lsbis_thms = |
730 val equiv_lsbis_thms = |
731 let |
731 let |
735 @{map 3} (fn goal => fn l_incl => fn incl_l => |
735 @{map 3} (fn goal => fn l_incl => fn incl_l => |
736 Variable.add_free_names lthy goal [] |
736 Variable.add_free_names lthy goal [] |
737 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
737 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
738 (fn {context = ctxt, prems = _} => mk_equiv_lsbis_tac ctxt sbis_lsbis_thm l_incl incl_l |
738 (fn {context = ctxt, prems = _} => mk_equiv_lsbis_tac ctxt sbis_lsbis_thm l_incl incl_l |
739 bis_Id_on_thm bis_converse_thm bis_O_thm) |
739 bis_Id_on_thm bis_converse_thm bis_O_thm) |
740 |> Thm.close_derivation)) |
740 |> Thm.close_derivation \<^here>)) |
741 goals lsbis_incl_thms incl_lsbis_thms |
741 goals lsbis_incl_thms incl_lsbis_thms |
742 end; |
742 end; |
743 |
743 |
744 val timer = time (timer "Bisimulations"); |
744 val timer = time (timer "Bisimulations"); |
745 |
745 |
966 |
966 |
967 val coalgT_thm = |
967 val coalgT_thm = |
968 Goal.prove_sorry lthy [] [] (HOLogic.mk_Trueprop (mk_coalg carTAs strTAs)) |
968 Goal.prove_sorry lthy [] [] (HOLogic.mk_Trueprop (mk_coalg carTAs strTAs)) |
969 (fn {context = ctxt, prems = _} => mk_coalgT_tac ctxt m |
969 (fn {context = ctxt, prems = _} => mk_coalgT_tac ctxt m |
970 (coalg_def :: isNode_defs @ carT_defs) strT_defs set_mapss) |
970 (coalg_def :: isNode_defs @ carT_defs) strT_defs set_mapss) |
971 |> Thm.close_derivation; |
971 |> Thm.close_derivation \<^here>; |
972 |
972 |
973 val timer = time (timer "Tree coalgebra"); |
973 val timer = time (timer "Tree coalgebra"); |
974 |
974 |
975 fun mk_to_sbd s x i i' = |
975 fun mk_to_sbd s x i i' = |
976 mk_toCard (nth (nth setssAs (i - 1)) (m + i' - 1) $ (s $ x)) sbd; |
976 mk_toCard (nth (nth setssAs (i - 1)) (m + i' - 1) $ (s $ x)) sbd; |
1142 val cts = map (SOME o Thm.cterm_of lthy) [Term.absfree nat' goal, nat]; |
1142 val cts = map (SOME o Thm.cterm_of lthy) [Term.absfree nat' goal, nat]; |
1143 |
1143 |
1144 val length_Lev = |
1144 val length_Lev = |
1145 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1145 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1146 (fn {context = ctxt, prems = _} => mk_length_Lev_tac ctxt cts Lev_0s Lev_Sucs) |
1146 (fn {context = ctxt, prems = _} => mk_length_Lev_tac ctxt cts Lev_0s Lev_Sucs) |
1147 |> Thm.close_derivation; |
1147 |> Thm.close_derivation \<^here>; |
1148 |
1148 |
1149 val length_Lev' = mk_specN (n + 1) length_Lev; |
1149 val length_Lev' = mk_specN (n + 1) length_Lev; |
1150 val length_Levs = map (fn i => length_Lev' RS mk_conjunctN n i RS mp) ks; |
1150 val length_Levs = map (fn i => length_Lev' RS mk_conjunctN n i RS mp) ks; |
1151 |
1151 |
1152 fun mk_goal i z = Logic.mk_implies |
1152 fun mk_goal i z = Logic.mk_implies |
1157 val length_Levs' = |
1157 val length_Levs' = |
1158 map2 (fn goal => fn length_Lev => |
1158 map2 (fn goal => fn length_Lev => |
1159 Variable.add_free_names lthy goal [] |
1159 Variable.add_free_names lthy goal [] |
1160 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
1160 |> (fn vars => Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
1161 mk_length_Lev'_tac ctxt length_Lev)) |
1161 mk_length_Lev'_tac ctxt length_Lev)) |
1162 |> Thm.close_derivation) |
1162 |> Thm.close_derivation \<^here>) |
1163 goals length_Levs; |
1163 goals length_Levs; |
1164 in |
1164 in |
1165 (length_Levs, length_Levs') |
1165 (length_Levs, length_Levs') |
1166 end; |
1166 end; |
1167 |
1167 |
1181 val cts = map (SOME o Thm.cterm_of lthy) [Term.absfree kl' goal, kl]; |
1181 val cts = map (SOME o Thm.cterm_of lthy) [Term.absfree kl' goal, kl]; |
1182 |
1182 |
1183 val rv_last = |
1183 val rv_last = |
1184 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1184 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1185 (fn {context = ctxt, prems = _} => mk_rv_last_tac ctxt cTs cts rv_Nils rv_Conss) |
1185 (fn {context = ctxt, prems = _} => mk_rv_last_tac ctxt cTs cts rv_Nils rv_Conss) |
1186 |> Thm.close_derivation; |
1186 |> Thm.close_derivation \<^here>; |
1187 |
1187 |
1188 val rv_last' = mk_specN (n + 1) rv_last; |
1188 val rv_last' = mk_specN (n + 1) rv_last; |
1189 in |
1189 in |
1190 map (fn i => map (fn i' => rv_last' RS mk_conjunctN n i RS mk_conjunctN n i') ks) ks |
1190 map (fn i => map (fn i' => rv_last' RS mk_conjunctN n i RS mk_conjunctN n i') ks) ks |
1191 end; |
1191 end; |
1219 |
1219 |
1220 val set_Lev = |
1220 val set_Lev = |
1221 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1221 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1222 (fn {context = ctxt, prems = _} => |
1222 (fn {context = ctxt, prems = _} => |
1223 mk_set_Lev_tac ctxt cts Lev_0s Lev_Sucs rv_Nils rv_Conss from_to_sbd_thmss) |
1223 mk_set_Lev_tac ctxt cts Lev_0s Lev_Sucs rv_Nils rv_Conss from_to_sbd_thmss) |
1224 |> Thm.close_derivation; |
1224 |> Thm.close_derivation \<^here>; |
1225 |
1225 |
1226 val set_Lev' = mk_specN (3 * n + 1) set_Lev; |
1226 val set_Lev' = mk_specN (3 * n + 1) set_Lev; |
1227 in |
1227 in |
1228 map (fn i => map (fn i' => map (fn i'' => set_Lev' RS |
1228 map (fn i => map (fn i' => map (fn i'' => set_Lev' RS |
1229 mk_conjunctN n i RS mp RS |
1229 mk_conjunctN n i RS mp RS |
1260 val set_image_Lev = |
1260 val set_image_Lev = |
1261 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1261 Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
1262 (fn {context = ctxt, prems = _} => |
1262 (fn {context = ctxt, prems = _} => |
1263 mk_set_image_Lev_tac ctxt cts Lev_0s Lev_Sucs rv_Nils rv_Conss |
1263 mk_set_image_Lev_tac ctxt cts Lev_0s Lev_Sucs rv_Nils rv_Conss |
1264 from_to_sbd_thmss to_sbd_inj_thmss) |
1264 from_to_sbd_thmss to_sbd_inj_thmss) |
1265 |> Thm.close_derivation; |
1265 |> Thm.close_derivation \<^here>; |
1266 |
1266 |
1267 val set_image_Lev' = mk_specN (2 * n + 2) set_image_Lev; |
1267 val set_image_Lev' = mk_specN (2 * n + 2) set_image_Lev; |
1268 in |
1268 in |
1269 map (fn i => map (fn i' => map (fn i'' => set_image_Lev' RS |
1269 map (fn i => map (fn i' => map (fn i'' => set_image_Lev' RS |
1270 mk_conjunctN n i RS mp RS |
1270 mk_conjunctN n i RS mp RS |
1281 (fn {context = ctxt, prems = _} => mk_mor_beh_tac ctxt m mor_def mor_cong_thm |
1281 (fn {context = ctxt, prems = _} => mk_mor_beh_tac ctxt m mor_def mor_cong_thm |
1282 beh_defs carT_defs strT_defs isNode_defs |
1282 beh_defs carT_defs strT_defs isNode_defs |
1283 to_sbd_inj_thmss from_to_sbd_thmss Lev_0s Lev_Sucs rv_Nils rv_Conss |
1283 to_sbd_inj_thmss from_to_sbd_thmss Lev_0s Lev_Sucs rv_Nils rv_Conss |
1284 length_Lev_thms length_Lev'_thms rv_last_thmss set_Lev_thmsss |
1284 length_Lev_thms length_Lev'_thms rv_last_thmss set_Lev_thmsss |
1285 set_image_Lev_thmsss set_mapss map_comp_id_thms map_cong0s) |
1285 set_image_Lev_thmsss set_mapss map_comp_id_thms map_cong0s) |
1286 |> Thm.close_derivation |
1286 |> Thm.close_derivation \<^here> |
1287 end; |
1287 end; |
1288 |
1288 |
1289 val timer = time (timer "Behavioral morphism"); |
1289 val timer = time (timer "Behavioral morphism"); |
1290 |
1290 |
1291 val lsbisAs = map (mk_lsbis carTAs strTAs) ks; |
1291 val lsbisAs = map (mk_lsbis carTAs strTAs) ks; |
1310 in |
1310 in |
1311 @{map 4} (fn goal => fn lsbisE => fn map_comp_id => fn map_cong0 => |
1311 @{map 4} (fn goal => fn lsbisE => fn map_comp_id => fn map_cong0 => |
1312 Goal.prove_sorry lthy [] [] goal |
1312 Goal.prove_sorry lthy [] [] goal |
1313 (fn {context = ctxt, prems = _} => mk_congruent_str_final_tac ctxt m lsbisE map_comp_id |
1313 (fn {context = ctxt, prems = _} => mk_congruent_str_final_tac ctxt m lsbisE map_comp_id |
1314 map_cong0 equiv_LSBIS_thms) |
1314 map_cong0 equiv_LSBIS_thms) |
1315 |> Thm.close_derivation) |
1315 |> Thm.close_derivation \<^here>) |
1316 goals lsbisE_thms map_comp_id_thms map_cong0s |
1316 goals lsbisE_thms map_comp_id_thms map_cong0s |
1317 end; |
1317 end; |
1318 |
1318 |
1319 val coalg_final_thm = Goal.prove_sorry lthy [] [] |
1319 val coalg_final_thm = Goal.prove_sorry lthy [] [] |
1320 (HOLogic.mk_Trueprop (mk_coalg car_finals str_finals)) |
1320 (HOLogic.mk_Trueprop (mk_coalg car_finals str_finals)) |
1321 (fn {context = ctxt, prems = _} => mk_coalg_final_tac ctxt m coalg_def |
1321 (fn {context = ctxt, prems = _} => mk_coalg_final_tac ctxt m coalg_def |
1322 congruent_str_final_thms equiv_LSBIS_thms set_mapss coalgT_set_thmss) |
1322 congruent_str_final_thms equiv_LSBIS_thms set_mapss coalgT_set_thmss) |
1323 |> Thm.close_derivation; |
1323 |> Thm.close_derivation \<^here>; |
1324 |
1324 |
1325 val mor_T_final_thm = Goal.prove_sorry lthy [] [] |
1325 val mor_T_final_thm = Goal.prove_sorry lthy [] [] |
1326 (HOLogic.mk_Trueprop (mk_mor carTAs strTAs car_finals str_finals (map mk_proj lsbisAs))) |
1326 (HOLogic.mk_Trueprop (mk_mor carTAs strTAs car_finals str_finals (map mk_proj lsbisAs))) |
1327 (fn {context = ctxt, prems = _} => mk_mor_T_final_tac ctxt mor_def congruent_str_final_thms |
1327 (fn {context = ctxt, prems = _} => mk_mor_T_final_tac ctxt mor_def congruent_str_final_thms |
1328 equiv_LSBIS_thms) |
1328 equiv_LSBIS_thms) |
1329 |> Thm.close_derivation; |
1329 |> Thm.close_derivation \<^here>; |
1330 |
1330 |
1331 val mor_final_thm = mor_comp_thm OF [mor_beh_thm, mor_T_final_thm]; |
1331 val mor_final_thm = mor_comp_thm OF [mor_beh_thm, mor_T_final_thm]; |
1332 val in_car_final_thms = map (fn thm => thm OF [mor_final_thm, UNIV_I]) mor_image'_thms; |
1332 val in_car_final_thms = map (fn thm => thm OF [mor_final_thm, UNIV_I]) mor_image'_thms; |
1333 |
1333 |
1334 val timer = time (timer "Final coalgebra"); |
1334 val timer = time (timer "Final coalgebra"); |
1402 val mor_Rep = |
1402 val mor_Rep = |
1403 Goal.prove_sorry lthy [] [] |
1403 Goal.prove_sorry lthy [] [] |
1404 (HOLogic.mk_Trueprop (mk_mor UNIVs dtors car_finals str_finals Rep_Ts)) |
1404 (HOLogic.mk_Trueprop (mk_mor UNIVs dtors car_finals str_finals Rep_Ts)) |
1405 (fn {context = ctxt, prems = _} => mk_mor_Rep_tac ctxt (mor_def :: dtor_defs) Reps |
1405 (fn {context = ctxt, prems = _} => mk_mor_Rep_tac ctxt (mor_def :: dtor_defs) Reps |
1406 Abs_inverses coalg_final_set_thmss map_comp_id_thms map_cong0L_thms) |
1406 Abs_inverses coalg_final_set_thmss map_comp_id_thms map_cong0L_thms) |
1407 |> Thm.close_derivation; |
1407 |> Thm.close_derivation \<^here>; |
1408 |
1408 |
1409 val mor_Abs = |
1409 val mor_Abs = |
1410 Goal.prove_sorry lthy [] [] |
1410 Goal.prove_sorry lthy [] [] |
1411 (HOLogic.mk_Trueprop (mk_mor car_finals str_finals UNIVs dtors Abs_Ts)) |
1411 (HOLogic.mk_Trueprop (mk_mor car_finals str_finals UNIVs dtors Abs_Ts)) |
1412 (fn {context = ctxt, prems = _} => mk_mor_Abs_tac ctxt (mor_def :: dtor_defs) |
1412 (fn {context = ctxt, prems = _} => mk_mor_Abs_tac ctxt (mor_def :: dtor_defs) |
1413 Abs_inverses) |
1413 Abs_inverses) |
1414 |> Thm.close_derivation; |
1414 |> Thm.close_derivation \<^here>; |
1415 in |
1415 in |
1416 (mor_Rep, mor_Abs) |
1416 (mor_Rep, mor_Abs) |
1417 end; |
1417 end; |
1418 |
1418 |
1419 val timer = time (timer "dtor definitions & thms"); |
1419 val timer = time (timer "dtor definitions & thms"); |
1460 val vars = Variable.add_free_names lthy goal []; |
1460 val vars = Variable.add_free_names lthy goal []; |
1461 in |
1461 in |
1462 Goal.prove_sorry lthy vars [] goal |
1462 Goal.prove_sorry lthy vars [] goal |
1463 (fn {context = ctxt, prems = _} => mk_mor_unfold_tac ctxt m mor_UNIV_thm dtor_defs |
1463 (fn {context = ctxt, prems = _} => mk_mor_unfold_tac ctxt m mor_UNIV_thm dtor_defs |
1464 unfold_defs Abs_inverses' morEs' map_comp_id_thms map_cong0s) |
1464 unfold_defs Abs_inverses' morEs' map_comp_id_thms map_cong0s) |
1465 |> Thm.close_derivation |
1465 |> Thm.close_derivation \<^here> |
1466 end; |
1466 end; |
1467 val dtor_unfold_thms = map (fn thm => (thm OF [mor_unfold_thm, UNIV_I]) RS sym) morE_thms; |
1467 val dtor_unfold_thms = map (fn thm => (thm OF [mor_unfold_thm, UNIV_I]) RS sym) morE_thms; |
1468 |
1468 |
1469 val (raw_coind_thms, raw_coind_thm) = |
1469 val (raw_coind_thms, raw_coind_thm) = |
1470 let |
1470 let |
1475 in |
1475 in |
1476 `split_conj_thm (Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, concl)) |
1476 `split_conj_thm (Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, concl)) |
1477 (fn {context = ctxt, prems = _} => mk_raw_coind_tac ctxt bis_def bis_cong_thm bis_O_thm |
1477 (fn {context = ctxt, prems = _} => mk_raw_coind_tac ctxt bis_def bis_cong_thm bis_O_thm |
1478 bis_converse_thm bis_Gr_thm tcoalg_thm coalgT_thm mor_T_final_thm sbis_lsbis_thm |
1478 bis_converse_thm bis_Gr_thm tcoalg_thm coalgT_thm mor_T_final_thm sbis_lsbis_thm |
1479 lsbis_incl_thms incl_lsbis_thms equiv_LSBIS_thms mor_Rep_thm Rep_injects) |
1479 lsbis_incl_thms incl_lsbis_thms equiv_LSBIS_thms mor_Rep_thm Rep_injects) |
1480 |> Thm.close_derivation) |
1480 |> Thm.close_derivation \<^here>) |
1481 end; |
1481 end; |
1482 |
1482 |
1483 val (unfold_unique_mor_thms, unfold_unique_mor_thm) = |
1483 val (unfold_unique_mor_thms, unfold_unique_mor_thm) = |
1484 let |
1484 let |
1485 val prem = HOLogic.mk_Trueprop (mk_mor active_UNIVs ss UNIVs dtors unfold_fs); |
1485 val prem = HOLogic.mk_Trueprop (mk_mor active_UNIVs ss UNIVs dtors unfold_fs); |
1492 val mor_thm = mor_comp_thm OF [mor_final_thm, mor_Abs_thm]; |
1492 val mor_thm = mor_comp_thm OF [mor_final_thm, mor_Abs_thm]; |
1493 |
1493 |
1494 val unique_mor = Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, unique)) |
1494 val unique_mor = Goal.prove_sorry lthy vars [] (Logic.mk_implies (prem, unique)) |
1495 (fn {context = ctxt, prems = _} => mk_unfold_unique_mor_tac ctxt raw_coind_thms |
1495 (fn {context = ctxt, prems = _} => mk_unfold_unique_mor_tac ctxt raw_coind_thms |
1496 bis_thm mor_thm unfold_defs) |
1496 bis_thm mor_thm unfold_defs) |
1497 |> Thm.close_derivation; |
1497 |> Thm.close_derivation \<^here>; |
1498 in |
1498 in |
1499 `split_conj_thm unique_mor |
1499 `split_conj_thm unique_mor |
1500 end; |
1500 end; |
1501 |
1501 |
1502 val (dtor_unfold_unique_thms, dtor_unfold_unique_thm) = `split_conj_thm (split_conj_prems n |
1502 val (dtor_unfold_unique_thms, dtor_unfold_unique_thm) = `split_conj_thm (split_conj_prems n |
1548 in |
1548 in |
1549 @{map 5} (fn goal => fn ctor_def => fn unfold => fn map_comp_id => fn map_cong0L => |
1549 @{map 5} (fn goal => fn ctor_def => fn unfold => fn map_comp_id => fn map_cong0L => |
1550 Goal.prove_sorry lthy [] [] goal |
1550 Goal.prove_sorry lthy [] [] goal |
1551 (fn {context = ctxt, prems = _} => mk_dtor_o_ctor_tac ctxt ctor_def unfold map_comp_id |
1551 (fn {context = ctxt, prems = _} => mk_dtor_o_ctor_tac ctxt ctor_def unfold map_comp_id |
1552 map_cong0L unfold_o_dtor_thms) |
1552 map_cong0L unfold_o_dtor_thms) |
1553 |> Thm.close_derivation) |
1553 |> Thm.close_derivation \<^here>) |
1554 goals ctor_defs dtor_unfold_thms map_comp_id_thms map_cong0L_thms |
1554 goals ctor_defs dtor_unfold_thms map_comp_id_thms map_cong0L_thms |
1555 end; |
1555 end; |
1556 |
1556 |
1557 val dtor_ctor_thms = map (fn thm => thm RS @{thm pointfree_idE}) dtor_o_ctor_thms; |
1557 val dtor_ctor_thms = map (fn thm => thm RS @{thm pointfree_idE}) dtor_o_ctor_thms; |
1558 val ctor_dtor_thms = map (fn thm => thm RS @{thm pointfree_idE}) ctor_o_dtor_thms; |
1558 val ctor_dtor_thms = map (fn thm => thm RS @{thm pointfree_idE}) ctor_o_dtor_thms; |
1606 val dtor_coinduct = |
1606 val dtor_coinduct = |
1607 Variable.add_free_names lthy dtor_coinduct_goal [] |
1607 Variable.add_free_names lthy dtor_coinduct_goal [] |
1608 |> (fn vars => Goal.prove_sorry lthy vars [] dtor_coinduct_goal |
1608 |> (fn vars => Goal.prove_sorry lthy vars [] dtor_coinduct_goal |
1609 (fn {context = ctxt, prems = _} => mk_dtor_coinduct_tac ctxt m raw_coind_thm bis_rel_thm |
1609 (fn {context = ctxt, prems = _} => mk_dtor_coinduct_tac ctxt m raw_coind_thm bis_rel_thm |
1610 rel_congs)) |
1610 rel_congs)) |
1611 |> Thm.close_derivation; |
1611 |> Thm.close_derivation \<^here>; |
1612 in |
1612 in |
1613 (rev (Term.add_tfrees dtor_coinduct_goal []), dtor_coinduct) |
1613 (rev (Term.add_tfrees dtor_coinduct_goal []), dtor_coinduct) |
1614 end; |
1614 end; |
1615 |
1615 |
1616 val timer = time (timer "coinduction"); |
1616 val timer = time (timer "coinduction"); |
1832 @{map 5} (fn goal => fn unfold => fn map_comp => fn map_cong0 => fn map_arg_cong => |
1832 @{map 5} (fn goal => fn unfold => fn map_comp => fn map_cong0 => fn map_arg_cong => |
1833 Variable.add_free_names lthy goal [] |
1833 Variable.add_free_names lthy goal [] |
1834 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1834 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1835 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jmap_defs THEN |
1835 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jmap_defs THEN |
1836 mk_map_tac ctxt m n map_arg_cong unfold map_comp map_cong0)) |
1836 mk_map_tac ctxt m n map_arg_cong unfold map_comp map_cong0)) |
1837 |> Thm.close_derivation) |
1837 |> Thm.close_derivation \<^here>) |
1838 goals dtor_unfold_thms map_comps map_cong0s map_arg_cong_thms; |
1838 goals dtor_unfold_thms map_comps map_cong0s map_arg_cong_thms; |
1839 in |
1839 in |
1840 map_split (fn thm => (thm RS @{thm comp_eq_dest}, thm)) maps |
1840 map_split (fn thm => (thm RS @{thm comp_eq_dest}, thm)) maps |
1841 end; |
1841 end; |
1842 |
1842 |
1852 val vars = fold (Variable.add_free_names lthy) (goal :: prems) []; |
1852 val vars = fold (Variable.add_free_names lthy) (goal :: prems) []; |
1853 in |
1853 in |
1854 `split_conj_thm (Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal)) |
1854 `split_conj_thm (Goal.prove_sorry lthy vars [] (Logic.list_implies (prems, goal)) |
1855 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jmap_defs THEN |
1855 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jmap_defs THEN |
1856 mk_dtor_map_unique_tac ctxt dtor_unfold_unique_thm sym_map_comps) |
1856 mk_dtor_map_unique_tac ctxt dtor_unfold_unique_thm sym_map_comps) |
1857 |> Thm.close_derivation) |
1857 |> Thm.close_derivation \<^here>) |
1858 end; |
1858 end; |
1859 |
1859 |
1860 val Jmap_comp0_thms = |
1860 val Jmap_comp0_thms = |
1861 let |
1861 let |
1862 val goal = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj |
1862 val goal = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj |
1866 val vars = Variable.add_free_names lthy goal []; |
1866 val vars = Variable.add_free_names lthy goal []; |
1867 in |
1867 in |
1868 split_conj_thm (Goal.prove_sorry lthy vars [] goal |
1868 split_conj_thm (Goal.prove_sorry lthy vars [] goal |
1869 (fn {context = ctxt, prems = _} => |
1869 (fn {context = ctxt, prems = _} => |
1870 mk_map_comp0_tac ctxt Jmap_thms map_comp0s dtor_Jmap_unique_thm) |
1870 mk_map_comp0_tac ctxt Jmap_thms map_comp0s dtor_Jmap_unique_thm) |
1871 |> Thm.close_derivation) |
1871 |> Thm.close_derivation \<^here>) |
1872 end; |
1872 end; |
1873 |
1873 |
1874 val timer = time (timer "map functions for the new codatatypes"); |
1874 val timer = time (timer "map functions for the new codatatypes"); |
1875 |
1875 |
1876 val Jset_minimal_thms = |
1876 val Jset_minimal_thms = |
1905 @{map 4} (fn goal => fn cts => fn col_0s => fn col_Sucs => |
1905 @{map 4} (fn goal => fn cts => fn col_0s => fn col_Sucs => |
1906 Variable.add_free_names lthy goal [] |
1906 Variable.add_free_names lthy goal [] |
1907 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1907 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1908 (fn {context = ctxt, prems = _} => mk_col_minimal_tac ctxt m cts col_0s |
1908 (fn {context = ctxt, prems = _} => mk_col_minimal_tac ctxt m cts col_0s |
1909 col_Sucs)) |
1909 col_Sucs)) |
1910 |> Thm.close_derivation) |
1910 |> Thm.close_derivation \<^here>) |
1911 goals ctss col_0ss' col_Sucss' |
1911 goals ctss col_0ss' col_Sucss' |
1912 end; |
1912 end; |
1913 |
1913 |
1914 fun mk_conjunct set K x = mk_leq (set $ x) (K $ x); |
1914 fun mk_conjunct set K x = mk_leq (set $ x) (K $ x); |
1915 fun mk_concl sets Ks = Library.foldr1 HOLogic.mk_conj (@{map 3} mk_conjunct sets Ks Jzs); |
1915 fun mk_concl sets Ks = Library.foldr1 HOLogic.mk_conj (@{map 3} mk_conjunct sets Ks Jzs); |
1921 map2 (fn goal => fn col_minimal => |
1921 map2 (fn goal => fn col_minimal => |
1922 Variable.add_free_names lthy goal [] |
1922 Variable.add_free_names lthy goal [] |
1923 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1923 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1924 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jset_defs THEN |
1924 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jset_defs THEN |
1925 mk_Jset_minimal_tac ctxt n col_minimal)) |
1925 mk_Jset_minimal_tac ctxt n col_minimal)) |
1926 |> Thm.close_derivation) |
1926 |> Thm.close_derivation \<^here>) |
1927 goals col_minimal_thms |
1927 goals col_minimal_thms |
1928 end; |
1928 end; |
1929 |
1929 |
1930 val (dtor_Jset_incl_thmss, dtor_set_Jset_incl_thmsss) = |
1930 val (dtor_Jset_incl_thmss, dtor_set_Jset_incl_thmsss) = |
1931 let |
1931 let |
1953 map2 (fn goal => fn rec_Suc => |
1953 map2 (fn goal => fn rec_Suc => |
1954 Variable.add_free_names lthy goal [] |
1954 Variable.add_free_names lthy goal [] |
1955 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1955 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1956 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jset_defs THEN |
1956 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jset_defs THEN |
1957 mk_set_incl_Jset_tac ctxt rec_Suc)) |
1957 mk_set_incl_Jset_tac ctxt rec_Suc)) |
1958 |> Thm.close_derivation) |
1958 |> Thm.close_derivation \<^here>) |
1959 goals rec_Sucs) |
1959 goals rec_Sucs) |
1960 set_incl_Jset_goalss col_Sucss, |
1960 set_incl_Jset_goalss col_Sucss, |
1961 map2 (fn goalss => fn rec_Sucs => |
1961 map2 (fn goalss => fn rec_Sucs => |
1962 map2 (fn k => fn goals => |
1962 map2 (fn k => fn goals => |
1963 map2 (fn goal => fn rec_Suc => |
1963 map2 (fn goal => fn rec_Suc => |
1964 Variable.add_free_names lthy goal [] |
1964 Variable.add_free_names lthy goal [] |
1965 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1965 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
1966 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jset_defs THEN |
1966 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jset_defs THEN |
1967 mk_set_Jset_incl_Jset_tac ctxt n rec_Suc k)) |
1967 mk_set_Jset_incl_Jset_tac ctxt n rec_Suc k)) |
1968 |> Thm.close_derivation) |
1968 |> Thm.close_derivation \<^here>) |
1969 goals rec_Sucs) |
1969 goals rec_Sucs) |
1970 ks goalss) |
1970 ks goalss) |
1971 set_Jset_incl_Jset_goalsss col_Sucss) |
1971 set_Jset_incl_Jset_goalsss col_Sucss) |
1972 end; |
1972 end; |
1973 |
1973 |
2022 (@{map 4} (fn goal => fn Jset_minimal => fn set_Jsets => fn set_Jset_Jsetss => |
2022 (@{map 4} (fn goal => fn Jset_minimal => fn set_Jsets => fn set_Jset_Jsetss => |
2023 Variable.add_free_names lthy goal [] |
2023 Variable.add_free_names lthy goal [] |
2024 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2024 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2025 (fn {context = ctxt, prems = _} => |
2025 (fn {context = ctxt, prems = _} => |
2026 mk_set_le_tac ctxt n Jset_minimal set_Jsets set_Jset_Jsetss)) |
2026 mk_set_le_tac ctxt n Jset_minimal set_Jsets set_Jset_Jsetss)) |
2027 |> Thm.close_derivation) |
2027 |> Thm.close_derivation \<^here>) |
2028 le_goals Jset_minimal_thms set_Jset_thmss' set_Jset_Jset_thmsss'); |
2028 le_goals Jset_minimal_thms set_Jset_thmss' set_Jset_Jset_thmsss'); |
2029 |
2029 |
2030 val ge_goalss = map (map HOLogic.mk_Trueprop) (mk_goals (uncurry mk_leq o swap)); |
2030 val ge_goalss = map (map HOLogic.mk_Trueprop) (mk_goals (uncurry mk_leq o swap)); |
2031 val set_ge_thmss = |
2031 val set_ge_thmss = |
2032 @{map 3} (@{map 3} (fn goal => fn set_incl_Jset => fn set_Jset_incl_Jsets => |
2032 @{map 3} (@{map 3} (fn goal => fn set_incl_Jset => fn set_Jset_incl_Jsets => |
2033 Variable.add_free_names lthy goal [] |
2033 Variable.add_free_names lthy goal [] |
2034 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2034 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2035 (fn {context = ctxt, prems = _} => |
2035 (fn {context = ctxt, prems = _} => |
2036 mk_set_ge_tac ctxt n set_incl_Jset set_Jset_incl_Jsets)) |
2036 mk_set_ge_tac ctxt n set_incl_Jset set_Jset_incl_Jsets)) |
2037 |> Thm.close_derivation)) |
2037 |> Thm.close_derivation \<^here>)) |
2038 ge_goalss set_incl_Jset_thmss' set_Jset_incl_Jset_thmsss' |
2038 ge_goalss set_incl_Jset_thmss' set_Jset_incl_Jset_thmsss' |
2039 in |
2039 in |
2040 map2 (map2 (fn le => fn ge => equalityI OF [le, ge])) set_le_thmss set_ge_thmss |
2040 map2 (map2 (fn le => fn ge => equalityI OF [le, ge])) set_le_thmss set_ge_thmss |
2041 |> `transpose |
2041 |> `transpose |
2042 end; |
2042 end; |
2065 @{map 4} (fn goal => fn cts => fn rec_0s => fn rec_Sucs => |
2065 @{map 4} (fn goal => fn cts => fn rec_0s => fn rec_Sucs => |
2066 Variable.add_free_names lthy goal [] |
2066 Variable.add_free_names lthy goal [] |
2067 |> (fn vars => Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
2067 |> (fn vars => Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
2068 (fn {context = ctxt, prems = _} => mk_col_natural_tac ctxt cts rec_0s rec_Sucs |
2068 (fn {context = ctxt, prems = _} => mk_col_natural_tac ctxt cts rec_0s rec_Sucs |
2069 dtor_Jmap_thms set_mapss)) |
2069 dtor_Jmap_thms set_mapss)) |
2070 |> Thm.close_derivation) |
2070 |> Thm.close_derivation \<^here>) |
2071 goals ctss col_0ss' col_Sucss'; |
2071 goals ctss col_0ss' col_Sucss'; |
2072 in |
2072 in |
2073 map (split_conj_thm o mk_specN n) thms |
2073 map (split_conj_thm o mk_specN n) thms |
2074 end; |
2074 end; |
2075 |
2075 |
2089 @{map 5} (fn j => fn goal => fn cts => fn rec_0s => fn rec_Sucs => |
2089 @{map 5} (fn j => fn goal => fn cts => fn rec_0s => fn rec_Sucs => |
2090 Variable.add_free_names lthy goal [] |
2090 Variable.add_free_names lthy goal [] |
2091 |> (fn vars => Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
2091 |> (fn vars => Goal.prove_sorry lthy vars [] (HOLogic.mk_Trueprop goal) |
2092 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jbd_defs THEN |
2092 (fn {context = ctxt, prems = _} => unfold_thms_tac ctxt Jbd_defs THEN |
2093 mk_col_bd_tac ctxt m j cts rec_0s rec_Sucs sbd_Card_order sbd_Cinfinite set_sbdss)) |
2093 mk_col_bd_tac ctxt m j cts rec_0s rec_Sucs sbd_Card_order sbd_Cinfinite set_sbdss)) |
2094 |> Thm.close_derivation) |
2094 |> Thm.close_derivation \<^here>) |
2095 ls goals ctss col_0ss' col_Sucss'; |
2095 ls goals ctss col_0ss' col_Sucss'; |
2096 in |
2096 in |
2097 map (split_conj_thm o mk_specN n) thms |
2097 map (split_conj_thm o mk_specN n) thms |
2098 end; |
2098 end; |
2099 |
2099 |
2136 val thm = |
2136 val thm = |
2137 Goal.prove_sorry lthy vars [] goal |
2137 Goal.prove_sorry lthy vars [] goal |
2138 (fn {context = ctxt, prems = _} => mk_mcong_tac ctxt m (rtac ctxt coinduct) map_comps |
2138 (fn {context = ctxt, prems = _} => mk_mcong_tac ctxt m (rtac ctxt coinduct) map_comps |
2139 dtor_Jmap_thms map_cong0s |
2139 dtor_Jmap_thms map_cong0s |
2140 set_mapss set_Jset_thmss set_Jset_Jset_thmsss in_rels) |
2140 set_mapss set_Jset_thmss set_Jset_Jset_thmsss in_rels) |
2141 |> Thm.close_derivation; |
2141 |> Thm.close_derivation \<^here>; |
2142 in |
2142 in |
2143 split_conj_thm thm |
2143 split_conj_thm thm |
2144 end; |
2144 end; |
2145 |
2145 |
2146 val in_Jrels = map (fn def => trans OF [def, @{thm OO_Grp_alt}] RS @{thm predicate2_eqD}) |
2146 val in_Jrels = map (fn def => trans OF [def, @{thm OO_Grp_alt}] RS @{thm predicate2_eqD}) |
2167 Variable.add_free_names lthy goal [] |
2167 Variable.add_free_names lthy goal [] |
2168 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2168 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2169 (fn {context = ctxt, prems = _} => |
2169 (fn {context = ctxt, prems = _} => |
2170 mk_dtor_rel_tac ctxt in_Jrels i in_rel map_comp0 map_cong0 dtor_map dtor_sets |
2170 mk_dtor_rel_tac ctxt in_Jrels i in_rel map_comp0 map_cong0 dtor_map dtor_sets |
2171 dtor_inject dtor_ctor set_map0s dtor_set_incls dtor_set_set_inclss)) |
2171 dtor_inject dtor_ctor set_map0s dtor_set_incls dtor_set_set_inclss)) |
2172 |> Thm.close_derivation) |
2172 |> Thm.close_derivation \<^here>) |
2173 ks goals in_rels map_comps map_cong0s dtor_Jmap_thms dtor_Jset_thmss' |
2173 ks goals in_rels map_comps map_cong0s dtor_Jmap_thms dtor_Jset_thmss' |
2174 dtor_inject_thms dtor_ctor_thms set_mapss dtor_Jset_incl_thmss |
2174 dtor_inject_thms dtor_ctor_thms set_mapss dtor_Jset_incl_thmss |
2175 dtor_set_Jset_incl_thmsss |
2175 dtor_set_Jset_incl_thmsss |
2176 end; |
2176 end; |
2177 |
2177 |
2250 Goal.prove_sorry lthy vars [] (Logic.list_implies (helper_prems, concl)) |
2250 Goal.prove_sorry lthy vars [] (Logic.list_implies (helper_prems, concl)) |
2251 (fn {context = ctxt, prems = _} => |
2251 (fn {context = ctxt, prems = _} => |
2252 mk_rel_coinduct_coind_tac ctxt fst m |
2252 mk_rel_coinduct_coind_tac ctxt fst m |
2253 (infer_instantiate' ctxt cts dtor_coinduct_thm) ks map_comps map_cong0s |
2253 (infer_instantiate' ctxt cts dtor_coinduct_thm) ks map_comps map_cong0s |
2254 map_arg_cong_thms set_mapss dtor_unfold_thms dtor_Jmap_thms in_rels) |
2254 map_arg_cong_thms set_mapss dtor_unfold_thms dtor_Jmap_thms in_rels) |
2255 |> Thm.close_derivation |
2255 |> Thm.close_derivation \<^here> |
2256 |> split_conj_thm |
2256 |> split_conj_thm |
2257 end; |
2257 end; |
2258 |
2258 |
2259 val helper_coind1_thms = mk_helper_coind_thms true helper_coind1_concl cts1; |
2259 val helper_coind1_thms = mk_helper_coind_thms true helper_coind1_concl cts1; |
2260 val helper_coind2_thms = mk_helper_coind_thms false helper_coind2_concl cts2; |
2260 val helper_coind2_thms = mk_helper_coind_thms false helper_coind2_concl cts2; |
2289 fold (Variable.add_free_names lthy) (concl :: helper_prems) [] |
2289 fold (Variable.add_free_names lthy) (concl :: helper_prems) [] |
2290 |> (fn vars => Goal.prove_sorry lthy vars [] (Logic.list_implies (helper_prems, concl)) |
2290 |> (fn vars => Goal.prove_sorry lthy vars [] (Logic.list_implies (helper_prems, concl)) |
2291 (fn {context = ctxt, prems = _} => |
2291 (fn {context = ctxt, prems = _} => |
2292 mk_rel_coinduct_ind_tac ctxt m ks |
2292 mk_rel_coinduct_ind_tac ctxt m ks |
2293 dtor_unfold_thms set_mapss j (infer_instantiate' ctxt cts set_induct))) |
2293 dtor_unfold_thms set_mapss j (infer_instantiate' ctxt cts set_induct))) |
2294 |> Thm.close_derivation |
2294 |> Thm.close_derivation \<^here> |
2295 |> split_conj_thm) |
2295 |> split_conj_thm) |
2296 mk_helper_ind_concls ls dtor_Jset_induct_thms ctss |
2296 mk_helper_ind_concls ls dtor_Jset_induct_thms ctss |
2297 |> transpose; |
2297 |> transpose; |
2298 in |
2298 in |
2299 mk_rel_coinduct_tac ctxt CIHs in_rels in_Jrels |
2299 mk_rel_coinduct_tac ctxt CIHs in_rels in_Jrels |
2313 val goal = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj goals); |
2313 val goal = HOLogic.mk_Trueprop (Library.foldr1 HOLogic.mk_conj goals); |
2314 val vars = Variable.add_free_names lthy goal []; |
2314 val vars = Variable.add_free_names lthy goal []; |
2315 in |
2315 in |
2316 Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
2316 Goal.prove_sorry lthy vars [] goal (fn {context = ctxt, prems = _} => |
2317 mk_le_rel_OO_tac ctxt Jrel_coinduct_thm dtor_Jrel_thms le_rel_OOs) |
2317 mk_le_rel_OO_tac ctxt Jrel_coinduct_thm dtor_Jrel_thms le_rel_OOs) |
2318 |> Thm.close_derivation |
2318 |> Thm.close_derivation \<^here> |
2319 end; |
2319 end; |
2320 |
2320 |
2321 val timer = time (timer "helpers for BNF properties"); |
2321 val timer = time (timer "helpers for BNF properties"); |
2322 |
2322 |
2323 fun close_wit I wit = (I, fold_rev Term.absfree (map (nth ys') I) wit); |
2323 fun close_wit I wit = (I, fold_rev Term.absfree (map (nth ys') I) wit); |
2433 map2 (fn goal => fn induct => |
2433 map2 (fn goal => fn induct => |
2434 Variable.add_free_names lthy goal [] |
2434 Variable.add_free_names lthy goal [] |
2435 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2435 |> (fn vars => Goal.prove_sorry lthy vars [] goal |
2436 (fn {context = ctxt, prems = _} => mk_coind_wit_tac ctxt induct dtor_unfold_thms |
2436 (fn {context = ctxt, prems = _} => mk_coind_wit_tac ctxt induct dtor_unfold_thms |
2437 (flat set_mapss) wit_thms)) |
2437 (flat set_mapss) wit_thms)) |
2438 |> Thm.close_derivation) |
2438 |> Thm.close_derivation \<^here>) |
2439 goals dtor_Jset_induct_thms |
2439 goals dtor_Jset_induct_thms |
2440 |> map split_conj_thm |
2440 |> map split_conj_thm |
2441 |> transpose |
2441 |> transpose |
2442 |> map (map_filter (try (fn thm => thm RS bspec RS mp))) |
2442 |> map (map_filter (try (fn thm => thm RS bspec RS mp))) |
2443 |> curry op ~~ (map_index Library.I (map (close_wit I) wits)) |
2443 |> curry op ~~ (map_index Library.I (map (close_wit I) wits)) |