src/HOL/Metis_Examples/Abstraction.thy
changeset 36566 f91342f218a9
parent 33027 9cf389429f6d
child 36571 16ec4fe058cb
equal deleted inserted replaced
36565:061475351a09 36566:f91342f218a9
    21   pset  :: "'a set => 'a set"
    21   pset  :: "'a set => 'a set"
    22   order :: "'a set => ('a * 'a) set"
    22   order :: "'a set => ('a * 'a) set"
    23 
    23 
    24 declare [[ atp_problem_prefix = "Abstraction__Collect_triv" ]]
    24 declare [[ atp_problem_prefix = "Abstraction__Collect_triv" ]]
    25 lemma (*Collect_triv:*) "a \<in> {x. P x} ==> P a"
    25 lemma (*Collect_triv:*) "a \<in> {x. P x} ==> P a"
    26 proof (neg_clausify)
    26 proof -
    27 assume 0: "(a\<Colon>'a\<Colon>type) \<in> Collect (P\<Colon>'a\<Colon>type \<Rightarrow> bool)"
    27   assume "a \<in> {x. P x}"
    28 assume 1: "\<not> (P\<Colon>'a\<Colon>type \<Rightarrow> bool) (a\<Colon>'a\<Colon>type)"
    28   hence "a \<in> P" by (metis Collect_def)
    29 have 2: "(P\<Colon>'a\<Colon>type \<Rightarrow> bool) (a\<Colon>'a\<Colon>type)"
    29   hence "P a" by (metis mem_def)
    30   by (metis CollectD 0)
    30   thus "P a" by metis
    31 show "False"
       
    32   by (metis 2 1)
       
    33 qed
    31 qed
    34 
    32 
    35 lemma Collect_triv: "a \<in> {x. P x} ==> P a"
    33 lemma Collect_triv: "a \<in> {x. P x} ==> P a"
    36 by (metis mem_Collect_eq)
    34 by (metis mem_Collect_eq)
    37 
    35 
    38 
    36 
    39 declare [[ atp_problem_prefix = "Abstraction__Collect_mp" ]]
    37 declare [[ atp_problem_prefix = "Abstraction__Collect_mp" ]]
    40 lemma "a \<in> {x. P x --> Q x} ==> a \<in> {x. P x} ==> a \<in> {x. Q x}"
    38 lemma "a \<in> {x. P x --> Q x} ==> a \<in> {x. P x} ==> a \<in> {x. Q x}"
    41   by (metis CollectI Collect_imp_eq ComplD UnE mem_Collect_eq);
    39   by (metis Collect_imp_eq ComplD UnE)
    42   --{*34 secs*}
       
    43 
    40 
    44 declare [[ atp_problem_prefix = "Abstraction__Sigma_triv" ]]
    41 declare [[ atp_problem_prefix = "Abstraction__Sigma_triv" ]]
    45 lemma "(a,b) \<in> Sigma A B ==> a \<in> A & b \<in> B a"
    42 lemma "(a,b) \<in> Sigma A B ==> a \<in> A & b \<in> B a"
    46 proof (neg_clausify)
    43 proof -
    47 assume 0: "(a\<Colon>'a\<Colon>type, b\<Colon>'b\<Colon>type) \<in> Sigma (A\<Colon>'a\<Colon>type set) (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set)"
    44   assume A1: "(a, b) \<in> Sigma A B"
    48 assume 1: "(a\<Colon>'a\<Colon>type) \<notin> (A\<Colon>'a\<Colon>type set) \<or> (b\<Colon>'b\<Colon>type) \<notin> (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set) a"
    45   hence F1: "b \<in> B a" by (metis mem_Sigma_iff)
    49 have 2: "(a\<Colon>'a\<Colon>type) \<in> (A\<Colon>'a\<Colon>type set)"
    46   have F2: "a \<in> A" by (metis A1 mem_Sigma_iff)
    50   by (metis SigmaD1 0)
    47   have "b \<in> B a" by (metis F1)
    51 have 3: "(b\<Colon>'b\<Colon>type) \<in> (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set) (a\<Colon>'a\<Colon>type)"
    48   thus "a \<in> A \<and> b \<in> B a" by (metis F2)
    52   by (metis SigmaD2 0)
       
    53 have 4: "(b\<Colon>'b\<Colon>type) \<notin> (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set) (a\<Colon>'a\<Colon>type)"
       
    54   by (metis 1 2)
       
    55 show "False"
       
    56   by (metis 3 4)
       
    57 qed
    49 qed
    58 
    50 
    59 lemma Sigma_triv: "(a,b) \<in> Sigma A B ==> a \<in> A & b \<in> B a"
    51 lemma Sigma_triv: "(a,b) \<in> Sigma A B ==> a \<in> A & b \<in> B a"
    60 by (metis SigmaD1 SigmaD2)
    52 by (metis SigmaD1 SigmaD2)
    61 
    53 
    62 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect" ]]
    54 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect" ]]
    63 lemma "(a,b) \<in> (SIGMA x: A. {y. x = f y}) ==> a \<in> A & a = f b"
    55 lemma "(a, b) \<in> (SIGMA x:A. {y. x = f y}) \<Longrightarrow> a \<in> A \<and> a = f b"
    64 (*???metis says this is satisfiable!
    56 (* Metis says this is satisfiable!
    65 by (metis CollectD SigmaD1 SigmaD2)
    57 by (metis CollectD SigmaD1 SigmaD2)
    66 *)
    58 *)
    67 by (meson CollectD SigmaD1 SigmaD2)
    59 by (meson CollectD SigmaD1 SigmaD2)
    68 
    60 
    69 
    61 
    70 (*single-step*)
    62 lemma "(a, b) \<in> (SIGMA x:A. {y. x = f y}) \<Longrightarrow> a \<in> A \<and> a = f b"
    71 lemma "(a,b) \<in> (SIGMA x: A. {y. x = f y}) ==> a \<in> A & a = f b"
    63 by (metis mem_Sigma_iff singleton_conv2 vimage_Collect_eq vimage_singleton_eq)
    72 by (metis SigmaD1 SigmaD2 insert_def singleton_conv2 Un_empty_right vimage_Collect_eq vimage_def vimage_singleton_eq)
    64 
    73 
    65 lemma "(a, b) \<in> (SIGMA x:A. {y. x = f y}) \<Longrightarrow> a \<in> A \<and> a = f b"
    74 
    66 proof -
    75 lemma "(a,b) \<in> (SIGMA x: A. {y. x = f y}) ==> a \<in> A & a = f b"
    67   assume A1: "(a, b) \<in> (SIGMA x:A. {y. x = f y})"
    76 proof (neg_clausify)
    68   have F1: "\<forall>u. {u} = op = u" by (metis singleton_conv2 Collect_def)
    77 assume 0: "(a\<Colon>'a\<Colon>type, b\<Colon>'b\<Colon>type)
    69   have F2: "\<forall>x w. (\<lambda>R. w (x R)) = x -` w" by (metis vimage_Collect_eq Collect_def)
    78 \<in> Sigma (A\<Colon>'a\<Colon>type set)
    70   have F3: "\<forall>v w y. v \<in> w -` op = y \<longrightarrow> w v = y" by (metis F1 vimage_singleton_eq)
    79    (COMBB Collect (COMBC (COMBB COMBB op =) (f\<Colon>'b\<Colon>type \<Rightarrow> 'a\<Colon>type)))"
    71   have F4: "b \<in> {R. a = f R}" by (metis A1 mem_Sigma_iff)
    80 assume 1: "(a\<Colon>'a\<Colon>type) \<notin> (A\<Colon>'a\<Colon>type set) \<or> a \<noteq> (f\<Colon>'b\<Colon>type \<Rightarrow> 'a\<Colon>type) (b\<Colon>'b\<Colon>type)"
    72   have F5: "a \<in> A" by (metis A1 mem_Sigma_iff)
    81 have 2: "(a\<Colon>'a\<Colon>type) \<in> (A\<Colon>'a\<Colon>type set)"
    73   have "b \<in> f -` op = a" by (metis F2 F4 Collect_def)
    82   by (metis 0 SigmaD1)
    74   hence "f b = a" by (metis F3)
    83 have 3: "(b\<Colon>'b\<Colon>type)
    75   thus "a \<in> A \<and> a = f b" by (metis F5)
    84 \<in> COMBB Collect (COMBC (COMBB COMBB op =) (f\<Colon>'b\<Colon>type \<Rightarrow> 'a\<Colon>type)) (a\<Colon>'a\<Colon>type)"
    76 qed
    85   by (metis 0 SigmaD2) 
    77 
    86 have 4: "(b\<Colon>'b\<Colon>type) \<in> Collect (COMBB (op = (a\<Colon>'a\<Colon>type)) (f\<Colon>'b\<Colon>type \<Rightarrow> 'a\<Colon>type))"
    78 (* Alternative structured proof *)
    87   by (metis 3)
    79 lemma "(a, b) \<in> (SIGMA x:A. {y. x = f y}) \<Longrightarrow> a \<in> A \<and> a = f b"
    88 have 5: "(f\<Colon>'b\<Colon>type \<Rightarrow> 'a\<Colon>type) (b\<Colon>'b\<Colon>type) \<noteq> (a\<Colon>'a\<Colon>type)"
    80 proof -
    89   by (metis 1 2)
    81   assume A1: "(a, b) \<in> (SIGMA x:A. {y. x = f y})"
    90 have 6: "(f\<Colon>'b\<Colon>type \<Rightarrow> 'a\<Colon>type) (b\<Colon>'b\<Colon>type) = (a\<Colon>'a\<Colon>type)"
    82   hence F1: "a \<in> A" by (metis mem_Sigma_iff)
    91   by (metis 4 vimage_singleton_eq insert_def singleton_conv2 Un_empty_right vimage_Collect_eq vimage_def)
    83   have "b \<in> {R. a = f R}" by (metis A1 mem_Sigma_iff)
    92 show "False"
    84   hence F2: "b \<in> (\<lambda>R. a = f R)" by (metis Collect_def)
    93   by (metis 5 6)
    85   hence "a = f b" by (unfold mem_def)
    94 qed
    86   thus "a \<in> A \<and> a = f b" by (metis F1)
    95 
       
    96 (*Alternative structured proof, untyped*)
       
    97 lemma "(a,b) \<in> (SIGMA x: A. {y. x = f y}) ==> a \<in> A & a = f b"
       
    98 proof (neg_clausify)
       
    99 assume 0: "(a, b) \<in> Sigma A (COMBB Collect (COMBC (COMBB COMBB op =) f))"
       
   100 have 1: "b \<in> Collect (COMBB (op = a) f)"
       
   101   by (metis 0 SigmaD2)
       
   102 have 2: "f b = a"
       
   103   by (metis 1 vimage_Collect_eq singleton_conv2 insert_def Un_empty_right vimage_singleton_eq vimage_def)
       
   104 assume 3: "a \<notin> A \<or> a \<noteq> f b"
       
   105 have 4: "a \<in> A"
       
   106   by (metis 0 SigmaD1)
       
   107 have 5: "f b \<noteq> a"
       
   108   by (metis 4 3)
       
   109 show "False"
       
   110   by (metis 5 2)
       
   111 qed
    87 qed
   112 
    88 
   113 
    89 
   114 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_in_pp" ]]
    90 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_in_pp" ]]
   115 lemma "(cl,f) \<in> CLF ==> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) ==> f \<in> pset cl"
    91 lemma "(cl,f) \<in> CLF ==> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) ==> f \<in> pset cl"
   116 by (metis Collect_mem_eq SigmaD2)
    92 by (metis Collect_mem_eq SigmaD2)
   117 
    93 
   118 lemma "(cl,f) \<in> CLF ==> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) ==> f \<in> pset cl"
    94 lemma "(cl,f) \<in> CLF ==> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) ==> f \<in> pset cl"
   119 proof (neg_clausify)
    95 proof -
   120 assume 0: "(cl, f) \<in> CLF"
    96   assume A1: "(cl, f) \<in> CLF"
   121 assume 1: "CLF = Sigma CL (COMBB Collect (COMBB (COMBC op \<in>) pset))"
    97   assume A2: "CLF = (SIGMA cl:CL. {f. f \<in> pset cl})"
   122 assume 2: "f \<notin> pset cl"
    98   have F1: "\<forall>v. (\<lambda>R. R \<in> v) = v" by (metis Collect_mem_eq Collect_def)
   123 have 3: "\<And>X1 X2. X2 \<in> COMBB Collect (COMBB (COMBC op \<in>) pset) X1 \<or> (X1, X2) \<notin> CLF"
    99   have "\<forall>v u. (u, v) \<in> CLF \<longrightarrow> v \<in> {R. R \<in> pset u}" by (metis A2 mem_Sigma_iff)
   124   by (metis SigmaD2 1)
   100   hence "\<forall>v u. (u, v) \<in> CLF \<longrightarrow> v \<in> pset u" by (metis F1 Collect_def)
   125 have 4: "\<And>X1 X2. X2 \<in> pset X1 \<or> (X1, X2) \<notin> CLF"
   101   hence "f \<in> pset cl" by (metis A1)
   126   by (metis 3 Collect_mem_eq)
   102   thus "f \<in> pset cl" by metis
   127 have 5: "(cl, f) \<notin> CLF"
       
   128   by (metis 2 4)
       
   129 show "False"
       
   130   by (metis 5 0)
       
   131 qed
   103 qed
   132 
   104 
   133 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect_Pi" ]]
   105 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect_Pi" ]]
   134 lemma
   106 lemma
   135     "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
   107     "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
   136     f \<in> pset cl \<rightarrow> pset cl"
   108     f \<in> pset cl \<rightarrow> pset cl"
   137 proof (neg_clausify)
   109 proof -
   138 assume 0: "f \<notin> Pi (pset cl) (COMBK (pset cl))"
   110   assume A1: "(cl, f) \<in> (SIGMA cl:CL. {f. f \<in> pset cl \<rightarrow> pset cl})"
   139 assume 1: "(cl, f)
   111   have F1: "\<forall>v. (\<lambda>R. R \<in> v) = v" by (metis Collect_mem_eq Collect_def)
   140 \<in> Sigma CL
   112   have "f \<in> {R. R \<in> pset cl \<rightarrow> pset cl}" using A1 by simp
   141    (COMBB Collect
   113   hence "f \<in> pset cl \<rightarrow> pset cl" by (metis F1 Collect_def)
   142      (COMBB (COMBC op \<in>) (COMBS (COMBB Pi pset) (COMBB COMBK pset))))"
   114   thus "f \<in> pset cl \<rightarrow> pset cl" by metis
   143 show "False"
   115 qed
   144 (*  by (metis 0 Collect_mem_eq SigmaD2 1) ??doesn't terminate*)
       
   145   by (insert 0 1, simp add: COMBB_def COMBS_def COMBC_def)
       
   146 qed
       
   147 
       
   148 
   116 
   149 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect_Int" ]]
   117 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect_Int" ]]
   150 lemma
   118 lemma
   151     "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
   119     "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
   152    f \<in> pset cl \<inter> cl"
   120    f \<in> pset cl \<inter> cl"
   153 proof (neg_clausify)
   121 proof -
   154 assume 0: "(cl, f)
   122   assume A1: "(cl, f) \<in> (SIGMA cl:CL. {f. f \<in> pset cl \<inter> cl})"
   155 \<in> Sigma CL
   123   have F1: "\<forall>v. (\<lambda>R. R \<in> v) = v" by (metis Collect_mem_eq Collect_def)
   156    (COMBB Collect (COMBB (COMBC op \<in>) (COMBS (COMBB op \<inter> pset) COMBI)))"
   124   have "f \<in> {R. R \<in> pset cl \<inter> cl}" using A1 by simp
   157 assume 1: "f \<notin> pset cl \<inter> cl"
   125   hence "f \<in> Id_on cl `` pset cl" by (metis F1 Int_commute Image_Id_on Collect_def)
   158 have 2: "f \<in> COMBB Collect (COMBB (COMBC op \<in>) (COMBS (COMBB op \<inter> pset) COMBI)) cl" 
   126   hence "f \<in> Id_on cl `` pset cl" by metis
   159   by (insert 0, simp add: COMBB_def) 
   127   hence "f \<in> cl \<inter> pset cl" by (metis Image_Id_on)
   160 (*  by (metis SigmaD2 0)  ??doesn't terminate*)
   128   thus "f \<in> pset cl \<inter> cl" by (metis Int_commute)
   161 have 3: "f \<in> COMBS (COMBB op \<inter> pset) COMBI cl"
       
   162   by (metis 2 Collect_mem_eq)
       
   163 have 4: "f \<notin> cl \<inter> pset cl"
       
   164   by (metis 1 Int_commute)
       
   165 have 5: "f \<in> cl \<inter> pset cl"
       
   166   by (metis 3 Int_commute)
       
   167 show "False"
       
   168   by (metis 5 4)
       
   169 qed
   129 qed
   170 
   130 
   171 
   131 
   172 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect_Pi_mono" ]]
   132 declare [[ atp_problem_prefix = "Abstraction__Sigma_Collect_Pi_mono" ]]
   173 lemma
   133 lemma
   179 lemma "(cl,f) \<in> CLF ==> 
   139 lemma "(cl,f) \<in> CLF ==> 
   180    CLF \<subseteq> (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
   140    CLF \<subseteq> (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
   181    f \<in> pset cl \<inter> cl"
   141    f \<in> pset cl \<inter> cl"
   182 by auto
   142 by auto
   183 
   143 
   184 (*??no longer terminates, with combinators
       
   185 by (metis Collect_mem_eq Int_def SigmaD2 UnCI Un_absorb1)
       
   186   --{*@{text Int_def} is redundant*}
       
   187 *)
       
   188 
   144 
   189 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_Collect_Int" ]]
   145 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_Collect_Int" ]]
   190 lemma "(cl,f) \<in> CLF ==> 
   146 lemma "(cl,f) \<in> CLF ==> 
   191    CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
   147    CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
   192    f \<in> pset cl \<inter> cl"
   148    f \<in> pset cl \<inter> cl"
   193 by auto
   149 by auto
   194 (*??no longer terminates, with combinators
   150 
   195 by (metis Collect_mem_eq Int_commute SigmaD2)
       
   196 *)
       
   197 
   151 
   198 declare [[ atp_problem_prefix = "Abstraction__CLF_subset_Collect_Pi" ]]
   152 declare [[ atp_problem_prefix = "Abstraction__CLF_subset_Collect_Pi" ]]
   199 lemma 
   153 lemma 
   200    "(cl,f) \<in> CLF ==> 
   154    "(cl,f) \<in> CLF ==> 
   201     CLF \<subseteq> (SIGMA cl': CL. {f. f \<in> pset cl' \<rightarrow> pset cl'}) ==> 
   155     CLF \<subseteq> (SIGMA cl': CL. {f. f \<in> pset cl' \<rightarrow> pset cl'}) ==> 
   202     f \<in> pset cl \<rightarrow> pset cl"
   156     f \<in> pset cl \<rightarrow> pset cl"
   203 by fast
   157 by fast
   204 (*??no longer terminates, with combinators
   158 
   205 by (metis Collect_mem_eq SigmaD2 subsetD)
       
   206 *)
       
   207 
   159 
   208 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_Collect_Pi" ]]
   160 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_Collect_Pi" ]]
   209 lemma 
   161 lemma 
   210   "(cl,f) \<in> CLF ==> 
   162   "(cl,f) \<in> CLF ==> 
   211    CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
   163    CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
   212    f \<in> pset cl \<rightarrow> pset cl"
   164    f \<in> pset cl \<rightarrow> pset cl"
   213 by auto
   165 by auto
   214 (*??no longer terminates, with combinators
   166 
   215 by (metis Collect_mem_eq SigmaD2 contra_subsetD equalityE)
       
   216 *)
       
   217 
   167 
   218 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_Collect_Pi_mono" ]]
   168 declare [[ atp_problem_prefix = "Abstraction__CLF_eq_Collect_Pi_mono" ]]
   219 lemma 
   169 lemma 
   220   "(cl,f) \<in> CLF ==> 
   170   "(cl,f) \<in> CLF ==> 
   221    CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl & monotone f (pset cl) (order cl)}) ==>
   171    CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl & monotone f (pset cl) (order cl)}) ==>
   223 by auto
   173 by auto
   224 
   174 
   225 declare [[ atp_problem_prefix = "Abstraction__map_eq_zipA" ]]
   175 declare [[ atp_problem_prefix = "Abstraction__map_eq_zipA" ]]
   226 lemma "map (%x. (f x, g x)) xs = zip (map f xs) (map g xs)"
   176 lemma "map (%x. (f x, g x)) xs = zip (map f xs) (map g xs)"
   227 apply (induct xs)
   177 apply (induct xs)
   228 (*sledgehammer*)  
   178  apply (metis map_is_Nil_conv zip.simps(1))
   229 apply auto
   179 by auto
   230 done
       
   231 
   180 
   232 declare [[ atp_problem_prefix = "Abstraction__map_eq_zipB" ]]
   181 declare [[ atp_problem_prefix = "Abstraction__map_eq_zipB" ]]
   233 lemma "map (%w. (w -> w, w \<times> w)) xs = 
   182 lemma "map (%w. (w -> w, w \<times> w)) xs = 
   234        zip (map (%w. w -> w) xs) (map (%w. w \<times> w) xs)"
   183        zip (map (%w. w -> w) xs) (map (%w. w \<times> w) xs)"
   235 apply (induct xs)
   184 apply (induct xs)
   236 (*sledgehammer*)  
   185  apply (metis Nil_is_map_conv zip_Nil)
   237 apply auto
   186 by auto
   238 done
       
   239 
   187 
   240 declare [[ atp_problem_prefix = "Abstraction__image_evenA" ]]
   188 declare [[ atp_problem_prefix = "Abstraction__image_evenA" ]]
   241 lemma "(%x. Suc(f x)) ` {x. even x} <= A ==> (\<forall>x. even x --> Suc(f x) \<in> A)";
   189 lemma "(%x. Suc(f x)) ` {x. even x} <= A ==> (\<forall>x. even x --> Suc(f x) \<in> A)"
   242 (*sledgehammer*)  
   190 by (metis Collect_def image_subset_iff mem_def)
   243 by auto
       
   244 
   191 
   245 declare [[ atp_problem_prefix = "Abstraction__image_evenB" ]]
   192 declare [[ atp_problem_prefix = "Abstraction__image_evenB" ]]
   246 lemma "(%x. f (f x)) ` ((%x. Suc(f x)) ` {x. even x}) <= A 
   193 lemma "(%x. f (f x)) ` ((%x. Suc(f x)) ` {x. even x}) <= A 
   247        ==> (\<forall>x. even x --> f (f (Suc(f x))) \<in> A)";
   194        ==> (\<forall>x. even x --> f (f (Suc(f x))) \<in> A)";
   248 (*sledgehammer*)  
   195 by (metis Collect_def imageI image_image image_subset_iff mem_def)
   249 by auto
       
   250 
   196 
   251 declare [[ atp_problem_prefix = "Abstraction__image_curry" ]]
   197 declare [[ atp_problem_prefix = "Abstraction__image_curry" ]]
   252 lemma "f \<in> (%u v. b \<times> u \<times> v) ` A ==> \<forall>u v. P (b \<times> u \<times> v) ==> P(f y)" 
   198 lemma "f \<in> (%u v. b \<times> u \<times> v) ` A ==> \<forall>u v. P (b \<times> u \<times> v) ==> P(f y)" 
   253 (*sledgehammer*)  
   199 (*sledgehammer*)
   254 by auto
   200 by auto
   255 
   201 
   256 declare [[ atp_problem_prefix = "Abstraction__image_TimesA" ]]
   202 declare [[ atp_problem_prefix = "Abstraction__image_TimesA" ]]
   257 lemma image_TimesA: "(%(x,y). (f x, g y)) ` (A \<times> B) = (f`A) \<times> (g`B)"
   203 lemma image_TimesA: "(%(x,y). (f x, g y)) ` (A \<times> B) = (f`A) \<times> (g`B)"
   258 (*sledgehammer*) 
   204 (*sledgehammer*)
   259 apply (rule equalityI)
   205 apply (rule equalityI)
   260 (***Even the two inclusions are far too difficult
   206 (***Even the two inclusions are far too difficult
   261 using [[ atp_problem_prefix = "Abstraction__image_TimesA_simpler"]]
   207 using [[ atp_problem_prefix = "Abstraction__image_TimesA_simpler"]]
   262 ***)
   208 ***)
   263 apply (rule subsetI)
   209 apply (rule subsetI)
   281 (*Given the difficulty of the previous problem, these two are probably
   227 (*Given the difficulty of the previous problem, these two are probably
   282 impossible*)
   228 impossible*)
   283 
   229 
   284 declare [[ atp_problem_prefix = "Abstraction__image_TimesB" ]]
   230 declare [[ atp_problem_prefix = "Abstraction__image_TimesB" ]]
   285 lemma image_TimesB:
   231 lemma image_TimesB:
   286     "(%(x,y,z). (f x, g y, h z)) ` (A \<times> B \<times> C) = (f`A) \<times> (g`B) \<times> (h`C)" 
   232     "(%(x,y,z). (f x, g y, h z)) ` (A \<times> B \<times> C) = (f`A) \<times> (g`B) \<times> (h`C)"
   287 (*sledgehammer*) 
   233 (*sledgehammer*)
   288 by force
   234 by force
   289 
   235 
   290 declare [[ atp_problem_prefix = "Abstraction__image_TimesC" ]]
   236 declare [[ atp_problem_prefix = "Abstraction__image_TimesC" ]]
   291 lemma image_TimesC:
   237 lemma image_TimesC:
   292     "(%(x,y). (x \<rightarrow> x, y \<times> y)) ` (A \<times> B) = 
   238     "(%(x,y). (x \<rightarrow> x, y \<times> y)) ` (A \<times> B) = 
   293      ((%x. x \<rightarrow> x) ` A) \<times> ((%y. y \<times> y) ` B)" 
   239      ((%x. x \<rightarrow> x) ` A) \<times> ((%y. y \<times> y) ` B)" 
   294 (*sledgehammer*) 
   240 (*sledgehammer*)
   295 by auto
   241 by auto
   296 
   242 
   297 end
   243 end