| author | bulwahn | 
| Mon, 23 Jan 2012 14:06:19 +0100 | |
| changeset 46312 | 518cc38a1a8c | 
| parent 46154 | 5115e47a7752 | 
| child 46553 | 50a7e97fe653 | 
| permissions | -rw-r--r-- | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 1 | (* Author: Tobias Nipkow, Lawrence C Paulson and Markus Wenzel; Florian Haftmann, TU Muenchen *) | 
| 11979 | 2 | |
| 44104 | 3 | header {* Complete lattices *}
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 4 | |
| 44860 
56101fa00193
renamed theory Complete_Lattice to Complete_Lattices, in accordance with Lattices, Orderings etc.
 haftmann parents: 
44845diff
changeset | 5 | theory Complete_Lattices | 
| 32139 | 6 | imports Set | 
| 7 | begin | |
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 8 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 9 | notation | 
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 10 | less_eq (infix "\<sqsubseteq>" 50) and | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 11 | less (infix "\<sqsubset>" 50) and | 
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 12 | inf (infixl "\<sqinter>" 70) and | 
| 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 13 | sup (infixl "\<squnion>" 65) and | 
| 32678 | 14 |   top ("\<top>") and
 | 
| 15 |   bot ("\<bottom>")
 | |
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 16 | |
| 32139 | 17 | |
| 32879 | 18 | subsection {* Syntactic infimum and supremum operations *}
 | 
| 19 | ||
| 20 | class Inf = | |
| 21 |   fixes Inf :: "'a set \<Rightarrow> 'a" ("\<Sqinter>_" [900] 900)
 | |
| 22 | ||
| 23 | class Sup = | |
| 24 |   fixes Sup :: "'a set \<Rightarrow> 'a" ("\<Squnion>_" [900] 900)
 | |
| 25 | ||
| 32139 | 26 | subsection {* Abstract complete lattices *}
 | 
| 27 | ||
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 28 | class complete_lattice = bounded_lattice + Inf + Sup + | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 29 | assumes Inf_lower: "x \<in> A \<Longrightarrow> \<Sqinter>A \<sqsubseteq> x" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 30 | and Inf_greatest: "(\<And>x. x \<in> A \<Longrightarrow> z \<sqsubseteq> x) \<Longrightarrow> z \<sqsubseteq> \<Sqinter>A" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 31 | assumes Sup_upper: "x \<in> A \<Longrightarrow> x \<sqsubseteq> \<Squnion>A" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 32 | and Sup_least: "(\<And>x. x \<in> A \<Longrightarrow> x \<sqsubseteq> z) \<Longrightarrow> \<Squnion>A \<sqsubseteq> z" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 33 | begin | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 34 | |
| 32678 | 35 | lemma dual_complete_lattice: | 
| 44845 | 36 | "class.complete_lattice Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom>" | 
| 36635 
080b755377c0
locale predicates of classes carry a mandatory "class" prefix
 haftmann parents: 
36364diff
changeset | 37 | by (auto intro!: class.complete_lattice.intro dual_bounded_lattice) | 
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 38 | (unfold_locales, (fact bot_least top_greatest | 
| 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 39 | Sup_upper Sup_least Inf_lower Inf_greatest)+) | 
| 32678 | 40 | |
| 44040 | 41 | definition INFI :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
 | 
| 42 | INF_def: "INFI A f = \<Sqinter>(f ` A)" | |
| 43 | ||
| 44 | definition SUPR :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
 | |
| 45 | SUP_def: "SUPR A f = \<Squnion>(f ` A)" | |
| 46 | ||
| 47 | text {*
 | |
| 48 |   Note: must use names @{const INFI} and @{const SUPR} here instead of
 | |
| 49 |   @{text INF} and @{text SUP} to allow the following syntax coexist
 | |
| 50 | with the plain constant names. | |
| 51 | *} | |
| 52 | ||
| 53 | end | |
| 54 | ||
| 55 | syntax | |
| 56 |   "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3INF _./ _)" [0, 10] 10)
 | |
| 57 |   "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3INF _:_./ _)" [0, 0, 10] 10)
 | |
| 58 |   "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3SUP _./ _)" [0, 10] 10)
 | |
| 59 |   "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3SUP _:_./ _)" [0, 0, 10] 10)
 | |
| 60 | ||
| 61 | syntax (xsymbols) | |
| 62 |   "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
 | |
| 63 |   "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
 | |
| 64 |   "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Squnion>_./ _)" [0, 10] 10)
 | |
| 65 |   "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Squnion>_\<in>_./ _)" [0, 0, 10] 10)
 | |
| 66 | ||
| 67 | translations | |
| 68 | "INF x y. B" == "INF x. INF y. B" | |
| 69 | "INF x. B" == "CONST INFI CONST UNIV (%x. B)" | |
| 70 | "INF x. B" == "INF x:CONST UNIV. B" | |
| 71 | "INF x:A. B" == "CONST INFI A (%x. B)" | |
| 72 | "SUP x y. B" == "SUP x. SUP y. B" | |
| 73 | "SUP x. B" == "CONST SUPR CONST UNIV (%x. B)" | |
| 74 | "SUP x. B" == "SUP x:CONST UNIV. B" | |
| 75 | "SUP x:A. B" == "CONST SUPR A (%x. B)" | |
| 76 | ||
| 77 | print_translation {*
 | |
| 78 |   [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax INFI} @{syntax_const "_INF"},
 | |
| 79 |     Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax SUPR} @{syntax_const "_SUP"}]
 | |
| 80 | *} -- {* to avoid eta-contraction of body *}
 | |
| 81 | ||
| 82 | context complete_lattice | |
| 83 | begin | |
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 84 | |
| 44040 | 85 | lemma INF_foundation_dual [no_atp]: | 
| 86 | "complete_lattice.SUPR Inf = INFI" | |
| 44921 | 87 | by (simp add: fun_eq_iff INF_def | 
| 88 | complete_lattice.SUP_def [OF dual_complete_lattice]) | |
| 44040 | 89 | |
| 90 | lemma SUP_foundation_dual [no_atp]: | |
| 91 | "complete_lattice.INFI Sup = SUPR" | |
| 44921 | 92 | by (simp add: fun_eq_iff SUP_def | 
| 93 | complete_lattice.INF_def [OF dual_complete_lattice]) | |
| 44040 | 94 | |
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 95 | lemma INF_lower: "i \<in> A \<Longrightarrow> (\<Sqinter>i\<in>A. f i) \<sqsubseteq> f i" | 
| 44040 | 96 | by (auto simp add: INF_def intro: Inf_lower) | 
| 97 | ||
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 98 | lemma INF_greatest: "(\<And>i. i \<in> A \<Longrightarrow> u \<sqsubseteq> f i) \<Longrightarrow> u \<sqsubseteq> (\<Sqinter>i\<in>A. f i)" | 
| 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 99 | by (auto simp add: INF_def intro: Inf_greatest) | 
| 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 100 | |
| 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 101 | lemma SUP_upper: "i \<in> A \<Longrightarrow> f i \<sqsubseteq> (\<Squnion>i\<in>A. f i)" | 
| 44040 | 102 | by (auto simp add: SUP_def intro: Sup_upper) | 
| 103 | ||
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 104 | lemma SUP_least: "(\<And>i. i \<in> A \<Longrightarrow> f i \<sqsubseteq> u) \<Longrightarrow> (\<Squnion>i\<in>A. f i) \<sqsubseteq> u" | 
| 44040 | 105 | by (auto simp add: SUP_def intro: Sup_least) | 
| 106 | ||
| 107 | lemma Inf_lower2: "u \<in> A \<Longrightarrow> u \<sqsubseteq> v \<Longrightarrow> \<Sqinter>A \<sqsubseteq> v" | |
| 108 | using Inf_lower [of u A] by auto | |
| 109 | ||
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 110 | lemma INF_lower2: "i \<in> A \<Longrightarrow> f i \<sqsubseteq> u \<Longrightarrow> (\<Sqinter>i\<in>A. f i) \<sqsubseteq> u" | 
| 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 111 | using INF_lower [of i A f] by auto | 
| 44040 | 112 | |
| 113 | lemma Sup_upper2: "u \<in> A \<Longrightarrow> v \<sqsubseteq> u \<Longrightarrow> v \<sqsubseteq> \<Squnion>A" | |
| 114 | using Sup_upper [of u A] by auto | |
| 115 | ||
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 116 | lemma SUP_upper2: "i \<in> A \<Longrightarrow> u \<sqsubseteq> f i \<Longrightarrow> u \<sqsubseteq> (\<Squnion>i\<in>A. f i)" | 
| 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 117 | using SUP_upper [of i A f] by auto | 
| 44040 | 118 | |
| 44918 | 119 | lemma le_Inf_iff: "b \<sqsubseteq> \<Sqinter>A \<longleftrightarrow> (\<forall>a\<in>A. b \<sqsubseteq> a)" | 
| 44040 | 120 | by (auto intro: Inf_greatest dest: Inf_lower) | 
| 121 | ||
| 44918 | 122 | lemma le_INF_iff: "u \<sqsubseteq> (\<Sqinter>i\<in>A. f i) \<longleftrightarrow> (\<forall>i\<in>A. u \<sqsubseteq> f i)" | 
| 44040 | 123 | by (auto simp add: INF_def le_Inf_iff) | 
| 124 | ||
| 44918 | 125 | lemma Sup_le_iff: "\<Squnion>A \<sqsubseteq> b \<longleftrightarrow> (\<forall>a\<in>A. a \<sqsubseteq> b)" | 
| 44040 | 126 | by (auto intro: Sup_least dest: Sup_upper) | 
| 127 | ||
| 44918 | 128 | lemma SUP_le_iff: "(\<Squnion>i\<in>A. f i) \<sqsubseteq> u \<longleftrightarrow> (\<forall>i\<in>A. f i \<sqsubseteq> u)" | 
| 44040 | 129 | by (auto simp add: SUP_def Sup_le_iff) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 130 | |
| 41080 | 131 | lemma Inf_empty [simp]: | 
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 132 |   "\<Sqinter>{} = \<top>"
 | 
| 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 133 | by (auto intro: antisym Inf_greatest) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 134 | |
| 44067 | 135 | lemma INF_empty [simp]: "(\<Sqinter>x\<in>{}. f x) = \<top>"
 | 
| 44040 | 136 | by (simp add: INF_def) | 
| 137 | ||
| 41080 | 138 | lemma Sup_empty [simp]: | 
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 139 |   "\<Squnion>{} = \<bottom>"
 | 
| 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32879diff
changeset | 140 | by (auto intro: antisym Sup_least) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 141 | |
| 44067 | 142 | lemma SUP_empty [simp]: "(\<Squnion>x\<in>{}. f x) = \<bottom>"
 | 
| 44040 | 143 | by (simp add: SUP_def) | 
| 144 | ||
| 41080 | 145 | lemma Inf_UNIV [simp]: | 
| 146 | "\<Sqinter>UNIV = \<bottom>" | |
| 44040 | 147 | by (auto intro!: antisym Inf_lower) | 
| 41080 | 148 | |
| 149 | lemma Sup_UNIV [simp]: | |
| 150 | "\<Squnion>UNIV = \<top>" | |
| 44040 | 151 | by (auto intro!: antisym Sup_upper) | 
| 41080 | 152 | |
| 44918 | 153 | lemma Inf_insert [simp]: "\<Sqinter>insert a A = a \<sqinter> \<Sqinter>A" | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 154 | by (auto intro: le_infI le_infI1 le_infI2 antisym Inf_greatest Inf_lower) | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 155 | |
| 44040 | 156 | lemma INF_insert: "(\<Sqinter>x\<in>insert a A. f x) = f a \<sqinter> INFI A f" | 
| 44919 | 157 | by (simp add: INF_def) | 
| 44040 | 158 | |
| 44918 | 159 | lemma Sup_insert [simp]: "\<Squnion>insert a A = a \<squnion> \<Squnion>A" | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 160 | by (auto intro: le_supI le_supI1 le_supI2 antisym Sup_least Sup_upper) | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 161 | |
| 44040 | 162 | lemma SUP_insert: "(\<Squnion>x\<in>insert a A. f x) = f a \<squnion> SUPR A f" | 
| 44919 | 163 | by (simp add: SUP_def) | 
| 44040 | 164 | |
| 44918 | 165 | lemma INF_image [simp]: "(\<Sqinter>x\<in>f`A. g x) = (\<Sqinter>x\<in>A. g (f x))" | 
| 44068 | 166 | by (simp add: INF_def image_image) | 
| 167 | ||
| 44918 | 168 | lemma SUP_image [simp]: "(\<Squnion>x\<in>f`A. g x) = (\<Squnion>x\<in>A. g (f x))" | 
| 44068 | 169 | by (simp add: SUP_def image_image) | 
| 170 | ||
| 44040 | 171 | lemma Inf_Sup: "\<Sqinter>A = \<Squnion>{b. \<forall>a \<in> A. b \<sqsubseteq> a}"
 | 
| 172 | by (auto intro: antisym Inf_lower Inf_greatest Sup_upper Sup_least) | |
| 173 | ||
| 174 | lemma Sup_Inf:  "\<Squnion>A = \<Sqinter>{b. \<forall>a \<in> A. a \<sqsubseteq> b}"
 | |
| 175 | by (auto intro: antisym Inf_lower Inf_greatest Sup_upper Sup_least) | |
| 176 | ||
| 43899 | 177 | lemma Inf_superset_mono: "B \<subseteq> A \<Longrightarrow> \<Sqinter>A \<sqsubseteq> \<Sqinter>B" | 
| 178 | by (auto intro: Inf_greatest Inf_lower) | |
| 179 | ||
| 180 | lemma Sup_subset_mono: "A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B" | |
| 181 | by (auto intro: Sup_least Sup_upper) | |
| 182 | ||
| 44041 | 183 | lemma INF_cong: | 
| 184 | "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Sqinter>x\<in>A. C x) = (\<Sqinter>x\<in>B. D x)" | |
| 185 | by (simp add: INF_def image_def) | |
| 186 | ||
| 187 | lemma SUP_cong: | |
| 188 | "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Squnion>x\<in>A. C x) = (\<Squnion>x\<in>B. D x)" | |
| 189 | by (simp add: SUP_def image_def) | |
| 190 | ||
| 38705 | 191 | lemma Inf_mono: | 
| 41971 | 192 | assumes "\<And>b. b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<sqsubseteq> b" | 
| 43741 | 193 | shows "\<Sqinter>A \<sqsubseteq> \<Sqinter>B" | 
| 38705 | 194 | proof (rule Inf_greatest) | 
| 195 | fix b assume "b \<in> B" | |
| 41971 | 196 | with assms obtain a where "a \<in> A" and "a \<sqsubseteq> b" by blast | 
| 43741 | 197 | from `a \<in> A` have "\<Sqinter>A \<sqsubseteq> a" by (rule Inf_lower) | 
| 198 | with `a \<sqsubseteq> b` show "\<Sqinter>A \<sqsubseteq> b" by auto | |
| 38705 | 199 | qed | 
| 200 | ||
| 44041 | 201 | lemma INF_mono: | 
| 202 | "(\<And>m. m \<in> B \<Longrightarrow> \<exists>n\<in>A. f n \<sqsubseteq> g m) \<Longrightarrow> (\<Sqinter>n\<in>A. f n) \<sqsubseteq> (\<Sqinter>n\<in>B. g n)" | |
| 44918 | 203 | unfolding INF_def by (rule Inf_mono) fast | 
| 44041 | 204 | |
| 41082 | 205 | lemma Sup_mono: | 
| 41971 | 206 | assumes "\<And>a. a \<in> A \<Longrightarrow> \<exists>b\<in>B. a \<sqsubseteq> b" | 
| 43741 | 207 | shows "\<Squnion>A \<sqsubseteq> \<Squnion>B" | 
| 41082 | 208 | proof (rule Sup_least) | 
| 209 | fix a assume "a \<in> A" | |
| 41971 | 210 | with assms obtain b where "b \<in> B" and "a \<sqsubseteq> b" by blast | 
| 43741 | 211 | from `b \<in> B` have "b \<sqsubseteq> \<Squnion>B" by (rule Sup_upper) | 
| 212 | with `a \<sqsubseteq> b` show "a \<sqsubseteq> \<Squnion>B" by auto | |
| 41082 | 213 | qed | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 214 | |
| 44041 | 215 | lemma SUP_mono: | 
| 216 | "(\<And>n. n \<in> A \<Longrightarrow> \<exists>m\<in>B. f n \<sqsubseteq> g m) \<Longrightarrow> (\<Squnion>n\<in>A. f n) \<sqsubseteq> (\<Squnion>n\<in>B. g n)" | |
| 44918 | 217 | unfolding SUP_def by (rule Sup_mono) fast | 
| 44041 | 218 | |
| 219 | lemma INF_superset_mono: | |
| 220 | "B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> f x \<sqsubseteq> g x) \<Longrightarrow> (\<Sqinter>x\<in>A. f x) \<sqsubseteq> (\<Sqinter>x\<in>B. g x)" | |
| 221 |   -- {* The last inclusion is POSITIVE! *}
 | |
| 222 | by (blast intro: INF_mono dest: subsetD) | |
| 223 | ||
| 224 | lemma SUP_subset_mono: | |
| 225 | "A \<subseteq> B \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<sqsubseteq> g x) \<Longrightarrow> (\<Squnion>x\<in>A. f x) \<sqsubseteq> (\<Squnion>x\<in>B. g x)" | |
| 226 | by (blast intro: SUP_mono dest: subsetD) | |
| 227 | ||
| 43868 | 228 | lemma Inf_less_eq: | 
| 229 | assumes "\<And>v. v \<in> A \<Longrightarrow> v \<sqsubseteq> u" | |
| 230 |     and "A \<noteq> {}"
 | |
| 231 | shows "\<Sqinter>A \<sqsubseteq> u" | |
| 232 | proof - | |
| 233 |   from `A \<noteq> {}` obtain v where "v \<in> A" by blast
 | |
| 234 | moreover with assms have "v \<sqsubseteq> u" by blast | |
| 235 | ultimately show ?thesis by (rule Inf_lower2) | |
| 236 | qed | |
| 237 | ||
| 238 | lemma less_eq_Sup: | |
| 239 | assumes "\<And>v. v \<in> A \<Longrightarrow> u \<sqsubseteq> v" | |
| 240 |     and "A \<noteq> {}"
 | |
| 241 | shows "u \<sqsubseteq> \<Squnion>A" | |
| 242 | proof - | |
| 243 |   from `A \<noteq> {}` obtain v where "v \<in> A" by blast
 | |
| 244 | moreover with assms have "u \<sqsubseteq> v" by blast | |
| 245 | ultimately show ?thesis by (rule Sup_upper2) | |
| 246 | qed | |
| 247 | ||
| 43899 | 248 | lemma less_eq_Inf_inter: "\<Sqinter>A \<squnion> \<Sqinter>B \<sqsubseteq> \<Sqinter>(A \<inter> B)" | 
| 43868 | 249 | by (auto intro: Inf_greatest Inf_lower) | 
| 250 | ||
| 43899 | 251 | lemma Sup_inter_less_eq: "\<Squnion>(A \<inter> B) \<sqsubseteq> \<Squnion>A \<sqinter> \<Squnion>B " | 
| 43868 | 252 | by (auto intro: Sup_least Sup_upper) | 
| 253 | ||
| 254 | lemma Inf_union_distrib: "\<Sqinter>(A \<union> B) = \<Sqinter>A \<sqinter> \<Sqinter>B" | |
| 255 | by (rule antisym) (auto intro: Inf_greatest Inf_lower le_infI1 le_infI2) | |
| 256 | ||
| 44041 | 257 | lemma INF_union: | 
| 258 | "(\<Sqinter>i \<in> A \<union> B. M i) = (\<Sqinter>i \<in> A. M i) \<sqinter> (\<Sqinter>i\<in>B. M i)" | |
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 259 | by (auto intro!: antisym INF_mono intro: le_infI1 le_infI2 INF_greatest INF_lower) | 
| 44041 | 260 | |
| 43868 | 261 | lemma Sup_union_distrib: "\<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B" | 
| 262 | by (rule antisym) (auto intro: Sup_least Sup_upper le_supI1 le_supI2) | |
| 263 | ||
| 44041 | 264 | lemma SUP_union: | 
| 265 | "(\<Squnion>i \<in> A \<union> B. M i) = (\<Squnion>i \<in> A. M i) \<squnion> (\<Squnion>i\<in>B. M i)" | |
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 266 | by (auto intro!: antisym SUP_mono intro: le_supI1 le_supI2 SUP_least SUP_upper) | 
| 44041 | 267 | |
| 268 | lemma INF_inf_distrib: "(\<Sqinter>a\<in>A. f a) \<sqinter> (\<Sqinter>a\<in>A. g a) = (\<Sqinter>a\<in>A. f a \<sqinter> g a)" | |
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 269 | by (rule antisym) (rule INF_greatest, auto intro: le_infI1 le_infI2 INF_lower INF_mono) | 
| 44041 | 270 | |
| 44918 | 271 | lemma SUP_sup_distrib: "(\<Squnion>a\<in>A. f a) \<squnion> (\<Squnion>a\<in>A. g a) = (\<Squnion>a\<in>A. f a \<squnion> g a)" (is "?L = ?R") | 
| 272 | proof (rule antisym) | |
| 273 | show "?L \<le> ?R" by (auto intro: le_supI1 le_supI2 SUP_upper SUP_mono) | |
| 274 | next | |
| 275 | show "?R \<le> ?L" by (rule SUP_least) (auto intro: le_supI1 le_supI2 SUP_upper) | |
| 276 | qed | |
| 44041 | 277 | |
| 44918 | 278 | lemma Inf_top_conv [simp, no_atp]: | 
| 43868 | 279 | "\<Sqinter>A = \<top> \<longleftrightarrow> (\<forall>x\<in>A. x = \<top>)" | 
| 280 | "\<top> = \<Sqinter>A \<longleftrightarrow> (\<forall>x\<in>A. x = \<top>)" | |
| 281 | proof - | |
| 282 | show "\<Sqinter>A = \<top> \<longleftrightarrow> (\<forall>x\<in>A. x = \<top>)" | |
| 283 | proof | |
| 284 | assume "\<forall>x\<in>A. x = \<top>" | |
| 285 |     then have "A = {} \<or> A = {\<top>}" by auto
 | |
| 44919 | 286 | then show "\<Sqinter>A = \<top>" by auto | 
| 43868 | 287 | next | 
| 288 | assume "\<Sqinter>A = \<top>" | |
| 289 | show "\<forall>x\<in>A. x = \<top>" | |
| 290 | proof (rule ccontr) | |
| 291 | assume "\<not> (\<forall>x\<in>A. x = \<top>)" | |
| 292 | then obtain x where "x \<in> A" and "x \<noteq> \<top>" by blast | |
| 293 | then obtain B where "A = insert x B" by blast | |
| 44919 | 294 | with `\<Sqinter>A = \<top>` `x \<noteq> \<top>` show False by simp | 
| 43868 | 295 | qed | 
| 296 | qed | |
| 297 | then show "\<top> = \<Sqinter>A \<longleftrightarrow> (\<forall>x\<in>A. x = \<top>)" by auto | |
| 298 | qed | |
| 299 | ||
| 44918 | 300 | lemma INF_top_conv [simp]: | 
| 44041 | 301 | "(\<Sqinter>x\<in>A. B x) = \<top> \<longleftrightarrow> (\<forall>x\<in>A. B x = \<top>)" | 
| 302 | "\<top> = (\<Sqinter>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. B x = \<top>)" | |
| 44919 | 303 | by (auto simp add: INF_def) | 
| 44041 | 304 | |
| 44918 | 305 | lemma Sup_bot_conv [simp, no_atp]: | 
| 43868 | 306 | "\<Squnion>A = \<bottom> \<longleftrightarrow> (\<forall>x\<in>A. x = \<bottom>)" (is ?P) | 
| 307 | "\<bottom> = \<Squnion>A \<longleftrightarrow> (\<forall>x\<in>A. x = \<bottom>)" (is ?Q) | |
| 44920 | 308 | using dual_complete_lattice | 
| 309 | by (rule complete_lattice.Inf_top_conv)+ | |
| 43868 | 310 | |
| 44918 | 311 | lemma SUP_bot_conv [simp]: | 
| 44041 | 312 | "(\<Squnion>x\<in>A. B x) = \<bottom> \<longleftrightarrow> (\<forall>x\<in>A. B x = \<bottom>)" | 
| 313 | "\<bottom> = (\<Squnion>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. B x = \<bottom>)" | |
| 44919 | 314 | by (auto simp add: SUP_def) | 
| 44041 | 315 | |
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 316 | lemma INF_const [simp]: "A \<noteq> {} \<Longrightarrow> (\<Sqinter>i\<in>A. f) = f"
 | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 317 | by (auto intro: antisym INF_lower INF_greatest) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 318 | |
| 43870 | 319 | lemma SUP_const [simp]: "A \<noteq> {} \<Longrightarrow> (\<Squnion>i\<in>A. f) = f"
 | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 320 | by (auto intro: antisym SUP_upper SUP_least) | 
| 43870 | 321 | |
| 44918 | 322 | lemma INF_top [simp]: "(\<Sqinter>x\<in>A. \<top>) = \<top>" | 
| 44921 | 323 |   by (cases "A = {}") simp_all
 | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 324 | |
| 44918 | 325 | lemma SUP_bot [simp]: "(\<Squnion>x\<in>A. \<bottom>) = \<bottom>" | 
| 44921 | 326 |   by (cases "A = {}") simp_all
 | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 327 | |
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 328 | lemma INF_commute: "(\<Sqinter>i\<in>A. \<Sqinter>j\<in>B. f i j) = (\<Sqinter>j\<in>B. \<Sqinter>i\<in>A. f i j)" | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 329 | by (iprover intro: INF_lower INF_greatest order_trans antisym) | 
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 330 | |
| 43870 | 331 | lemma SUP_commute: "(\<Squnion>i\<in>A. \<Squnion>j\<in>B. f i j) = (\<Squnion>j\<in>B. \<Squnion>i\<in>A. f i j)" | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 332 | by (iprover intro: SUP_upper SUP_least order_trans antisym) | 
| 43870 | 333 | |
| 43871 | 334 | lemma INF_absorb: | 
| 43868 | 335 | assumes "k \<in> I" | 
| 336 | shows "A k \<sqinter> (\<Sqinter>i\<in>I. A i) = (\<Sqinter>i\<in>I. A i)" | |
| 337 | proof - | |
| 338 | from assms obtain J where "I = insert k J" by blast | |
| 339 | then show ?thesis by (simp add: INF_insert) | |
| 340 | qed | |
| 341 | ||
| 43871 | 342 | lemma SUP_absorb: | 
| 343 | assumes "k \<in> I" | |
| 344 | shows "A k \<squnion> (\<Squnion>i\<in>I. A i) = (\<Squnion>i\<in>I. A i)" | |
| 345 | proof - | |
| 346 | from assms obtain J where "I = insert k J" by blast | |
| 347 | then show ?thesis by (simp add: SUP_insert) | |
| 348 | qed | |
| 349 | ||
| 350 | lemma INF_constant: | |
| 43868 | 351 |   "(\<Sqinter>y\<in>A. c) = (if A = {} then \<top> else c)"
 | 
| 44921 | 352 | by simp | 
| 43868 | 353 | |
| 43871 | 354 | lemma SUP_constant: | 
| 355 |   "(\<Squnion>y\<in>A. c) = (if A = {} then \<bottom> else c)"
 | |
| 44921 | 356 | by simp | 
| 43871 | 357 | |
| 43943 | 358 | lemma less_INF_D: | 
| 359 | assumes "y < (\<Sqinter>i\<in>A. f i)" "i \<in> A" shows "y < f i" | |
| 360 | proof - | |
| 361 | note `y < (\<Sqinter>i\<in>A. f i)` | |
| 362 | also have "(\<Sqinter>i\<in>A. f i) \<le> f i" using `i \<in> A` | |
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 363 | by (rule INF_lower) | 
| 43943 | 364 | finally show "y < f i" . | 
| 365 | qed | |
| 366 | ||
| 367 | lemma SUP_lessD: | |
| 368 | assumes "(\<Squnion>i\<in>A. f i) < y" "i \<in> A" shows "f i < y" | |
| 369 | proof - | |
| 370 | have "f i \<le> (\<Squnion>i\<in>A. f i)" using `i \<in> A` | |
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 371 | by (rule SUP_upper) | 
| 43943 | 372 | also note `(\<Squnion>i\<in>A. f i) < y` | 
| 373 | finally show "f i < y" . | |
| 374 | qed | |
| 375 | ||
| 43873 | 376 | lemma INF_UNIV_bool_expand: | 
| 43868 | 377 | "(\<Sqinter>b. A b) = A True \<sqinter> A False" | 
| 44921 | 378 | by (simp add: UNIV_bool INF_insert inf_commute) | 
| 43868 | 379 | |
| 43873 | 380 | lemma SUP_UNIV_bool_expand: | 
| 43871 | 381 | "(\<Squnion>b. A b) = A True \<squnion> A False" | 
| 44921 | 382 | by (simp add: UNIV_bool SUP_insert sup_commute) | 
| 43871 | 383 | |
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 384 | end | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 385 | |
| 44024 | 386 | class complete_distrib_lattice = complete_lattice + | 
| 44039 | 387 | assumes sup_Inf: "a \<squnion> \<Sqinter>B = (\<Sqinter>b\<in>B. a \<squnion> b)" | 
| 44024 | 388 | assumes inf_Sup: "a \<sqinter> \<Squnion>B = (\<Squnion>b\<in>B. a \<sqinter> b)" | 
| 389 | begin | |
| 390 | ||
| 44039 | 391 | lemma sup_INF: | 
| 392 | "a \<squnion> (\<Sqinter>b\<in>B. f b) = (\<Sqinter>b\<in>B. a \<squnion> f b)" | |
| 393 | by (simp add: INF_def sup_Inf image_image) | |
| 394 | ||
| 395 | lemma inf_SUP: | |
| 396 | "a \<sqinter> (\<Squnion>b\<in>B. f b) = (\<Squnion>b\<in>B. a \<sqinter> f b)" | |
| 397 | by (simp add: SUP_def inf_Sup image_image) | |
| 398 | ||
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 399 | lemma dual_complete_distrib_lattice: | 
| 44845 | 400 | "class.complete_distrib_lattice Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom>" | 
| 44024 | 401 | apply (rule class.complete_distrib_lattice.intro) | 
| 402 | apply (fact dual_complete_lattice) | |
| 403 | apply (rule class.complete_distrib_lattice_axioms.intro) | |
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 404 | apply (simp_all only: INF_foundation_dual SUP_foundation_dual inf_Sup sup_Inf) | 
| 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 405 | done | 
| 44024 | 406 | |
| 44322 | 407 | subclass distrib_lattice proof | 
| 44024 | 408 | fix a b c | 
| 409 |   from sup_Inf have "a \<squnion> \<Sqinter>{b, c} = (\<Sqinter>d\<in>{b, c}. a \<squnion> d)" .
 | |
| 44919 | 410 | then show "a \<squnion> b \<sqinter> c = (a \<squnion> b) \<sqinter> (a \<squnion> c)" by (simp add: INF_def) | 
| 44024 | 411 | qed | 
| 412 | ||
| 44039 | 413 | lemma Inf_sup: | 
| 414 | "\<Sqinter>B \<squnion> a = (\<Sqinter>b\<in>B. b \<squnion> a)" | |
| 415 | by (simp add: sup_Inf sup_commute) | |
| 416 | ||
| 417 | lemma Sup_inf: | |
| 418 | "\<Squnion>B \<sqinter> a = (\<Squnion>b\<in>B. b \<sqinter> a)" | |
| 419 | by (simp add: inf_Sup inf_commute) | |
| 420 | ||
| 421 | lemma INF_sup: | |
| 422 | "(\<Sqinter>b\<in>B. f b) \<squnion> a = (\<Sqinter>b\<in>B. f b \<squnion> a)" | |
| 423 | by (simp add: sup_INF sup_commute) | |
| 424 | ||
| 425 | lemma SUP_inf: | |
| 426 | "(\<Squnion>b\<in>B. f b) \<sqinter> a = (\<Squnion>b\<in>B. f b \<sqinter> a)" | |
| 427 | by (simp add: inf_SUP inf_commute) | |
| 428 | ||
| 429 | lemma Inf_sup_eq_top_iff: | |
| 430 | "(\<Sqinter>B \<squnion> a = \<top>) \<longleftrightarrow> (\<forall>b\<in>B. b \<squnion> a = \<top>)" | |
| 431 | by (simp only: Inf_sup INF_top_conv) | |
| 432 | ||
| 433 | lemma Sup_inf_eq_bot_iff: | |
| 434 | "(\<Squnion>B \<sqinter> a = \<bottom>) \<longleftrightarrow> (\<forall>b\<in>B. b \<sqinter> a = \<bottom>)" | |
| 435 | by (simp only: Sup_inf SUP_bot_conv) | |
| 436 | ||
| 437 | lemma INF_sup_distrib2: | |
| 438 | "(\<Sqinter>a\<in>A. f a) \<squnion> (\<Sqinter>b\<in>B. g b) = (\<Sqinter>a\<in>A. \<Sqinter>b\<in>B. f a \<squnion> g b)" | |
| 439 | by (subst INF_commute) (simp add: sup_INF INF_sup) | |
| 440 | ||
| 441 | lemma SUP_inf_distrib2: | |
| 442 | "(\<Squnion>a\<in>A. f a) \<sqinter> (\<Squnion>b\<in>B. g b) = (\<Squnion>a\<in>A. \<Squnion>b\<in>B. f a \<sqinter> g b)" | |
| 443 | by (subst SUP_commute) (simp add: inf_SUP SUP_inf) | |
| 444 | ||
| 44024 | 445 | end | 
| 446 | ||
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 447 | class complete_boolean_algebra = boolean_algebra + complete_distrib_lattice | 
| 43873 | 448 | begin | 
| 449 | ||
| 43943 | 450 | lemma dual_complete_boolean_algebra: | 
| 44845 | 451 | "class.complete_boolean_algebra Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom> (\<lambda>x y. x \<squnion> - y) uminus" | 
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 452 | by (rule class.complete_boolean_algebra.intro, rule dual_complete_distrib_lattice, rule dual_boolean_algebra) | 
| 43943 | 453 | |
| 43873 | 454 | lemma uminus_Inf: | 
| 455 | "- (\<Sqinter>A) = \<Squnion>(uminus ` A)" | |
| 456 | proof (rule antisym) | |
| 457 | show "- \<Sqinter>A \<le> \<Squnion>(uminus ` A)" | |
| 458 | by (rule compl_le_swap2, rule Inf_greatest, rule compl_le_swap2, rule Sup_upper) simp | |
| 459 | show "\<Squnion>(uminus ` A) \<le> - \<Sqinter>A" | |
| 460 | by (rule Sup_least, rule compl_le_swap1, rule Inf_lower) auto | |
| 461 | qed | |
| 462 | ||
| 44041 | 463 | lemma uminus_INF: "- (\<Sqinter>x\<in>A. B x) = (\<Squnion>x\<in>A. - B x)" | 
| 464 | by (simp add: INF_def SUP_def uminus_Inf image_image) | |
| 465 | ||
| 43873 | 466 | lemma uminus_Sup: | 
| 467 | "- (\<Squnion>A) = \<Sqinter>(uminus ` A)" | |
| 468 | proof - | |
| 469 | have "\<Squnion>A = - \<Sqinter>(uminus ` A)" by (simp add: image_image uminus_Inf) | |
| 470 | then show ?thesis by simp | |
| 471 | qed | |
| 472 | ||
| 473 | lemma uminus_SUP: "- (\<Squnion>x\<in>A. B x) = (\<Sqinter>x\<in>A. - B x)" | |
| 474 | by (simp add: INF_def SUP_def uminus_Sup image_image) | |
| 475 | ||
| 476 | end | |
| 477 | ||
| 43940 | 478 | class complete_linorder = linorder + complete_lattice | 
| 479 | begin | |
| 480 | ||
| 43943 | 481 | lemma dual_complete_linorder: | 
| 44845 | 482 | "class.complete_linorder Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom>" | 
| 43943 | 483 | by (rule class.complete_linorder.intro, rule dual_complete_lattice, rule dual_linorder) | 
| 484 | ||
| 44918 | 485 | lemma Inf_less_iff: | 
| 43940 | 486 | "\<Sqinter>S \<sqsubset> a \<longleftrightarrow> (\<exists>x\<in>S. x \<sqsubset> a)" | 
| 487 | unfolding not_le [symmetric] le_Inf_iff by auto | |
| 488 | ||
| 44918 | 489 | lemma INF_less_iff: | 
| 44041 | 490 | "(\<Sqinter>i\<in>A. f i) \<sqsubset> a \<longleftrightarrow> (\<exists>x\<in>A. f x \<sqsubset> a)" | 
| 491 | unfolding INF_def Inf_less_iff by auto | |
| 492 | ||
| 44918 | 493 | lemma less_Sup_iff: | 
| 43940 | 494 | "a \<sqsubset> \<Squnion>S \<longleftrightarrow> (\<exists>x\<in>S. a \<sqsubset> x)" | 
| 495 | unfolding not_le [symmetric] Sup_le_iff by auto | |
| 496 | ||
| 44918 | 497 | lemma less_SUP_iff: | 
| 43940 | 498 | "a \<sqsubset> (\<Squnion>i\<in>A. f i) \<longleftrightarrow> (\<exists>x\<in>A. a \<sqsubset> f x)" | 
| 499 | unfolding SUP_def less_Sup_iff by auto | |
| 500 | ||
| 44918 | 501 | lemma Sup_eq_top_iff [simp]: | 
| 43943 | 502 | "\<Squnion>A = \<top> \<longleftrightarrow> (\<forall>x<\<top>. \<exists>i\<in>A. x < i)" | 
| 503 | proof | |
| 504 | assume *: "\<Squnion>A = \<top>" | |
| 505 | show "(\<forall>x<\<top>. \<exists>i\<in>A. x < i)" unfolding * [symmetric] | |
| 506 | proof (intro allI impI) | |
| 507 | fix x assume "x < \<Squnion>A" then show "\<exists>i\<in>A. x < i" | |
| 508 | unfolding less_Sup_iff by auto | |
| 509 | qed | |
| 510 | next | |
| 511 | assume *: "\<forall>x<\<top>. \<exists>i\<in>A. x < i" | |
| 512 | show "\<Squnion>A = \<top>" | |
| 513 | proof (rule ccontr) | |
| 514 | assume "\<Squnion>A \<noteq> \<top>" | |
| 515 | with top_greatest [of "\<Squnion>A"] | |
| 516 | have "\<Squnion>A < \<top>" unfolding le_less by auto | |
| 517 | then have "\<Squnion>A < \<Squnion>A" | |
| 518 | using * unfolding less_Sup_iff by auto | |
| 519 | then show False by auto | |
| 520 | qed | |
| 521 | qed | |
| 522 | ||
| 44918 | 523 | lemma SUP_eq_top_iff [simp]: | 
| 44041 | 524 | "(\<Squnion>i\<in>A. f i) = \<top> \<longleftrightarrow> (\<forall>x<\<top>. \<exists>i\<in>A. x < f i)" | 
| 44919 | 525 | unfolding SUP_def by auto | 
| 44041 | 526 | |
| 44918 | 527 | lemma Inf_eq_bot_iff [simp]: | 
| 43943 | 528 | "\<Sqinter>A = \<bottom> \<longleftrightarrow> (\<forall>x>\<bottom>. \<exists>i\<in>A. i < x)" | 
| 44920 | 529 | using dual_complete_linorder | 
| 530 | by (rule complete_linorder.Sup_eq_top_iff) | |
| 43943 | 531 | |
| 44918 | 532 | lemma INF_eq_bot_iff [simp]: | 
| 43967 | 533 | "(\<Sqinter>i\<in>A. f i) = \<bottom> \<longleftrightarrow> (\<forall>x>\<bottom>. \<exists>i\<in>A. f i < x)" | 
| 44919 | 534 | unfolding INF_def by auto | 
| 43967 | 535 | |
| 43940 | 536 | end | 
| 537 | ||
| 43873 | 538 | |
| 32139 | 539 | subsection {* @{typ bool} and @{typ "_ \<Rightarrow> _"} as complete lattice *}
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 540 | |
| 44024 | 541 | instantiation bool :: complete_lattice | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 542 | begin | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 543 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 544 | definition | 
| 46154 | 545 | [simp, code]: "\<Sqinter>A \<longleftrightarrow> False \<notin> A" | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 546 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 547 | definition | 
| 46154 | 548 | [simp, code]: "\<Squnion>A \<longleftrightarrow> True \<in> A" | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 549 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 550 | instance proof | 
| 44322 | 551 | qed (auto intro: bool_induct) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 552 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 553 | end | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 554 | |
| 43873 | 555 | lemma INF_bool_eq [simp]: | 
| 32120 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 556 | "INFI = Ball" | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 557 | proof (rule ext)+ | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 558 | fix A :: "'a set" | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 559 | fix P :: "'a \<Rightarrow> bool" | 
| 43753 | 560 | show "(\<Sqinter>x\<in>A. P x) \<longleftrightarrow> (\<forall>x\<in>A. P x)" | 
| 44322 | 561 | by (auto simp add: INF_def) | 
| 32120 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 562 | qed | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 563 | |
| 43873 | 564 | lemma SUP_bool_eq [simp]: | 
| 32120 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 565 | "SUPR = Bex" | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 566 | proof (rule ext)+ | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 567 | fix A :: "'a set" | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 568 | fix P :: "'a \<Rightarrow> bool" | 
| 43753 | 569 | show "(\<Squnion>x\<in>A. P x) \<longleftrightarrow> (\<exists>x\<in>A. P x)" | 
| 44322 | 570 | by (auto simp add: SUP_def) | 
| 32120 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 571 | qed | 
| 
53a21a5e6889
attempt for more concise setup of non-etacontracting binders
 haftmann parents: 
32117diff
changeset | 572 | |
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 573 | instance bool :: complete_boolean_algebra proof | 
| 44322 | 574 | qed (auto intro: bool_induct) | 
| 44024 | 575 | |
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 576 | instantiation "fun" :: (type, complete_lattice) complete_lattice | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 577 | begin | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 578 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 579 | definition | 
| 44024 | 580 | "\<Sqinter>A = (\<lambda>x. \<Sqinter>f\<in>A. f x)" | 
| 41080 | 581 | |
| 46154 | 582 | lemma Inf_apply [code]: | 
| 44024 | 583 | "(\<Sqinter>A) x = (\<Sqinter>f\<in>A. f x)" | 
| 41080 | 584 | by (simp add: Inf_fun_def) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 585 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 586 | definition | 
| 44024 | 587 | "\<Squnion>A = (\<lambda>x. \<Squnion>f\<in>A. f x)" | 
| 41080 | 588 | |
| 46154 | 589 | lemma Sup_apply [code]: | 
| 44024 | 590 | "(\<Squnion>A) x = (\<Squnion>f\<in>A. f x)" | 
| 41080 | 591 | by (simp add: Sup_fun_def) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 592 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 593 | instance proof | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 594 | qed (auto simp add: le_fun_def Inf_apply Sup_apply intro: INF_lower INF_greatest SUP_upper SUP_least) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 595 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 596 | end | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 597 | |
| 43873 | 598 | lemma INF_apply: | 
| 41080 | 599 | "(\<Sqinter>y\<in>A. f y) x = (\<Sqinter>y\<in>A. f y x)" | 
| 43872 | 600 | by (auto intro: arg_cong [of _ _ Inf] simp add: INF_def Inf_apply) | 
| 38705 | 601 | |
| 43873 | 602 | lemma SUP_apply: | 
| 41080 | 603 | "(\<Squnion>y\<in>A. f y) x = (\<Squnion>y\<in>A. f y x)" | 
| 43872 | 604 | by (auto intro: arg_cong [of _ _ Sup] simp add: SUP_def Sup_apply) | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 605 | |
| 44024 | 606 | instance "fun" :: (type, complete_distrib_lattice) complete_distrib_lattice proof | 
| 607 | qed (auto simp add: inf_apply sup_apply Inf_apply Sup_apply INF_def SUP_def inf_Sup sup_Inf image_image) | |
| 608 | ||
| 43873 | 609 | instance "fun" :: (type, complete_boolean_algebra) complete_boolean_algebra .. | 
| 610 | ||
| 45960 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 611 | instantiation "set" :: (type) complete_lattice | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 612 | begin | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 613 | |
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 614 | definition | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 615 |   "\<Sqinter>A = {x. \<Sqinter>((\<lambda>B. x \<in> B) ` A)}"
 | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 616 | |
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 617 | definition | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 618 |   "\<Squnion>A = {x. \<Squnion>((\<lambda>B. x \<in> B) ` A)}"
 | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 619 | |
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 620 | instance proof | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 621 | qed (auto simp add: less_eq_set_def Inf_set_def Sup_set_def Inf_bool_def Sup_bool_def le_fun_def) | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 622 | |
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 623 | end | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 624 | |
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 625 | instance "set" :: (type) complete_boolean_algebra | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 626 | proof | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 627 | qed (auto simp add: INF_def SUP_def Inf_set_def Sup_set_def image_def) | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 628 | |
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 629 | |
| 41082 | 630 | subsection {* Inter *}
 | 
| 631 | ||
| 632 | abbreviation Inter :: "'a set set \<Rightarrow> 'a set" where | |
| 633 | "Inter S \<equiv> \<Sqinter>S" | |
| 634 | ||
| 635 | notation (xsymbols) | |
| 636 |   Inter  ("\<Inter>_" [90] 90)
 | |
| 637 | ||
| 638 | lemma Inter_eq: | |
| 639 |   "\<Inter>A = {x. \<forall>B \<in> A. x \<in> B}"
 | |
| 640 | proof (rule set_eqI) | |
| 641 | fix x | |
| 642 |   have "(\<forall>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<forall>B\<in>A. x \<in> B)"
 | |
| 643 | by auto | |
| 644 |   then show "x \<in> \<Inter>A \<longleftrightarrow> x \<in> {x. \<forall>B \<in> A. x \<in> B}"
 | |
| 45960 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 645 | by (simp add: Inf_set_def image_def) | 
| 41082 | 646 | qed | 
| 647 | ||
| 43741 | 648 | lemma Inter_iff [simp,no_atp]: "A \<in> \<Inter>C \<longleftrightarrow> (\<forall>X\<in>C. A \<in> X)" | 
| 41082 | 649 | by (unfold Inter_eq) blast | 
| 650 | ||
| 43741 | 651 | lemma InterI [intro!]: "(\<And>X. X \<in> C \<Longrightarrow> A \<in> X) \<Longrightarrow> A \<in> \<Inter>C" | 
| 41082 | 652 | by (simp add: Inter_eq) | 
| 653 | ||
| 654 | text {*
 | |
| 655 |   \medskip A ``destruct'' rule -- every @{term X} in @{term C}
 | |
| 43741 | 656 |   contains @{term A} as an element, but @{prop "A \<in> X"} can hold when
 | 
| 657 |   @{prop "X \<in> C"} does not!  This rule is analogous to @{text spec}.
 | |
| 41082 | 658 | *} | 
| 659 | ||
| 43741 | 660 | lemma InterD [elim, Pure.elim]: "A \<in> \<Inter>C \<Longrightarrow> X \<in> C \<Longrightarrow> A \<in> X" | 
| 41082 | 661 | by auto | 
| 662 | ||
| 43741 | 663 | lemma InterE [elim]: "A \<in> \<Inter>C \<Longrightarrow> (X \<notin> C \<Longrightarrow> R) \<Longrightarrow> (A \<in> X \<Longrightarrow> R) \<Longrightarrow> R" | 
| 41082 | 664 |   -- {* ``Classical'' elimination rule -- does not require proving
 | 
| 43741 | 665 |     @{prop "X \<in> C"}. *}
 | 
| 41082 | 666 | by (unfold Inter_eq) blast | 
| 667 | ||
| 43741 | 668 | lemma Inter_lower: "B \<in> A \<Longrightarrow> \<Inter>A \<subseteq> B" | 
| 43740 | 669 | by (fact Inf_lower) | 
| 670 | ||
| 41082 | 671 | lemma Inter_subset: | 
| 43755 | 672 |   "(\<And>X. X \<in> A \<Longrightarrow> X \<subseteq> B) \<Longrightarrow> A \<noteq> {} \<Longrightarrow> \<Inter>A \<subseteq> B"
 | 
| 43740 | 673 | by (fact Inf_less_eq) | 
| 41082 | 674 | |
| 43755 | 675 | lemma Inter_greatest: "(\<And>X. X \<in> A \<Longrightarrow> C \<subseteq> X) \<Longrightarrow> C \<subseteq> Inter A" | 
| 43740 | 676 | by (fact Inf_greatest) | 
| 41082 | 677 | |
| 44067 | 678 | lemma Inter_empty: "\<Inter>{} = UNIV"
 | 
| 679 | by (fact Inf_empty) (* already simp *) | |
| 41082 | 680 | |
| 44067 | 681 | lemma Inter_UNIV: "\<Inter>UNIV = {}"
 | 
| 682 | by (fact Inf_UNIV) (* already simp *) | |
| 41082 | 683 | |
| 44920 | 684 | lemma Inter_insert: "\<Inter>(insert a B) = a \<inter> \<Inter>B" | 
| 685 | by (fact Inf_insert) (* already simp *) | |
| 41082 | 686 | |
| 687 | lemma Inter_Un_subset: "\<Inter>A \<union> \<Inter>B \<subseteq> \<Inter>(A \<inter> B)" | |
| 43899 | 688 | by (fact less_eq_Inf_inter) | 
| 41082 | 689 | |
| 690 | lemma Inter_Un_distrib: "\<Inter>(A \<union> B) = \<Inter>A \<inter> \<Inter>B" | |
| 43756 | 691 | by (fact Inf_union_distrib) | 
| 692 | ||
| 43868 | 693 | lemma Inter_UNIV_conv [simp, no_atp]: | 
| 43741 | 694 | "\<Inter>A = UNIV \<longleftrightarrow> (\<forall>x\<in>A. x = UNIV)" | 
| 695 | "UNIV = \<Inter>A \<longleftrightarrow> (\<forall>x\<in>A. x = UNIV)" | |
| 43801 | 696 | by (fact Inf_top_conv)+ | 
| 41082 | 697 | |
| 43741 | 698 | lemma Inter_anti_mono: "B \<subseteq> A \<Longrightarrow> \<Inter>A \<subseteq> \<Inter>B" | 
| 43899 | 699 | by (fact Inf_superset_mono) | 
| 41082 | 700 | |
| 701 | ||
| 702 | subsection {* Intersections of families *}
 | |
| 703 | ||
| 704 | abbreviation INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
 | |
| 705 | "INTER \<equiv> INFI" | |
| 706 | ||
| 43872 | 707 | text {*
 | 
| 708 |   Note: must use name @{const INTER} here instead of @{text INT}
 | |
| 709 | to allow the following syntax coexist with the plain constant name. | |
| 710 | *} | |
| 711 | ||
| 41082 | 712 | syntax | 
| 713 |   "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3INT _./ _)" [0, 10] 10)
 | |
| 714 |   "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" [0, 0, 10] 10)
 | |
| 715 | ||
| 716 | syntax (xsymbols) | |
| 717 |   "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" [0, 10] 10)
 | |
| 718 |   "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>_\<in>_./ _)" [0, 0, 10] 10)
 | |
| 719 | ||
| 720 | syntax (latex output) | |
| 721 |   "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
 | |
| 722 |   "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 0, 10] 10)
 | |
| 723 | ||
| 724 | translations | |
| 725 | "INT x y. B" == "INT x. INT y. B" | |
| 726 | "INT x. B" == "CONST INTER CONST UNIV (%x. B)" | |
| 727 | "INT x. B" == "INT x:CONST UNIV. B" | |
| 728 | "INT x:A. B" == "CONST INTER A (%x. B)" | |
| 729 | ||
| 730 | print_translation {*
 | |
| 42284 | 731 |   [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax INTER} @{syntax_const "_INTER"}]
 | 
| 41082 | 732 | *} -- {* to avoid eta-contraction of body *}
 | 
| 733 | ||
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 734 | lemma INTER_eq: | 
| 41082 | 735 |   "(\<Inter>x\<in>A. B x) = {y. \<forall>x\<in>A. y \<in> B x}"
 | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 736 | by (auto simp add: INF_def) | 
| 41082 | 737 | |
| 738 | lemma Inter_image_eq [simp]: | |
| 739 | "\<Inter>(B`A) = (\<Inter>x\<in>A. B x)" | |
| 43872 | 740 | by (rule sym) (fact INF_def) | 
| 41082 | 741 | |
| 43817 | 742 | lemma INT_iff [simp]: "b \<in> (\<Inter>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. b \<in> B x)" | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 743 | by (auto simp add: INF_def image_def) | 
| 41082 | 744 | |
| 43817 | 745 | lemma INT_I [intro!]: "(\<And>x. x \<in> A \<Longrightarrow> b \<in> B x) \<Longrightarrow> b \<in> (\<Inter>x\<in>A. B x)" | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 746 | by (auto simp add: INF_def image_def) | 
| 41082 | 747 | |
| 43852 | 748 | lemma INT_D [elim, Pure.elim]: "b \<in> (\<Inter>x\<in>A. B x) \<Longrightarrow> a \<in> A \<Longrightarrow> b \<in> B a" | 
| 41082 | 749 | by auto | 
| 750 | ||
| 43852 | 751 | lemma INT_E [elim]: "b \<in> (\<Inter>x\<in>A. B x) \<Longrightarrow> (b \<in> B a \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R" | 
| 752 |   -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a\<in>A"}. *}
 | |
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 753 | by (auto simp add: INF_def image_def) | 
| 41082 | 754 | |
| 755 | lemma INT_cong [cong]: | |
| 43854 | 756 | "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Inter>x\<in>A. C x) = (\<Inter>x\<in>B. D x)" | 
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 757 | by (fact INF_cong) | 
| 41082 | 758 | |
| 759 | lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
 | |
| 760 | by blast | |
| 761 | ||
| 762 | lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
 | |
| 763 | by blast | |
| 764 | ||
| 43817 | 765 | lemma INT_lower: "a \<in> A \<Longrightarrow> (\<Inter>x\<in>A. B x) \<subseteq> B a" | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 766 | by (fact INF_lower) | 
| 41082 | 767 | |
| 43817 | 768 | lemma INT_greatest: "(\<And>x. x \<in> A \<Longrightarrow> C \<subseteq> B x) \<Longrightarrow> C \<subseteq> (\<Inter>x\<in>A. B x)" | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 769 | by (fact INF_greatest) | 
| 41082 | 770 | |
| 44067 | 771 | lemma INT_empty: "(\<Inter>x\<in>{}. B x) = UNIV"
 | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 772 | by (fact INF_empty) | 
| 43854 | 773 | |
| 43817 | 774 | lemma INT_absorb: "k \<in> I \<Longrightarrow> A k \<inter> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. A i)" | 
| 43872 | 775 | by (fact INF_absorb) | 
| 41082 | 776 | |
| 43854 | 777 | lemma INT_subset_iff: "B \<subseteq> (\<Inter>i\<in>I. A i) \<longleftrightarrow> (\<forall>i\<in>I. B \<subseteq> A i)" | 
| 41082 | 778 | by (fact le_INF_iff) | 
| 779 | ||
| 780 | lemma INT_insert [simp]: "(\<Inter>x \<in> insert a A. B x) = B a \<inter> INTER A B" | |
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 781 | by (fact INF_insert) | 
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 782 | |
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 783 | lemma INT_Un: "(\<Inter>i \<in> A \<union> B. M i) = (\<Inter>i \<in> A. M i) \<inter> (\<Inter>i\<in>B. M i)" | 
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 784 | by (fact INF_union) | 
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 785 | |
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 786 | lemma INT_insert_distrib: | 
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 787 | "u \<in> A \<Longrightarrow> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)" | 
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 788 | by blast | 
| 43854 | 789 | |
| 41082 | 790 | lemma INT_constant [simp]: "(\<Inter>y\<in>A. c) = (if A = {} then UNIV else c)"
 | 
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 791 | by (fact INF_constant) | 
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 792 | |
| 44920 | 793 | lemma INTER_UNIV_conv: | 
| 43817 | 794 | "(UNIV = (\<Inter>x\<in>A. B x)) = (\<forall>x\<in>A. B x = UNIV)" | 
| 795 | "((\<Inter>x\<in>A. B x) = UNIV) = (\<forall>x\<in>A. B x = UNIV)" | |
| 44920 | 796 | by (fact INF_top_conv)+ (* already simp *) | 
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 797 | |
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 798 | lemma INT_bool_eq: "(\<Inter>b. A b) = A True \<inter> A False" | 
| 43873 | 799 | by (fact INF_UNIV_bool_expand) | 
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 800 | |
| 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 801 | lemma INT_anti_mono: | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 802 | "A \<subseteq> B \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<subseteq> g x) \<Longrightarrow> (\<Inter>x\<in>B. f x) \<subseteq> (\<Inter>x\<in>A. g x)" | 
| 43865 
db18f4d0cc7d
further generalization from sets to complete lattices
 haftmann parents: 
43854diff
changeset | 803 |   -- {* The last inclusion is POSITIVE! *}
 | 
| 43940 | 804 | by (fact INF_superset_mono) | 
| 41082 | 805 | |
| 806 | lemma Pow_INT_eq: "Pow (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. Pow (B x))" | |
| 807 | by blast | |
| 808 | ||
| 43817 | 809 | lemma vimage_INT: "f -` (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. f -` B x)" | 
| 41082 | 810 | by blast | 
| 811 | ||
| 812 | ||
| 32139 | 813 | subsection {* Union *}
 | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 814 | |
| 32587 
caa5ada96a00
Inter and Union are mere abbreviations for Inf and Sup
 haftmann parents: 
32436diff
changeset | 815 | abbreviation Union :: "'a set set \<Rightarrow> 'a set" where | 
| 
caa5ada96a00
Inter and Union are mere abbreviations for Inf and Sup
 haftmann parents: 
32436diff
changeset | 816 | "Union S \<equiv> \<Squnion>S" | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 817 | |
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 818 | notation (xsymbols) | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 819 |   Union  ("\<Union>_" [90] 90)
 | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 820 | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 821 | lemma Union_eq: | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 822 |   "\<Union>A = {x. \<exists>B \<in> A. x \<in> B}"
 | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
38705diff
changeset | 823 | proof (rule set_eqI) | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 824 | fix x | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 825 |   have "(\<exists>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<exists>B\<in>A. x \<in> B)"
 | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 826 | by auto | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 827 |   then show "x \<in> \<Union>A \<longleftrightarrow> x \<in> {x. \<exists>B\<in>A. x \<in> B}"
 | 
| 45960 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 828 | by (simp add: Sup_set_def image_def) | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 829 | qed | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 830 | |
| 35828 
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
 blanchet parents: 
35629diff
changeset | 831 | lemma Union_iff [simp, no_atp]: | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 832 | "A \<in> \<Union>C \<longleftrightarrow> (\<exists>X\<in>C. A\<in>X)" | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 833 | by (unfold Union_eq) blast | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 834 | |
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 835 | lemma UnionI [intro]: | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 836 | "X \<in> C \<Longrightarrow> A \<in> X \<Longrightarrow> A \<in> \<Union>C" | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 837 |   -- {* The order of the premises presupposes that @{term C} is rigid;
 | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 838 |     @{term A} may be flexible. *}
 | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 839 | by auto | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 840 | |
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 841 | lemma UnionE [elim!]: | 
| 43817 | 842 | "A \<in> \<Union>C \<Longrightarrow> (\<And>X. A \<in> X \<Longrightarrow> X \<in> C \<Longrightarrow> R) \<Longrightarrow> R" | 
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 843 | by auto | 
| 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 844 | |
| 43817 | 845 | lemma Union_upper: "B \<in> A \<Longrightarrow> B \<subseteq> \<Union>A" | 
| 43901 | 846 | by (fact Sup_upper) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 847 | |
| 43817 | 848 | lemma Union_least: "(\<And>X. X \<in> A \<Longrightarrow> X \<subseteq> C) \<Longrightarrow> \<Union>A \<subseteq> C" | 
| 43901 | 849 | by (fact Sup_least) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 850 | |
| 44920 | 851 | lemma Union_empty: "\<Union>{} = {}"
 | 
| 852 | by (fact Sup_empty) (* already simp *) | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 853 | |
| 44920 | 854 | lemma Union_UNIV: "\<Union>UNIV = UNIV" | 
| 855 | by (fact Sup_UNIV) (* already simp *) | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 856 | |
| 44920 | 857 | lemma Union_insert: "\<Union>insert a B = a \<union> \<Union>B" | 
| 858 | by (fact Sup_insert) (* already simp *) | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 859 | |
| 43817 | 860 | lemma Union_Un_distrib [simp]: "\<Union>(A \<union> B) = \<Union>A \<union> \<Union>B" | 
| 43901 | 861 | by (fact Sup_union_distrib) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 862 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 863 | lemma Union_Int_subset: "\<Union>(A \<inter> B) \<subseteq> \<Union>A \<inter> \<Union>B" | 
| 43901 | 864 | by (fact Sup_inter_less_eq) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 865 | |
| 44920 | 866 | lemma Union_empty_conv [no_atp]: "(\<Union>A = {}) \<longleftrightarrow> (\<forall>x\<in>A. x = {})"
 | 
| 867 | by (fact Sup_bot_conv) (* already simp *) | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 868 | |
| 44920 | 869 | lemma empty_Union_conv [no_atp]: "({} = \<Union>A) \<longleftrightarrow> (\<forall>x\<in>A. x = {})"
 | 
| 870 | by (fact Sup_bot_conv) (* already simp *) | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 871 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 872 | lemma subset_Pow_Union: "A \<subseteq> Pow (\<Union>A)" | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 873 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 874 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 875 | lemma Union_Pow_eq [simp]: "\<Union>(Pow A) = A" | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 876 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 877 | |
| 43817 | 878 | lemma Union_mono: "A \<subseteq> B \<Longrightarrow> \<Union>A \<subseteq> \<Union>B" | 
| 43901 | 879 | by (fact Sup_subset_mono) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 880 | |
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 881 | |
| 32139 | 882 | subsection {* Unions of families *}
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 883 | |
| 32606 
b5c3a8a75772
INTER and UNION are mere abbreviations for INFI and SUPR
 haftmann parents: 
32587diff
changeset | 884 | abbreviation UNION :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
 | 
| 
b5c3a8a75772
INTER and UNION are mere abbreviations for INFI and SUPR
 haftmann parents: 
32587diff
changeset | 885 | "UNION \<equiv> SUPR" | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 886 | |
| 43872 | 887 | text {*
 | 
| 888 |   Note: must use name @{const UNION} here instead of @{text UN}
 | |
| 889 | to allow the following syntax coexist with the plain constant name. | |
| 890 | *} | |
| 891 | ||
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 892 | syntax | 
| 35115 | 893 |   "_UNION1"     :: "pttrns => 'b set => 'b set"           ("(3UN _./ _)" [0, 10] 10)
 | 
| 36364 
0e2679025aeb
fix syntax precedence declarations for UNION, INTER, SUP, INF
 huffman parents: 
35828diff
changeset | 894 |   "_UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3UN _:_./ _)" [0, 0, 10] 10)
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 895 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 896 | syntax (xsymbols) | 
| 35115 | 897 |   "_UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>_./ _)" [0, 10] 10)
 | 
| 36364 
0e2679025aeb
fix syntax precedence declarations for UNION, INTER, SUP, INF
 huffman parents: 
35828diff
changeset | 898 |   "_UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Union>_\<in>_./ _)" [0, 0, 10] 10)
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 899 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 900 | syntax (latex output) | 
| 35115 | 901 |   "_UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
 | 
| 36364 
0e2679025aeb
fix syntax precedence declarations for UNION, INTER, SUP, INF
 huffman parents: 
35828diff
changeset | 902 |   "_UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Union>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 0, 10] 10)
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 903 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 904 | translations | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 905 | "UN x y. B" == "UN x. UN y. B" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 906 | "UN x. B" == "CONST UNION CONST UNIV (%x. B)" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 907 | "UN x. B" == "UN x:CONST UNIV. B" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 908 | "UN x:A. B" == "CONST UNION A (%x. B)" | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 909 | |
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 910 | text {*
 | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 911 | Note the difference between ordinary xsymbol syntax of indexed | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 912 |   unions and intersections (e.g.\ @{text"\<Union>a\<^isub>1\<in>A\<^isub>1. B"})
 | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 913 |   and their \LaTeX\ rendition: @{term"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}. The
 | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 914 | former does not make the index expression a subscript of the | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 915 | union/intersection symbol because this leads to problems with nested | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 916 | subscripts in Proof General. | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 917 | *} | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 918 | |
| 35115 | 919 | print_translation {*
 | 
| 42284 | 920 |   [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax UNION} @{syntax_const "_UNION"}]
 | 
| 35115 | 921 | *} -- {* to avoid eta-contraction of body *}
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 922 | |
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 923 | lemma UNION_eq [no_atp]: | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 924 |   "(\<Union>x\<in>A. B x) = {y. \<exists>x\<in>A. y \<in> B x}"
 | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 925 | by (auto simp add: SUP_def) | 
| 44920 | 926 | |
| 45960 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 927 | lemma bind_UNION [code]: | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 928 | "Set.bind A f = UNION A f" | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 929 | by (simp add: bind_def UNION_eq) | 
| 
e1b09bfb52f1
lattice type class instances for `set`; added code lemma for Set.bind
 haftmann parents: 
45013diff
changeset | 930 | |
| 46036 | 931 | lemma member_bind [simp]: | 
| 932 | "x \<in> Set.bind P f \<longleftrightarrow> x \<in> UNION P f " | |
| 933 | by (simp add: bind_UNION) | |
| 934 | ||
| 32115 
8f10fb3bb46e
swapped bootstrap order of UNION/Union and INTER/Inter in theory Set
 haftmann parents: 
32082diff
changeset | 935 | lemma Union_image_eq [simp]: | 
| 43817 | 936 | "\<Union>(B ` A) = (\<Union>x\<in>A. B x)" | 
| 44920 | 937 | by (rule sym) (fact SUP_def) | 
| 938 | ||
| 46036 | 939 | lemma UN_iff [simp]: "b \<in> (\<Union>x\<in>A. B x) \<longleftrightarrow> (\<exists>x\<in>A. b \<in> B x)" | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 940 | by (auto simp add: SUP_def image_def) | 
| 11979 | 941 | |
| 43852 | 942 | lemma UN_I [intro]: "a \<in> A \<Longrightarrow> b \<in> B a \<Longrightarrow> b \<in> (\<Union>x\<in>A. B x)" | 
| 11979 | 943 |   -- {* The order of the premises presupposes that @{term A} is rigid;
 | 
| 944 |     @{term b} may be flexible. *}
 | |
| 945 | by auto | |
| 946 | ||
| 43852 | 947 | lemma UN_E [elim!]: "b \<in> (\<Union>x\<in>A. B x) \<Longrightarrow> (\<And>x. x\<in>A \<Longrightarrow> b \<in> B x \<Longrightarrow> R) \<Longrightarrow> R" | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 948 | by (auto simp add: SUP_def image_def) | 
| 923 | 949 | |
| 11979 | 950 | lemma UN_cong [cong]: | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 951 | "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Union>x\<in>A. C x) = (\<Union>x\<in>B. D x)" | 
| 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 952 | by (fact SUP_cong) | 
| 11979 | 953 | |
| 29691 | 954 | lemma strong_UN_cong: | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 955 | "A = B \<Longrightarrow> (\<And>x. x \<in> B =simp=> C x = D x) \<Longrightarrow> (\<Union>x\<in>A. C x) = (\<Union>x\<in>B. D x)" | 
| 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 956 | by (unfold simp_implies_def) (fact UN_cong) | 
| 29691 | 957 | |
| 43817 | 958 | lemma image_eq_UN: "f ` A = (\<Union>x\<in>A. {f x})"
 | 
| 32077 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 959 | by blast | 
| 
3698947146b2
closer relation of sets and complete lattices; corresponding consts, defs and syntax at similar places in theory text
 haftmann parents: 
32064diff
changeset | 960 | |
| 43817 | 961 | lemma UN_upper: "a \<in> A \<Longrightarrow> B a \<subseteq> (\<Union>x\<in>A. B x)" | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 962 | by (fact SUP_upper) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 963 | |
| 43817 | 964 | lemma UN_least: "(\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C) \<Longrightarrow> (\<Union>x\<in>A. B x) \<subseteq> C" | 
| 44103 
cedaca00789f
more uniform naming scheme for Inf/INF and Sup/SUP lemmas
 haftmann parents: 
44085diff
changeset | 965 | by (fact SUP_least) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 966 | |
| 35828 
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
 blanchet parents: 
35629diff
changeset | 967 | lemma Collect_bex_eq [no_atp]: "{x. \<exists>y\<in>A. P x y} = (\<Union>y\<in>A. {x. P x y})"
 | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 968 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 969 | |
| 43817 | 970 | lemma UN_insert_distrib: "u \<in> A \<Longrightarrow> (\<Union>x\<in>A. insert a (B x)) = insert a (\<Union>x\<in>A. B x)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 971 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 972 | |
| 44067 | 973 | lemma UN_empty [no_atp]: "(\<Union>x\<in>{}. B x) = {}"
 | 
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 974 | by (fact SUP_empty) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 975 | |
| 44920 | 976 | lemma UN_empty2: "(\<Union>x\<in>A. {}) = {}"
 | 
| 977 | by (fact SUP_bot) (* already simp *) | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 978 | |
| 43817 | 979 | lemma UN_absorb: "k \<in> I \<Longrightarrow> A k \<union> (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. A i)" | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 980 | by (fact SUP_absorb) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 981 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 982 | lemma UN_insert [simp]: "(\<Union>x\<in>insert a A. B x) = B a \<union> UNION A B" | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 983 | by (fact SUP_insert) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 984 | |
| 44085 
a65e26f1427b
move legacy candiates to bottom; marked candidates for default simp rules
 haftmann parents: 
44084diff
changeset | 985 | lemma UN_Un [simp]: "(\<Union>i \<in> A \<union> B. M i) = (\<Union>i\<in>A. M i) \<union> (\<Union>i\<in>B. M i)" | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 986 | by (fact SUP_union) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 987 | |
| 43967 | 988 | lemma UN_UN_flatten: "(\<Union>x \<in> (\<Union>y\<in>A. B y). C x) = (\<Union>y\<in>A. \<Union>x\<in>B y. C x)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 989 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 990 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 991 | lemma UN_subset_iff: "((\<Union>i\<in>I. A i) \<subseteq> B) = (\<forall>i\<in>I. A i \<subseteq> B)" | 
| 35629 | 992 | by (fact SUP_le_iff) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 993 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 994 | lemma UN_constant [simp]: "(\<Union>y\<in>A. c) = (if A = {} then {} else c)"
 | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 995 | by (fact SUP_constant) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 996 | |
| 43944 | 997 | lemma image_Union: "f ` \<Union>S = (\<Union>x\<in>S. f ` x)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 998 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 999 | |
| 44920 | 1000 | lemma UNION_empty_conv: | 
| 43817 | 1001 |   "{} = (\<Union>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. B x = {})"
 | 
| 1002 |   "(\<Union>x\<in>A. B x) = {} \<longleftrightarrow> (\<forall>x\<in>A. B x = {})"
 | |
| 44920 | 1003 | by (fact SUP_bot_conv)+ (* already simp *) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1004 | |
| 35828 
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
 blanchet parents: 
35629diff
changeset | 1005 | lemma Collect_ex_eq [no_atp]: "{x. \<exists>y. P x y} = (\<Union>y. {x. P x y})"
 | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1006 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1007 | |
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 1008 | lemma ball_UN: "(\<forall>z \<in> UNION A B. P z) \<longleftrightarrow> (\<forall>x\<in>A. \<forall>z \<in> B x. P z)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1009 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1010 | |
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 1011 | lemma bex_UN: "(\<exists>z \<in> UNION A B. P z) \<longleftrightarrow> (\<exists>x\<in>A. \<exists>z\<in>B x. P z)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1012 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1013 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1014 | lemma Un_eq_UN: "A \<union> B = (\<Union>b. if b then A else B)" | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1015 | by (auto simp add: split_if_mem2) | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1016 | |
| 43817 | 1017 | lemma UN_bool_eq: "(\<Union>b. A b) = (A True \<union> A False)" | 
| 43900 
7162691e740b
generalization; various notation and proof tuning
 haftmann parents: 
43899diff
changeset | 1018 | by (fact SUP_UNIV_bool_expand) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1019 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1020 | lemma UN_Pow_subset: "(\<Union>x\<in>A. Pow (B x)) \<subseteq> Pow (\<Union>x\<in>A. B x)" | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1021 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1022 | |
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1023 | lemma UN_mono: | 
| 43817 | 1024 | "A \<subseteq> B \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<subseteq> g x) \<Longrightarrow> | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1025 | (\<Union>x\<in>A. f x) \<subseteq> (\<Union>x\<in>B. g x)" | 
| 43940 | 1026 | by (fact SUP_subset_mono) | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1027 | |
| 43817 | 1028 | lemma vimage_Union: "f -` (\<Union>A) = (\<Union>X\<in>A. f -` X)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1029 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1030 | |
| 43817 | 1031 | lemma vimage_UN: "f -` (\<Union>x\<in>A. B x) = (\<Union>x\<in>A. f -` B x)" | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1032 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1033 | |
| 43817 | 1034 | lemma vimage_eq_UN: "f -` B = (\<Union>y\<in>B. f -` {y})"
 | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1035 |   -- {* NOT suitable for rewriting *}
 | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1036 | by blast | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1037 | |
| 43817 | 1038 | lemma image_UN: "f ` UNION A B = (\<Union>x\<in>A. f ` B x)" | 
| 1039 | by blast | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1040 | |
| 45013 | 1041 | lemma UN_singleton [simp]: "(\<Union>x\<in>A. {x}) = A"
 | 
| 1042 | by blast | |
| 1043 | ||
| 11979 | 1044 | |
| 32139 | 1045 | subsection {* Distributive laws *}
 | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1046 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1047 | lemma Int_Union: "A \<inter> \<Union>B = (\<Union>C\<in>B. A \<inter> C)" | 
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 1048 | by (fact inf_Sup) | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1049 | |
| 44039 | 1050 | lemma Un_Inter: "A \<union> \<Inter>B = (\<Inter>C\<in>B. A \<union> C)" | 
| 1051 | by (fact sup_Inf) | |
| 1052 | ||
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1053 | lemma Int_Union2: "\<Union>B \<inter> A = (\<Union>C\<in>B. C \<inter> A)" | 
| 44039 | 1054 | by (fact Sup_inf) | 
| 1055 | ||
| 1056 | lemma INT_Int_distrib: "(\<Inter>i\<in>I. A i \<inter> B i) = (\<Inter>i\<in>I. A i) \<inter> (\<Inter>i\<in>I. B i)" | |
| 1057 | by (rule sym) (rule INF_inf_distrib) | |
| 1058 | ||
| 1059 | lemma UN_Un_distrib: "(\<Union>i\<in>I. A i \<union> B i) = (\<Union>i\<in>I. A i) \<union> (\<Union>i\<in>I. B i)" | |
| 1060 | by (rule sym) (rule SUP_sup_distrib) | |
| 1061 | ||
| 1062 | lemma Int_Inter_image: "(\<Inter>x\<in>C. A x \<inter> B x) = \<Inter>(A ` C) \<inter> \<Inter>(B ` C)" | |
| 1063 | by (simp only: INT_Int_distrib INF_def) | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1064 | |
| 43817 | 1065 | lemma Un_Union_image: "(\<Union>x\<in>C. A x \<union> B x) = \<Union>(A ` C) \<union> \<Union>(B ` C)" | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1066 |   -- {* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: *}
 | 
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1067 |   -- {* Union of a family of unions *}
 | 
| 44039 | 1068 | by (simp only: UN_Un_distrib SUP_def) | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1069 | |
| 44039 | 1070 | lemma Un_INT_distrib: "B \<union> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. B \<union> A i)" | 
| 1071 | by (fact sup_INF) | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1072 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1073 | lemma Int_UN_distrib: "B \<inter> (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. B \<inter> A i)" | 
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1074 |   -- {* Halmos, Naive Set Theory, page 35. *}
 | 
| 44039 | 1075 | by (fact inf_SUP) | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1076 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1077 | lemma Int_UN_distrib2: "(\<Union>i\<in>I. A i) \<inter> (\<Union>j\<in>J. B j) = (\<Union>i\<in>I. \<Union>j\<in>J. A i \<inter> B j)" | 
| 44039 | 1078 | by (fact SUP_inf_distrib2) | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1079 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1080 | lemma Un_INT_distrib2: "(\<Inter>i\<in>I. A i) \<union> (\<Inter>j\<in>J. B j) = (\<Inter>i\<in>I. \<Inter>j\<in>J. A i \<union> B j)" | 
| 44039 | 1081 | by (fact INF_sup_distrib2) | 
| 1082 | ||
| 1083 | lemma Union_disjoint: "(\<Union>C \<inter> A = {}) \<longleftrightarrow> (\<forall>B\<in>C. B \<inter> A = {})"
 | |
| 1084 | by (fact Sup_inf_eq_bot_iff) | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1085 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1086 | |
| 32139 | 1087 | subsection {* Complement *}
 | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1088 | |
| 43873 | 1089 | lemma Compl_INT [simp]: "- (\<Inter>x\<in>A. B x) = (\<Union>x\<in>A. -B x)" | 
| 1090 | by (fact uminus_INF) | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1091 | |
| 43873 | 1092 | lemma Compl_UN [simp]: "- (\<Union>x\<in>A. B x) = (\<Inter>x\<in>A. -B x)" | 
| 1093 | by (fact uminus_SUP) | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1094 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1095 | |
| 32139 | 1096 | subsection {* Miniscoping and maxiscoping *}
 | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1097 | |
| 13860 | 1098 | text {* \medskip Miniscoping: pushing in quantifiers and big Unions
 | 
| 1099 | and Intersections. *} | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1100 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1101 | lemma UN_simps [simp]: | 
| 43817 | 1102 |   "\<And>a B C. (\<Union>x\<in>C. insert a (B x)) = (if C={} then {} else insert a (\<Union>x\<in>C. B x))"
 | 
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 1103 |   "\<And>A B C. (\<Union>x\<in>C. A x \<union> B) = ((if C={} then {} else (\<Union>x\<in>C. A x) \<union> B))"
 | 
| 43852 | 1104 |   "\<And>A B C. (\<Union>x\<in>C. A \<union> B x) = ((if C={} then {} else A \<union> (\<Union>x\<in>C. B x)))"
 | 
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 1105 | "\<And>A B C. (\<Union>x\<in>C. A x \<inter> B) = ((\<Union>x\<in>C. A x) \<inter> B)" | 
| 43852 | 1106 | "\<And>A B C. (\<Union>x\<in>C. A \<inter> B x) = (A \<inter>(\<Union>x\<in>C. B x))" | 
| 1107 | "\<And>A B C. (\<Union>x\<in>C. A x - B) = ((\<Union>x\<in>C. A x) - B)" | |
| 1108 | "\<And>A B C. (\<Union>x\<in>C. A - B x) = (A - (\<Inter>x\<in>C. B x))" | |
| 1109 | "\<And>A B. (\<Union>x\<in>\<Union>A. B x) = (\<Union>y\<in>A. \<Union>x\<in>y. B x)" | |
| 1110 | "\<And>A B C. (\<Union>z\<in>UNION A B. C z) = (\<Union>x\<in>A. \<Union>z\<in>B x. C z)" | |
| 43831 | 1111 | "\<And>A B f. (\<Union>x\<in>f`A. B x) = (\<Union>a\<in>A. B (f a))" | 
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1112 | by auto | 
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1113 | |
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1114 | lemma INT_simps [simp]: | 
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 1115 |   "\<And>A B C. (\<Inter>x\<in>C. A x \<inter> B) = (if C={} then UNIV else (\<Inter>x\<in>C. A x) \<inter> B)"
 | 
| 43831 | 1116 |   "\<And>A B C. (\<Inter>x\<in>C. A \<inter> B x) = (if C={} then UNIV else A \<inter>(\<Inter>x\<in>C. B x))"
 | 
| 43852 | 1117 |   "\<And>A B C. (\<Inter>x\<in>C. A x - B) = (if C={} then UNIV else (\<Inter>x\<in>C. A x) - B)"
 | 
| 1118 |   "\<And>A B C. (\<Inter>x\<in>C. A - B x) = (if C={} then UNIV else A - (\<Union>x\<in>C. B x))"
 | |
| 43817 | 1119 | "\<And>a B C. (\<Inter>x\<in>C. insert a (B x)) = insert a (\<Inter>x\<in>C. B x)" | 
| 43852 | 1120 | "\<And>A B C. (\<Inter>x\<in>C. A x \<union> B) = ((\<Inter>x\<in>C. A x) \<union> B)" | 
| 1121 | "\<And>A B C. (\<Inter>x\<in>C. A \<union> B x) = (A \<union> (\<Inter>x\<in>C. B x))" | |
| 1122 | "\<And>A B. (\<Inter>x\<in>\<Union>A. B x) = (\<Inter>y\<in>A. \<Inter>x\<in>y. B x)" | |
| 1123 | "\<And>A B C. (\<Inter>z\<in>UNION A B. C z) = (\<Inter>x\<in>A. \<Inter>z\<in>B x. C z)" | |
| 1124 | "\<And>A B f. (\<Inter>x\<in>f`A. B x) = (\<Inter>a\<in>A. B (f a))" | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1125 | by auto | 
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1126 | |
| 43967 | 1127 | lemma UN_ball_bex_simps [simp, no_atp]: | 
| 43852 | 1128 | "\<And>A P. (\<forall>x\<in>\<Union>A. P x) \<longleftrightarrow> (\<forall>y\<in>A. \<forall>x\<in>y. P x)" | 
| 43967 | 1129 | "\<And>A B P. (\<forall>x\<in>UNION A B. P x) = (\<forall>a\<in>A. \<forall>x\<in> B a. P x)" | 
| 43852 | 1130 | "\<And>A P. (\<exists>x\<in>\<Union>A. P x) \<longleftrightarrow> (\<exists>y\<in>A. \<exists>x\<in>y. P x)" | 
| 1131 | "\<And>A B P. (\<exists>x\<in>UNION A B. P x) \<longleftrightarrow> (\<exists>a\<in>A. \<exists>x\<in>B a. P x)" | |
| 12897 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1132 | by auto | 
| 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
 wenzelm parents: 
12633diff
changeset | 1133 | |
| 43943 | 1134 | |
| 13860 | 1135 | text {* \medskip Maxiscoping: pulling out big Unions and Intersections. *}
 | 
| 1136 | ||
| 1137 | lemma UN_extend_simps: | |
| 43817 | 1138 |   "\<And>a B C. insert a (\<Union>x\<in>C. B x) = (if C={} then {a} else (\<Union>x\<in>C. insert a (B x)))"
 | 
| 44032 
cb768f4ceaf9
solving duality problem for complete_distrib_lattice; tuned
 haftmann parents: 
44029diff
changeset | 1139 |   "\<And>A B C. (\<Union>x\<in>C. A x) \<union> B = (if C={} then B else (\<Union>x\<in>C. A x \<union> B))"
 | 
| 43852 | 1140 |   "\<And>A B C. A \<union> (\<Union>x\<in>C. B x) = (if C={} then A else (\<Union>x\<in>C. A \<union> B x))"
 | 
| 1141 | "\<And>A B C. ((\<Union>x\<in>C. A x) \<inter> B) = (\<Union>x\<in>C. A x \<inter> B)" | |
| 1142 | "\<And>A B C. (A \<inter> (\<Union>x\<in>C. B x)) = (\<Union>x\<in>C. A \<inter> B x)" | |
| 43817 | 1143 | "\<And>A B C. ((\<Union>x\<in>C. A x) - B) = (\<Union>x\<in>C. A x - B)" | 
| 1144 | "\<And>A B C. (A - (\<Inter>x\<in>C. B x)) = (\<Union>x\<in>C. A - B x)" | |
| 43852 | 1145 | "\<And>A B. (\<Union>y\<in>A. \<Union>x\<in>y. B x) = (\<Union>x\<in>\<Union>A. B x)" | 
| 1146 | "\<And>A B C. (\<Union>x\<in>A. \<Union>z\<in>B x. C z) = (\<Union>z\<in>UNION A B. C z)" | |
| 43831 | 1147 | "\<And>A B f. (\<Union>a\<in>A. B (f a)) = (\<Union>x\<in>f`A. B x)" | 
| 13860 | 1148 | by auto | 
| 1149 | ||
| 1150 | lemma INT_extend_simps: | |
| 43852 | 1151 |   "\<And>A B C. (\<Inter>x\<in>C. A x) \<inter> B = (if C={} then B else (\<Inter>x\<in>C. A x \<inter> B))"
 | 
| 1152 |   "\<And>A B C. A \<inter> (\<Inter>x\<in>C. B x) = (if C={} then A else (\<Inter>x\<in>C. A \<inter> B x))"
 | |
| 1153 |   "\<And>A B C. (\<Inter>x\<in>C. A x) - B = (if C={} then UNIV - B else (\<Inter>x\<in>C. A x - B))"
 | |
| 1154 |   "\<And>A B C. A - (\<Union>x\<in>C. B x) = (if C={} then A else (\<Inter>x\<in>C. A - B x))"
 | |
| 43817 | 1155 | "\<And>a B C. insert a (\<Inter>x\<in>C. B x) = (\<Inter>x\<in>C. insert a (B x))" | 
| 43852 | 1156 | "\<And>A B C. ((\<Inter>x\<in>C. A x) \<union> B) = (\<Inter>x\<in>C. A x \<union> B)" | 
| 1157 | "\<And>A B C. A \<union> (\<Inter>x\<in>C. B x) = (\<Inter>x\<in>C. A \<union> B x)" | |
| 1158 | "\<And>A B. (\<Inter>y\<in>A. \<Inter>x\<in>y. B x) = (\<Inter>x\<in>\<Union>A. B x)" | |
| 1159 | "\<And>A B C. (\<Inter>x\<in>A. \<Inter>z\<in>B x. C z) = (\<Inter>z\<in>UNION A B. C z)" | |
| 1160 | "\<And>A B f. (\<Inter>a\<in>A. B (f a)) = (\<Inter>x\<in>f`A. B x)" | |
| 13860 | 1161 | by auto | 
| 1162 | ||
| 43872 | 1163 | text {* Finally *}
 | 
| 1164 | ||
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1165 | no_notation | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1166 | less_eq (infix "\<sqsubseteq>" 50) and | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1167 | less (infix "\<sqsubset>" 50) and | 
| 41082 | 1168 |   bot ("\<bottom>") and
 | 
| 1169 |   top ("\<top>") and
 | |
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1170 | inf (infixl "\<sqinter>" 70) and | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1171 | sup (infixl "\<squnion>" 65) and | 
| 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1172 |   Inf  ("\<Sqinter>_" [900] 900) and
 | 
| 41082 | 1173 |   Sup  ("\<Squnion>_" [900] 900)
 | 
| 32135 
f645b51e8e54
set intersection and union now named inter and union; closer connection between set and lattice operations; factored out complete lattice
 haftmann parents: 
32120diff
changeset | 1174 | |
| 41080 | 1175 | no_syntax (xsymbols) | 
| 41082 | 1176 |   "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
 | 
| 1177 |   "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
 | |
| 41080 | 1178 |   "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Squnion>_./ _)" [0, 10] 10)
 | 
| 1179 |   "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Squnion>_\<in>_./ _)" [0, 0, 10] 10)
 | |
| 1180 | ||
| 30596 | 1181 | lemmas mem_simps = | 
| 1182 | insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff | |
| 1183 | mem_Collect_eq UN_iff Union_iff INT_iff Inter_iff | |
| 1184 |   -- {* Each of these has ALREADY been added @{text "[simp]"} above. *}
 | |
| 21669 | 1185 | |
| 11979 | 1186 | end |