src/HOL/Library/Countable_Set.thy
changeset 69661 a03a63b81f44
parent 68860 f443ec10447d
child 70178 4900351361b0
equal deleted inserted replaced
69660:2bc2a8599369 69661:a03a63b81f44
   332   assumes S: "countable S"
   332   assumes S: "countable S"
   333   shows "(\<forall>s\<in>S. P s) \<longleftrightarrow> (\<forall>n::nat. from_nat_into S n \<in> S \<longrightarrow> P (from_nat_into S n))"
   333   shows "(\<forall>s\<in>S. P s) \<longleftrightarrow> (\<forall>n::nat. from_nat_into S n \<in> S \<longrightarrow> P (from_nat_into S n))"
   334   using S[THEN subset_range_from_nat_into] by auto
   334   using S[THEN subset_range_from_nat_into] by auto
   335 
   335 
   336 lemma finite_sequence_to_countable_set:
   336 lemma finite_sequence_to_countable_set:
   337    assumes "countable X" obtains F where "\<And>i. F i \<subseteq> X" "\<And>i. F i \<subseteq> F (Suc i)" "\<And>i. finite (F i)" "(\<Union>i. F i) = X"
   337   assumes "countable X"
   338 proof -  show thesis
   338   obtains F where "\<And>i. F i \<subseteq> X" "\<And>i. F i \<subseteq> F (Suc i)" "\<And>i. finite (F i)" "(\<Union>i. F i) = X"
       
   339 proof -
       
   340   show thesis
   339     apply (rule that[of "\<lambda>i. if X = {} then {} else from_nat_into X ` {..i}"])
   341     apply (rule that[of "\<lambda>i. if X = {} then {} else from_nat_into X ` {..i}"])
   340     apply (auto simp: image_iff Ball_def intro: from_nat_into split: if_split_asm)
   342        apply (auto simp add: image_iff intro: from_nat_into split: if_splits)
   341   proof -
   343     using assms from_nat_into_surj by (fastforce cong: image_cong)
   342     fix x n assume "x \<in> X" "\<forall>i m. m \<le> i \<longrightarrow> x \<noteq> from_nat_into X m"
       
   343     with from_nat_into_surj[OF \<open>countable X\<close> \<open>x \<in> X\<close>]
       
   344     show False
       
   345       by auto
       
   346   qed
       
   347 qed
   344 qed
   348 
   345 
   349 lemma transfer_countable[transfer_rule]:
   346 lemma transfer_countable[transfer_rule]:
   350   "bi_unique R \<Longrightarrow> rel_fun (rel_set R) (=) countable countable"
   347   "bi_unique R \<Longrightarrow> rel_fun (rel_set R) (=) countable countable"
   351   by (rule rel_funI, erule (1) bi_unique_rel_set_lemma)
   348   by (rule rel_funI, erule (1) bi_unique_rel_set_lemma)