author nipkow Fri, 13 Feb 2009 23:55:04 +0100 changeset 29901 f4b3f8fbf599 parent 29889 95e6eb9044fe child 29902 445320b620ef
finiteness lemmas
 src/HOL/Finite_Set.thy file | annotate | diff | comparison | revisions src/HOL/Library/Infinite_Set.thy file | annotate | diff | comparison | revisions src/HOL/Library/Multiset.thy file | annotate | diff | comparison | revisions src/HOL/Set.thy file | annotate | diff | comparison | revisions
```--- a/src/HOL/Finite_Set.thy	Fri Feb 13 09:56:24 2009 +0100
+++ b/src/HOL/Finite_Set.thy	Fri Feb 13 23:55:04 2009 +0100
@@ -144,8 +144,7 @@
subsubsection{* Finiteness and set theoretic constructions *}

lemma finite_UnI: "finite F ==> finite G ==> finite (F Un G)"
-  -- {* The union of two finite sets is finite. *}
-  by (induct set: finite) simp_all
+by (induct set: finite) simp_all

lemma finite_subset: "A \<subseteq> B ==> finite B ==> finite A"
-- {* Every subset of a finite set is finite. *}
@@ -174,15 +173,21 @@
qed
qed

-lemma finite_Collect_subset[simp]: "finite A \<Longrightarrow> finite{x \<in> A. P x}"
-using finite_subset[of "{x \<in> A. P x}" "A"] by blast
-
lemma finite_Un [iff]: "finite (F Un G) = (finite F & finite G)"
-  by (blast intro: finite_subset [of _ "X Un Y", standard] finite_UnI)
+by (blast intro: finite_subset [of _ "X Un Y", standard] finite_UnI)
+
+lemma finite_disjI[simp]:
+  "finite{x. P x | Q x} = (finite{x. P x} & finite{x. Q x})"

lemma finite_Int [simp, intro]: "finite F | finite G ==> finite (F Int G)"
-- {* The converse obviously fails. *}
-  by (blast intro: finite_subset)
+by (blast intro: finite_subset)
+
+lemma finite_conjI [simp, intro]:
+  "finite{x. P x} | finite{x. Q x} ==> finite{x. P x & Q x}"
+  -- {* The converse obviously fails. *}

lemma finite_insert [simp]: "finite (insert a A) = finite A"
apply (subst insert_is_Un)
@@ -227,8 +232,20 @@
then show ?thesis by simp
qed

-lemma finite_Diff [simp]: "finite B ==> finite (B - Ba)"
-  by (rule Diff_subset [THEN finite_subset])
+lemma finite_Diff [simp]: "finite A ==> finite (A - B)"
+by (rule Diff_subset [THEN finite_subset])
+
+lemma finite_Diff2 [simp]:
+  assumes "finite B" shows "finite (A - B) = finite A"
+proof -
+  have "finite A \<longleftrightarrow> finite((A-B) Un (A Int B))" by(simp add: Un_Diff_Int)
+  also have "\<dots> \<longleftrightarrow> finite(A-B)" using `finite B` by(simp)
+  finally show ?thesis ..
+qed
+
+lemma finite_compl[simp]:
+  "finite(A::'a set) \<Longrightarrow> finite(-A) = finite(UNIV::'a set)"

lemma finite_Diff_insert [iff]: "finite (A - insert a B) = finite (A - B)"
apply (subst Diff_insert)
@@ -237,9 +254,6 @@
apply (subst insert_Diff, simp_all)
done

-lemma finite_Diff_singleton [simp]: "finite (A - {a}) = finite A"
-  by simp
-

text {* Image and Inverse Image over Finite Sets *}
```
```--- a/src/HOL/Library/Infinite_Set.thy	Fri Feb 13 09:56:24 2009 +0100
+++ b/src/HOL/Library/Infinite_Set.thy	Fri Feb 13 23:55:04 2009 +0100
@@ -461,10 +461,11 @@
by simp

lemma enumerate_in_set: "infinite S \<Longrightarrow> enumerate S n : S"
-  apply (induct n arbitrary: S)
-   apply (fastsimp intro: LeastI dest!: infinite_imp_nonempty)
-  apply (fastsimp iff: finite_Diff_singleton)
-  done
+apply (induct n arbitrary: S)
+ apply (fastsimp intro: LeastI dest!: infinite_imp_nonempty)
+apply simp
+apply (metis Collect_def Collect_mem_eq DiffE infinite_remove)
+done

declare enumerate_0 [simp del] enumerate_Suc [simp del]
```
```--- a/src/HOL/Library/Multiset.thy	Fri Feb 13 09:56:24 2009 +0100
+++ b/src/HOL/Library/Multiset.thy	Fri Feb 13 23:55:04 2009 +0100
@@ -88,10 +88,8 @@

lemma union_preserves_multiset:
"M \<in> multiset ==> N \<in> multiset ==> (\<lambda>a. M a + N a) \<in> multiset"
-apply (drule (1) finite_UnI)
-apply (simp del: finite_Un add: Un_def)
-done
+

lemma diff_preserves_multiset:
"M \<in> multiset ==> (\<lambda>a. M a - N a) \<in> multiset"```
```--- a/src/HOL/Set.thy	Fri Feb 13 09:56:24 2009 +0100
+++ b/src/HOL/Set.thy	Fri Feb 13 23:55:04 2009 +0100
@@ -787,6 +787,9 @@

lemma set_diff_eq: "A - B = {x. x : A & ~ x : B}" by blast

+lemma Compl_eq_Diff_UNIV: "-A = (UNIV - A)"
+by blast
+

subsubsection {* Augmenting a set -- insert *}
```