src/HOL/Fun.thy
changeset 49905 a81f95693c68
parent 49739 13aa6d8268ec
child 51598 5dbe537087aa
equal deleted inserted replaced
49904:2df2786ac7b7 49905:a81f95693c68
   186 
   186 
   187 lemma inj_on_UNION_chain:
   187 lemma inj_on_UNION_chain:
   188   assumes CH: "\<And> i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<le> A j \<or> A j \<le> A i" and
   188   assumes CH: "\<And> i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<le> A j \<or> A j \<le> A i" and
   189          INJ: "\<And> i. i \<in> I \<Longrightarrow> inj_on f (A i)"
   189          INJ: "\<And> i. i \<in> I \<Longrightarrow> inj_on f (A i)"
   190   shows "inj_on f (\<Union> i \<in> I. A i)"
   190   shows "inj_on f (\<Union> i \<in> I. A i)"
   191 proof(unfold inj_on_def UNION_eq, auto)
   191 proof -
   192   fix i j x y
   192   {
   193   assume *: "i \<in> I" "j \<in> I" and **: "x \<in> A i" "y \<in> A j"
   193     fix i j x y
   194          and ***: "f x = f y"
   194     assume *: "i \<in> I" "j \<in> I" and **: "x \<in> A i" "y \<in> A j"
   195   show "x = y"
   195       and ***: "f x = f y"
   196   proof-
   196     have "x = y"
   197     {assume "A i \<le> A j"
   197     proof -
   198      with ** have "x \<in> A j" by auto
   198       {
   199      with INJ * ** *** have ?thesis
   199         assume "A i \<le> A j"
   200      by(auto simp add: inj_on_def)
   200         with ** have "x \<in> A j" by auto
   201     }
   201         with INJ * ** *** have ?thesis
   202     moreover
   202         by(auto simp add: inj_on_def)
   203     {assume "A j \<le> A i"
   203       }
   204      with ** have "y \<in> A i" by auto
   204       moreover
   205      with INJ * ** *** have ?thesis
   205       {
   206      by(auto simp add: inj_on_def)
   206         assume "A j \<le> A i"
   207     }
   207         with ** have "y \<in> A i" by auto
   208     ultimately show ?thesis using  CH * by blast
   208         with INJ * ** *** have ?thesis
   209   qed
   209         by(auto simp add: inj_on_def)
       
   210       }
       
   211       ultimately show ?thesis using CH * by blast
       
   212     qed
       
   213   }
       
   214   then show ?thesis by (unfold inj_on_def UNION_eq) auto
   210 qed
   215 qed
   211 
   216 
   212 lemma surj_id: "surj id"
   217 lemma surj_id: "surj id"
   213 by simp
   218 by simp
   214 
   219 
   414 
   419 
   415 lemma bij_betw_UNION_chain:
   420 lemma bij_betw_UNION_chain:
   416   assumes CH: "\<And> i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<le> A j \<or> A j \<le> A i" and
   421   assumes CH: "\<And> i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<le> A j \<or> A j \<le> A i" and
   417          BIJ: "\<And> i. i \<in> I \<Longrightarrow> bij_betw f (A i) (A' i)"
   422          BIJ: "\<And> i. i \<in> I \<Longrightarrow> bij_betw f (A i) (A' i)"
   418   shows "bij_betw f (\<Union> i \<in> I. A i) (\<Union> i \<in> I. A' i)"
   423   shows "bij_betw f (\<Union> i \<in> I. A i) (\<Union> i \<in> I. A' i)"
   419 proof(unfold bij_betw_def, auto simp add: image_def)
   424 proof (unfold bij_betw_def, auto)
   420   have "\<And> i. i \<in> I \<Longrightarrow> inj_on f (A i)"
   425   have "\<And> i. i \<in> I \<Longrightarrow> inj_on f (A i)"
   421   using BIJ bij_betw_def[of f] by auto
   426   using BIJ bij_betw_def[of f] by auto
   422   thus "inj_on f (\<Union> i \<in> I. A i)"
   427   thus "inj_on f (\<Union> i \<in> I. A i)"
   423   using CH inj_on_UNION_chain[of I A f] by auto
   428   using CH inj_on_UNION_chain[of I A f] by auto
   424 next
   429 next
   428   thus "\<exists>j \<in> I. f x \<in> A' j" using * by blast
   433   thus "\<exists>j \<in> I. f x \<in> A' j" using * by blast
   429 next
   434 next
   430   fix i x'
   435   fix i x'
   431   assume *: "i \<in> I" "x' \<in> A' i"
   436   assume *: "i \<in> I" "x' \<in> A' i"
   432   hence "\<exists>x \<in> A i. x' = f x" using BIJ bij_betw_def[of f] by blast
   437   hence "\<exists>x \<in> A i. x' = f x" using BIJ bij_betw_def[of f] by blast
   433   thus "\<exists>j \<in> I. \<exists>x \<in> A j. x' = f x"
   438   then have "\<exists>j \<in> I. \<exists>x \<in> A j. x' = f x"
   434   using * by blast
   439     using * by blast
       
   440   then show "x' \<in> f ` (\<Union>x\<in>I. A x)" by (simp add: image_def)
   435 qed
   441 qed
   436 
   442 
   437 lemma bij_betw_subset:
   443 lemma bij_betw_subset:
   438   assumes BIJ: "bij_betw f A A'" and
   444   assumes BIJ: "bij_betw f A A'" and
   439           SUB: "B \<le> A" and IM: "f ` B = B'"
   445           SUB: "B \<le> A" and IM: "f ` B = B'"