src/HOL/Map.thy
changeset 17724 e969fc0a4925
parent 17399 56a3a4affedc
child 17782 b3846df9d643
equal deleted inserted replaced
17723:ee5b42e3cbb4 17724:e969fc0a4925
   200 
   200 
   201 lemma Some_eq_map_of_iff[simp]:
   201 lemma Some_eq_map_of_iff[simp]:
   202  "distinct(map fst xys) \<Longrightarrow> (Some y = map_of xys x) = ((x,y) \<in> set xys)"
   202  "distinct(map fst xys) \<Longrightarrow> (Some y = map_of xys x) = ((x,y) \<in> set xys)"
   203 by(auto simp del:map_of_eq_Some_iff simp add:map_of_eq_Some_iff[symmetric])
   203 by(auto simp del:map_of_eq_Some_iff simp add:map_of_eq_Some_iff[symmetric])
   204 
   204 
   205 lemma [simp]: "\<lbrakk> distinct(map fst xys); (x,y) \<in> set xys \<rbrakk>
   205 lemma map_of_is_SomeI [simp]: "\<lbrakk> distinct(map fst xys); (x,y) \<in> set xys \<rbrakk>
   206   \<Longrightarrow> map_of xys x = Some y"
   206   \<Longrightarrow> map_of xys x = Some y"
   207 apply (induct xys)
   207 apply (induct xys)
   208  apply simp
   208  apply simp
   209 apply force
   209 apply force
   210 done
   210 done
   551 subsection {* @{text "map_le"} *}
   551 subsection {* @{text "map_le"} *}
   552 
   552 
   553 lemma map_le_empty [simp]: "empty \<subseteq>\<^sub>m g"
   553 lemma map_le_empty [simp]: "empty \<subseteq>\<^sub>m g"
   554 by(simp add:map_le_def)
   554 by(simp add:map_le_def)
   555 
   555 
   556 lemma [simp]: "f(x := None) \<subseteq>\<^sub>m f"
   556 lemma upd_None_map_le [simp]: "f(x := None) \<subseteq>\<^sub>m f"
   557 by(force simp add:map_le_def)
   557 by(force simp add:map_le_def)
   558 
   558 
   559 lemma map_le_upd[simp]: "f \<subseteq>\<^sub>m g ==> f(a := b) \<subseteq>\<^sub>m g(a := b)"
   559 lemma map_le_upd[simp]: "f \<subseteq>\<^sub>m g ==> f(a := b) \<subseteq>\<^sub>m g(a := b)"
   560 by(fastsimp simp add:map_le_def)
   560 by(fastsimp simp add:map_le_def)
   561 
   561 
   562 lemma [simp]: "m1 \<subseteq>\<^sub>m m2 \<Longrightarrow> m1(x := None) \<subseteq>\<^sub>m m2(x \<mapsto> y)"
   562 lemma map_le_imp_upd_le [simp]: "m1 \<subseteq>\<^sub>m m2 \<Longrightarrow> m1(x := None) \<subseteq>\<^sub>m m2(x \<mapsto> y)"
   563 by(force simp add:map_le_def)
   563 by(force simp add:map_le_def)
   564 
   564 
   565 lemma map_le_upds[simp]:
   565 lemma map_le_upds[simp]:
   566  "!!f g bs. f \<subseteq>\<^sub>m g ==> f(as [|->] bs) \<subseteq>\<^sub>m g(as [|->] bs)"
   566  "!!f g bs. f \<subseteq>\<^sub>m g ==> f(as [|->] bs) \<subseteq>\<^sub>m g(as [|->] bs)"
   567 apply (induct as, simp)
   567 apply (induct as, simp)