src/HOL/Map.thy
changeset 53820 9c7e97d67b45
parent 53374 a14d2a854c02
child 55466 786edc984c98
equal deleted inserted replaced
53813:0a62ad289c4d 53820:9c7e97d67b45
   587 proof -
   587 proof -
   588   from assms have "dom (map_of xs) = dom (map_of ys)" by simp
   588   from assms have "dom (map_of xs) = dom (map_of ys)" by simp
   589   then show ?thesis by (simp add: dom_map_of_conv_image_fst)
   589   then show ?thesis by (simp add: dom_map_of_conv_image_fst)
   590 qed
   590 qed
   591 
   591 
       
   592 lemma finite_set_of_finite_maps:
       
   593 assumes "finite A" "finite B"
       
   594 shows  "finite {m. dom m = A \<and> ran m \<subseteq> B}" (is "finite ?S")
       
   595 proof -
       
   596   let ?S' = "{m. \<forall>x. (x \<in> A \<longrightarrow> m x \<in> Some ` B) \<and> (x \<notin> A \<longrightarrow> m x = None)}"
       
   597   have "?S = ?S'"
       
   598   proof
       
   599     show "?S \<subseteq> ?S'" by(auto simp: dom_def ran_def image_def)
       
   600     show "?S' \<subseteq> ?S"
       
   601     proof
       
   602       fix m assume "m \<in> ?S'"
       
   603       hence 1: "dom m = A" by force
       
   604       hence 2: "ran m \<subseteq> B" using `m \<in> ?S'` by(auto simp: dom_def ran_def)
       
   605       from 1 2 show "m \<in> ?S" by blast
       
   606     qed
       
   607   qed
       
   608   with assms show ?thesis by(simp add: finite_set_of_finite_funs)
       
   609 qed
   592 
   610 
   593 subsection {* @{term [source] ran} *}
   611 subsection {* @{term [source] ran} *}
   594 
   612 
   595 lemma ranI: "m a = Some b ==> b : ran m"
   613 lemma ranI: "m a = Some b ==> b : ran m"
   596 by(auto simp: ran_def)
   614 by(auto simp: ran_def)