src/HOL/Set.thy
changeset 16773 33c4d8fe6f78
parent 16636 1ed737a98198
child 17002 fb9261990ffe
equal deleted inserted replaced
16772:fe9dfbc2fa3f 16773:33c4d8fe6f78
  1108 
  1108 
  1109 
  1109 
  1110 text {* \medskip Monotonicity. *}
  1110 text {* \medskip Monotonicity. *}
  1111 
  1111 
  1112 lemma mono_Un: "mono f ==> f A \<union> f B \<subseteq> f (A \<union> B)"
  1112 lemma mono_Un: "mono f ==> f A \<union> f B \<subseteq> f (A \<union> B)"
  1113   by (blast dest: monoD)
  1113   by (auto simp add: mono_def)
  1114 
  1114 
  1115 lemma mono_Int: "mono f ==> f (A \<inter> B) \<subseteq> f A \<inter> f B"
  1115 lemma mono_Int: "mono f ==> f (A \<inter> B) \<subseteq> f A \<inter> f B"
  1116   by (blast dest: monoD)
  1116   by (auto simp add: mono_def)
  1117 
  1117 
  1118 subsubsection {* Equalities involving union, intersection, inclusion, etc. *}
  1118 subsubsection {* Equalities involving union, intersection, inclusion, etc. *}
  1119 
  1119 
  1120 text {* @{text "{}"}. *}
  1120 text {* @{text "{}"}. *}
  1121 
  1121 
  1197   by blast
  1197   by blast
  1198 
  1198 
  1199 lemma insert_disjoint[simp]:
  1199 lemma insert_disjoint[simp]:
  1200  "(insert a A \<inter> B = {}) = (a \<notin> B \<and> A \<inter> B = {})"
  1200  "(insert a A \<inter> B = {}) = (a \<notin> B \<and> A \<inter> B = {})"
  1201  "({} = insert a A \<inter> B) = (a \<notin> B \<and> {} = A \<inter> B)"
  1201  "({} = insert a A \<inter> B) = (a \<notin> B \<and> {} = A \<inter> B)"
  1202 by auto
  1202   by auto
  1203 
  1203 
  1204 lemma disjoint_insert[simp]:
  1204 lemma disjoint_insert[simp]:
  1205  "(B \<inter> insert a A = {}) = (a \<notin> B \<and> B \<inter> A = {})"
  1205  "(B \<inter> insert a A = {}) = (a \<notin> B \<and> B \<inter> A = {})"
  1206  "({} = A \<inter> insert b B) = (b \<notin> A \<and> {} = A \<inter> B)"
  1206  "({} = A \<inter> insert b B) = (b \<notin> A \<and> {} = A \<inter> B)"
  1207 by auto
  1207   by auto
  1208 
  1208 
  1209 text {* \medskip @{text image}. *}
  1209 text {* \medskip @{text image}. *}
  1210 
  1210 
  1211 lemma image_empty [simp]: "f`{} = {}"
  1211 lemma image_empty [simp]: "f`{} = {}"
  1212   by blast
  1212   by blast
  1213 
  1213 
  1214 lemma image_insert [simp]: "f ` insert a B = insert (f a) (f`B)"
  1214 lemma image_insert [simp]: "f ` insert a B = insert (f a) (f`B)"
  1215   by blast
  1215   by blast
  1216 
  1216 
  1217 lemma image_constant: "x \<in> A ==> (\<lambda>x. c) ` A = {c}"
  1217 lemma image_constant: "x \<in> A ==> (\<lambda>x. c) ` A = {c}"
  1218   by blast
  1218   by auto
  1219 
  1219 
  1220 lemma image_image: "f ` (g ` A) = (\<lambda>x. f (g x)) ` A"
  1220 lemma image_image: "f ` (g ` A) = (\<lambda>x. f (g x)) ` A"
  1221   by blast
  1221   by blast
  1222 
  1222 
  1223 lemma insert_image [simp]: "x \<in> A ==> insert (f x) (f`A) = f`A"
  1223 lemma insert_image [simp]: "x \<in> A ==> insert (f x) (f`A) = f`A"
  1224   by blast
  1224   by blast
  1225 
  1225 
  1226 lemma image_is_empty [iff]: "(f`A = {}) = (A = {})"
  1226 lemma image_is_empty [iff]: "(f`A = {}) = (A = {})"
  1227   by blast
  1227   by blast
  1228 
  1228 
       
  1229 
  1229 lemma image_Collect: "f ` {x. P x} = {f x | x. P x}"
  1230 lemma image_Collect: "f ` {x. P x} = {f x | x. P x}"
  1230   -- {* NOT suitable as a default simprule: the RHS isn't simpler than the LHS, *}
  1231   -- {* NOT suitable as a default simprule: the RHS isn't simpler than the LHS,
  1231   -- {* with its implicit quantifier and conjunction.  Also image enjoys better *}
  1232       with its implicit quantifier and conjunction.  Also image enjoys better
  1232   -- {* equational properties than does the RHS. *}
  1233       equational properties than does the RHS. *}
  1233   by blast
  1234   by blast
  1234 
  1235 
  1235 lemma if_image_distrib [simp]:
  1236 lemma if_image_distrib [simp]:
  1236   "(\<lambda>x. if P x then f x else g x) ` S
  1237   "(\<lambda>x. if P x then f x else g x) ` S
  1237     = (f ` (S \<inter> {x. P x})) \<union> (g ` (S \<inter> {x. \<not> P x}))"
  1238     = (f ` (S \<inter> {x. P x})) \<union> (g ` (S \<inter> {x. \<not> P x}))"