| author | desharna | 
| Fri, 20 Oct 2023 12:25:35 +0200 | |
| changeset 78789 | f2e845c3e65c | 
| parent 78250 | 400aecdfd71f | 
| child 80914 | d97fdabd9e2b | 
| permissions | -rw-r--r-- | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 1 | (* Title: HOL/Library/Set_Idioms.thy | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 2 | Author: Lawrence Paulson (but borrowed from HOL Light) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 3 | *) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 4 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 5 | section \<open>Set Idioms\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 6 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 7 | theory Set_Idioms | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 8 | imports Countable_Set | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 9 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 10 | begin | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 11 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 12 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 13 | subsection\<open>Idioms for being a suitable union/intersection of something\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 14 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 15 | definition union_of :: "('a set set \<Rightarrow> bool) \<Rightarrow> ('a set \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> bool"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 16 | (infixr "union'_of" 60) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 17 | where "P union_of Q \<equiv> \<lambda>S. \<exists>\<U>. P \<U> \<and> \<U> \<subseteq> Collect Q \<and> \<Union>\<U> = S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 18 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 19 | definition intersection_of :: "('a set set \<Rightarrow> bool) \<Rightarrow> ('a set \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> bool"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 20 | (infixr "intersection'_of" 60) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 21 | where "P intersection_of Q \<equiv> \<lambda>S. \<exists>\<U>. P \<U> \<and> \<U> \<subseteq> Collect Q \<and> \<Inter>\<U> = S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 22 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 23 | definition arbitrary:: "'a set set \<Rightarrow> bool" where "arbitrary \<U> \<equiv> True" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 24 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 25 | lemma union_of_inc: "\<lbrakk>P {S}; Q S\<rbrakk> \<Longrightarrow> (P union_of Q) S"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 26 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 27 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 28 | lemma intersection_of_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 29 |    "\<lbrakk>P {S}; Q S\<rbrakk> \<Longrightarrow> (P intersection_of Q) S"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 30 | by (auto simp: intersection_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 31 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 32 | lemma union_of_mono: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 33 | "\<lbrakk>(P union_of Q) S; \<And>x. Q x \<Longrightarrow> Q' x\<rbrakk> \<Longrightarrow> (P union_of Q') S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 34 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 35 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 36 | lemma intersection_of_mono: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 37 | "\<lbrakk>(P intersection_of Q) S; \<And>x. Q x \<Longrightarrow> Q' x\<rbrakk> \<Longrightarrow> (P intersection_of Q') S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 38 | by (auto simp: intersection_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 39 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 40 | lemma all_union_of: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 41 | "(\<forall>S. (P union_of Q) S \<longrightarrow> R S) \<longleftrightarrow> (\<forall>T. P T \<and> T \<subseteq> Collect Q \<longrightarrow> R(\<Union>T))" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 42 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 43 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 44 | lemma all_intersection_of: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 45 | "(\<forall>S. (P intersection_of Q) S \<longrightarrow> R S) \<longleftrightarrow> (\<forall>T. P T \<and> T \<subseteq> Collect Q \<longrightarrow> R(\<Inter>T))" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 46 | by (auto simp: intersection_of_def) | 
| 69918 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 47 | |
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 48 | lemma intersection_ofE: | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 49 | "\<lbrakk>(P intersection_of Q) S; \<And>T. \<lbrakk>P T; T \<subseteq> Collect Q\<rbrakk> \<Longrightarrow> R(\<Inter>T)\<rbrakk> \<Longrightarrow> R S" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 50 | by (auto simp: intersection_of_def) | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 51 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 52 | lemma union_of_empty: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 53 |      "P {} \<Longrightarrow> (P union_of Q) {}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 54 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 55 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 56 | lemma intersection_of_empty: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 57 |      "P {} \<Longrightarrow> (P intersection_of Q) UNIV"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 58 | by (auto simp: intersection_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 59 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 60 | text\<open> The arbitrary and finite cases\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 61 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 62 | lemma arbitrary_union_of_alt: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 63 | "(arbitrary union_of Q) S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>U. Q U \<and> x \<in> U \<and> U \<subseteq> S)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 64 | (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 65 | proof | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 66 | assume ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 67 | then show ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 68 | by (force simp: union_of_def arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 69 | next | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 70 | assume ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 71 |   then have "{U. Q U \<and> U \<subseteq> S} \<subseteq> Collect Q" "\<Union>{U. Q U \<and> U \<subseteq> S} = S"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 72 | by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 73 | then show ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 74 | unfolding union_of_def arbitrary_def by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 75 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 76 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 77 | lemma arbitrary_union_of_empty [simp]: "(arbitrary union_of P) {}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 78 | by (force simp: union_of_def arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 79 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 80 | lemma arbitrary_intersection_of_empty [simp]: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 81 | "(arbitrary intersection_of P) UNIV" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 82 | by (force simp: intersection_of_def arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 83 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 84 | lemma arbitrary_union_of_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 85 | "P S \<Longrightarrow> (arbitrary union_of P) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 86 | by (force simp: union_of_inc arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 87 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 88 | lemma arbitrary_intersection_of_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 89 | "P S \<Longrightarrow> (arbitrary intersection_of P) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 90 | by (force simp: intersection_of_inc arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 91 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 92 | lemma arbitrary_union_of_complement: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 93 | "(arbitrary union_of P) S \<longleftrightarrow> (arbitrary intersection_of (\<lambda>S. P(- S))) (- S)" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 94 | proof | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 95 | assume ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 96 | then obtain \<U> where "\<U> \<subseteq> Collect P" "S = \<Union>\<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 97 | by (auto simp: union_of_def arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 98 | then show ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 99 | unfolding intersection_of_def arbitrary_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 100 | by (rule_tac x="uminus ` \<U>" in exI) auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 101 | next | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 102 | assume ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 103 |   then obtain \<U> where "\<U> \<subseteq> {S. P (- S)}" "\<Inter>\<U> = - S"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 104 | by (auto simp: union_of_def intersection_of_def arbitrary_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 105 | then show ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 106 | unfolding union_of_def arbitrary_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 107 | by (rule_tac x="uminus ` \<U>" in exI) auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 108 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 109 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 110 | lemma arbitrary_intersection_of_complement: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 111 | "(arbitrary intersection_of P) S \<longleftrightarrow> (arbitrary union_of (\<lambda>S. P(- S))) (- S)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 112 | by (simp add: arbitrary_union_of_complement) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 113 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 114 | lemma arbitrary_union_of_idempot [simp]: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 115 | "arbitrary union_of arbitrary union_of P = arbitrary union_of P" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 116 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 117 |   have 1: "\<exists>\<U>'\<subseteq>Collect P. \<Union>\<U>' = \<Union>\<U>" if "\<U> \<subseteq> {S. \<exists>\<V>\<subseteq>Collect P. \<Union>\<V> = S}" for \<U>
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 118 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 119 |     let ?\<W> = "{V. \<exists>\<V>. \<V>\<subseteq>Collect P \<and> V \<in> \<V> \<and> (\<exists>S \<in> \<U>. \<Union>\<V> = S)}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 120 | have *: "\<And>x U. \<lbrakk>x \<in> U; U \<in> \<U>\<rbrakk> \<Longrightarrow> x \<in> \<Union>?\<W>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 121 | using that | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 122 | apply simp | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 123 | apply (drule subsetD, assumption, auto) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 124 | done | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 125 | show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 126 |     apply (rule_tac x="{V. \<exists>\<V>. \<V>\<subseteq>Collect P \<and> V \<in> \<V> \<and> (\<exists>S \<in> \<U>. \<Union>\<V> = S)}" in exI)
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 127 | using that by (blast intro: *) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 128 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 129 |   have 2: "\<exists>\<U>'\<subseteq>{S. \<exists>\<U>\<subseteq>Collect P. \<Union>\<U> = S}. \<Union>\<U>' = \<Union>\<U>" if "\<U> \<subseteq> Collect P" for \<U>
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 130 | by (metis (mono_tags, lifting) union_of_def arbitrary_union_of_inc that) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 131 | show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 132 | unfolding union_of_def arbitrary_def by (force simp: 1 2) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 133 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 134 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 135 | lemma arbitrary_intersection_of_idempot: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 136 | "arbitrary intersection_of arbitrary intersection_of P = arbitrary intersection_of P" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 137 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 138 | have "- ?lhs = - ?rhs" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 139 | unfolding arbitrary_intersection_of_complement by simp | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 140 | then show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 141 | by simp | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 142 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 143 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 144 | lemma arbitrary_union_of_Union: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 145 | "(\<And>S. S \<in> \<U> \<Longrightarrow> (arbitrary union_of P) S) \<Longrightarrow> (arbitrary union_of P) (\<Union>\<U>)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 146 | by (metis union_of_def arbitrary_def arbitrary_union_of_idempot mem_Collect_eq subsetI) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 147 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 148 | lemma arbitrary_union_of_Un: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 149 | "\<lbrakk>(arbitrary union_of P) S; (arbitrary union_of P) T\<rbrakk> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 150 | \<Longrightarrow> (arbitrary union_of P) (S \<union> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 151 |   using arbitrary_union_of_Union [of "{S,T}"] by auto
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 152 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 153 | lemma arbitrary_intersection_of_Inter: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 154 | "(\<And>S. S \<in> \<U> \<Longrightarrow> (arbitrary intersection_of P) S) \<Longrightarrow> (arbitrary intersection_of P) (\<Inter>\<U>)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 155 | by (metis intersection_of_def arbitrary_def arbitrary_intersection_of_idempot mem_Collect_eq subsetI) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 156 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 157 | lemma arbitrary_intersection_of_Int: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 158 | "\<lbrakk>(arbitrary intersection_of P) S; (arbitrary intersection_of P) T\<rbrakk> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 159 | \<Longrightarrow> (arbitrary intersection_of P) (S \<inter> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 160 |   using arbitrary_intersection_of_Inter [of "{S,T}"] by auto
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 161 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 162 | lemma arbitrary_union_of_Int_eq: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 163 | "(\<forall>S T. (arbitrary union_of P) S \<and> (arbitrary union_of P) T | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 164 | \<longrightarrow> (arbitrary union_of P) (S \<inter> T)) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 165 | \<longleftrightarrow> (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary union_of P) (S \<inter> T))" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 166 | proof | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 167 | assume ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 168 | then show ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 169 | by (simp add: arbitrary_union_of_inc) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 170 | next | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 171 | assume R: ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 172 | show ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 173 | proof clarify | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 174 | fix S :: "'a set" and T :: "'a set" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 175 | assume "(arbitrary union_of P) S" and "(arbitrary union_of P) T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 176 | then obtain \<U> \<V> where *: "\<U> \<subseteq> Collect P" "\<Union>\<U> = S" "\<V> \<subseteq> Collect P" "\<Union>\<V> = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 177 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 178 | then have "(arbitrary union_of P) (\<Union>C\<in>\<U>. \<Union>D\<in>\<V>. C \<inter> D)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 179 | using R by (blast intro: arbitrary_union_of_Union) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 180 | then show "(arbitrary union_of P) (S \<inter> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 181 | by (simp add: Int_UN_distrib2 *) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 182 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 183 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 184 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 185 | lemma arbitrary_intersection_of_Un_eq: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 186 | "(\<forall>S T. (arbitrary intersection_of P) S \<and> (arbitrary intersection_of P) T | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 187 | \<longrightarrow> (arbitrary intersection_of P) (S \<union> T)) \<longleftrightarrow> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 188 | (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary intersection_of P) (S \<union> T))" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 189 | apply (simp add: arbitrary_intersection_of_complement) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 190 | using arbitrary_union_of_Int_eq [of "\<lambda>S. P (- S)"] | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 191 | by (metis (no_types, lifting) arbitrary_def double_compl union_of_inc) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 192 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 193 | lemma finite_union_of_empty [simp]: "(finite union_of P) {}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 194 | by (simp add: union_of_empty) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 195 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 196 | lemma finite_intersection_of_empty [simp]: "(finite intersection_of P) UNIV" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 197 | by (simp add: intersection_of_empty) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 198 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 199 | lemma finite_union_of_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 200 | "P S \<Longrightarrow> (finite union_of P) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 201 | by (simp add: union_of_inc) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 202 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 203 | lemma finite_intersection_of_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 204 | "P S \<Longrightarrow> (finite intersection_of P) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 205 | by (simp add: intersection_of_inc) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 206 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 207 | lemma finite_union_of_complement: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 208 | "(finite union_of P) S \<longleftrightarrow> (finite intersection_of (\<lambda>S. P(- S))) (- S)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 209 | unfolding union_of_def intersection_of_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 210 | apply safe | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 211 | apply (rule_tac x="uminus ` \<U>" in exI, fastforce)+ | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 212 | done | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 213 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 214 | lemma finite_intersection_of_complement: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 215 | "(finite intersection_of P) S \<longleftrightarrow> (finite union_of (\<lambda>S. P(- S))) (- S)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 216 | by (simp add: finite_union_of_complement) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 217 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 218 | lemma finite_union_of_idempot [simp]: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 219 | "finite union_of finite union_of P = finite union_of P" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 220 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 221 | have "(finite union_of P) S" if S: "(finite union_of finite union_of P) S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 222 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 223 | obtain \<U> where "finite \<U>" "S = \<Union>\<U>" and \<U>: "\<forall>U\<in>\<U>. \<exists>\<U>. finite \<U> \<and> (\<U> \<subseteq> Collect P) \<and> \<Union>\<U> = U" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 224 | using S unfolding union_of_def by (auto simp: subset_eq) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 225 | then obtain f where "\<forall>U\<in>\<U>. finite (f U) \<and> (f U \<subseteq> Collect P) \<and> \<Union>(f U) = U" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 226 | by metis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 227 | then show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 228 | unfolding union_of_def \<open>S = \<Union>\<U>\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 229 | by (rule_tac x = "snd ` Sigma \<U> f" in exI) (fastforce simp: \<open>finite \<U>\<close>) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 230 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 231 | moreover | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 232 | have "(finite union_of finite union_of P) S" if "(finite union_of P) S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 233 | by (simp add: finite_union_of_inc that) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 234 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 235 | by force | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 236 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 237 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 238 | lemma finite_intersection_of_idempot [simp]: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 239 | "finite intersection_of finite intersection_of P = finite intersection_of P" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 240 | by (force simp: finite_intersection_of_complement) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 241 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 242 | lemma finite_union_of_Union: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 243 | "\<lbrakk>finite \<U>; \<And>S. S \<in> \<U> \<Longrightarrow> (finite union_of P) S\<rbrakk> \<Longrightarrow> (finite union_of P) (\<Union>\<U>)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 244 | using finite_union_of_idempot [of P] | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 245 | by (metis mem_Collect_eq subsetI union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 246 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 247 | lemma finite_union_of_Un: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 248 | "\<lbrakk>(finite union_of P) S; (finite union_of P) T\<rbrakk> \<Longrightarrow> (finite union_of P) (S \<union> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 249 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 250 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 251 | lemma finite_intersection_of_Inter: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 252 | "\<lbrakk>finite \<U>; \<And>S. S \<in> \<U> \<Longrightarrow> (finite intersection_of P) S\<rbrakk> \<Longrightarrow> (finite intersection_of P) (\<Inter>\<U>)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 253 | using finite_intersection_of_idempot [of P] | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 254 | by (metis intersection_of_def mem_Collect_eq subsetI) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 255 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 256 | lemma finite_intersection_of_Int: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 257 | "\<lbrakk>(finite intersection_of P) S; (finite intersection_of P) T\<rbrakk> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 258 | \<Longrightarrow> (finite intersection_of P) (S \<inter> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 259 | by (auto simp: intersection_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 260 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 261 | lemma finite_union_of_Int_eq: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 262 | "(\<forall>S T. (finite union_of P) S \<and> (finite union_of P) T \<longrightarrow> (finite union_of P) (S \<inter> T)) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 263 | \<longleftrightarrow> (\<forall>S T. P S \<and> P T \<longrightarrow> (finite union_of P) (S \<inter> T))" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 264 | (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 265 | proof | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 266 | assume ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 267 | then show ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 268 | by (simp add: finite_union_of_inc) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 269 | next | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 270 | assume R: ?rhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 271 | show ?lhs | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 272 | proof clarify | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 273 | fix S :: "'a set" and T :: "'a set" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 274 | assume "(finite union_of P) S" and "(finite union_of P) T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 275 | then obtain \<U> \<V> where *: "\<U> \<subseteq> Collect P" "\<Union>\<U> = S" "finite \<U>" "\<V> \<subseteq> Collect P" "\<Union>\<V> = T" "finite \<V>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 276 | by (auto simp: union_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 277 | then have "(finite union_of P) (\<Union>C\<in>\<U>. \<Union>D\<in>\<V>. C \<inter> D)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 278 | using R | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 279 | by (blast intro: finite_union_of_Union) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 280 | then show "(finite union_of P) (S \<inter> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 281 | by (simp add: Int_UN_distrib2 *) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 282 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 283 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 284 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 285 | lemma finite_intersection_of_Un_eq: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 286 | "(\<forall>S T. (finite intersection_of P) S \<and> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 287 | (finite intersection_of P) T | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 288 | \<longrightarrow> (finite intersection_of P) (S \<union> T)) \<longleftrightarrow> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 289 | (\<forall>S T. P S \<and> P T \<longrightarrow> (finite intersection_of P) (S \<union> T))" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 290 | apply (simp add: finite_intersection_of_complement) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 291 | using finite_union_of_Int_eq [of "\<lambda>S. P (- S)"] | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 292 | by (metis (no_types, lifting) double_compl) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 293 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 294 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 295 | abbreviation finite' :: "'a set \<Rightarrow> bool" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 296 |   where "finite' A \<equiv> finite A \<and> A \<noteq> {}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 297 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 298 | lemma finite'_intersection_of_Int: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 299 | "\<lbrakk>(finite' intersection_of P) S; (finite' intersection_of P) T\<rbrakk> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 300 | \<Longrightarrow> (finite' intersection_of P) (S \<inter> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 301 | by (auto simp: intersection_of_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 302 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 303 | lemma finite'_intersection_of_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 304 | "P S \<Longrightarrow> (finite' intersection_of P) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 305 | by (simp add: intersection_of_inc) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 306 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 307 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 308 | subsection \<open>The ``Relative to'' operator\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 309 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 310 | text\<open>A somewhat cheap but handy way of getting localized forms of various topological concepts | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 311 | (open, closed, borel, fsigma, gdelta etc.)\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 312 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 313 | definition relative_to :: "['a set \<Rightarrow> bool, 'a set, 'a set] \<Rightarrow> bool" (infixl "relative'_to" 55) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 314 | where "P relative_to S \<equiv> \<lambda>T. \<exists>U. P U \<and> S \<inter> U = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 315 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 316 | lemma relative_to_UNIV [simp]: "(P relative_to UNIV) S \<longleftrightarrow> P S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 317 | by (simp add: relative_to_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 318 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 319 | lemma relative_to_imp_subset: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 320 | "(P relative_to S) T \<Longrightarrow> T \<subseteq> S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 321 | by (auto simp: relative_to_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 322 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 323 | lemma all_relative_to: "(\<forall>S. (P relative_to U) S \<longrightarrow> Q S) \<longleftrightarrow> (\<forall>S. P S \<longrightarrow> Q(U \<inter> S))" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 324 | by (auto simp: relative_to_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 325 | |
| 69918 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 326 | lemma relative_toE: "\<lbrakk>(P relative_to U) S; \<And>S. P S \<Longrightarrow> Q(U \<inter> S)\<rbrakk> \<Longrightarrow> Q S" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 327 | by (auto simp: relative_to_def) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69325diff
changeset | 328 | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 329 | lemma relative_to_inc: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 330 | "P S \<Longrightarrow> (P relative_to U) (U \<inter> S)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 331 | by (auto simp: relative_to_def) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 332 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 333 | lemma relative_to_relative_to [simp]: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 334 | "P relative_to S relative_to T = P relative_to (S \<inter> T)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 335 | unfolding relative_to_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 336 | by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 337 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 338 | lemma relative_to_compl: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 339 | "S \<subseteq> U \<Longrightarrow> ((P relative_to U) (U - S) \<longleftrightarrow> ((\<lambda>c. P(- c)) relative_to U) S)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 340 | unfolding relative_to_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 341 | by (metis Diff_Diff_Int Diff_eq double_compl inf.absorb_iff2) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 342 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 343 | lemma relative_to_subset_trans: | 
| 78250 
400aecdfd71f
Another tranche of HOL Light material on metric and topological spaces
 paulson <lp15@cam.ac.uk> parents: 
77935diff
changeset | 344 | "\<lbrakk>(P relative_to U) S; S \<subseteq> T; T \<subseteq> U\<rbrakk> \<Longrightarrow> (P relative_to T) S" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 345 | unfolding relative_to_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 346 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 347 | lemma relative_to_mono: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 348 | "\<lbrakk>(P relative_to U) S; \<And>S. P S \<Longrightarrow> Q S\<rbrakk> \<Longrightarrow> (Q relative_to U) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 349 | unfolding relative_to_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 350 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 351 | lemma relative_to_subset_inc: "\<lbrakk>S \<subseteq> U; P S\<rbrakk> \<Longrightarrow> (P relative_to U) S" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 352 | unfolding relative_to_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 353 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 354 | lemma relative_to_Int: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 355 | "\<lbrakk>(P relative_to S) C; (P relative_to S) D; \<And>X Y. \<lbrakk>P X; P Y\<rbrakk> \<Longrightarrow> P(X \<inter> Y)\<rbrakk> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 356 | \<Longrightarrow> (P relative_to S) (C \<inter> D)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 357 | unfolding relative_to_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 358 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 359 | lemma relative_to_Un: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 360 | "\<lbrakk>(P relative_to S) C; (P relative_to S) D; \<And>X Y. \<lbrakk>P X; P Y\<rbrakk> \<Longrightarrow> P(X \<union> Y)\<rbrakk> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 361 | \<Longrightarrow> (P relative_to S) (C \<union> D)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 362 | unfolding relative_to_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 363 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 364 | lemma arbitrary_union_of_relative_to: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 365 | "((arbitrary union_of P) relative_to U) = (arbitrary union_of (P relative_to U))" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 366 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 367 | have "?rhs S" if L: "?lhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 368 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 369 | obtain \<U> where "S = U \<inter> \<Union>\<U>" "\<U> \<subseteq> Collect P" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 370 | using L unfolding relative_to_def union_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 371 | then show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 372 | unfolding relative_to_def union_of_def arbitrary_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 373 | by (rule_tac x="(\<lambda>X. U \<inter> X) ` \<U>" in exI) auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 374 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 375 | moreover have "?lhs S" if R: "?rhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 376 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 377 | obtain \<U> where "S = \<Union>\<U>" "\<forall>T\<in>\<U>. \<exists>V. P V \<and> U \<inter> V = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 378 | using R unfolding relative_to_def union_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 379 | then obtain f where f: "\<And>T. T \<in> \<U> \<Longrightarrow> P (f T)" "\<And>T. T \<in> \<U> \<Longrightarrow> U \<inter> (f T) = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 380 | by metis | 
| 69325 | 381 | then have "\<exists>\<U>'\<subseteq>Collect P. \<Union>\<U>' = \<Union> (f ` \<U>)" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 382 | by (metis image_subset_iff mem_Collect_eq) | 
| 69325 | 383 | moreover have eq: "U \<inter> \<Union> (f ` \<U>) = \<Union>\<U>" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 384 | using f by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 385 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 386 | unfolding relative_to_def union_of_def arbitrary_def \<open>S = \<Union>\<U>\<close> | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 387 | by metis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 388 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 389 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 390 | by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 391 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 392 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 393 | lemma finite_union_of_relative_to: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 394 | "((finite union_of P) relative_to U) = (finite union_of (P relative_to U))" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 395 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 396 | have "?rhs S" if L: "?lhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 397 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 398 | obtain \<U> where "S = U \<inter> \<Union>\<U>" "\<U> \<subseteq> Collect P" "finite \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 399 | using L unfolding relative_to_def union_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 400 | then show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 401 | unfolding relative_to_def union_of_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 402 | by (rule_tac x="(\<lambda>X. U \<inter> X) ` \<U>" in exI) auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 403 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 404 | moreover have "?lhs S" if R: "?rhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 405 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 406 | obtain \<U> where "S = \<Union>\<U>" "\<forall>T\<in>\<U>. \<exists>V. P V \<and> U \<inter> V = T" "finite \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 407 | using R unfolding relative_to_def union_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 408 | then obtain f where f: "\<And>T. T \<in> \<U> \<Longrightarrow> P (f T)" "\<And>T. T \<in> \<U> \<Longrightarrow> U \<inter> (f T) = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 409 | by metis | 
| 69325 | 410 | then have "\<exists>\<U>'\<subseteq>Collect P. \<Union>\<U>' = \<Union> (f ` \<U>)" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 411 | by (metis image_subset_iff mem_Collect_eq) | 
| 69325 | 412 | moreover have eq: "U \<inter> \<Union> (f ` \<U>) = \<Union>\<U>" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 413 | using f by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 414 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 415 | using \<open>finite \<U>\<close> f | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 416 | unfolding relative_to_def union_of_def \<open>S = \<Union>\<U>\<close> | 
| 69325 | 417 | by (rule_tac x="\<Union> (f ` \<U>)" in exI) (metis finite_imageI image_subsetI mem_Collect_eq) | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 418 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 419 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 420 | by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 421 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 422 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 423 | lemma countable_union_of_relative_to: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 424 | "((countable union_of P) relative_to U) = (countable union_of (P relative_to U))" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 425 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 426 | have "?rhs S" if L: "?lhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 427 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 428 | obtain \<U> where "S = U \<inter> \<Union>\<U>" "\<U> \<subseteq> Collect P" "countable \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 429 | using L unfolding relative_to_def union_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 430 | then show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 431 | unfolding relative_to_def union_of_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 432 | by (rule_tac x="(\<lambda>X. U \<inter> X) ` \<U>" in exI) auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 433 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 434 | moreover have "?lhs S" if R: "?rhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 435 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 436 | obtain \<U> where "S = \<Union>\<U>" "\<forall>T\<in>\<U>. \<exists>V. P V \<and> U \<inter> V = T" "countable \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 437 | using R unfolding relative_to_def union_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 438 | then obtain f where f: "\<And>T. T \<in> \<U> \<Longrightarrow> P (f T)" "\<And>T. T \<in> \<U> \<Longrightarrow> U \<inter> (f T) = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 439 | by metis | 
| 69325 | 440 | then have "\<exists>\<U>'\<subseteq>Collect P. \<Union>\<U>' = \<Union> (f ` \<U>)" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 441 | by (metis image_subset_iff mem_Collect_eq) | 
| 69325 | 442 | moreover have eq: "U \<inter> \<Union> (f ` \<U>) = \<Union>\<U>" | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 443 | using f by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 444 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 445 | using \<open>countable \<U>\<close> f | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 446 | unfolding relative_to_def union_of_def \<open>S = \<Union>\<U>\<close> | 
| 69325 | 447 | by (rule_tac x="\<Union> (f ` \<U>)" in exI) (metis countable_image image_subsetI mem_Collect_eq) | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 448 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 449 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 450 | by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 451 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 452 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 453 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 454 | lemma arbitrary_intersection_of_relative_to: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 455 | "((arbitrary intersection_of P) relative_to U) = ((arbitrary intersection_of (P relative_to U)) relative_to U)" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 456 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 457 | have "?rhs S" if L: "?lhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 458 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 459 | obtain \<U> where \<U>: "S = U \<inter> \<Inter>\<U>" "\<U> \<subseteq> Collect P" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 460 | using L unfolding relative_to_def intersection_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 461 | show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 462 | unfolding relative_to_def intersection_of_def arbitrary_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 463 | proof (intro exI conjI) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 464 |       show "U \<inter> (\<Inter>X\<in>\<U>. U \<inter> X) = S" "(\<inter>) U ` \<U> \<subseteq> {T. \<exists>Ua. P Ua \<and> U \<inter> Ua = T}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 465 | using \<U> by blast+ | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 466 | qed auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 467 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 468 | moreover have "?lhs S" if R: "?rhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 469 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 470 | obtain \<U> where "S = U \<inter> \<Inter>\<U>" "\<forall>T\<in>\<U>. \<exists>V. P V \<and> U \<inter> V = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 471 | using R unfolding relative_to_def intersection_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 472 | then obtain f where f: "\<And>T. T \<in> \<U> \<Longrightarrow> P (f T)" "\<And>T. T \<in> \<U> \<Longrightarrow> U \<inter> (f T) = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 473 | by metis | 
| 69313 | 474 | then have "f ` \<U> \<subseteq> Collect P" | 
| 475 | by auto | |
| 476 | moreover have eq: "U \<inter> \<Inter>(f ` \<U>) = U \<inter> \<Inter>\<U>" | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 477 | using f by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 478 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 479 | unfolding relative_to_def intersection_of_def arbitrary_def \<open>S = U \<inter> \<Inter>\<U>\<close> | 
| 69313 | 480 | by auto | 
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 481 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 482 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 483 | by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 484 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 485 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 486 | lemma finite_intersection_of_relative_to: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 487 | "((finite intersection_of P) relative_to U) = ((finite intersection_of (P relative_to U)) relative_to U)" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 488 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 489 | have "?rhs S" if L: "?lhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 490 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 491 | obtain \<U> where \<U>: "S = U \<inter> \<Inter>\<U>" "\<U> \<subseteq> Collect P" "finite \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 492 | using L unfolding relative_to_def intersection_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 493 | show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 494 | unfolding relative_to_def intersection_of_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 495 | proof (intro exI conjI) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 496 |       show "U \<inter> (\<Inter>X\<in>\<U>. U \<inter> X) = S" "(\<inter>) U ` \<U> \<subseteq> {T. \<exists>Ua. P Ua \<and> U \<inter> Ua = T}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 497 | using \<U> by blast+ | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 498 | show "finite ((\<inter>) U ` \<U>)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 499 | by (simp add: \<open>finite \<U>\<close>) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 500 | qed auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 501 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 502 | moreover have "?lhs S" if R: "?rhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 503 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 504 | obtain \<U> where "S = U \<inter> \<Inter>\<U>" "\<forall>T\<in>\<U>. \<exists>V. P V \<and> U \<inter> V = T" "finite \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 505 | using R unfolding relative_to_def intersection_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 506 | then obtain f where f: "\<And>T. T \<in> \<U> \<Longrightarrow> P (f T)" "\<And>T. T \<in> \<U> \<Longrightarrow> U \<inter> (f T) = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 507 | by metis | 
| 69313 | 508 | then have "f ` \<U> \<subseteq> Collect P" | 
| 509 | by auto | |
| 510 | moreover have eq: "U \<inter> \<Inter> (f ` \<U>) = U \<inter> \<Inter> \<U>" | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 511 | using f by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 512 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 513 | unfolding relative_to_def intersection_of_def \<open>S = U \<inter> \<Inter>\<U>\<close> | 
| 69313 | 514 | using \<open>finite \<U>\<close> | 
| 515 | by auto | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 516 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 517 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 518 | by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 519 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 520 | |
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 521 | lemma countable_intersection_of_relative_to: | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 522 | "((countable intersection_of P) relative_to U) = ((countable intersection_of (P relative_to U)) relative_to U)" (is "?lhs = ?rhs") | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 523 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 524 | have "?rhs S" if L: "?lhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 525 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 526 | obtain \<U> where \<U>: "S = U \<inter> \<Inter>\<U>" "\<U> \<subseteq> Collect P" "countable \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 527 | using L unfolding relative_to_def intersection_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 528 | show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 529 | unfolding relative_to_def intersection_of_def | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 530 | proof (intro exI conjI) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 531 |       show "U \<inter> (\<Inter>X\<in>\<U>. U \<inter> X) = S" "(\<inter>) U ` \<U> \<subseteq> {T. \<exists>Ua. P Ua \<and> U \<inter> Ua = T}"
 | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 532 | using \<U> by blast+ | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 533 | show "countable ((\<inter>) U ` \<U>)" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 534 | by (simp add: \<open>countable \<U>\<close>) | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 535 | qed auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 536 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 537 | moreover have "?lhs S" if R: "?rhs S" for S | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 538 | proof - | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 539 | obtain \<U> where "S = U \<inter> \<Inter>\<U>" "\<forall>T\<in>\<U>. \<exists>V. P V \<and> U \<inter> V = T" "countable \<U>" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 540 | using R unfolding relative_to_def intersection_of_def by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 541 | then obtain f where f: "\<And>T. T \<in> \<U> \<Longrightarrow> P (f T)" "\<And>T. T \<in> \<U> \<Longrightarrow> U \<inter> (f T) = T" | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 542 | by metis | 
| 69313 | 543 | then have "f ` \<U> \<subseteq> Collect P" | 
| 544 | by auto | |
| 545 | moreover have eq: "U \<inter> \<Inter> (f ` \<U>) = U \<inter> \<Inter> \<U>" | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 546 | using f by auto | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 547 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 548 | unfolding relative_to_def intersection_of_def \<open>S = U \<inter> \<Inter>\<U>\<close> | 
| 69313 | 549 | using \<open>countable \<U>\<close> countable_image | 
| 550 | by auto | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 551 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 552 | ultimately show ?thesis | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 553 | by blast | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 554 | qed | 
| 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 555 | |
| 77935 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 556 | lemma countable_union_of_empty [simp]: "(countable union_of P) {}"
 | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 557 | by (simp add: union_of_empty) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 558 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 559 | lemma countable_intersection_of_empty [simp]: "(countable intersection_of P) UNIV" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 560 | by (simp add: intersection_of_empty) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 561 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 562 | lemma countable_union_of_inc: "P S \<Longrightarrow> (countable union_of P) S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 563 | by (simp add: union_of_inc) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 564 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 565 | lemma countable_intersection_of_inc: "P S \<Longrightarrow> (countable intersection_of P) S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 566 | by (simp add: intersection_of_inc) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 567 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 568 | lemma countable_union_of_complement: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 569 | "(countable union_of P) S \<longleftrightarrow> (countable intersection_of (\<lambda>S. P(-S))) (-S)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 570 | (is "?lhs=?rhs") | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 571 | proof | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 572 | assume ?lhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 573 | then obtain \<U> where "countable \<U>" and \<U>: "\<U> \<subseteq> Collect P" "\<Union>\<U> = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 574 | by (metis union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 575 | define \<U>' where "\<U>' \<equiv> (\<lambda>C. -C) ` \<U>" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 576 |   have "\<U>' \<subseteq> {S. P (- S)}" "\<Inter>\<U>' = -S"
 | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 577 | using \<U>'_def \<U> by auto | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 578 | then show ?rhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 579 | unfolding intersection_of_def by (metis \<U>'_def \<open>countable \<U>\<close> countable_image) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 580 | next | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 581 | assume ?rhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 582 |   then obtain \<U> where "countable \<U>" and \<U>: "\<U> \<subseteq> {S. P (- S)}" "\<Inter>\<U> = -S"
 | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 583 | by (metis intersection_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 584 | define \<U>' where "\<U>' \<equiv> (\<lambda>C. -C) ` \<U>" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 585 | have "\<U>' \<subseteq> Collect P" "\<Union> \<U>' = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 586 | using \<U>'_def \<U> by auto | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 587 | then show ?lhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 588 | unfolding union_of_def | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 589 | by (metis \<U>'_def \<open>countable \<U>\<close> countable_image) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 590 | qed | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 591 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 592 | lemma countable_intersection_of_complement: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 593 | "(countable intersection_of P) S \<longleftrightarrow> (countable union_of (\<lambda>S. P(- S))) (- S)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 594 | by (simp add: countable_union_of_complement) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 595 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 596 | lemma countable_union_of_explicit: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 597 |   assumes "P {}"
 | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 598 | shows "(countable union_of P) S \<longleftrightarrow> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 599 | (\<exists>T. (\<forall>n::nat. P(T n)) \<and> \<Union>(range T) = S)" (is "?lhs=?rhs") | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 600 | proof | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 601 | assume ?lhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 602 | then obtain \<U> where "countable \<U>" and \<U>: "\<U> \<subseteq> Collect P" "\<Union>\<U> = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 603 | by (metis union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 604 | then show ?rhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 605 | by (metis SUP_bot Sup_empty assms from_nat_into mem_Collect_eq range_from_nat_into subsetD) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 606 | next | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 607 | assume ?rhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 608 | then show ?lhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 609 | by (metis countableI_type countable_image image_subset_iff mem_Collect_eq union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 610 | qed | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 611 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 612 | lemma countable_union_of_ascending: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 613 |   assumes empty: "P {}" and Un: "\<And>T U. \<lbrakk>P T; P U\<rbrakk> \<Longrightarrow> P(T \<union> U)"
 | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 614 | shows "(countable union_of P) S \<longleftrightarrow> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 615 | (\<exists>T. (\<forall>n. P(T n)) \<and> (\<forall>n. T n \<subseteq> T(Suc n)) \<and> \<Union>(range T) = S)" (is "?lhs=?rhs") | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 616 | proof | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 617 | assume ?lhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 618 | then obtain T where T: "\<And>n::nat. P(T n)" "\<Union>(range T) = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 619 | by (meson empty countable_union_of_explicit) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 620 |   have "P (\<Union> (T ` {..n}))" for n
 | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 621 | by (induction n) (auto simp: atMost_Suc Un T) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 622 | with T show ?rhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 623 | by (rule_tac x="\<lambda>n. \<Union>k\<le>n. T k" in exI) force | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 624 | next | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 625 | assume ?rhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 626 | then show ?lhs | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 627 | using empty countable_union_of_explicit by auto | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 628 | qed | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 629 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 630 | lemma countable_union_of_idem [simp]: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 631 | "countable union_of countable union_of P = countable union_of P" (is "?lhs=?rhs") | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 632 | proof | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 633 | fix S | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 634 | show "(countable union_of countable union_of P) S = (countable union_of P) S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 635 | proof | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 636 | assume L: "?lhs S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 637 | then obtain \<U> where "countable \<U>" and \<U>: "\<U> \<subseteq> Collect (countable union_of P)" "\<Union>\<U> = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 638 | by (metis union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 639 | then have "\<forall>U \<in> \<U>. \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> Collect P \<and> U = \<Union>\<V>" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 640 | by (metis Ball_Collect union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 641 | then obtain \<F> where \<F>: "\<forall>U \<in> \<U>. countable (\<F> U) \<and> \<F> U \<subseteq> Collect P \<and> U = \<Union>(\<F> U)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 642 | by metis | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 643 | have "countable (\<Union> (\<F> ` \<U>))" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 644 | using \<F> \<open>countable \<U>\<close> by blast | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 645 | moreover have "\<Union> (\<F> ` \<U>) \<subseteq> Collect P" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 646 | by (simp add: Sup_le_iff \<F>) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 647 | moreover have "\<Union> (\<Union> (\<F> ` \<U>)) = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 648 | by auto (metis Union_iff \<F> \<U>(2))+ | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 649 | ultimately show "?rhs S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 650 | by (meson union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 651 | qed (simp add: countable_union_of_inc) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 652 | qed | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 653 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 654 | lemma countable_intersection_of_idem [simp]: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 655 | "countable intersection_of countable intersection_of P = | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 656 | countable intersection_of P" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 657 | by (force simp: countable_intersection_of_complement) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 658 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 659 | lemma countable_union_of_Union: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 660 | "\<lbrakk>countable \<U>; \<And>S. S \<in> \<U> \<Longrightarrow> (countable union_of P) S\<rbrakk> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 661 | \<Longrightarrow> (countable union_of P) (\<Union> \<U>)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 662 | by (metis Ball_Collect countable_union_of_idem union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 663 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 664 | lemma countable_union_of_UN: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 665 | "\<lbrakk>countable I; \<And>i. i \<in> I \<Longrightarrow> (countable union_of P) (U i)\<rbrakk> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 666 | \<Longrightarrow> (countable union_of P) (\<Union>i\<in>I. U i)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 667 | by (metis (mono_tags, lifting) countable_image countable_union_of_Union imageE) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 668 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 669 | lemma countable_union_of_Un: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 670 | "\<lbrakk>(countable union_of P) S; (countable union_of P) T\<rbrakk> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 671 | \<Longrightarrow> (countable union_of P) (S \<union> T)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 672 | by (smt (verit) Union_Un_distrib countable_Un le_sup_iff union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 673 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 674 | lemma countable_intersection_of_Inter: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 675 | "\<lbrakk>countable \<U>; \<And>S. S \<in> \<U> \<Longrightarrow> (countable intersection_of P) S\<rbrakk> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 676 | \<Longrightarrow> (countable intersection_of P) (\<Inter> \<U>)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 677 | by (metis countable_intersection_of_idem intersection_of_def mem_Collect_eq subsetI) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 678 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 679 | lemma countable_intersection_of_INT: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 680 | "\<lbrakk>countable I; \<And>i. i \<in> I \<Longrightarrow> (countable intersection_of P) (U i)\<rbrakk> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 681 | \<Longrightarrow> (countable intersection_of P) (\<Inter>i\<in>I. U i)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 682 | by (metis (mono_tags, lifting) countable_image countable_intersection_of_Inter imageE) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 683 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 684 | lemma countable_intersection_of_inter: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 685 | "\<lbrakk>(countable intersection_of P) S; (countable intersection_of P) T\<rbrakk> | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 686 | \<Longrightarrow> (countable intersection_of P) (S \<inter> T)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 687 | by (simp add: countable_intersection_of_complement countable_union_of_Un) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 688 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 689 | lemma countable_union_of_Int: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 690 | assumes S: "(countable union_of P) S" and T: "(countable union_of P) T" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 691 | and Int: "\<And>S T. P S \<and> P T \<Longrightarrow> P(S \<inter> T)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 692 | shows "(countable union_of P) (S \<inter> T)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 693 | proof - | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 694 | obtain \<U> where "countable \<U>" and \<U>: "\<U> \<subseteq> Collect P" "\<Union>\<U> = S" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 695 | using S by (metis union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 696 | obtain \<V> where "countable \<V>" and \<V>: "\<V> \<subseteq> Collect P" "\<Union>\<V> = T" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 697 | using T by (metis union_of_def) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 698 | have "\<And>U V. \<lbrakk>U \<in> \<U>; V \<in> \<V>\<rbrakk> \<Longrightarrow> (countable union_of P) (U \<inter> V)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 699 | using \<U> \<V> by (metis Ball_Collect countable_union_of_inc local.Int) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 700 | then have "(countable union_of P) (\<Union>U\<in>\<U>. \<Union>V\<in>\<V>. U \<inter> V)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 701 | by (meson \<open>countable \<U>\<close> \<open>countable \<V>\<close> countable_union_of_UN) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 702 | moreover have "S \<inter> T = (\<Union>U\<in>\<U>. \<Union>V\<in>\<V>. U \<inter> V)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 703 | by (simp add: \<U> \<V>) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 704 | ultimately show ?thesis | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 705 | by presburger | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 706 | qed | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 707 | |
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 708 | lemma countable_intersection_of_union: | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 709 | assumes S: "(countable intersection_of P) S" and T: "(countable intersection_of P) T" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 710 | and Un: "\<And>S T. P S \<and> P T \<Longrightarrow> P(S \<union> T)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 711 | shows "(countable intersection_of P) (S \<union> T)" | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 712 | by (metis (mono_tags, lifting) Compl_Int S T Un compl_sup countable_intersection_of_complement countable_union_of_Int) | 
| 
7f240b0dabd9
More new theorems, and a necessary correction
 paulson <lp15@cam.ac.uk> parents: 
69918diff
changeset | 713 | |
| 69004 
f6a0c8115e9c
Set idioms theory "finite intersection_of open", etc.
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 714 | end |