src/HOL/Fun.thy
changeset 59504 8c6747dba731
parent 58889 5b7a9633cfa8
child 59507 b468e0f8da2a
equal deleted inserted replaced
59492:ef195926dd98 59504:8c6747dba731
    13 
    13 
    14 lemma apply_inverse:
    14 lemma apply_inverse:
    15   "f x = u \<Longrightarrow> (\<And>x. P x \<Longrightarrow> g (f x) = x) \<Longrightarrow> P x \<Longrightarrow> x = g u"
    15   "f x = u \<Longrightarrow> (\<And>x. P x \<Longrightarrow> g (f x) = x) \<Longrightarrow> P x \<Longrightarrow> x = g u"
    16   by auto
    16   by auto
    17 
    17 
       
    18 text{*Uniqueness, so NOT the axiom of choice.*}
       
    19 lemma uniq_choice: "\<forall>x. \<exists>!y. Q x y \<Longrightarrow> \<exists>f. \<forall>x. Q x (f x)"
       
    20   by (force intro: theI')
       
    21 
       
    22 lemma b_uniq_choice: "\<forall>x\<in>S. \<exists>!y. Q x y \<Longrightarrow> \<exists>f. \<forall>x\<in>S. Q x (f x)"
       
    23   by (force intro: theI')
    18 
    24 
    19 subsection {* The Identity Function @{text id} *}
    25 subsection {* The Identity Function @{text id} *}
    20 
    26 
    21 definition id :: "'a \<Rightarrow> 'a" where
    27 definition id :: "'a \<Rightarrow> 'a" where
    22   "id = (\<lambda>x. x)"
    28   "id = (\<lambda>x. x)"
    76   by auto
    82   by auto
    77 
    83 
    78 lemma vimage_comp:
    84 lemma vimage_comp:
    79   "f -` (g -` x) = (g \<circ> f) -` x"
    85   "f -` (g -` x) = (g \<circ> f) -` x"
    80   by auto
    86   by auto
       
    87 
       
    88 lemma image_eq_imp_comp: "f ` A = g ` B \<Longrightarrow> (h o f) ` A = (h o g) ` B"
       
    89   by (auto simp: comp_def elim!: equalityE)
    81 
    90 
    82 code_printing
    91 code_printing
    83   constant comp \<rightharpoonup> (SML) infixl 5 "o" and (Haskell) infixr 9 "."
    92   constant comp \<rightharpoonup> (SML) infixl 5 "o" and (Haskell) infixr 9 "."
    84 
    93 
    85 
    94 
   475 by (simp add: inj_on_def, blast)
   484 by (simp add: inj_on_def, blast)
   476 
   485 
   477 lemma image_set_diff: "inj f ==> f`(A-B) = f`A - f`B"
   486 lemma image_set_diff: "inj f ==> f`(A-B) = f`A - f`B"
   478 by (simp add: inj_on_def, blast)
   487 by (simp add: inj_on_def, blast)
   479 
   488 
   480 lemma inj_image_mem_iff: "inj f ==> (f a : f`A) = (a : A)"
   489 lemma inj_on_image_mem_iff: "\<lbrakk>inj_on f B; a \<in> B; A \<subseteq> B\<rbrakk> \<Longrightarrow> f a \<in> f`A \<longleftrightarrow> a \<in> A"
   481 by (blast dest: injD)
   490   by (auto simp: inj_on_def)
       
   491 
       
   492 lemma inj_image_mem_iff: "inj f \<Longrightarrow> f a \<in> f`A \<longleftrightarrow> a \<in> A"
       
   493   by (blast dest: injD)
   482 
   494 
   483 lemma inj_image_subset_iff: "inj f ==> (f`A <= f`B) = (A<=B)"
   495 lemma inj_image_subset_iff: "inj f ==> (f`A <= f`B) = (A<=B)"
   484 by (simp add: inj_on_def, blast)
   496   by (blast dest: injD)
   485 
   497 
   486 lemma inj_image_eq_iff: "inj f ==> (f`A = f`B) = (A = B)"
   498 lemma inj_image_eq_iff: "inj f ==> (f`A = f`B) = (A = B)"
   487 by (blast dest: injD)
   499   by (blast dest: injD)
   488 
   500 
   489 lemma surj_Compl_image_subset: "surj f ==> -(f`A) <= f`(-A)"
   501 lemma surj_Compl_image_subset: "surj f ==> -(f`A) <= f`(-A)"
   490 by auto
   502 by auto
   491 
   503 
   492 lemma inj_image_Compl_subset: "inj f ==> f`(-A) <= -(f`A)"
   504 lemma inj_image_Compl_subset: "inj f ==> f`(-A) <= -(f`A)"