src/HOL/Map.thy
changeset 61032 b57df8eecad6
parent 60841 144523e0678e
child 61069 aefe89038dd2
equal deleted inserted replaced
61031:162bd20dae23 61032:b57df8eecad6
   225 lemma map_of_SomeD: "map_of xs k = Some y \<Longrightarrow> (k, y) \<in> set xs"
   225 lemma map_of_SomeD: "map_of xs k = Some y \<Longrightarrow> (k, y) \<in> set xs"
   226   by (induct xs) (auto split: if_splits)
   226   by (induct xs) (auto split: if_splits)
   227 
   227 
   228 lemma map_of_mapk_SomeI:
   228 lemma map_of_mapk_SomeI:
   229   "inj f \<Longrightarrow> map_of t k = Some x \<Longrightarrow>
   229   "inj f \<Longrightarrow> map_of t k = Some x \<Longrightarrow>
   230    map_of (map (split (\<lambda>k. Pair (f k))) t) (f k) = Some x"
   230    map_of (map (case_prod (\<lambda>k. Pair (f k))) t) (f k) = Some x"
   231 by (induct t) (auto simp: inj_eq)
   231 by (induct t) (auto simp: inj_eq)
   232 
   232 
   233 lemma weak_map_of_SomeI: "(k, x) \<in> set l \<Longrightarrow> \<exists>x. map_of l k = Some x"
   233 lemma weak_map_of_SomeI: "(k, x) \<in> set l \<Longrightarrow> \<exists>x. map_of l k = Some x"
   234 by (induct l) auto
   234 by (induct l) auto
   235 
   235 
   236 lemma map_of_filter_in:
   236 lemma map_of_filter_in:
   237   "map_of xs k = Some z \<Longrightarrow> P k z \<Longrightarrow> map_of (filter (split P) xs) k = Some z"
   237   "map_of xs k = Some z \<Longrightarrow> P k z \<Longrightarrow> map_of (filter (case_prod P) xs) k = Some z"
   238 by (induct xs) auto
   238 by (induct xs) auto
   239 
   239 
   240 lemma map_of_map:
   240 lemma map_of_map:
   241   "map_of (map (\<lambda>(k, v). (k, f v)) xs) = map_option f \<circ> map_of xs"
   241   "map_of (map (\<lambda>(k, v). (k, f v)) xs) = map_option f \<circ> map_of xs"
   242   by (induct xs) (auto simp: fun_eq_iff)
   242   by (induct xs) (auto simp: fun_eq_iff)