src/HOL/Fun.thy
changeset 51598 5dbe537087aa
parent 49905 a81f95693c68
child 51717 9e7d1c139569
equal deleted inserted replaced
51597:c916828edc92 51598:5dbe537087aa
   283 by(auto simp add: comp_inj_on inj_on_def)
   283 by(auto simp add: comp_inj_on inj_on_def)
   284 
   284 
   285 lemma inj_on_imageI2:
   285 lemma inj_on_imageI2:
   286   "inj_on (f' o f) A \<Longrightarrow> inj_on f A"
   286   "inj_on (f' o f) A \<Longrightarrow> inj_on f A"
   287 by(auto simp add: comp_inj_on inj_on_def)
   287 by(auto simp add: comp_inj_on inj_on_def)
       
   288 
       
   289 lemma inj_img_insertE:
       
   290   assumes "inj_on f A"
       
   291   assumes "x \<notin> B" and "insert x B = f ` A"
       
   292   obtains x' A' where "x' \<notin> A'" and "A = insert x' A'"
       
   293     and "x = f x'" and "B = f ` A'" 
       
   294 proof -
       
   295   from assms have "x \<in> f ` A" by auto
       
   296   then obtain x' where *: "x' \<in> A" "x = f x'" by auto
       
   297   then have "A = insert x' (A - {x'})" by auto
       
   298   with assms * have "B = f ` (A - {x'})"
       
   299     by (auto dest: inj_on_contraD)
       
   300   have "x' \<notin> A - {x'}" by simp
       
   301   from `x' \<notin> A - {x'}` `A = insert x' (A - {x'})` `x = f x'` `B = image f (A - {x'})`
       
   302   show ?thesis ..
       
   303 qed
   288 
   304 
   289 lemma surj_def: "surj f \<longleftrightarrow> (\<forall>y. \<exists>x. y = f x)"
   305 lemma surj_def: "surj f \<longleftrightarrow> (\<forall>y. \<exists>x. y = f x)"
   290   by auto
   306   by auto
   291 
   307 
   292 lemma surjI: assumes *: "\<And> x. g (f x) = x" shows "surj g"
   308 lemma surjI: assumes *: "\<And> x. g (f x) = x" shows "surj g"