src/HOL/Fun.thy
changeset 69661 a03a63b81f44
parent 69605 a96320074298
child 69700 7a92cbec7030
equal deleted inserted replaced
69660:2bc2a8599369 69661:a03a63b81f44
   597 text \<open>Important examples\<close>
   597 text \<open>Important examples\<close>
   598 
   598 
   599 context cancel_semigroup_add
   599 context cancel_semigroup_add
   600 begin
   600 begin
   601 
   601 
   602 lemma inj_add_left [simp]: \<open>inj ((+) a)\<close>
   602 lemma inj_on_add [simp]:
   603   by (rule injI) simp
   603   "inj_on ((+) a) A"
       
   604   by (rule inj_onI) simp
       
   605 
       
   606 lemma inj_add_left:
       
   607   \<open>inj ((+) a)\<close>
       
   608   by simp
       
   609 
       
   610 lemma inj_on_add' [simp]:
       
   611   "inj_on (\<lambda>b. b + a) A"
       
   612   by (rule inj_onI) simp
       
   613 
       
   614 lemma bij_betw_add [simp]:
       
   615   "bij_betw ((+) a) A B \<longleftrightarrow> (+) a ` A = B"
       
   616   by (simp add: bij_betw_def)
   604 
   617 
   605 end
   618 end
   606 
   619 
   607 context ab_group_add
   620 context ab_group_add
   608 begin
   621 begin
   609 
   622 
   610 lemma inj_diff_right [simp]: \<open>inj (\<lambda>b. b - a)\<close>
   623 lemma surj_plus [simp]:
       
   624   "surj ((+) a)"
       
   625   by (auto intro: range_eqI [of b "(+) a" "b - a" for b] simp add: algebra_simps)
       
   626 
       
   627 lemma inj_diff_right [simp]:
       
   628   \<open>inj (\<lambda>b. b - a)\<close>
   611 proof -
   629 proof -
   612   have \<open>inj ((+) (- a))\<close>
   630   have \<open>inj ((+) (- a))\<close>
   613     by (fact inj_add_left)
   631     by (fact inj_add_left)
   614   also have \<open>(+) (- a) = (\<lambda>b. b - a)\<close>
   632   also have \<open>(+) (- a) = (\<lambda>b. b - a)\<close>
   615     by (simp add: fun_eq_iff)
   633     by (simp add: fun_eq_iff)
   616   finally show ?thesis .
   634   finally show ?thesis .
   617 qed
   635 qed
       
   636 
       
   637 lemma surj_diff_right [simp]:
       
   638   "surj (\<lambda>x. x - a)"
       
   639   using surj_plus [of "- a"] by (simp cong: image_cong_simp)
       
   640 
       
   641 lemma translation_Compl:
       
   642   "(+) a ` (- t) = - ((+) a ` t)"
       
   643 proof (rule set_eqI)
       
   644   fix b
       
   645   show "b \<in> (+) a ` (- t) \<longleftrightarrow> b \<in> - (+) a ` t"
       
   646     by (auto simp: image_iff algebra_simps intro!: bexI [of _ "b - a"])
       
   647 qed
       
   648 
       
   649 lemma translation_subtract_Compl:
       
   650   "(\<lambda>x. x - a) ` (- t) = - ((\<lambda>x. x - a) ` t)"
       
   651   using translation_Compl [of "- a" t] by (simp cong: image_cong_simp)
       
   652 
       
   653 lemma translation_diff:
       
   654   "(+) a ` (s - t) = ((+) a ` s) - ((+) a ` t)"
       
   655   by auto
       
   656 
       
   657 lemma translation_subtract_diff:
       
   658   "(\<lambda>x. x - a) ` (s - t) = ((\<lambda>x. x - a) ` s) - ((\<lambda>x. x - a) ` t)"
       
   659   using translation_diff [of "- a"] by (simp cong: image_cong_simp)
       
   660 
       
   661 lemma translation_Int:
       
   662   "(+) a ` (s \<inter> t) = ((+) a ` s) \<inter> ((+) a ` t)"
       
   663   by auto
       
   664 
       
   665 lemma translation_subtract_Int:
       
   666   "(\<lambda>x. x - a) ` (s \<inter> t) = ((\<lambda>x. x - a) ` s) \<inter> ((\<lambda>x. x - a) ` t)"
       
   667   using translation_Int [of " -a"] by (simp cong: image_cong_simp)
   618 
   668 
   619 end
   669 end
   620 
   670 
   621 
   671 
   622 subsection \<open>Function Updating\<close>
   672 subsection \<open>Function Updating\<close>