Made UN_Un simp
authornipkow
Sun Aug 19 21:21:37 2007 +0200 (2007-08-19)
changeset 2433176f7a8c6e842
parent 24330 9cae2e2a4b70
child 24332 e3a2b75b1cf9
Made UN_Un simp
src/HOL/Library/Continuity.thy
src/HOL/Map.thy
src/HOL/Set.thy
     1.1 --- a/src/HOL/Library/Continuity.thy	Sun Aug 19 12:43:05 2007 +0200
     1.2 +++ b/src/HOL/Library/Continuity.thy	Sun Aug 19 21:21:37 2007 +0200
     1.3 @@ -139,26 +139,26 @@
     1.4    "up_cont f = (\<forall>F. up_chain F --> f (\<Union>(range F)) = \<Union>(f ` range F))"
     1.5  
     1.6  lemma up_contI:
     1.7 -    "(!!F. up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)) ==> up_cont f"
     1.8 -  apply (unfold up_cont_def)
     1.9 -  apply blast
    1.10 -  done
    1.11 +  "(!!F. up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)) ==> up_cont f"
    1.12 +apply (unfold up_cont_def)
    1.13 +apply blast
    1.14 +done
    1.15  
    1.16  lemma up_contD:
    1.17 -    "up_cont f ==> up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)"
    1.18 -  apply (unfold up_cont_def)
    1.19 -  apply auto
    1.20 -  done
    1.21 +  "up_cont f ==> up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)"
    1.22 +apply (unfold up_cont_def)
    1.23 +apply auto
    1.24 +done
    1.25  
    1.26  
    1.27  lemma up_cont_mono: "up_cont f ==> mono f"
    1.28 -  apply (rule monoI)
    1.29 -  apply (drule_tac F = "\<lambda>i. if i = 0 then A else B" in up_contD)
    1.30 -   apply (rule up_chainI)
    1.31 -   apply  simp+
    1.32 -  apply (drule Un_absorb1)
    1.33 -  apply (auto simp add: nat_not_singleton)
    1.34 -  done
    1.35 +apply (rule monoI)
    1.36 +apply (drule_tac F = "\<lambda>i. if i = 0 then A else B" in up_contD)
    1.37 + apply (rule up_chainI)
    1.38 + apply simp
    1.39 +apply (drule Un_absorb1)
    1.40 +apply (auto simp add: nat_not_singleton)
    1.41 +done
    1.42  
    1.43  
    1.44  definition
    1.45 @@ -180,13 +180,13 @@
    1.46    done
    1.47  
    1.48  lemma down_cont_mono: "down_cont f ==> mono f"
    1.49 -  apply (rule monoI)
    1.50 -  apply (drule_tac F = "\<lambda>i. if i = 0 then B else A" in down_contD)
    1.51 -   apply (rule down_chainI)
    1.52 -   apply simp+
    1.53 -  apply (drule Int_absorb1)
    1.54 -  apply (auto simp add: nat_not_singleton)
    1.55 -  done
    1.56 +apply (rule monoI)
    1.57 +apply (drule_tac F = "\<lambda>i. if i = 0 then B else A" in down_contD)
    1.58 + apply (rule down_chainI)
    1.59 + apply simp
    1.60 +apply (drule Int_absorb1)
    1.61 +apply (auto simp add: nat_not_singleton)
    1.62 +done
    1.63  
    1.64  
    1.65  subsection "Iteration"
     2.1 --- a/src/HOL/Map.thy	Sun Aug 19 12:43:05 2007 +0200
     2.2 +++ b/src/HOL/Map.thy	Sun Aug 19 21:21:37 2007 +0200
     2.3 @@ -90,13 +90,13 @@
     2.4  subsection {* @{term [source] empty} *}
     2.5  
     2.6  lemma empty_upd_none [simp]: "empty(x := None) = empty"
     2.7 -  by (rule ext) simp
     2.8 +by (rule ext) simp
     2.9  
    2.10  
    2.11  subsection {* @{term [source] map_upd} *}
    2.12  
    2.13  lemma map_upd_triv: "t k = Some x ==> t(k|->x) = t"
    2.14 -  by (rule ext) simp
    2.15 +by (rule ext) simp
    2.16  
    2.17  lemma map_upd_nonempty [simp]: "t(k|->x) ~= empty"
    2.18  proof
    2.19 @@ -114,344 +114,338 @@
    2.20  qed
    2.21  
    2.22  lemma map_upd_Some_unfold:
    2.23 -    "((m(a|->b)) x = Some y) = (x = a \<and> b = y \<or> x \<noteq> a \<and> m x = Some y)"
    2.24 -  by auto
    2.25 +  "((m(a|->b)) x = Some y) = (x = a \<and> b = y \<or> x \<noteq> a \<and> m x = Some y)"
    2.26 +by auto
    2.27  
    2.28  lemma image_map_upd [simp]: "x \<notin> A \<Longrightarrow> m(x \<mapsto> y) ` A = m ` A"
    2.29 -  by auto
    2.30 +by auto
    2.31  
    2.32  lemma finite_range_updI: "finite (range f) ==> finite (range (f(a|->b)))"
    2.33 -  unfolding image_def
    2.34 -  apply (simp (no_asm_use) add: full_SetCompr_eq)
    2.35 -  apply (rule finite_subset)
    2.36 -   prefer 2 apply assumption
    2.37 -  apply auto
    2.38 -  done
    2.39 +unfolding image_def
    2.40 +apply (simp (no_asm_use) add:full_SetCompr_eq)
    2.41 +apply (rule finite_subset)
    2.42 + prefer 2 apply assumption
    2.43 +apply (auto)
    2.44 +done
    2.45  
    2.46  
    2.47  subsection {* @{term [source] map_of} *}
    2.48  
    2.49  lemma map_of_eq_None_iff:
    2.50 -    "(map_of xys x = None) = (x \<notin> fst ` (set xys))"
    2.51 -  by (induct xys) simp_all
    2.52 +  "(map_of xys x = None) = (x \<notin> fst ` (set xys))"
    2.53 +by (induct xys) simp_all
    2.54  
    2.55 -lemma map_of_is_SomeD:
    2.56 -    "map_of xys x = Some y \<Longrightarrow> (x,y) \<in> set xys"
    2.57 -  apply (induct xys)
    2.58 -   apply simp
    2.59 -  apply (clarsimp split: if_splits)
    2.60 -  done
    2.61 +lemma map_of_is_SomeD: "map_of xys x = Some y \<Longrightarrow> (x,y) \<in> set xys"
    2.62 +apply (induct xys)
    2.63 + apply simp
    2.64 +apply (clarsimp split: if_splits)
    2.65 +done
    2.66  
    2.67  lemma map_of_eq_Some_iff [simp]:
    2.68 -    "distinct(map fst xys) \<Longrightarrow> (map_of xys x = Some y) = ((x,y) \<in> set xys)"
    2.69 -  apply (induct xys)
    2.70 -   apply simp
    2.71 -  apply (auto simp: map_of_eq_None_iff [symmetric])
    2.72 -  done
    2.73 +  "distinct(map fst xys) \<Longrightarrow> (map_of xys x = Some y) = ((x,y) \<in> set xys)"
    2.74 +apply (induct xys)
    2.75 + apply simp
    2.76 +apply (auto simp: map_of_eq_None_iff [symmetric])
    2.77 +done
    2.78  
    2.79  lemma Some_eq_map_of_iff [simp]:
    2.80 -    "distinct(map fst xys) \<Longrightarrow> (Some y = map_of xys x) = ((x,y) \<in> set xys)"
    2.81 -  by (auto simp del:map_of_eq_Some_iff simp add: map_of_eq_Some_iff [symmetric])
    2.82 +  "distinct(map fst xys) \<Longrightarrow> (Some y = map_of xys x) = ((x,y) \<in> set xys)"
    2.83 +by (auto simp del:map_of_eq_Some_iff simp add: map_of_eq_Some_iff [symmetric])
    2.84  
    2.85  lemma map_of_is_SomeI [simp]: "\<lbrakk> distinct(map fst xys); (x,y) \<in> set xys \<rbrakk>
    2.86      \<Longrightarrow> map_of xys x = Some y"
    2.87 -  apply (induct xys)
    2.88 -   apply simp
    2.89 -  apply force
    2.90 -  done
    2.91 +apply (induct xys)
    2.92 + apply simp
    2.93 +apply force
    2.94 +done
    2.95  
    2.96  lemma map_of_zip_is_None [simp]:
    2.97 -    "length xs = length ys \<Longrightarrow> (map_of (zip xs ys) x = None) = (x \<notin> set xs)"
    2.98 -  by (induct rule: list_induct2) simp_all
    2.99 +  "length xs = length ys \<Longrightarrow> (map_of (zip xs ys) x = None) = (x \<notin> set xs)"
   2.100 +by (induct rule: list_induct2) simp_all
   2.101  
   2.102  lemma finite_range_map_of: "finite (range (map_of xys))"
   2.103 -  apply (induct xys)
   2.104 -   apply (simp_all add: image_constant)
   2.105 -  apply (rule finite_subset)
   2.106 -   prefer 2 apply assumption
   2.107 -  apply auto
   2.108 -  done
   2.109 +apply (induct xys)
   2.110 + apply (simp_all add: image_constant)
   2.111 +apply (rule finite_subset)
   2.112 + prefer 2 apply assumption
   2.113 +apply auto
   2.114 +done
   2.115  
   2.116  lemma map_of_SomeD: "map_of xs k = Some y \<Longrightarrow> (k, y) \<in> set xs"
   2.117 -  by (induct xs) (simp, atomize (full), auto)
   2.118 +by (induct xs) (simp, atomize (full), auto)
   2.119  
   2.120  lemma map_of_mapk_SomeI:
   2.121 -  assumes "inj f"
   2.122 -  shows "map_of t k = Some x ==>
   2.123 -    map_of (map (split (%k. Pair (f k))) t) (f k) = Some x"
   2.124 -  by (induct t) (auto simp add: `inj f` inj_eq)
   2.125 +  "inj f ==> map_of t k = Some x ==>
   2.126 +   map_of (map (split (%k. Pair (f k))) t) (f k) = Some x"
   2.127 +by (induct t) (auto simp add: inj_eq)
   2.128  
   2.129  lemma weak_map_of_SomeI: "(k, x) : set l ==> \<exists>x. map_of l k = Some x"
   2.130 -  by (induct l) auto
   2.131 +by (induct l) auto
   2.132  
   2.133  lemma map_of_filter_in:
   2.134 -  assumes 1: "map_of xs k = Some z"
   2.135 -    and 2: "P k z"
   2.136 -  shows "map_of (filter (split P) xs) k = Some z"
   2.137 -  using 1 by (induct xs) (insert 2, auto)
   2.138 +  "map_of xs k = Some z \<Longrightarrow> P k z \<Longrightarrow> map_of (filter (split P) xs) k = Some z"
   2.139 +by (induct xs) auto
   2.140  
   2.141  lemma map_of_map: "map_of (map (%(a,b). (a,f b)) xs) x = option_map f (map_of xs x)"
   2.142 -  by (induct xs) auto
   2.143 +by (induct xs) auto
   2.144  
   2.145  
   2.146  subsection {* @{term [source] option_map} related *}
   2.147  
   2.148  lemma option_map_o_empty [simp]: "option_map f o empty = empty"
   2.149 -  by (rule ext) simp
   2.150 +by (rule ext) simp
   2.151  
   2.152  lemma option_map_o_map_upd [simp]:
   2.153 -    "option_map f o m(a|->b) = (option_map f o m)(a|->f b)"
   2.154 -  by (rule ext) simp
   2.155 +  "option_map f o m(a|->b) = (option_map f o m)(a|->f b)"
   2.156 +by (rule ext) simp
   2.157  
   2.158  
   2.159  subsection {* @{term [source] map_comp} related *}
   2.160  
   2.161  lemma map_comp_empty [simp]:
   2.162 -    "m \<circ>\<^sub>m empty = empty"
   2.163 -    "empty \<circ>\<^sub>m m = empty"
   2.164 -  by (auto simp add: map_comp_def intro: ext split: option.splits)
   2.165 +  "m \<circ>\<^sub>m empty = empty"
   2.166 +  "empty \<circ>\<^sub>m m = empty"
   2.167 +by (auto simp add: map_comp_def intro: ext split: option.splits)
   2.168  
   2.169  lemma map_comp_simps [simp]:
   2.170 -    "m2 k = None \<Longrightarrow> (m1 \<circ>\<^sub>m m2) k = None"
   2.171 -    "m2 k = Some k' \<Longrightarrow> (m1 \<circ>\<^sub>m m2) k = m1 k'"
   2.172 -  by (auto simp add: map_comp_def)
   2.173 +  "m2 k = None \<Longrightarrow> (m1 \<circ>\<^sub>m m2) k = None"
   2.174 +  "m2 k = Some k' \<Longrightarrow> (m1 \<circ>\<^sub>m m2) k = m1 k'"
   2.175 +by (auto simp add: map_comp_def)
   2.176  
   2.177  lemma map_comp_Some_iff:
   2.178 -    "((m1 \<circ>\<^sub>m m2) k = Some v) = (\<exists>k'. m2 k = Some k' \<and> m1 k' = Some v)"
   2.179 -  by (auto simp add: map_comp_def split: option.splits)
   2.180 +  "((m1 \<circ>\<^sub>m m2) k = Some v) = (\<exists>k'. m2 k = Some k' \<and> m1 k' = Some v)"
   2.181 +by (auto simp add: map_comp_def split: option.splits)
   2.182  
   2.183  lemma map_comp_None_iff:
   2.184 -    "((m1 \<circ>\<^sub>m m2) k = None) = (m2 k = None \<or> (\<exists>k'. m2 k = Some k' \<and> m1 k' = None)) "
   2.185 -  by (auto simp add: map_comp_def split: option.splits)
   2.186 +  "((m1 \<circ>\<^sub>m m2) k = None) = (m2 k = None \<or> (\<exists>k'. m2 k = Some k' \<and> m1 k' = None)) "
   2.187 +by (auto simp add: map_comp_def split: option.splits)
   2.188  
   2.189  
   2.190  subsection {* @{text "++"} *}
   2.191  
   2.192  lemma map_add_empty[simp]: "m ++ empty = m"
   2.193 -  unfolding map_add_def by simp
   2.194 +by(simp add: map_add_def)
   2.195  
   2.196  lemma empty_map_add[simp]: "empty ++ m = m"
   2.197 -  unfolding map_add_def by (rule ext) (simp split: option.split)
   2.198 +by (rule ext) (simp add: map_add_def split: option.split)
   2.199  
   2.200  lemma map_add_assoc[simp]: "m1 ++ (m2 ++ m3) = (m1 ++ m2) ++ m3"
   2.201 -  unfolding map_add_def by (rule ext) (simp add: map_add_def split: option.split)
   2.202 +by (rule ext) (simp add: map_add_def split: option.split)
   2.203  
   2.204  lemma map_add_Some_iff:
   2.205 -    "((m ++ n) k = Some x) = (n k = Some x | n k = None & m k = Some x)"
   2.206 -  unfolding map_add_def by (simp split: option.split)
   2.207 +  "((m ++ n) k = Some x) = (n k = Some x | n k = None & m k = Some x)"
   2.208 +by (simp add: map_add_def split: option.split)
   2.209  
   2.210  lemma map_add_SomeD [dest!]:
   2.211 -    "(m ++ n) k = Some x \<Longrightarrow> n k = Some x \<or> n k = None \<and> m k = Some x"
   2.212 -  by (rule map_add_Some_iff [THEN iffD1])
   2.213 +  "(m ++ n) k = Some x \<Longrightarrow> n k = Some x \<or> n k = None \<and> m k = Some x"
   2.214 +by (rule map_add_Some_iff [THEN iffD1])
   2.215  
   2.216  lemma map_add_find_right [simp]: "!!xx. n k = Some xx ==> (m ++ n) k = Some xx"
   2.217 -  by (subst map_add_Some_iff) fast
   2.218 +by (subst map_add_Some_iff) fast
   2.219  
   2.220  lemma map_add_None [iff]: "((m ++ n) k = None) = (n k = None & m k = None)"
   2.221 -  unfolding map_add_def by (simp split: option.split)
   2.222 +by (simp add: map_add_def split: option.split)
   2.223  
   2.224  lemma map_add_upd[simp]: "f ++ g(x|->y) = (f ++ g)(x|->y)"
   2.225 -  unfolding map_add_def by (rule ext) simp
   2.226 +by (rule ext) (simp add: map_add_def)
   2.227  
   2.228  lemma map_add_upds[simp]: "m1 ++ (m2(xs[\<mapsto>]ys)) = (m1++m2)(xs[\<mapsto>]ys)"
   2.229 -  by (simp add: map_upds_def)
   2.230 +by (simp add: map_upds_def)
   2.231  
   2.232  lemma map_of_append[simp]: "map_of (xs @ ys) = map_of ys ++ map_of xs"
   2.233 -  unfolding map_add_def
   2.234 -  apply (induct xs)
   2.235 -   apply simp
   2.236 -  apply (rule ext)
   2.237 -  apply (simp split add: option.split)
   2.238 -  done
   2.239 +unfolding map_add_def
   2.240 +apply (induct xs)
   2.241 + apply simp
   2.242 +apply (rule ext)
   2.243 +apply (simp split add: option.split)
   2.244 +done
   2.245  
   2.246  lemma finite_range_map_of_map_add:
   2.247    "finite (range f) ==> finite (range (f ++ map_of l))"
   2.248 -  apply (induct l)
   2.249 -   apply (auto simp del: fun_upd_apply)
   2.250 -  apply (erule finite_range_updI)
   2.251 -  done
   2.252 +apply (induct l)
   2.253 + apply (auto simp del: fun_upd_apply)
   2.254 +apply (erule finite_range_updI)
   2.255 +done
   2.256  
   2.257  lemma inj_on_map_add_dom [iff]:
   2.258 -    "inj_on (m ++ m') (dom m') = inj_on m' (dom m')"
   2.259 -  unfolding map_add_def dom_def inj_on_def
   2.260 -  by (fastsimp split: option.splits)
   2.261 +  "inj_on (m ++ m') (dom m') = inj_on m' (dom m')"
   2.262 +by (fastsimp simp: map_add_def dom_def inj_on_def split: option.splits)
   2.263  
   2.264  
   2.265  subsection {* @{term [source] restrict_map} *}
   2.266  
   2.267  lemma restrict_map_to_empty [simp]: "m|`{} = empty"
   2.268 -  by (simp add: restrict_map_def)
   2.269 +by (simp add: restrict_map_def)
   2.270  
   2.271  lemma restrict_map_empty [simp]: "empty|`D = empty"
   2.272 -  by (simp add: restrict_map_def)
   2.273 +by (simp add: restrict_map_def)
   2.274  
   2.275  lemma restrict_in [simp]: "x \<in> A \<Longrightarrow> (m|`A) x = m x"
   2.276 -  by (simp add: restrict_map_def)
   2.277 +by (simp add: restrict_map_def)
   2.278  
   2.279  lemma restrict_out [simp]: "x \<notin> A \<Longrightarrow> (m|`A) x = None"
   2.280 -  by (simp add: restrict_map_def)
   2.281 +by (simp add: restrict_map_def)
   2.282  
   2.283  lemma ran_restrictD: "y \<in> ran (m|`A) \<Longrightarrow> \<exists>x\<in>A. m x = Some y"
   2.284 -  by (auto simp: restrict_map_def ran_def split: split_if_asm)
   2.285 +by (auto simp: restrict_map_def ran_def split: split_if_asm)
   2.286  
   2.287  lemma dom_restrict [simp]: "dom (m|`A) = dom m \<inter> A"
   2.288 -  by (auto simp: restrict_map_def dom_def split: split_if_asm)
   2.289 +by (auto simp: restrict_map_def dom_def split: split_if_asm)
   2.290  
   2.291  lemma restrict_upd_same [simp]: "m(x\<mapsto>y)|`(-{x}) = m|`(-{x})"
   2.292 -  by (rule ext) (auto simp: restrict_map_def)
   2.293 +by (rule ext) (auto simp: restrict_map_def)
   2.294  
   2.295  lemma restrict_restrict [simp]: "m|`A|`B = m|`(A\<inter>B)"
   2.296 -  by (rule ext) (auto simp: restrict_map_def)
   2.297 +by (rule ext) (auto simp: restrict_map_def)
   2.298  
   2.299  lemma restrict_fun_upd [simp]:
   2.300 -    "m(x := y)|`D = (if x \<in> D then (m|`(D-{x}))(x := y) else m|`D)"
   2.301 -  by (simp add: restrict_map_def expand_fun_eq)
   2.302 +  "m(x := y)|`D = (if x \<in> D then (m|`(D-{x}))(x := y) else m|`D)"
   2.303 +by (simp add: restrict_map_def expand_fun_eq)
   2.304  
   2.305  lemma fun_upd_None_restrict [simp]:
   2.306 -    "(m|`D)(x := None) = (if x:D then m|`(D - {x}) else m|`D)"
   2.307 -  by (simp add: restrict_map_def expand_fun_eq)
   2.308 +  "(m|`D)(x := None) = (if x:D then m|`(D - {x}) else m|`D)"
   2.309 +by (simp add: restrict_map_def expand_fun_eq)
   2.310  
   2.311  lemma fun_upd_restrict: "(m|`D)(x := y) = (m|`(D-{x}))(x := y)"
   2.312 -  by (simp add: restrict_map_def expand_fun_eq)
   2.313 +by (simp add: restrict_map_def expand_fun_eq)
   2.314  
   2.315  lemma fun_upd_restrict_conv [simp]:
   2.316 -    "x \<in> D \<Longrightarrow> (m|`D)(x := y) = (m|`(D-{x}))(x := y)"
   2.317 -  by (simp add: restrict_map_def expand_fun_eq)
   2.318 +  "x \<in> D \<Longrightarrow> (m|`D)(x := y) = (m|`(D-{x}))(x := y)"
   2.319 +by (simp add: restrict_map_def expand_fun_eq)
   2.320  
   2.321  
   2.322  subsection {* @{term [source] map_upds} *}
   2.323  
   2.324  lemma map_upds_Nil1 [simp]: "m([] [|->] bs) = m"
   2.325 -  by (simp add: map_upds_def)
   2.326 +by (simp add: map_upds_def)
   2.327  
   2.328  lemma map_upds_Nil2 [simp]: "m(as [|->] []) = m"
   2.329 -  by (simp add:map_upds_def)
   2.330 +by (simp add:map_upds_def)
   2.331  
   2.332  lemma map_upds_Cons [simp]: "m(a#as [|->] b#bs) = (m(a|->b))(as[|->]bs)"
   2.333 -  by (simp add:map_upds_def)
   2.334 +by (simp add:map_upds_def)
   2.335  
   2.336  lemma map_upds_append1 [simp]: "\<And>ys m. size xs < size ys \<Longrightarrow>
   2.337 -    m(xs@[x] [\<mapsto>] ys) = m(xs [\<mapsto>] ys)(x \<mapsto> ys!size xs)"
   2.338 -  apply(induct xs)
   2.339 -   apply (clarsimp simp add: neq_Nil_conv)
   2.340 -  apply (case_tac ys)
   2.341 -   apply simp
   2.342 -  apply simp
   2.343 -  done
   2.344 +  m(xs@[x] [\<mapsto>] ys) = m(xs [\<mapsto>] ys)(x \<mapsto> ys!size xs)"
   2.345 +apply(induct xs)
   2.346 + apply (clarsimp simp add: neq_Nil_conv)
   2.347 +apply (case_tac ys)
   2.348 + apply simp
   2.349 +apply simp
   2.350 +done
   2.351  
   2.352  lemma map_upds_list_update2_drop [simp]:
   2.353    "\<lbrakk>size xs \<le> i; i < size ys\<rbrakk>
   2.354      \<Longrightarrow> m(xs[\<mapsto>]ys[i:=y]) = m(xs[\<mapsto>]ys)"
   2.355 -  apply (induct xs arbitrary: m ys i)
   2.356 -   apply simp
   2.357 -  apply (case_tac ys)
   2.358 -   apply simp
   2.359 -  apply (simp split: nat.split)
   2.360 -  done
   2.361 +apply (induct xs arbitrary: m ys i)
   2.362 + apply simp
   2.363 +apply (case_tac ys)
   2.364 + apply simp
   2.365 +apply (simp split: nat.split)
   2.366 +done
   2.367  
   2.368  lemma map_upd_upds_conv_if:
   2.369    "(f(x|->y))(xs [|->] ys) =
   2.370     (if x : set(take (length ys) xs) then f(xs [|->] ys)
   2.371                                      else (f(xs [|->] ys))(x|->y))"
   2.372 -  apply (induct xs arbitrary: x y ys f)
   2.373 -   apply simp
   2.374 -  apply (case_tac ys)
   2.375 -   apply (auto split: split_if simp: fun_upd_twist)
   2.376 -  done
   2.377 +apply (induct xs arbitrary: x y ys f)
   2.378 + apply simp
   2.379 +apply (case_tac ys)
   2.380 + apply (auto split: split_if simp: fun_upd_twist)
   2.381 +done
   2.382  
   2.383  lemma map_upds_twist [simp]:
   2.384 -    "a ~: set as ==> m(a|->b)(as[|->]bs) = m(as[|->]bs)(a|->b)"
   2.385 -  using set_take_subset by (fastsimp simp add: map_upd_upds_conv_if)
   2.386 +  "a ~: set as ==> m(a|->b)(as[|->]bs) = m(as[|->]bs)(a|->b)"
   2.387 +using set_take_subset by (fastsimp simp add: map_upd_upds_conv_if)
   2.388  
   2.389  lemma map_upds_apply_nontin [simp]:
   2.390 -    "x ~: set xs ==> (f(xs[|->]ys)) x = f x"
   2.391 -  apply (induct xs arbitrary: ys)
   2.392 -   apply simp
   2.393 -  apply (case_tac ys)
   2.394 -   apply (auto simp: map_upd_upds_conv_if)
   2.395 -  done
   2.396 +  "x ~: set xs ==> (f(xs[|->]ys)) x = f x"
   2.397 +apply (induct xs arbitrary: ys)
   2.398 + apply simp
   2.399 +apply (case_tac ys)
   2.400 + apply (auto simp: map_upd_upds_conv_if)
   2.401 +done
   2.402  
   2.403  lemma fun_upds_append_drop [simp]:
   2.404 -    "size xs = size ys \<Longrightarrow> m(xs@zs[\<mapsto>]ys) = m(xs[\<mapsto>]ys)"
   2.405 -  apply (induct xs arbitrary: m ys)
   2.406 -   apply simp
   2.407 -  apply (case_tac ys)
   2.408 -   apply simp_all
   2.409 -  done
   2.410 +  "size xs = size ys \<Longrightarrow> m(xs@zs[\<mapsto>]ys) = m(xs[\<mapsto>]ys)"
   2.411 +apply (induct xs arbitrary: m ys)
   2.412 + apply simp
   2.413 +apply (case_tac ys)
   2.414 + apply simp_all
   2.415 +done
   2.416  
   2.417  lemma fun_upds_append2_drop [simp]:
   2.418 -    "size xs = size ys \<Longrightarrow> m(xs[\<mapsto>]ys@zs) = m(xs[\<mapsto>]ys)"
   2.419 -  apply (induct xs arbitrary: m ys)
   2.420 -   apply simp
   2.421 -  apply (case_tac ys)
   2.422 -   apply simp_all
   2.423 -  done
   2.424 +  "size xs = size ys \<Longrightarrow> m(xs[\<mapsto>]ys@zs) = m(xs[\<mapsto>]ys)"
   2.425 +apply (induct xs arbitrary: m ys)
   2.426 + apply simp
   2.427 +apply (case_tac ys)
   2.428 + apply simp_all
   2.429 +done
   2.430  
   2.431  
   2.432  lemma restrict_map_upds[simp]:
   2.433    "\<lbrakk> length xs = length ys; set xs \<subseteq> D \<rbrakk>
   2.434      \<Longrightarrow> m(xs [\<mapsto>] ys)|`D = (m|`(D - set xs))(xs [\<mapsto>] ys)"
   2.435 -  apply (induct xs arbitrary: m ys)
   2.436 -   apply simp
   2.437 -  apply (case_tac ys)
   2.438 -   apply simp
   2.439 -  apply (simp add: Diff_insert [symmetric] insert_absorb)
   2.440 -  apply (simp add: map_upd_upds_conv_if)
   2.441 -  done
   2.442 +apply (induct xs arbitrary: m ys)
   2.443 + apply simp
   2.444 +apply (case_tac ys)
   2.445 + apply simp
   2.446 +apply (simp add: Diff_insert [symmetric] insert_absorb)
   2.447 +apply (simp add: map_upd_upds_conv_if)
   2.448 +done
   2.449  
   2.450  
   2.451  subsection {* @{term [source] dom} *}
   2.452  
   2.453  lemma domI: "m a = Some b ==> a : dom m"
   2.454 -  unfolding dom_def by simp
   2.455 +by(simp add:dom_def)
   2.456  (* declare domI [intro]? *)
   2.457  
   2.458  lemma domD: "a : dom m ==> \<exists>b. m a = Some b"
   2.459 -  by (cases "m a") (auto simp add: dom_def)
   2.460 +by (cases "m a") (auto simp add: dom_def)
   2.461  
   2.462  lemma domIff [iff, simp del]: "(a : dom m) = (m a ~= None)"
   2.463 -  unfolding dom_def by simp
   2.464 +by(simp add:dom_def)
   2.465  
   2.466  lemma dom_empty [simp]: "dom empty = {}"
   2.467 -  unfolding dom_def by simp
   2.468 +by(simp add:dom_def)
   2.469  
   2.470  lemma dom_fun_upd [simp]:
   2.471 -    "dom(f(x := y)) = (if y=None then dom f - {x} else insert x (dom f))"
   2.472 -  unfolding dom_def by auto
   2.473 +  "dom(f(x := y)) = (if y=None then dom f - {x} else insert x (dom f))"
   2.474 +by(auto simp add:dom_def)
   2.475  
   2.476  lemma dom_map_of: "dom(map_of xys) = {x. \<exists>y. (x,y) : set xys}"
   2.477 -  by (induct xys) (auto simp del: fun_upd_apply)
   2.478 +by (induct xys) (auto simp del: fun_upd_apply)
   2.479  
   2.480  lemma dom_map_of_conv_image_fst:
   2.481 -    "dom(map_of xys) = fst ` (set xys)"
   2.482 -  unfolding dom_map_of by force
   2.483 +  "dom(map_of xys) = fst ` (set xys)"
   2.484 +by(force simp: dom_map_of)
   2.485  
   2.486  lemma dom_map_of_zip [simp]: "[| length xs = length ys; distinct xs |] ==>
   2.487 -    dom(map_of(zip xs ys)) = set xs"
   2.488 -  by (induct rule: list_induct2) simp_all
   2.489 +  dom(map_of(zip xs ys)) = set xs"
   2.490 +by (induct rule: list_induct2) simp_all
   2.491  
   2.492  lemma finite_dom_map_of: "finite (dom (map_of l))"
   2.493 -  unfolding dom_def
   2.494 -  by (induct l) (auto simp add: insert_Collect [symmetric])
   2.495 +by (induct l) (auto simp add: dom_def insert_Collect [symmetric])
   2.496  
   2.497  lemma dom_map_upds [simp]:
   2.498 -    "dom(m(xs[|->]ys)) = set(take (length ys) xs) Un dom m"
   2.499 -  apply (induct xs arbitrary: m ys)
   2.500 -   apply simp
   2.501 -  apply (case_tac ys)
   2.502 -   apply auto
   2.503 -  done
   2.504 +  "dom(m(xs[|->]ys)) = set(take (length ys) xs) Un dom m"
   2.505 +apply (induct xs arbitrary: m ys)
   2.506 + apply simp
   2.507 +apply (case_tac ys)
   2.508 + apply auto
   2.509 +done
   2.510  
   2.511  lemma dom_map_add [simp]: "dom(m++n) = dom n Un dom m"
   2.512 -  unfolding dom_def by auto
   2.513 +by(auto simp:dom_def)
   2.514  
   2.515  lemma dom_override_on [simp]:
   2.516    "dom(override_on f g A) =
   2.517      (dom f  - {a. a : A - dom g}) Un {a. a : A Int dom g}"
   2.518 -  unfolding dom_def override_on_def by auto
   2.519 +by(auto simp: dom_def override_on_def)
   2.520  
   2.521  lemma map_add_comm: "dom m1 \<inter> dom m2 = {} \<Longrightarrow> m1++m2 = m2++m1"
   2.522 -  by (rule ext) (force simp: map_add_def dom_def split: option.split)
   2.523 +by (rule ext) (force simp: map_add_def dom_def split: option.split)
   2.524  
   2.525  (* Due to John Matthews - could be rephrased with dom *)
   2.526  lemma finite_map_freshness:
   2.527 @@ -462,68 +456,68 @@
   2.528  subsection {* @{term [source] ran} *}
   2.529  
   2.530  lemma ranI: "m a = Some b ==> b : ran m"
   2.531 -  unfolding ran_def by auto
   2.532 +by(auto simp: ran_def)
   2.533  (* declare ranI [intro]? *)
   2.534  
   2.535  lemma ran_empty [simp]: "ran empty = {}"
   2.536 -  unfolding ran_def by simp
   2.537 +by(auto simp: ran_def)
   2.538  
   2.539  lemma ran_map_upd [simp]: "m a = None ==> ran(m(a|->b)) = insert b (ran m)"
   2.540 -  unfolding ran_def
   2.541 -  apply auto
   2.542 -  apply (subgoal_tac "aa ~= a")
   2.543 -   apply auto
   2.544 -  done
   2.545 +unfolding ran_def
   2.546 +apply auto
   2.547 +apply (subgoal_tac "aa ~= a")
   2.548 + apply auto
   2.549 +done
   2.550  
   2.551  
   2.552  subsection {* @{text "map_le"} *}
   2.553  
   2.554  lemma map_le_empty [simp]: "empty \<subseteq>\<^sub>m g"
   2.555 -  by (simp add: map_le_def)
   2.556 +by (simp add: map_le_def)
   2.557  
   2.558  lemma upd_None_map_le [simp]: "f(x := None) \<subseteq>\<^sub>m f"
   2.559 -  by (force simp add: map_le_def)
   2.560 +by (force simp add: map_le_def)
   2.561  
   2.562  lemma map_le_upd[simp]: "f \<subseteq>\<^sub>m g ==> f(a := b) \<subseteq>\<^sub>m g(a := b)"
   2.563 -  by (fastsimp simp add: map_le_def)
   2.564 +by (fastsimp simp add: map_le_def)
   2.565  
   2.566  lemma map_le_imp_upd_le [simp]: "m1 \<subseteq>\<^sub>m m2 \<Longrightarrow> m1(x := None) \<subseteq>\<^sub>m m2(x \<mapsto> y)"
   2.567 -  by (force simp add: map_le_def)
   2.568 +by (force simp add: map_le_def)
   2.569  
   2.570  lemma map_le_upds [simp]:
   2.571 -    "f \<subseteq>\<^sub>m g ==> f(as [|->] bs) \<subseteq>\<^sub>m g(as [|->] bs)"
   2.572 -  apply (induct as arbitrary: f g bs)
   2.573 -   apply simp
   2.574 -  apply (case_tac bs)
   2.575 -   apply auto
   2.576 -  done
   2.577 +  "f \<subseteq>\<^sub>m g ==> f(as [|->] bs) \<subseteq>\<^sub>m g(as [|->] bs)"
   2.578 +apply (induct as arbitrary: f g bs)
   2.579 + apply simp
   2.580 +apply (case_tac bs)
   2.581 + apply auto
   2.582 +done
   2.583  
   2.584  lemma map_le_implies_dom_le: "(f \<subseteq>\<^sub>m g) \<Longrightarrow> (dom f \<subseteq> dom g)"
   2.585 -  by (fastsimp simp add: map_le_def dom_def)
   2.586 +by (fastsimp simp add: map_le_def dom_def)
   2.587  
   2.588  lemma map_le_refl [simp]: "f \<subseteq>\<^sub>m f"
   2.589 -  by (simp add: map_le_def)
   2.590 +by (simp add: map_le_def)
   2.591  
   2.592  lemma map_le_trans[trans]: "\<lbrakk> m1 \<subseteq>\<^sub>m m2; m2 \<subseteq>\<^sub>m m3\<rbrakk> \<Longrightarrow> m1 \<subseteq>\<^sub>m m3"
   2.593 -  by (auto simp add: map_le_def dom_def)
   2.594 +by (auto simp add: map_le_def dom_def)
   2.595  
   2.596  lemma map_le_antisym: "\<lbrakk> f \<subseteq>\<^sub>m g; g \<subseteq>\<^sub>m f \<rbrakk> \<Longrightarrow> f = g"
   2.597 -  unfolding map_le_def
   2.598 -  apply (rule ext)
   2.599 -  apply (case_tac "x \<in> dom f", simp)
   2.600 -  apply (case_tac "x \<in> dom g", simp, fastsimp)
   2.601 -  done
   2.602 +unfolding map_le_def
   2.603 +apply (rule ext)
   2.604 +apply (case_tac "x \<in> dom f", simp)
   2.605 +apply (case_tac "x \<in> dom g", simp, fastsimp)
   2.606 +done
   2.607  
   2.608  lemma map_le_map_add [simp]: "f \<subseteq>\<^sub>m (g ++ f)"
   2.609 -  by (fastsimp simp add: map_le_def)
   2.610 +by (fastsimp simp add: map_le_def)
   2.611  
   2.612  lemma map_le_iff_map_add_commute: "(f \<subseteq>\<^sub>m f ++ g) = (f++g = g++f)"
   2.613 -  by (fastsimp simp add: map_add_def map_le_def expand_fun_eq split: option.splits)
   2.614 +by(fastsimp simp: map_add_def map_le_def expand_fun_eq split: option.splits)
   2.615  
   2.616  lemma map_add_le_mapE: "f++g \<subseteq>\<^sub>m h \<Longrightarrow> g \<subseteq>\<^sub>m h"
   2.617 -  by (fastsimp simp add: map_le_def map_add_def dom_def)
   2.618 +by (fastsimp simp add: map_le_def map_add_def dom_def)
   2.619  
   2.620  lemma map_add_le_mapI: "\<lbrakk> f \<subseteq>\<^sub>m h; g \<subseteq>\<^sub>m h; f \<subseteq>\<^sub>m f++g \<rbrakk> \<Longrightarrow> f++g \<subseteq>\<^sub>m h"
   2.621 -  by (clarsimp simp add: map_le_def map_add_def dom_def split: option.splits)
   2.622 +by (clarsimp simp add: map_le_def map_add_def dom_def split: option.splits)
   2.623  
   2.624  end
     3.1 --- a/src/HOL/Set.thy	Sun Aug 19 12:43:05 2007 +0200
     3.2 +++ b/src/HOL/Set.thy	Sun Aug 19 21:21:37 2007 +0200
     3.3 @@ -1543,7 +1543,7 @@
     3.4  lemma UN_insert [simp]: "(\<Union>x\<in>insert a A. B x) = B a \<union> UNION A B"
     3.5    by blast
     3.6  
     3.7 -lemma UN_Un: "(\<Union>i \<in> A \<union> B. M i) = (\<Union>i\<in>A. M i) \<union> (\<Union>i\<in>B. M i)"
     3.8 +lemma UN_Un[simp]: "(\<Union>i \<in> A \<union> B. M i) = (\<Union>i\<in>A. M i) \<union> (\<Union>i\<in>B. M i)"
     3.9    by blast
    3.10  
    3.11  lemma UN_UN_flatten: "(\<Union>x \<in> (\<Union>y\<in>A. B y). C x) = (\<Union>y\<in>A. \<Union>x\<in>B y. C x)"