src/HOL/Map.thy
changeset 29622 2eeb09477ed3
parent 28790 2efba7b18c5b
child 30235 58d147683393
equal deleted inserted replaced
29619:82054da94a74 29622:2eeb09477ed3
   501 by(auto simp: dom_def override_on_def)
   501 by(auto simp: dom_def override_on_def)
   502 
   502 
   503 lemma map_add_comm: "dom m1 \<inter> dom m2 = {} \<Longrightarrow> m1++m2 = m2++m1"
   503 lemma map_add_comm: "dom m1 \<inter> dom m2 = {} \<Longrightarrow> m1++m2 = m2++m1"
   504 by (rule ext) (force simp: map_add_def dom_def split: option.split)
   504 by (rule ext) (force simp: map_add_def dom_def split: option.split)
   505 
   505 
       
   506 lemma dom_const [simp]:
       
   507   "dom (\<lambda>x. Some y) = UNIV"
       
   508   by auto
       
   509 
       
   510 lemma dom_if:
       
   511   "dom (\<lambda>x. if P x then f x else g x) = dom f \<inter> {x. P x} \<union> dom g \<inter> {x. \<not> P x}"
       
   512   by (auto split: if_splits)
       
   513 
       
   514 
   506 (* Due to John Matthews - could be rephrased with dom *)
   515 (* Due to John Matthews - could be rephrased with dom *)
   507 lemma finite_map_freshness:
   516 lemma finite_map_freshness:
   508   "finite (dom (f :: 'a \<rightharpoonup> 'b)) \<Longrightarrow> \<not> finite (UNIV :: 'a set) \<Longrightarrow>
   517   "finite (dom (f :: 'a \<rightharpoonup> 'b)) \<Longrightarrow> \<not> finite (UNIV :: 'a set) \<Longrightarrow>
   509    \<exists>x. f x = None"
   518    \<exists>x. f x = None"
   510 by(bestsimp dest:ex_new_if_finite)
   519 by(bestsimp dest:ex_new_if_finite)