src/HOL/Tools/BNF/bnf_gfp_tactics.ML
changeset 58634 9f10d82e8188
parent 58446 e89f57d1e46c
child 59498 50b60f501b05
equal deleted inserted replaced
58633:8529745af3dc 58634:9f10d82e8188
   606           (K (Conv.try_conv (Conv.rewr_conv (rv_Nil RS eq_reflection)))) ctxt),
   606           (K (Conv.try_conv (Conv.rewr_conv (rv_Nil RS eq_reflection)))) ctxt),
   607         if n = 1 then K all_tac
   607         if n = 1 then K all_tac
   608         else (rtac (sum_case_cong_weak RS trans) THEN'
   608         else (rtac (sum_case_cong_weak RS trans) THEN'
   609           rtac (mk_sum_caseN n i) THEN' rtac (mk_sum_caseN n i RS trans)),
   609           rtac (mk_sum_caseN n i) THEN' rtac (mk_sum_caseN n i RS trans)),
   610         rtac (map_comp_id RS trans), rtac (map_cong0 OF replicate m refl),
   610         rtac (map_comp_id RS trans), rtac (map_cong0 OF replicate m refl),
   611         EVERY' (map3 (fn i' => fn to_sbd_inj => fn from_to_sbd =>
   611         EVERY' (@{map 3} (fn i' => fn to_sbd_inj => fn from_to_sbd =>
   612           DETERM o EVERY' [rtac trans, rtac o_apply, rtac prod_injectI, rtac conjI,
   612           DETERM o EVERY' [rtac trans, rtac o_apply, rtac prod_injectI, rtac conjI,
   613             rtac trans, rtac @{thm Shift_def},
   613             rtac trans, rtac @{thm Shift_def},
   614             rtac equalityI, rtac subsetI, etac thin_rl,
   614             rtac equalityI, rtac subsetI, etac thin_rl,
   615             REPEAT_DETERM o eresolve_tac [CollectE, @{thm UN_E}], dtac length_Lev', dtac asm_rl,
   615             REPEAT_DETERM o eresolve_tac [CollectE, @{thm UN_E}], dtac length_Lev', dtac asm_rl,
   616             etac thin_rl, dtac @{thm set_rev_mp[OF _ equalityD1]},
   616             etac thin_rl, dtac @{thm set_rev_mp[OF _ equalityD1]},
   781 
   781 
   782 fun mk_set_le_tac n Jset_minimal set_Jsets set_Jset_Jsetss =
   782 fun mk_set_le_tac n Jset_minimal set_Jsets set_Jset_Jsetss =
   783   EVERY' [rtac Jset_minimal,
   783   EVERY' [rtac Jset_minimal,
   784     REPEAT_DETERM_N n o rtac @{thm Un_upper1},
   784     REPEAT_DETERM_N n o rtac @{thm Un_upper1},
   785     REPEAT_DETERM_N n o
   785     REPEAT_DETERM_N n o
   786       EVERY' (map3 (fn i => fn set_Jset => fn set_Jset_Jsets =>
   786       EVERY' (@{map 3} (fn i => fn set_Jset => fn set_Jset_Jsets =>
   787         EVERY' [rtac subsetI, rtac @{thm UnI2}, rtac (mk_UnIN n i), etac @{thm UN_I},
   787         EVERY' [rtac subsetI, rtac @{thm UnI2}, rtac (mk_UnIN n i), etac @{thm UN_I},
   788           etac UnE, etac set_Jset, REPEAT_DETERM_N (n - 1) o etac UnE,
   788           etac UnE, etac set_Jset, REPEAT_DETERM_N (n - 1) o etac UnE,
   789           EVERY' (map (fn thm => EVERY' [etac @{thm UN_E}, etac thm, atac]) set_Jset_Jsets)])
   789           EVERY' (map (fn thm => EVERY' [etac @{thm UN_E}, etac thm, atac]) set_Jset_Jsets)])
   790       (1 upto n) set_Jsets set_Jset_Jsetss)] 1;
   790       (1 upto n) set_Jsets set_Jset_Jsetss)] 1;
   791 
   791 
  1016     val n = length ks;
  1016     val n = length ks;
  1017     val fst_diag_nth = if fst then @{thm fst_diag_fst} else @{thm fst_diag_snd};
  1017     val fst_diag_nth = if fst then @{thm fst_diag_fst} else @{thm fst_diag_snd};
  1018     val snd_diag_nth = if fst then @{thm snd_diag_fst} else @{thm snd_diag_snd};
  1018     val snd_diag_nth = if fst then @{thm snd_diag_fst} else @{thm snd_diag_snd};
  1019   in
  1019   in
  1020     EVERY' [rtac coinduct,
  1020     EVERY' [rtac coinduct,
  1021       EVERY' (map8 (fn i => fn map_comp0 => fn map_cong => fn map_arg_cong => fn set_map0s =>
  1021       EVERY' (@{map 8} (fn i => fn map_comp0 => fn map_cong => fn map_arg_cong => fn set_map0s =>
  1022           fn dtor_unfold => fn dtor_map => fn in_rel =>
  1022           fn dtor_unfold => fn dtor_map => fn in_rel =>
  1023         EVERY' [REPEAT_DETERM o resolve_tac [allI, impI, in_rel RS iffD2],
  1023         EVERY' [REPEAT_DETERM o resolve_tac [allI, impI, in_rel RS iffD2],
  1024           REPEAT_DETERM o eresolve_tac [exE, conjE],
  1024           REPEAT_DETERM o eresolve_tac [exE, conjE],
  1025           select_prem_tac (length ks) (dtac @{thm spec2}) i, dtac mp, atac,
  1025           select_prem_tac (length ks) (dtac @{thm spec2}) i, dtac mp, atac,
  1026           REPEAT_DETERM o eresolve_tac [CollectE, conjE], hyp_subst_tac ctxt,
  1026           REPEAT_DETERM o eresolve_tac [CollectE, conjE], hyp_subst_tac ctxt,
  1048 
  1048 
  1049 fun mk_rel_coinduct_ind_tac ctxt m ks unfolds set_map0ss j set_induct =
  1049 fun mk_rel_coinduct_ind_tac ctxt m ks unfolds set_map0ss j set_induct =
  1050   let val n = length ks;
  1050   let val n = length ks;
  1051   in
  1051   in
  1052     rtac set_induct 1 THEN
  1052     rtac set_induct 1 THEN
  1053     EVERY' (map3 (fn unfold => fn set_map0s => fn i =>
  1053     EVERY' (@{map 3} (fn unfold => fn set_map0s => fn i =>
  1054       EVERY' [REPEAT_DETERM o resolve_tac [allI, impI], etac conjE,
  1054       EVERY' [REPEAT_DETERM o resolve_tac [allI, impI], etac conjE,
  1055         select_prem_tac n (dtac @{thm spec2}) i, dtac mp, atac,
  1055         select_prem_tac n (dtac @{thm spec2}) i, dtac mp, atac,
  1056         REPEAT_DETERM o eresolve_tac [CollectE, conjE, Collect_splitD_set_mp, set_rev_mp],
  1056         REPEAT_DETERM o eresolve_tac [CollectE, conjE, Collect_splitD_set_mp, set_rev_mp],
  1057         hyp_subst_tac ctxt,
  1057         hyp_subst_tac ctxt,
  1058         SELECT_GOAL (unfold_thms_tac ctxt ([unfold, nth set_map0s (j - 1)] @ split_id_unfolds)),
  1058         SELECT_GOAL (unfold_thms_tac ctxt ([unfold, nth set_map0s (j - 1)] @ split_id_unfolds)),
  1059         rtac subset_refl])
  1059         rtac subset_refl])
  1060     unfolds set_map0ss ks) 1 THEN
  1060     unfolds set_map0ss ks) 1 THEN
  1061     EVERY' (map3 (fn unfold => fn set_map0s => fn i =>
  1061     EVERY' (@{map 3} (fn unfold => fn set_map0s => fn i =>
  1062       EVERY' (map (fn set_map0 =>
  1062       EVERY' (map (fn set_map0 =>
  1063         EVERY' [REPEAT_DETERM o resolve_tac [allI, impI], etac conjE,
  1063         EVERY' [REPEAT_DETERM o resolve_tac [allI, impI], etac conjE,
  1064         select_prem_tac n (dtac @{thm spec2}) i, dtac mp, atac,
  1064         select_prem_tac n (dtac @{thm spec2}) i, dtac mp, atac,
  1065         REPEAT_DETERM o eresolve_tac [CollectE, conjE], hyp_subst_tac ctxt,
  1065         REPEAT_DETERM o eresolve_tac [CollectE, conjE], hyp_subst_tac ctxt,
  1066         SELECT_GOAL (unfold_thms_tac ctxt ([unfold, set_map0] @ split_id_unfolds)),
  1066         SELECT_GOAL (unfold_thms_tac ctxt ([unfold, set_map0] @ split_id_unfolds)),