src/HOL/Codatatype/Tools/bnf_wrap_tactics.ML
changeset 49463 83ac281bcdc2
parent 49213 975ccb0130cb
child 49484 0194a18f80cf
equal deleted inserted replaced
49462:9ef072c757ca 49463:83ac281bcdc2
    36 fun mk_unique_disc_def_tac m exhaust' =
    36 fun mk_unique_disc_def_tac m exhaust' =
    37   EVERY' [rtac iffI, rtac exhaust', REPEAT_DETERM_N m o rtac exI, atac, rtac refl] 1;
    37   EVERY' [rtac iffI, rtac exhaust', REPEAT_DETERM_N m o rtac exI, atac, rtac refl] 1;
    38 
    38 
    39 fun mk_alternate_disc_def_tac ctxt k other_disc_def distinct exhaust' =
    39 fun mk_alternate_disc_def_tac ctxt k other_disc_def distinct exhaust' =
    40   EVERY' ([subst_tac ctxt [other_disc_def], rtac @{thm iffI_np}, REPEAT_DETERM o etac exE,
    40   EVERY' ([subst_tac ctxt [other_disc_def], rtac @{thm iffI_np}, REPEAT_DETERM o etac exE,
    41     hyp_subst_tac, SELECT_GOAL (Local_Defs.unfold_tac ctxt [not_ex]), REPEAT_DETERM o rtac allI,
    41     hyp_subst_tac, SELECT_GOAL (unfold_defs_tac ctxt [not_ex]), REPEAT_DETERM o rtac allI,
    42     rtac distinct, rtac exhaust'] @
    42     rtac distinct, rtac exhaust'] @
    43     (([etac notE, REPEAT_DETERM o rtac exI, atac], [REPEAT_DETERM o rtac exI, atac])
    43     (([etac notE, REPEAT_DETERM o rtac exI, atac], [REPEAT_DETERM o rtac exI, atac])
    44      |> k = 1 ? swap |> op @)) 1;
    44      |> k = 1 ? swap |> op @)) 1;
    45 
    45 
    46 fun mk_half_disc_exclude_tac m discD disc'_thm =
    46 fun mk_half_disc_exclude_tac m discD disc'_thm =
    62    (if m = 0 then
    62    (if m = 0 then
    63       atac
    63       atac
    64     else
    64     else
    65       REPEAT_DETERM_N m o etac exE THEN'
    65       REPEAT_DETERM_N m o etac exE THEN'
    66       hyp_subst_tac THEN'
    66       hyp_subst_tac THEN'
    67       SELECT_GOAL (Local_Defs.unfold_tac ctxt sel_thms) THEN'
    67       SELECT_GOAL (unfold_defs_tac ctxt sel_thms) THEN'
    68       rtac refl)) 1;
    68       rtac refl)) 1;
    69 
    69 
    70 fun mk_case_eq_tac ctxt n exhaust' case_thms disc_thmss' sel_thmss =
    70 fun mk_case_eq_tac ctxt n exhaust' case_thms disc_thmss' sel_thmss =
    71   (rtac exhaust' THEN'
    71   (rtac exhaust' THEN'
    72    EVERY' (map3 (fn case_thm => fn if_disc_thms => fn sel_thms =>
    72    EVERY' (map3 (fn case_thm => fn if_disc_thms => fn sel_thms =>
    73        EVERY' [hyp_subst_tac, SELECT_GOAL (Local_Defs.unfold_tac ctxt (if_disc_thms @ sel_thms)),
    73        EVERY' [hyp_subst_tac, SELECT_GOAL (unfold_defs_tac ctxt (if_disc_thms @ sel_thms)),
    74          rtac case_thm])
    74          rtac case_thm])
    75      case_thms (map2 (seq_conds if_P_or_not_P_OF n) (1 upto n) disc_thmss') sel_thmss)) 1;
    75      case_thms (map2 (seq_conds if_P_or_not_P_OF n) (1 upto n) disc_thmss') sel_thmss)) 1;
    76 
    76 
    77 fun mk_case_cong_tac exhaust' case_thms =
    77 fun mk_case_cong_tac exhaust' case_thms =
    78   (rtac exhaust' THEN'
    78   (rtac exhaust' THEN'
    88   ALLGOALS (blast_tac naked_ctxt);
    88   ALLGOALS (blast_tac naked_ctxt);
    89 
    89 
    90 val split_asm_thms = @{thms imp_conv_disj de_Morgan_conj de_Morgan_disj not_not not_ex};
    90 val split_asm_thms = @{thms imp_conv_disj de_Morgan_conj de_Morgan_disj not_not not_ex};
    91 
    91 
    92 fun mk_split_asm_tac ctxt split =
    92 fun mk_split_asm_tac ctxt split =
    93   rtac (split RS trans) 1 THEN Local_Defs.unfold_tac ctxt split_asm_thms THEN rtac refl 1;
    93   rtac (split RS trans) 1 THEN unfold_defs_tac ctxt split_asm_thms THEN rtac refl 1;
    94 
    94 
    95 end;
    95 end;