392 by (simp add: atLeast_Suc_greaterThan atLeastLessThan_def |
392 by (simp add: atLeast_Suc_greaterThan atLeastLessThan_def |
393 greaterThanLessThan_def) |
393 greaterThanLessThan_def) |
394 |
394 |
395 lemma atLeastAtMostSuc_conv: "m \<le> Suc n \<Longrightarrow> {m..Suc n} = insert (Suc n) {m..n}" |
395 lemma atLeastAtMostSuc_conv: "m \<le> Suc n \<Longrightarrow> {m..Suc n} = insert (Suc n) {m..n}" |
396 by (auto simp add: atLeastAtMost_def) |
396 by (auto simp add: atLeastAtMost_def) |
|
397 |
|
398 lemma atLeastLessThan_add_Un: "i \<le> j \<Longrightarrow> {i..<j+k} = {i..<j} \<union> {j..<j+k::nat}" |
|
399 apply (induct k) |
|
400 apply (simp_all add: atLeastLessThanSuc) |
|
401 done |
397 |
402 |
398 subsubsection {* Image *} |
403 subsubsection {* Image *} |
399 |
404 |
400 lemma image_add_atLeastAtMost: |
405 lemma image_add_atLeastAtMost: |
401 "(%n::nat. n+k) ` {i..j} = {i+k..j+k}" (is "?A = ?B") |
406 "(%n::nat. n+k) ` {i..j} = {i+k..j+k}" (is "?A = ?B") |
520 by (auto simp add: atLeast0LessThan) |
525 by (auto simp add: atLeast0LessThan) |
521 |
526 |
522 lemma UN_finite_subset: "(!!n::nat. (\<Union>i\<in>{0..<n}. A i) \<subseteq> C) \<Longrightarrow> (\<Union>n. A n) \<subseteq> C" |
527 lemma UN_finite_subset: "(!!n::nat. (\<Union>i\<in>{0..<n}. A i) \<subseteq> C) \<Longrightarrow> (\<Union>n. A n) \<subseteq> C" |
523 by (subst UN_UN_finite_eq [symmetric]) blast |
528 by (subst UN_UN_finite_eq [symmetric]) blast |
524 |
529 |
525 lemma UN_finite2_subset: |
530 lemma UN_finite2_subset: |
526 assumes sb: "!!n::nat. (\<Union>i\<in>{0..<n}. A i) \<subseteq> (\<Union>i\<in>{0..<n}. B i)" |
531 "(!!n::nat. (\<Union>i\<in>{0..<n}. A i) \<subseteq> (\<Union>i\<in>{0..<n+k}. B i)) \<Longrightarrow> (\<Union>n. A n) \<subseteq> (\<Union>n. B n)" |
527 shows "(\<Union>n. A n) \<subseteq> (\<Union>n. B n)" |
532 apply (rule UN_finite_subset) |
528 proof (rule UN_finite_subset) |
533 apply (subst UN_UN_finite_eq [symmetric, of B]) |
529 fix n |
534 apply blast |
530 have "(\<Union>i\<in>{0..<n}. A i) \<subseteq> (\<Union>i\<in>{0..<n}. B i)" by (rule sb) |
535 done |
531 also have "... \<subseteq> (\<Union>n::nat. \<Union>i\<in>{0..<n}. B i)" by blast |
|
532 also have "... = (\<Union>n. B n)" by (simp add: UN_UN_finite_eq) |
|
533 finally show "(\<Union>i\<in>{0..<n}. A i) \<subseteq> (\<Union>n. B n)" . |
|
534 qed |
|
535 |
536 |
536 lemma UN_finite2_eq: |
537 lemma UN_finite2_eq: |
537 "(!!n::nat. (\<Union>i\<in>{0..<n}. A i) = (\<Union>i\<in>{0..<n}. B i)) \<Longrightarrow> (\<Union>n. A n) = (\<Union>n. B n)" |
538 "(!!n::nat. (\<Union>i\<in>{0..<n}. A i) = (\<Union>i\<in>{0..<n+k}. B i)) \<Longrightarrow> (\<Union>n. A n) = (\<Union>n. B n)" |
538 by (iprover intro: subset_antisym UN_finite2_subset elim: equalityE) |
539 apply (rule subset_antisym) |
|
540 apply (rule UN_finite2_subset, blast) |
|
541 apply (rule UN_finite2_subset [where k=k]) |
|
542 apply (force simp add: atLeastLessThan_add_Un [of 0] UN_Un) |
|
543 done |
539 |
544 |
540 |
545 |
541 subsubsection {* Cardinality *} |
546 subsubsection {* Cardinality *} |
542 |
547 |
543 lemma card_lessThan [simp]: "card {..<u} = u" |
548 lemma card_lessThan [simp]: "card {..<u} = u" |