src/HOL/Tools/BNF/bnf_comp_tactics.ML
changeset 55930 25a90cebbbe5
parent 55906 abf91ebd0820
child 55990 41c6b99c5fb7
equal deleted inserted replaced
55929:91f245c23bc5 55930:25a90cebbbe5
    29   val mk_permute_in_alt_tac: ''a list -> ''a list -> tactic
    29   val mk_permute_in_alt_tac: ''a list -> ''a list -> tactic
    30 
    30 
    31   val mk_le_rel_OO_tac: thm -> thm -> thm list -> tactic
    31   val mk_le_rel_OO_tac: thm -> thm -> thm list -> tactic
    32   val mk_simple_rel_OO_Grp_tac: thm -> thm -> tactic
    32   val mk_simple_rel_OO_Grp_tac: thm -> thm -> tactic
    33   val mk_simple_wit_tac: thm list -> tactic
    33   val mk_simple_wit_tac: thm list -> tactic
    34   val mk_simplified_set_tac: Proof.context -> tactic
    34   val mk_simplified_set_tac: Proof.context -> thm -> tactic
    35   val bd_ordIso_natLeq_tac: tactic
    35   val bd_ordIso_natLeq_tac: tactic
    36 end;
    36 end;
    37 
    37 
    38 structure BNF_Comp_Tactics : BNF_COMP_TACTICS =
    38 structure BNF_Comp_Tactics : BNF_COMP_TACTICS =
    39 struct
    39 struct
   142      WRAP' gen_before gen_after bds (rtac last_bd) THEN'
   142      WRAP' gen_before gen_after bds (rtac last_bd) THEN'
   143      rtac @{thm ordIso_imp_ordLeq} THEN'
   143      rtac @{thm ordIso_imp_ordLeq} THEN'
   144      rtac @{thm cprod_com}) 1
   144      rtac @{thm cprod_com}) 1
   145   end;
   145   end;
   146 
   146 
   147 val comp_in_alt_thms = @{thms o_apply collect_def SUP_def image_insert image_empty Union_insert
   147 val comp_in_alt_thms = @{thms o_apply collect_def image_insert image_empty Union_insert UN_insert
   148   Union_empty Un_empty_right Union_Un_distrib Un_subset_iff conj_subset_def UN_image_subset
   148   UN_empty Union_empty Un_empty_right Union_Un_distrib Un_subset_iff conj_subset_def UN_image_subset
   149   conj_assoc};
   149   conj_assoc};
   150 
   150 
   151 fun mk_comp_in_alt_tac ctxt comp_set_alts =
   151 fun mk_comp_in_alt_tac ctxt comp_set_alts =
   152   unfold_thms_tac ctxt (comp_set_alts @ comp_in_alt_thms) THEN
   152   unfold_thms_tac ctxt comp_set_alts THEN
       
   153   unfold_thms_tac ctxt comp_in_alt_thms THEN
   153   unfold_thms_tac ctxt @{thms set_eq_subset} THEN
   154   unfold_thms_tac ctxt @{thms set_eq_subset} THEN
   154   rtac conjI 1 THEN
   155   rtac conjI 1 THEN
   155   REPEAT_DETERM (
   156   REPEAT_DETERM (
   156     rtac @{thm subsetI} 1 THEN
   157     rtac @{thm subsetI} 1 THEN
   157     unfold_thms_tac ctxt @{thms mem_Collect_eq Ball_def} THEN
   158     unfold_thms_tac ctxt @{thms mem_Collect_eq Ball_def} THEN
   159      REPEAT_DETERM (CHANGED ((
   160      REPEAT_DETERM (CHANGED ((
   160        (rtac conjI THEN' (atac ORELSE' rtac subset_UNIV)) ORELSE'
   161        (rtac conjI THEN' (atac ORELSE' rtac subset_UNIV)) ORELSE'
   161        atac ORELSE'
   162        atac ORELSE'
   162        (rtac subset_UNIV)) 1)) ORELSE rtac subset_UNIV 1));
   163        (rtac subset_UNIV)) 1)) ORELSE rtac subset_UNIV 1));
   163 
   164 
   164 val comp_wit_thms = @{thms Union_empty_conv o_apply collect_def SUP_def
   165 val comp_wit_thms = @{thms Union_empty_conv o_apply collect_def UN_insert UN_empty Un_empty_right
   165   Union_image_insert Union_image_empty};
   166   Union_image_insert Union_image_empty};
   166 
   167 
   167 fun mk_comp_wit_tac ctxt set'_eq_sets Gwit_thms collect_set_map Fwit_thms =
   168 fun mk_comp_wit_tac ctxt set'_eq_sets Gwit_thms collect_set_map Fwit_thms =
   168   unfold_thms_tac ctxt set'_eq_sets THEN
   169   unfold_thms_tac ctxt set'_eq_sets THEN
   169   ALLGOALS (dtac @{thm in_Union_o_assoc}) THEN
   170   ALLGOALS (dtac @{thm in_Union_o_assoc}) THEN
   170   unfold_thms_tac ctxt (collect_set_map :: comp_wit_thms) THEN
   171   unfold_thms_tac ctxt [collect_set_map] THEN
       
   172   unfold_thms_tac ctxt comp_wit_thms THEN
   171   REPEAT_DETERM ((atac ORELSE'
   173   REPEAT_DETERM ((atac ORELSE'
   172     REPEAT_DETERM o eresolve_tac @{thms UnionE UnE} THEN'
   174     REPEAT_DETERM o eresolve_tac @{thms UnionE UnE} THEN'
   173     etac imageE THEN' TRY o dresolve_tac Gwit_thms THEN'
   175     etac imageE THEN' TRY o dresolve_tac Gwit_thms THEN'
   174     (etac FalseE ORELSE'
   176     (etac FalseE ORELSE'
   175     hyp_subst_tac ctxt THEN'
   177     hyp_subst_tac ctxt THEN'
   234 val csum_thms =
   236 val csum_thms =
   235   @{thms csum_cong1 csum_cong2 csum_cong  csum_dup[OF natLeq_cinfinite natLeq_Card_order]};
   237   @{thms csum_cong1 csum_cong2 csum_cong  csum_dup[OF natLeq_cinfinite natLeq_Card_order]};
   236 val cprod_thms =
   238 val cprod_thms =
   237   @{thms cprod_cong1 cprod_cong2 cprod_cong cprod_dup[OF natLeq_cinfinite natLeq_Card_order]};
   239   @{thms cprod_cong1 cprod_cong2 cprod_cong cprod_dup[OF natLeq_cinfinite natLeq_Card_order]};
   238 
   240 
   239 (*inspired by "bnf_fp_def_sugar_tactics.ML"*)
       
   240 val simplified_set_simps =
   241 val simplified_set_simps =
   241   @{thms SUP_empty Sup_empty Sup_insert UN_insert Un_empty_left Un_empty_right Un_iff
   242   @{thms collect_def[abs_def] UN_insert UN_empty Un_empty_right Un_empty_left
   242       Union_Un_distrib collect_def[abs_def] image_def o_def map_pair_simp mem_Collect_eq
   243     o_def Union_Un_distrib Union_image_eq UN_empty2 UN_singleton id_bnf_comp_def};
   243       mem_UN_compreh_ex_eq UN_compreh_ex_eq_eq sum.set_map prod.set_map id_bnf_comp_def};
   244 
   244 
   245 fun mk_simplified_set_tac ctxt collect_set_map =
   245 fun mk_simplified_set_tac ctxt =
   246   unfold_thms_tac ctxt (collect_set_map :: @{thms comp_assoc}) THEN
   246   unfold_thms_tac ctxt simplified_set_simps THEN rtac refl 1;
   247   unfold_thms_tac ctxt simplified_set_simps THEN rtac refl 1;
   247 
   248 
   248 val bd_ordIso_natLeq_tac =
   249 val bd_ordIso_natLeq_tac =
   249   HEADGOAL (REPEAT_DETERM o resolve_tac
   250   HEADGOAL (REPEAT_DETERM o resolve_tac
   250     (@{thm ordIso_refl[OF natLeq_Card_order]} :: csum_thms @ cprod_thms));
   251     (@{thm ordIso_refl[OF natLeq_Card_order]} :: csum_thms @ cprod_thms));