348 REPEAT_DETERM o etac allE, rtac @{thm relcompI}, |
348 REPEAT_DETERM o etac allE, rtac @{thm relcompI}, |
349 etac mp, atac, etac mp, atac]) (rel_congs ~~ rel_Os)] 1; |
349 etac mp, atac, etac mp, atac]) (rel_congs ~~ rel_Os)] 1; |
350 |
350 |
351 fun mk_bis_Gr_tac bis_rel rel_Grs mor_images morEs coalg_ins |
351 fun mk_bis_Gr_tac bis_rel rel_Grs mor_images morEs coalg_ins |
352 {context = ctxt, prems = _} = |
352 {context = ctxt, prems = _} = |
353 Local_Defs.unfold_tac ctxt (bis_rel :: @{thm diag_Gr} :: rel_Grs) THEN |
353 unfold_defs_tac ctxt (bis_rel :: @{thm diag_Gr} :: rel_Grs) THEN |
354 EVERY' [rtac conjI, |
354 EVERY' [rtac conjI, |
355 CONJ_WRAP' (fn thm => rtac (@{thm Gr_incl} RS ssubst) THEN' etac thm) mor_images, |
355 CONJ_WRAP' (fn thm => rtac (@{thm Gr_incl} RS ssubst) THEN' etac thm) mor_images, |
356 CONJ_WRAP' (fn (coalg_in, morE) => |
356 CONJ_WRAP' (fn (coalg_in, morE) => |
357 EVERY' [rtac allI, rtac allI, rtac impI, rtac @{thm GrI}, etac coalg_in, |
357 EVERY' [rtac allI, rtac allI, rtac impI, rtac @{thm GrI}, etac coalg_in, |
358 etac @{thm GrD1}, etac (morE RS trans), etac @{thm GrD1}, |
358 etac @{thm GrD1}, etac (morE RS trans), etac @{thm GrD1}, |
361 fun mk_bis_Union_tac bis_def in_monos {context = ctxt, prems = _} = |
361 fun mk_bis_Union_tac bis_def in_monos {context = ctxt, prems = _} = |
362 let |
362 let |
363 val n = length in_monos; |
363 val n = length in_monos; |
364 val ks = 1 upto n; |
364 val ks = 1 upto n; |
365 in |
365 in |
366 Local_Defs.unfold_tac ctxt [bis_def] THEN |
366 unfold_defs_tac ctxt [bis_def] THEN |
367 EVERY' [rtac conjI, |
367 EVERY' [rtac conjI, |
368 CONJ_WRAP' (fn i => |
368 CONJ_WRAP' (fn i => |
369 EVERY' [rtac @{thm UN_least}, dtac bspec, atac, |
369 EVERY' [rtac @{thm UN_least}, dtac bspec, atac, |
370 dtac conjunct1, etac (mk_conjunctN n i)]) ks, |
370 dtac conjunct1, etac (mk_conjunctN n i)]) ks, |
371 CONJ_WRAP' (fn (i, in_mono) => |
371 CONJ_WRAP' (fn (i, in_mono) => |
424 etac equalityD1, etac CollectD, |
424 etac equalityD1, etac CollectD, |
425 rtac conjI, etac @{thm Shift_clists}, |
425 rtac conjI, etac @{thm Shift_clists}, |
426 rtac conjI, etac @{thm Shift_prefCl}, |
426 rtac conjI, etac @{thm Shift_prefCl}, |
427 rtac conjI, rtac ballI, |
427 rtac conjI, rtac ballI, |
428 rtac conjI, dtac @{thm iffD1[OF ball_conj_distrib]}, dtac conjunct1, |
428 rtac conjI, dtac @{thm iffD1[OF ball_conj_distrib]}, dtac conjunct1, |
429 SELECT_GOAL (Local_Defs.unfold_tac ctxt @{thms Succ_Shift shift_def}), |
429 SELECT_GOAL (unfold_defs_tac ctxt @{thms Succ_Shift shift_def}), |
430 etac bspec, etac @{thm ShiftD}, |
430 etac bspec, etac @{thm ShiftD}, |
431 CONJ_WRAP' (fn i => EVERY' [rtac ballI, etac CollectE, dtac @{thm ShiftD}, |
431 CONJ_WRAP' (fn i => EVERY' [rtac ballI, etac CollectE, dtac @{thm ShiftD}, |
432 dtac bspec, etac thin_rl, atac, dtac conjunct2, dtac (mk_conjunctN n i), |
432 dtac bspec, etac thin_rl, atac, dtac conjunct2, dtac (mk_conjunctN n i), |
433 dtac bspec, rtac CollectI, etac @{thm set_mp[OF equalityD1[OF Succ_Shift]]}, |
433 dtac bspec, rtac CollectI, etac @{thm set_mp[OF equalityD1[OF Succ_Shift]]}, |
434 REPEAT_DETERM o eresolve_tac [exE, conjE], rtac exI, |
434 REPEAT_DETERM o eresolve_tac [exE, conjE], rtac exI, |
448 REPEAT_DETERM_N m o (rtac conjI THEN' atac), |
448 REPEAT_DETERM_N m o (rtac conjI THEN' atac), |
449 CONJ_WRAP' (K (EVERY' [etac trans, rtac @{thm Collect_cong}, |
449 CONJ_WRAP' (K (EVERY' [etac trans, rtac @{thm Collect_cong}, |
450 rtac @{thm eqset_imp_iff}, rtac sym, rtac trans, rtac @{thm Succ_Shift}, |
450 rtac @{thm eqset_imp_iff}, rtac sym, rtac trans, rtac @{thm Succ_Shift}, |
451 rtac (@{thm append_Nil} RS sym RS arg_cong)])) ks]) (ks ~~ active_sets)]; |
451 rtac (@{thm append_Nil} RS sym RS arg_cong)])) ks]) (ks ~~ active_sets)]; |
452 in |
452 in |
453 Local_Defs.unfold_tac ctxt defs THEN |
453 unfold_defs_tac ctxt defs THEN |
454 CONJ_WRAP' coalg_tac (ks ~~ (map (chop m) set_naturalss ~~ strT_defs)) 1 |
454 CONJ_WRAP' coalg_tac (ks ~~ (map (chop m) set_naturalss ~~ strT_defs)) 1 |
455 end; |
455 end; |
456 |
456 |
457 fun mk_card_of_carT_tac m isNode_defs sbd_sbd |
457 fun mk_card_of_carT_tac m isNode_defs sbd_sbd |
458 sbd_card_order sbd_Card_order sbd_Cinfinite sbd_Cnotzero in_sbds = |
458 sbd_card_order sbd_Card_order sbd_Cinfinite sbd_Cnotzero in_sbds = |
601 fun mk_isNode_hset_tac n isNode_def strT_hsets {context = ctxt, prems = _} = |
601 fun mk_isNode_hset_tac n isNode_def strT_hsets {context = ctxt, prems = _} = |
602 let |
602 let |
603 val m = length strT_hsets; |
603 val m = length strT_hsets; |
604 in |
604 in |
605 if m = 0 then atac 1 |
605 if m = 0 then atac 1 |
606 else (Local_Defs.unfold_tac ctxt [isNode_def] THEN |
606 else (unfold_defs_tac ctxt [isNode_def] THEN |
607 EVERY' [REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE], |
607 EVERY' [REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE], |
608 rtac exI, rtac conjI, atac, |
608 rtac exI, rtac conjI, atac, |
609 CONJ_WRAP' (fn (thm, i) => if i > m then atac |
609 CONJ_WRAP' (fn (thm, i) => if i > m then atac |
610 else EVERY' [rtac (thm RS subset_trans), atac, rtac conjI, atac, atac, atac]) |
610 else EVERY' [rtac (thm RS subset_trans), atac, rtac conjI, atac, atac, atac]) |
611 (strT_hsets @ (replicate n mp) ~~ (1 upto (m + n)))] 1) |
611 (strT_hsets @ (replicate n mp) ~~ (1 upto (m + n)))] 1) |
990 REPEAT_DETERM o rtac exI, rtac conjI, rtac refl, etac conjI, atac, |
990 REPEAT_DETERM o rtac exI, rtac conjI, rtac refl, etac conjI, atac, |
991 CONVERSION (Conv.top_conv |
991 CONVERSION (Conv.top_conv |
992 (K (Conv.try_conv (Conv.rewr_conv (rv_Cons RS eq_reflection)))) ctxt), |
992 (K (Conv.try_conv (Conv.rewr_conv (rv_Cons RS eq_reflection)))) ctxt), |
993 if n = 1 then K all_tac |
993 if n = 1 then K all_tac |
994 else rtac sum_case_weak_cong THEN' rtac (mk_sum_casesN n i' RS trans), |
994 else rtac sum_case_weak_cong THEN' rtac (mk_sum_casesN n i' RS trans), |
995 SELECT_GOAL (Local_Defs.unfold_tac ctxt [from_to_sbd]), rtac refl, |
995 SELECT_GOAL (unfold_defs_tac ctxt [from_to_sbd]), rtac refl, |
996 rtac refl]) |
996 rtac refl]) |
997 ks to_sbd_injs from_to_sbds)]; |
997 ks to_sbd_injs from_to_sbds)]; |
998 in |
998 in |
999 (rtac mor_cong THEN' |
999 (rtac mor_cong THEN' |
1000 EVERY' (map (fn thm => rtac (thm RS ext)) beh_defs) THEN' |
1000 EVERY' (map (fn thm => rtac (thm RS ext)) beh_defs) THEN' |
1047 rtac congruent_str_final, atac, rtac o_apply]) |
1047 rtac congruent_str_final, atac, rtac o_apply]) |
1048 (equiv_LSBISs ~~ congruent_str_finals)] 1; |
1048 (equiv_LSBISs ~~ congruent_str_finals)] 1; |
1049 |
1049 |
1050 fun mk_mor_Rep_tac m defs Reps Abs_inverses coalg_final_setss map_comp_ids map_congLs |
1050 fun mk_mor_Rep_tac m defs Reps Abs_inverses coalg_final_setss map_comp_ids map_congLs |
1051 {context = ctxt, prems = _} = |
1051 {context = ctxt, prems = _} = |
1052 Local_Defs.unfold_tac ctxt defs THEN |
1052 unfold_defs_tac ctxt defs THEN |
1053 EVERY' [rtac conjI, |
1053 EVERY' [rtac conjI, |
1054 CONJ_WRAP' (fn thm => rtac ballI THEN' rtac thm) Reps, |
1054 CONJ_WRAP' (fn thm => rtac ballI THEN' rtac thm) Reps, |
1055 CONJ_WRAP' (fn (Rep, ((map_comp_id, map_congL), coalg_final_sets)) => |
1055 CONJ_WRAP' (fn (Rep, ((map_comp_id, map_congL), coalg_final_sets)) => |
1056 EVERY' [rtac ballI, rtac (map_comp_id RS trans), rtac map_congL, |
1056 EVERY' [rtac ballI, rtac (map_comp_id RS trans), rtac map_congL, |
1057 EVERY' (map2 (fn Abs_inverse => fn coalg_final_set => |
1057 EVERY' (map2 (fn Abs_inverse => fn coalg_final_set => |
1059 etac set_rev_mp, rtac coalg_final_set, rtac Rep]) |
1059 etac set_rev_mp, rtac coalg_final_set, rtac Rep]) |
1060 Abs_inverses (drop m coalg_final_sets))]) |
1060 Abs_inverses (drop m coalg_final_sets))]) |
1061 (Reps ~~ ((map_comp_ids ~~ map_congLs) ~~ coalg_final_setss))] 1; |
1061 (Reps ~~ ((map_comp_ids ~~ map_congLs) ~~ coalg_final_setss))] 1; |
1062 |
1062 |
1063 fun mk_mor_Abs_tac defs Abs_inverses {context = ctxt, prems = _} = |
1063 fun mk_mor_Abs_tac defs Abs_inverses {context = ctxt, prems = _} = |
1064 Local_Defs.unfold_tac ctxt defs THEN |
1064 unfold_defs_tac ctxt defs THEN |
1065 EVERY' [rtac conjI, |
1065 EVERY' [rtac conjI, |
1066 CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) Abs_inverses, |
1066 CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) Abs_inverses, |
1067 CONJ_WRAP' (fn thm => rtac ballI THEN' etac (thm RS arg_cong RS sym)) Abs_inverses] 1; |
1067 CONJ_WRAP' (fn thm => rtac ballI THEN' etac (thm RS arg_cong RS sym)) Abs_inverses] 1; |
1068 |
1068 |
1069 fun mk_mor_coiter_tac m mor_UNIV unf_defs coiter_defs Abs_inverses morEs map_comp_ids map_congs = |
1069 fun mk_mor_coiter_tac m mor_UNIV unf_defs coiter_defs Abs_inverses morEs map_comp_ids map_congs = |
1114 rtac @{thm image2_eqI}, rtac refl, rtac (coiter_def RS arg_cong RS trans), |
1114 rtac @{thm image2_eqI}, rtac refl, rtac (coiter_def RS arg_cong RS trans), |
1115 rtac (o_apply RS sym), rtac UNIV_I]) (raw_coinds ~~ coiter_defs) 1; |
1115 rtac (o_apply RS sym), rtac UNIV_I]) (raw_coinds ~~ coiter_defs) 1; |
1116 |
1116 |
1117 fun mk_unf_o_fld_tac fld_def coiter map_comp_id map_congL coiter_o_unfs |
1117 fun mk_unf_o_fld_tac fld_def coiter map_comp_id map_congL coiter_o_unfs |
1118 {context = ctxt, prems = _} = |
1118 {context = ctxt, prems = _} = |
1119 Local_Defs.unfold_tac ctxt [fld_def] THEN EVERY' [rtac ext, rtac trans, rtac o_apply, |
1119 unfold_defs_tac ctxt [fld_def] THEN EVERY' [rtac ext, rtac trans, rtac o_apply, |
1120 rtac trans, rtac coiter, rtac trans, rtac map_comp_id, rtac trans, rtac map_congL, |
1120 rtac trans, rtac coiter, rtac trans, rtac map_comp_id, rtac trans, rtac map_congL, |
1121 EVERY' (map (fn thm => |
1121 EVERY' (map (fn thm => |
1122 rtac ballI THEN' rtac (trans OF [thm RS fun_cong, @{thm id_apply}])) coiter_o_unfs), |
1122 rtac ballI THEN' rtac (trans OF [thm RS fun_cong, @{thm id_apply}])) coiter_o_unfs), |
1123 rtac sym, rtac @{thm id_apply}] 1; |
1123 rtac sym, rtac @{thm id_apply}] 1; |
1124 |
1124 |
1125 fun mk_corec_tac m corec_defs coiter map_cong corec_Inls {context = ctxt, prems = _} = |
1125 fun mk_corec_tac m corec_defs coiter map_cong corec_Inls {context = ctxt, prems = _} = |
1126 Local_Defs.unfold_tac ctxt corec_defs THEN EVERY' [rtac trans, rtac (o_apply RS arg_cong), |
1126 unfold_defs_tac ctxt corec_defs THEN EVERY' [rtac trans, rtac (o_apply RS arg_cong), |
1127 rtac trans, rtac coiter, fo_rtac (@{thm sum.cases(2)} RS arg_cong RS trans) ctxt, rtac map_cong, |
1127 rtac trans, rtac coiter, fo_rtac (@{thm sum.cases(2)} RS arg_cong RS trans) ctxt, rtac map_cong, |
1128 REPEAT_DETERM_N m o rtac refl, |
1128 REPEAT_DETERM_N m o rtac refl, |
1129 EVERY' (map (fn thm => rtac @{thm sum_case_expand_Inr} THEN' rtac thm) corec_Inls)] 1; |
1129 EVERY' (map (fn thm => rtac @{thm sum_case_expand_Inr} THEN' rtac thm) corec_Inls)] 1; |
1130 |
1130 |
1131 fun mk_rel_coinduct_tac ks raw_coind bis_rel = |
1131 fun mk_rel_coinduct_tac ks raw_coind bis_rel = |
1260 rtac conjI, rtac refl, rtac refl]) ks]) 1 |
1260 rtac conjI, rtac refl, rtac refl]) ks]) 1 |
1261 end |
1261 end |
1262 |
1262 |
1263 fun mk_map_unique_tac coiter_unique map_comps {context = ctxt, prems = _} = |
1263 fun mk_map_unique_tac coiter_unique map_comps {context = ctxt, prems = _} = |
1264 rtac coiter_unique 1 THEN |
1264 rtac coiter_unique 1 THEN |
1265 Local_Defs.unfold_tac ctxt (map (fn thm => thm RS sym) map_comps @ @{thms o_assoc id_o o_id}) THEN |
1265 unfold_defs_tac ctxt (map (fn thm => thm RS sym) map_comps @ @{thms o_assoc id_o o_id}) THEN |
1266 ALLGOALS (etac sym); |
1266 ALLGOALS (etac sym); |
1267 |
1267 |
1268 fun mk_col_natural_tac cts rec_0s rec_Sucs map_simps set_naturalss |
1268 fun mk_col_natural_tac cts rec_0s rec_Sucs map_simps set_naturalss |
1269 {context = ctxt, prems = _} = |
1269 {context = ctxt, prems = _} = |
1270 let |
1270 let |
1271 val n = length map_simps; |
1271 val n = length map_simps; |
1272 in |
1272 in |
1273 EVERY' [rtac (Drule.instantiate' [] cts nat_induct), |
1273 EVERY' [rtac (Drule.instantiate' [] cts nat_induct), |
1274 REPEAT_DETERM o rtac allI, SELECT_GOAL (Local_Defs.unfold_tac ctxt rec_0s), |
1274 REPEAT_DETERM o rtac allI, SELECT_GOAL (unfold_defs_tac ctxt rec_0s), |
1275 CONJ_WRAP' (K (rtac @{thm image_empty})) rec_0s, |
1275 CONJ_WRAP' (K (rtac @{thm image_empty})) rec_0s, |
1276 REPEAT_DETERM o rtac allI, |
1276 REPEAT_DETERM o rtac allI, |
1277 CONJ_WRAP' (fn (rec_Suc, (map_simp, set_nats)) => EVERY' |
1277 CONJ_WRAP' (fn (rec_Suc, (map_simp, set_nats)) => EVERY' |
1278 [SELECT_GOAL (Local_Defs.unfold_tac ctxt |
1278 [SELECT_GOAL (unfold_defs_tac ctxt |
1279 (rec_Suc :: map_simp :: set_nats @ @{thms image_Un image_UN UN_simps(10)})), |
1279 (rec_Suc :: map_simp :: set_nats @ @{thms image_Un image_UN UN_simps(10)})), |
1280 rtac @{thm Un_cong}, rtac refl, |
1280 rtac @{thm Un_cong}, rtac refl, |
1281 CONJ_WRAP_GEN' (rtac (Thm.permute_prems 0 1 @{thm Un_cong})) |
1281 CONJ_WRAP_GEN' (rtac (Thm.permute_prems 0 1 @{thm Un_cong})) |
1282 (fn i => EVERY' [rtac @{thm UN_cong[OF refl]}, |
1282 (fn i => EVERY' [rtac @{thm UN_cong[OF refl]}, |
1283 REPEAT_DETERM o etac allE, etac (mk_conjunctN n i)]) (n downto 1)]) |
1283 REPEAT_DETERM o etac allE, etac (mk_conjunctN n i)]) (n downto 1)]) |
1370 REPEAT_DETERM o eresolve_tac [CollectE, conjE], etac map_eq] |
1370 REPEAT_DETERM o eresolve_tac [CollectE, conjE], etac map_eq] |
1371 end; |
1371 end; |
1372 |
1372 |
1373 fun mk_coalg_thePull_tac m coalg_def map_wpulls set_naturalss pickWP_assms_tacs |
1373 fun mk_coalg_thePull_tac m coalg_def map_wpulls set_naturalss pickWP_assms_tacs |
1374 {context = ctxt, prems = _} = |
1374 {context = ctxt, prems = _} = |
1375 Local_Defs.unfold_tac ctxt [coalg_def] THEN |
1375 unfold_defs_tac ctxt [coalg_def] THEN |
1376 CONJ_WRAP' (fn (map_wpull, (pickWP_assms_tac, set_naturals)) => |
1376 CONJ_WRAP' (fn (map_wpull, (pickWP_assms_tac, set_naturals)) => |
1377 EVERY' [rtac ballI, dtac @{thm set_mp[OF equalityD1[OF thePull_def]]}, |
1377 EVERY' [rtac ballI, dtac @{thm set_mp[OF equalityD1[OF thePull_def]]}, |
1378 REPEAT_DETERM o eresolve_tac [CollectE, @{thm prod_caseE}], |
1378 REPEAT_DETERM o eresolve_tac [CollectE, @{thm prod_caseE}], |
1379 hyp_subst_tac, rtac rev_mp, rtac (map_wpull RS @{thm pickWP(1)}), |
1379 hyp_subst_tac, rtac rev_mp, rtac (map_wpull RS @{thm pickWP(1)}), |
1380 EVERY' (map (etac o mk_conjunctN m) (1 upto m)), |
1380 EVERY' (map (etac o mk_conjunctN m) (1 upto m)), |
1381 pickWP_assms_tac, |
1381 pickWP_assms_tac, |
1382 SELECT_GOAL (Local_Defs.unfold_tac ctxt @{thms o_apply prod.cases}), rtac impI, |
1382 SELECT_GOAL (unfold_defs_tac ctxt @{thms o_apply prod.cases}), rtac impI, |
1383 REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
1383 REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
1384 rtac CollectI, |
1384 rtac CollectI, |
1385 REPEAT_DETERM_N m o (rtac conjI THEN' rtac @{thm subset_UNIV}), |
1385 REPEAT_DETERM_N m o (rtac conjI THEN' rtac @{thm subset_UNIV}), |
1386 CONJ_WRAP' (fn set_natural => |
1386 CONJ_WRAP' (fn set_natural => |
1387 EVERY' [rtac ord_eq_le_trans, rtac trans, rtac set_natural, |
1387 EVERY' [rtac ord_eq_le_trans, rtac trans, rtac set_natural, |
1392 fun mk_mor_thePull_nth_tac conv pick m mor_def map_wpulls map_comps pickWP_assms_tacs |
1392 fun mk_mor_thePull_nth_tac conv pick m mor_def map_wpulls map_comps pickWP_assms_tacs |
1393 {context = ctxt, prems = _} = |
1393 {context = ctxt, prems = _} = |
1394 let |
1394 let |
1395 val n = length map_comps; |
1395 val n = length map_comps; |
1396 in |
1396 in |
1397 Local_Defs.unfold_tac ctxt [mor_def] THEN |
1397 unfold_defs_tac ctxt [mor_def] THEN |
1398 EVERY' [rtac conjI, |
1398 EVERY' [rtac conjI, |
1399 CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) (1 upto n), |
1399 CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) (1 upto n), |
1400 CONJ_WRAP' (fn (map_wpull, (pickWP_assms_tac, map_comp)) => |
1400 CONJ_WRAP' (fn (map_wpull, (pickWP_assms_tac, map_comp)) => |
1401 EVERY' [rtac ballI, dtac @{thm set_mp[OF equalityD1[OF thePull_def]]}, |
1401 EVERY' [rtac ballI, dtac @{thm set_mp[OF equalityD1[OF thePull_def]]}, |
1402 REPEAT_DETERM o eresolve_tac [CollectE, @{thm prod_caseE}, conjE], |
1402 REPEAT_DETERM o eresolve_tac [CollectE, @{thm prod_caseE}, conjE], |
1403 hyp_subst_tac, |
1403 hyp_subst_tac, |
1404 SELECT_GOAL (Local_Defs.unfold_tac ctxt @{thms o_apply prod.cases}), |
1404 SELECT_GOAL (unfold_defs_tac ctxt @{thms o_apply prod.cases}), |
1405 rtac (map_comp RS trans), |
1405 rtac (map_comp RS trans), |
1406 SELECT_GOAL (Local_Defs.unfold_tac ctxt (conv :: @{thms o_id id_o})), |
1406 SELECT_GOAL (unfold_defs_tac ctxt (conv :: @{thms o_id id_o})), |
1407 rtac (map_wpull RS pick), REPEAT_DETERM_N m o atac, |
1407 rtac (map_wpull RS pick), REPEAT_DETERM_N m o atac, |
1408 pickWP_assms_tac]) |
1408 pickWP_assms_tac]) |
1409 (map_wpulls ~~ (pickWP_assms_tacs ~~ map_comps))] 1 |
1409 (map_wpulls ~~ (pickWP_assms_tacs ~~ map_comps))] 1 |
1410 end; |
1410 end; |
1411 |
1411 |
1412 val mk_mor_thePull_fst_tac = mk_mor_thePull_nth_tac @{thm fst_conv} @{thm pickWP(2)}; |
1412 val mk_mor_thePull_fst_tac = mk_mor_thePull_nth_tac @{thm fst_conv} @{thm pickWP(2)}; |
1413 val mk_mor_thePull_snd_tac = mk_mor_thePull_nth_tac @{thm snd_conv} @{thm pickWP(3)}; |
1413 val mk_mor_thePull_snd_tac = mk_mor_thePull_nth_tac @{thm snd_conv} @{thm pickWP(3)}; |
1414 |
1414 |
1415 fun mk_mor_thePull_pick_tac mor_def coiters map_comps {context = ctxt, prems = _} = |
1415 fun mk_mor_thePull_pick_tac mor_def coiters map_comps {context = ctxt, prems = _} = |
1416 Local_Defs.unfold_tac ctxt [mor_def, @{thm thePull_def}] THEN rtac conjI 1 THEN |
1416 unfold_defs_tac ctxt [mor_def, @{thm thePull_def}] THEN rtac conjI 1 THEN |
1417 CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) coiters 1 THEN |
1417 CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) coiters 1 THEN |
1418 CONJ_WRAP' (fn (coiter, map_comp) => |
1418 CONJ_WRAP' (fn (coiter, map_comp) => |
1419 EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, @{thm prod_caseE}, conjE], |
1419 EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, @{thm prod_caseE}, conjE], |
1420 hyp_subst_tac, |
1420 hyp_subst_tac, |
1421 SELECT_GOAL (Local_Defs.unfold_tac ctxt (coiter :: map_comp :: @{thms comp_def id_def})), |
1421 SELECT_GOAL (unfold_defs_tac ctxt (coiter :: map_comp :: @{thms comp_def id_def})), |
1422 rtac refl]) |
1422 rtac refl]) |
1423 (coiters ~~ map_comps) 1; |
1423 (coiters ~~ map_comps) 1; |
1424 |
1424 |
1425 fun mk_pick_col_tac m j cts rec_0s rec_Sucs coiters set_naturalss map_wpulls pickWP_assms_tacs |
1425 fun mk_pick_col_tac m j cts rec_0s rec_Sucs coiters set_naturalss map_wpulls pickWP_assms_tacs |
1426 {context = ctxt, prems = _} = |
1426 {context = ctxt, prems = _} = |
1440 EVERY' (map (etac o mk_conjunctN m) (1 upto m)), |
1440 EVERY' (map (etac o mk_conjunctN m) (1 upto m)), |
1441 pickWP_assms_tac, |
1441 pickWP_assms_tac, |
1442 rtac impI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
1442 rtac impI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
1443 rtac ord_eq_le_trans, rtac rec_Suc, |
1443 rtac ord_eq_le_trans, rtac rec_Suc, |
1444 rtac @{thm Un_least}, |
1444 rtac @{thm Un_least}, |
1445 SELECT_GOAL (Local_Defs.unfold_tac ctxt [coiter, nth set_naturals (j - 1), |
1445 SELECT_GOAL (unfold_defs_tac ctxt [coiter, nth set_naturals (j - 1), |
1446 @{thm prod.cases}]), |
1446 @{thm prod.cases}]), |
1447 etac ord_eq_le_trans_trans_fun_cong_image_id_id_apply, |
1447 etac ord_eq_le_trans_trans_fun_cong_image_id_id_apply, |
1448 CONJ_WRAP_GEN' (rtac (Thm.permute_prems 0 1 @{thm Un_least})) (fn (i, set_natural) => |
1448 CONJ_WRAP_GEN' (rtac (Thm.permute_prems 0 1 @{thm Un_least})) (fn (i, set_natural) => |
1449 EVERY' [rtac @{thm UN_least}, |
1449 EVERY' [rtac @{thm UN_least}, |
1450 SELECT_GOAL (Local_Defs.unfold_tac ctxt [coiter, set_natural, @{thm prod.cases}]), |
1450 SELECT_GOAL (unfold_defs_tac ctxt [coiter, set_natural, @{thm prod.cases}]), |
1451 etac imageE, hyp_subst_tac, REPEAT_DETERM o etac allE, |
1451 etac imageE, hyp_subst_tac, REPEAT_DETERM o etac allE, |
1452 dtac (mk_conjunctN n i), etac mp, etac set_mp, atac]) |
1452 dtac (mk_conjunctN n i), etac mp, etac set_mp, atac]) |
1453 (ks ~~ rev (drop m set_naturals))]) |
1453 (ks ~~ rev (drop m set_naturals))]) |
1454 (rec_Sucs ~~ ((coiters ~~ set_naturalss) ~~ (map_wpulls ~~ pickWP_assms_tacs)))] 1 |
1454 (rec_Sucs ~~ ((coiters ~~ set_naturalss) ~~ (map_wpulls ~~ pickWP_assms_tacs)))] 1 |
1455 end; |
1455 end; |
1480 |
1480 |
1481 fun mk_wit_tac n unf_flds set_simp wit coind_wits {context = ctxt, prems = _} = |
1481 fun mk_wit_tac n unf_flds set_simp wit coind_wits {context = ctxt, prems = _} = |
1482 ALLGOALS (TRY o (eresolve_tac coind_wits THEN' rtac refl)) THEN |
1482 ALLGOALS (TRY o (eresolve_tac coind_wits THEN' rtac refl)) THEN |
1483 REPEAT_DETERM (atac 1 ORELSE |
1483 REPEAT_DETERM (atac 1 ORELSE |
1484 EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac set_simp, |
1484 EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac set_simp, |
1485 K (Local_Defs.unfold_tac ctxt unf_flds), |
1485 K (unfold_defs_tac ctxt unf_flds), |
1486 REPEAT_DETERM_N n o etac UnE, |
1486 REPEAT_DETERM_N n o etac UnE, |
1487 REPEAT_DETERM o |
1487 REPEAT_DETERM o |
1488 (TRY o REPEAT_DETERM o etac UnE THEN' TRY o etac @{thm UN_E} THEN' |
1488 (TRY o REPEAT_DETERM o etac UnE THEN' TRY o etac @{thm UN_E} THEN' |
1489 (eresolve_tac wit ORELSE' |
1489 (eresolve_tac wit ORELSE' |
1490 (dresolve_tac wit THEN' |
1490 (dresolve_tac wit THEN' |
1491 (etac FalseE ORELSE' |
1491 (etac FalseE ORELSE' |
1492 EVERY' [hyp_subst_tac, dtac set_rev_mp, rtac equalityD1, resolve_tac set_simp, |
1492 EVERY' [hyp_subst_tac, dtac set_rev_mp, rtac equalityD1, resolve_tac set_simp, |
1493 K (Local_Defs.unfold_tac ctxt unf_flds), REPEAT_DETERM_N n o etac UnE]))))] 1); |
1493 K (unfold_defs_tac ctxt unf_flds), REPEAT_DETERM_N n o etac UnE]))))] 1); |
1494 |
1494 |
1495 fun mk_coind_wit_tac induct coiters set_nats wits {context = ctxt, prems = _} = |
1495 fun mk_coind_wit_tac induct coiters set_nats wits {context = ctxt, prems = _} = |
1496 rtac induct 1 THEN ALLGOALS (TRY o rtac impI THEN' TRY o hyp_subst_tac) THEN |
1496 rtac induct 1 THEN ALLGOALS (TRY o rtac impI THEN' TRY o hyp_subst_tac) THEN |
1497 Local_Defs.unfold_tac ctxt (coiters @ set_nats @ @{thms image_id id_apply}) THEN |
1497 unfold_defs_tac ctxt (coiters @ set_nats @ @{thms image_id id_apply}) THEN |
1498 ALLGOALS (REPEAT_DETERM o etac imageE THEN' TRY o hyp_subst_tac) THEN |
1498 ALLGOALS (REPEAT_DETERM o etac imageE THEN' TRY o hyp_subst_tac) THEN |
1499 ALLGOALS (TRY o |
1499 ALLGOALS (TRY o |
1500 FIRST' [rtac TrueI, rtac refl, etac (refl RSN (2, mp)), dresolve_tac wits THEN' etac FalseE]) |
1500 FIRST' [rtac TrueI, rtac refl, etac (refl RSN (2, mp)), dresolve_tac wits THEN' etac FalseE]) |
1501 |
1501 |
1502 fun mk_rel_simp_tac in_Jrels i in_rel map_comp map_cong map_simp set_simps unf_inject unf_fld |
1502 fun mk_rel_simp_tac in_Jrels i in_rel map_comp map_cong map_simp set_simps unf_inject unf_fld |