src/HOL/Library/Countable_Set.thy
 changeset 57025 e7fd64f82876 parent 54410 0a578fb7fb73 child 57234 596a499318ab
```--- a/src/HOL/Library/Countable_Set.thy	Tue May 20 16:52:59 2014 +0200
+++ b/src/HOL/Library/Countable_Set.thy	Tue May 20 19:24:39 2014 +0200
@@ -283,4 +283,17 @@
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))"
using S[THEN subset_range_from_nat_into] by auto

+lemma finite_sequence_to_countable_set:
+   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"
+proof -  show thesis
+    apply (rule that[of "\<lambda>i. if X = {} then {} else from_nat_into X ` {..i}"])
+    apply (auto simp: image_iff Ball_def intro: from_nat_into split: split_if_asm)
+  proof -
+    fix x n assume "x \<in> X" "\<forall>i m. m \<le> i \<longrightarrow> x \<noteq> from_nat_into X m"
+    with from_nat_into_surj[OF `countable X` `x \<in> X`]
+    show False
+      by auto
+  qed
+qed
+
end```