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