src/HOL/Complete_Lattices.thy
author kuncar
Fri Dec 09 18:07:04 2011 +0100 (2011-12-09)
changeset 45802 b16f976db515
parent 45013 05031b71a89a
child 45960 e1b09bfb52f1
permissions -rw-r--r--
Quotient_Info stores only relation maps
     1  (*  Author:     Tobias Nipkow, Lawrence C Paulson and Markus Wenzel; Florian Haftmann, TU Muenchen *)
     2 
     3 header {* Complete lattices *}
     4 
     5 theory Complete_Lattices
     6 imports Set
     7 begin
     8 
     9 notation
    10   less_eq (infix "\<sqsubseteq>" 50) and
    11   less (infix "\<sqsubset>" 50) and
    12   inf (infixl "\<sqinter>" 70) and
    13   sup (infixl "\<squnion>" 65) and
    14   top ("\<top>") and
    15   bot ("\<bottom>")
    16 
    17 
    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 
    26 subsection {* Abstract complete lattices *}
    27 
    28 class complete_lattice = bounded_lattice + Inf + Sup +
    29   assumes Inf_lower: "x \<in> A \<Longrightarrow> \<Sqinter>A \<sqsubseteq> x"
    30      and Inf_greatest: "(\<And>x. x \<in> A \<Longrightarrow> z \<sqsubseteq> x) \<Longrightarrow> z \<sqsubseteq> \<Sqinter>A"
    31   assumes Sup_upper: "x \<in> A \<Longrightarrow> x \<sqsubseteq> \<Squnion>A"
    32      and Sup_least: "(\<And>x. x \<in> A \<Longrightarrow> x \<sqsubseteq> z) \<Longrightarrow> \<Squnion>A \<sqsubseteq> z"
    33 begin
    34 
    35 lemma dual_complete_lattice:
    36   "class.complete_lattice Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom>"
    37   by (auto intro!: class.complete_lattice.intro dual_bounded_lattice)
    38     (unfold_locales, (fact bot_least top_greatest
    39         Sup_upper Sup_least Inf_lower Inf_greatest)+)
    40 
    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
    84 
    85 lemma INF_foundation_dual [no_atp]:
    86   "complete_lattice.SUPR Inf = INFI"
    87   by (simp add: fun_eq_iff INF_def
    88     complete_lattice.SUP_def [OF dual_complete_lattice])
    89 
    90 lemma SUP_foundation_dual [no_atp]:
    91   "complete_lattice.INFI Sup = SUPR"
    92   by (simp add: fun_eq_iff SUP_def
    93     complete_lattice.INF_def [OF dual_complete_lattice])
    94 
    95 lemma INF_lower: "i \<in> A \<Longrightarrow> (\<Sqinter>i\<in>A. f i) \<sqsubseteq> f i"
    96   by (auto simp add: INF_def intro: Inf_lower)
    97 
    98 lemma INF_greatest: "(\<And>i. i \<in> A \<Longrightarrow> u \<sqsubseteq> f i) \<Longrightarrow> u \<sqsubseteq> (\<Sqinter>i\<in>A. f i)"
    99   by (auto simp add: INF_def intro: Inf_greatest)
   100 
   101 lemma SUP_upper: "i \<in> A \<Longrightarrow> f i \<sqsubseteq> (\<Squnion>i\<in>A. f i)"
   102   by (auto simp add: SUP_def intro: Sup_upper)
   103 
   104 lemma SUP_least: "(\<And>i. i \<in> A \<Longrightarrow> f i \<sqsubseteq> u) \<Longrightarrow> (\<Squnion>i\<in>A. f i) \<sqsubseteq> u"
   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 
   110 lemma INF_lower2: "i \<in> A \<Longrightarrow> f i \<sqsubseteq> u \<Longrightarrow> (\<Sqinter>i\<in>A. f i) \<sqsubseteq> u"
   111   using INF_lower [of i A f] by auto
   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 
   116 lemma SUP_upper2: "i \<in> A \<Longrightarrow> u \<sqsubseteq> f i \<Longrightarrow> u \<sqsubseteq> (\<Squnion>i\<in>A. f i)"
   117   using SUP_upper [of i A f] by auto
   118 
   119 lemma le_Inf_iff: "b \<sqsubseteq> \<Sqinter>A \<longleftrightarrow> (\<forall>a\<in>A. b \<sqsubseteq> a)"
   120   by (auto intro: Inf_greatest dest: Inf_lower)
   121 
   122 lemma le_INF_iff: "u \<sqsubseteq> (\<Sqinter>i\<in>A. f i) \<longleftrightarrow> (\<forall>i\<in>A. u \<sqsubseteq> f i)"
   123   by (auto simp add: INF_def le_Inf_iff)
   124 
   125 lemma Sup_le_iff: "\<Squnion>A \<sqsubseteq> b \<longleftrightarrow> (\<forall>a\<in>A. a \<sqsubseteq> b)"
   126   by (auto intro: Sup_least dest: Sup_upper)
   127 
   128 lemma SUP_le_iff: "(\<Squnion>i\<in>A. f i) \<sqsubseteq> u \<longleftrightarrow> (\<forall>i\<in>A. f i \<sqsubseteq> u)"
   129   by (auto simp add: SUP_def Sup_le_iff)
   130 
   131 lemma Inf_empty [simp]:
   132   "\<Sqinter>{} = \<top>"
   133   by (auto intro: antisym Inf_greatest)
   134 
   135 lemma INF_empty [simp]: "(\<Sqinter>x\<in>{}. f x) = \<top>"
   136   by (simp add: INF_def)
   137 
   138 lemma Sup_empty [simp]:
   139   "\<Squnion>{} = \<bottom>"
   140   by (auto intro: antisym Sup_least)
   141 
   142 lemma SUP_empty [simp]: "(\<Squnion>x\<in>{}. f x) = \<bottom>"
   143   by (simp add: SUP_def)
   144 
   145 lemma Inf_UNIV [simp]:
   146   "\<Sqinter>UNIV = \<bottom>"
   147   by (auto intro!: antisym Inf_lower)
   148 
   149 lemma Sup_UNIV [simp]:
   150   "\<Squnion>UNIV = \<top>"
   151   by (auto intro!: antisym Sup_upper)
   152 
   153 lemma Inf_insert [simp]: "\<Sqinter>insert a A = a \<sqinter> \<Sqinter>A"
   154   by (auto intro: le_infI le_infI1 le_infI2 antisym Inf_greatest Inf_lower)
   155 
   156 lemma INF_insert: "(\<Sqinter>x\<in>insert a A. f x) = f a \<sqinter> INFI A f"
   157   by (simp add: INF_def)
   158 
   159 lemma Sup_insert [simp]: "\<Squnion>insert a A = a \<squnion> \<Squnion>A"
   160   by (auto intro: le_supI le_supI1 le_supI2 antisym Sup_least Sup_upper)
   161 
   162 lemma SUP_insert: "(\<Squnion>x\<in>insert a A. f x) = f a \<squnion> SUPR A f"
   163   by (simp add: SUP_def)
   164 
   165 lemma INF_image [simp]: "(\<Sqinter>x\<in>f`A. g x) = (\<Sqinter>x\<in>A. g (f x))"
   166   by (simp add: INF_def image_image)
   167 
   168 lemma SUP_image [simp]: "(\<Squnion>x\<in>f`A. g x) = (\<Squnion>x\<in>A. g (f x))"
   169   by (simp add: SUP_def image_image)
   170 
   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 
   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 
   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 
   191 lemma Inf_mono:
   192   assumes "\<And>b. b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<sqsubseteq> b"
   193   shows "\<Sqinter>A \<sqsubseteq> \<Sqinter>B"
   194 proof (rule Inf_greatest)
   195   fix b assume "b \<in> B"
   196   with assms obtain a where "a \<in> A" and "a \<sqsubseteq> b" by blast
   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
   199 qed
   200 
   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)"
   203   unfolding INF_def by (rule Inf_mono) fast
   204 
   205 lemma Sup_mono:
   206   assumes "\<And>a. a \<in> A \<Longrightarrow> \<exists>b\<in>B. a \<sqsubseteq> b"
   207   shows "\<Squnion>A \<sqsubseteq> \<Squnion>B"
   208 proof (rule Sup_least)
   209   fix a assume "a \<in> A"
   210   with assms obtain b where "b \<in> B" and "a \<sqsubseteq> b" by blast
   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
   213 qed
   214 
   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)"
   217   unfolding SUP_def by (rule Sup_mono) fast
   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 
   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 
   248 lemma less_eq_Inf_inter: "\<Sqinter>A \<squnion> \<Sqinter>B \<sqsubseteq> \<Sqinter>(A \<inter> B)"
   249   by (auto intro: Inf_greatest Inf_lower)
   250 
   251 lemma Sup_inter_less_eq: "\<Squnion>(A \<inter> B) \<sqsubseteq> \<Squnion>A \<sqinter> \<Squnion>B "
   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 
   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)"
   259   by (auto intro!: antisym INF_mono intro: le_infI1 le_infI2 INF_greatest INF_lower)
   260 
   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 
   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)"
   266   by (auto intro!: antisym SUP_mono intro: le_supI1 le_supI2 SUP_least SUP_upper)
   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)"
   269   by (rule antisym) (rule INF_greatest, auto intro: le_infI1 le_infI2 INF_lower INF_mono)
   270 
   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
   277 
   278 lemma Inf_top_conv [simp, no_atp]:
   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
   286     then show "\<Sqinter>A = \<top>" by auto
   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
   294       with `\<Sqinter>A = \<top>` `x \<noteq> \<top>` show False by simp
   295     qed
   296   qed
   297   then show "\<top> = \<Sqinter>A \<longleftrightarrow> (\<forall>x\<in>A. x = \<top>)" by auto
   298 qed
   299 
   300 lemma INF_top_conv [simp]:
   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>)"
   303   by (auto simp add: INF_def)
   304 
   305 lemma Sup_bot_conv [simp, no_atp]:
   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)
   308   using dual_complete_lattice
   309   by (rule complete_lattice.Inf_top_conv)+
   310 
   311 lemma SUP_bot_conv [simp]:
   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>)"
   314   by (auto simp add: SUP_def)
   315 
   316 lemma INF_const [simp]: "A \<noteq> {} \<Longrightarrow> (\<Sqinter>i\<in>A. f) = f"
   317   by (auto intro: antisym INF_lower INF_greatest)
   318 
   319 lemma SUP_const [simp]: "A \<noteq> {} \<Longrightarrow> (\<Squnion>i\<in>A. f) = f"
   320   by (auto intro: antisym SUP_upper SUP_least)
   321 
   322 lemma INF_top [simp]: "(\<Sqinter>x\<in>A. \<top>) = \<top>"
   323   by (cases "A = {}") simp_all
   324 
   325 lemma SUP_bot [simp]: "(\<Squnion>x\<in>A. \<bottom>) = \<bottom>"
   326   by (cases "A = {}") simp_all
   327 
   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)"
   329   by (iprover intro: INF_lower INF_greatest order_trans antisym)
   330 
   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)"
   332   by (iprover intro: SUP_upper SUP_least order_trans antisym)
   333 
   334 lemma INF_absorb:
   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 
   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:
   351   "(\<Sqinter>y\<in>A. c) = (if A = {} then \<top> else c)"
   352   by simp
   353 
   354 lemma SUP_constant:
   355   "(\<Squnion>y\<in>A. c) = (if A = {} then \<bottom> else c)"
   356   by simp
   357 
   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`
   363     by (rule INF_lower)
   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`
   371     by (rule SUP_upper)
   372   also note `(\<Squnion>i\<in>A. f i) < y`
   373   finally show "f i < y" .
   374 qed
   375 
   376 lemma INF_UNIV_bool_expand:
   377   "(\<Sqinter>b. A b) = A True \<sqinter> A False"
   378   by (simp add: UNIV_bool INF_insert inf_commute)
   379 
   380 lemma SUP_UNIV_bool_expand:
   381   "(\<Squnion>b. A b) = A True \<squnion> A False"
   382   by (simp add: UNIV_bool SUP_insert sup_commute)
   383 
   384 end
   385 
   386 class complete_distrib_lattice = complete_lattice +
   387   assumes sup_Inf: "a \<squnion> \<Sqinter>B = (\<Sqinter>b\<in>B. a \<squnion> b)"
   388   assumes inf_Sup: "a \<sqinter> \<Squnion>B = (\<Squnion>b\<in>B. a \<sqinter> b)"
   389 begin
   390 
   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 
   399 lemma dual_complete_distrib_lattice:
   400   "class.complete_distrib_lattice Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom>"
   401   apply (rule class.complete_distrib_lattice.intro)
   402   apply (fact dual_complete_lattice)
   403   apply (rule class.complete_distrib_lattice_axioms.intro)
   404   apply (simp_all only: INF_foundation_dual SUP_foundation_dual inf_Sup sup_Inf)
   405   done
   406 
   407 subclass distrib_lattice proof
   408   fix a b c
   409   from sup_Inf have "a \<squnion> \<Sqinter>{b, c} = (\<Sqinter>d\<in>{b, c}. a \<squnion> d)" .
   410   then show "a \<squnion> b \<sqinter> c = (a \<squnion> b) \<sqinter> (a \<squnion> c)" by (simp add: INF_def)
   411 qed
   412 
   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 
   445 end
   446 
   447 class complete_boolean_algebra = boolean_algebra + complete_distrib_lattice
   448 begin
   449 
   450 lemma dual_complete_boolean_algebra:
   451   "class.complete_boolean_algebra Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom> (\<lambda>x y. x \<squnion> - y) uminus"
   452   by (rule class.complete_boolean_algebra.intro, rule dual_complete_distrib_lattice, rule dual_boolean_algebra)
   453 
   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 
   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 
   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 
   478 class complete_linorder = linorder + complete_lattice
   479 begin
   480 
   481 lemma dual_complete_linorder:
   482   "class.complete_linorder Sup Inf sup (op \<ge>) (op >) inf \<top> \<bottom>"
   483   by (rule class.complete_linorder.intro, rule dual_complete_lattice, rule dual_linorder)
   484 
   485 lemma Inf_less_iff:
   486   "\<Sqinter>S \<sqsubset> a \<longleftrightarrow> (\<exists>x\<in>S. x \<sqsubset> a)"
   487   unfolding not_le [symmetric] le_Inf_iff by auto
   488 
   489 lemma INF_less_iff:
   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 
   493 lemma less_Sup_iff:
   494   "a \<sqsubset> \<Squnion>S \<longleftrightarrow> (\<exists>x\<in>S. a \<sqsubset> x)"
   495   unfolding not_le [symmetric] Sup_le_iff by auto
   496 
   497 lemma less_SUP_iff:
   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 
   501 lemma Sup_eq_top_iff [simp]:
   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 
   523 lemma SUP_eq_top_iff [simp]:
   524   "(\<Squnion>i\<in>A. f i) = \<top> \<longleftrightarrow> (\<forall>x<\<top>. \<exists>i\<in>A. x < f i)"
   525   unfolding SUP_def by auto
   526 
   527 lemma Inf_eq_bot_iff [simp]:
   528   "\<Sqinter>A = \<bottom> \<longleftrightarrow> (\<forall>x>\<bottom>. \<exists>i\<in>A. i < x)"
   529   using dual_complete_linorder
   530   by (rule complete_linorder.Sup_eq_top_iff)
   531 
   532 lemma INF_eq_bot_iff [simp]:
   533   "(\<Sqinter>i\<in>A. f i) = \<bottom> \<longleftrightarrow> (\<forall>x>\<bottom>. \<exists>i\<in>A. f i < x)"
   534   unfolding INF_def by auto
   535 
   536 end
   537 
   538 
   539 subsection {* @{typ bool} and @{typ "_ \<Rightarrow> _"} as complete lattice *}
   540 
   541 instantiation bool :: complete_lattice
   542 begin
   543 
   544 definition
   545   [simp]: "\<Sqinter>A \<longleftrightarrow> False \<notin> A"
   546 
   547 definition
   548   [simp]: "\<Squnion>A \<longleftrightarrow> True \<in> A"
   549 
   550 instance proof
   551 qed (auto intro: bool_induct)
   552 
   553 end
   554 
   555 lemma INF_bool_eq [simp]:
   556   "INFI = Ball"
   557 proof (rule ext)+
   558   fix A :: "'a set"
   559   fix P :: "'a \<Rightarrow> bool"
   560   show "(\<Sqinter>x\<in>A. P x) \<longleftrightarrow> (\<forall>x\<in>A. P x)"
   561     by (auto simp add: INF_def)
   562 qed
   563 
   564 lemma SUP_bool_eq [simp]:
   565   "SUPR = Bex"
   566 proof (rule ext)+
   567   fix A :: "'a set"
   568   fix P :: "'a \<Rightarrow> bool"
   569   show "(\<Squnion>x\<in>A. P x) \<longleftrightarrow> (\<exists>x\<in>A. P x)"
   570     by (auto simp add: SUP_def)
   571 qed
   572 
   573 instance bool :: complete_boolean_algebra proof
   574 qed (auto intro: bool_induct)
   575 
   576 instantiation "fun" :: (type, complete_lattice) complete_lattice
   577 begin
   578 
   579 definition
   580   "\<Sqinter>A = (\<lambda>x. \<Sqinter>f\<in>A. f x)"
   581 
   582 lemma Inf_apply:
   583   "(\<Sqinter>A) x = (\<Sqinter>f\<in>A. f x)"
   584   by (simp add: Inf_fun_def)
   585 
   586 definition
   587   "\<Squnion>A = (\<lambda>x. \<Squnion>f\<in>A. f x)"
   588 
   589 lemma Sup_apply:
   590   "(\<Squnion>A) x = (\<Squnion>f\<in>A. f x)"
   591   by (simp add: Sup_fun_def)
   592 
   593 instance proof
   594 qed (auto simp add: le_fun_def Inf_apply Sup_apply intro: INF_lower INF_greatest SUP_upper SUP_least)
   595 
   596 end
   597 
   598 lemma INF_apply:
   599   "(\<Sqinter>y\<in>A. f y) x = (\<Sqinter>y\<in>A. f y x)"
   600   by (auto intro: arg_cong [of _ _ Inf] simp add: INF_def Inf_apply)
   601 
   602 lemma SUP_apply:
   603   "(\<Squnion>y\<in>A. f y) x = (\<Squnion>y\<in>A. f y x)"
   604   by (auto intro: arg_cong [of _ _ Sup] simp add: SUP_def Sup_apply)
   605 
   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 
   609 instance "fun" :: (type, complete_boolean_algebra) complete_boolean_algebra ..
   610 
   611 
   612 subsection {* Inter *}
   613 
   614 abbreviation Inter :: "'a set set \<Rightarrow> 'a set" where
   615   "Inter S \<equiv> \<Sqinter>S"
   616   
   617 notation (xsymbols)
   618   Inter  ("\<Inter>_" [90] 90)
   619 
   620 lemma Inter_eq:
   621   "\<Inter>A = {x. \<forall>B \<in> A. x \<in> B}"
   622 proof (rule set_eqI)
   623   fix x
   624   have "(\<forall>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<forall>B\<in>A. x \<in> B)"
   625     by auto
   626   then show "x \<in> \<Inter>A \<longleftrightarrow> x \<in> {x. \<forall>B \<in> A. x \<in> B}"
   627     by (simp add: Inf_fun_def) (simp add: mem_def)
   628 qed
   629 
   630 lemma Inter_iff [simp,no_atp]: "A \<in> \<Inter>C \<longleftrightarrow> (\<forall>X\<in>C. A \<in> X)"
   631   by (unfold Inter_eq) blast
   632 
   633 lemma InterI [intro!]: "(\<And>X. X \<in> C \<Longrightarrow> A \<in> X) \<Longrightarrow> A \<in> \<Inter>C"
   634   by (simp add: Inter_eq)
   635 
   636 text {*
   637   \medskip A ``destruct'' rule -- every @{term X} in @{term C}
   638   contains @{term A} as an element, but @{prop "A \<in> X"} can hold when
   639   @{prop "X \<in> C"} does not!  This rule is analogous to @{text spec}.
   640 *}
   641 
   642 lemma InterD [elim, Pure.elim]: "A \<in> \<Inter>C \<Longrightarrow> X \<in> C \<Longrightarrow> A \<in> X"
   643   by auto
   644 
   645 lemma InterE [elim]: "A \<in> \<Inter>C \<Longrightarrow> (X \<notin> C \<Longrightarrow> R) \<Longrightarrow> (A \<in> X \<Longrightarrow> R) \<Longrightarrow> R"
   646   -- {* ``Classical'' elimination rule -- does not require proving
   647     @{prop "X \<in> C"}. *}
   648   by (unfold Inter_eq) blast
   649 
   650 lemma Inter_lower: "B \<in> A \<Longrightarrow> \<Inter>A \<subseteq> B"
   651   by (fact Inf_lower)
   652 
   653 lemma Inter_subset:
   654   "(\<And>X. X \<in> A \<Longrightarrow> X \<subseteq> B) \<Longrightarrow> A \<noteq> {} \<Longrightarrow> \<Inter>A \<subseteq> B"
   655   by (fact Inf_less_eq)
   656 
   657 lemma Inter_greatest: "(\<And>X. X \<in> A \<Longrightarrow> C \<subseteq> X) \<Longrightarrow> C \<subseteq> Inter A"
   658   by (fact Inf_greatest)
   659 
   660 lemma Inter_empty: "\<Inter>{} = UNIV"
   661   by (fact Inf_empty) (* already simp *)
   662 
   663 lemma Inter_UNIV: "\<Inter>UNIV = {}"
   664   by (fact Inf_UNIV) (* already simp *)
   665 
   666 lemma Inter_insert: "\<Inter>(insert a B) = a \<inter> \<Inter>B"
   667   by (fact Inf_insert) (* already simp *)
   668 
   669 lemma Inter_Un_subset: "\<Inter>A \<union> \<Inter>B \<subseteq> \<Inter>(A \<inter> B)"
   670   by (fact less_eq_Inf_inter)
   671 
   672 lemma Inter_Un_distrib: "\<Inter>(A \<union> B) = \<Inter>A \<inter> \<Inter>B"
   673   by (fact Inf_union_distrib)
   674 
   675 lemma Inter_UNIV_conv [simp, no_atp]:
   676   "\<Inter>A = UNIV \<longleftrightarrow> (\<forall>x\<in>A. x = UNIV)"
   677   "UNIV = \<Inter>A \<longleftrightarrow> (\<forall>x\<in>A. x = UNIV)"
   678   by (fact Inf_top_conv)+
   679 
   680 lemma Inter_anti_mono: "B \<subseteq> A \<Longrightarrow> \<Inter>A \<subseteq> \<Inter>B"
   681   by (fact Inf_superset_mono)
   682 
   683 
   684 subsection {* Intersections of families *}
   685 
   686 abbreviation INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
   687   "INTER \<equiv> INFI"
   688 
   689 text {*
   690   Note: must use name @{const INTER} here instead of @{text INT}
   691   to allow the following syntax coexist with the plain constant name.
   692 *}
   693 
   694 syntax
   695   "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3INT _./ _)" [0, 10] 10)
   696   "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" [0, 0, 10] 10)
   697 
   698 syntax (xsymbols)
   699   "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" [0, 10] 10)
   700   "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>_\<in>_./ _)" [0, 0, 10] 10)
   701 
   702 syntax (latex output)
   703   "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
   704   "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 0, 10] 10)
   705 
   706 translations
   707   "INT x y. B"  == "INT x. INT y. B"
   708   "INT x. B"    == "CONST INTER CONST UNIV (%x. B)"
   709   "INT x. B"    == "INT x:CONST UNIV. B"
   710   "INT x:A. B"  == "CONST INTER A (%x. B)"
   711 
   712 print_translation {*
   713   [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax INTER} @{syntax_const "_INTER"}]
   714 *} -- {* to avoid eta-contraction of body *}
   715 
   716 lemma INTER_eq:
   717   "(\<Inter>x\<in>A. B x) = {y. \<forall>x\<in>A. y \<in> B x}"
   718   by (auto simp add: INF_def)
   719 
   720 lemma Inter_image_eq [simp]:
   721   "\<Inter>(B`A) = (\<Inter>x\<in>A. B x)"
   722   by (rule sym) (fact INF_def)
   723 
   724 lemma INT_iff [simp]: "b \<in> (\<Inter>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. b \<in> B x)"
   725   by (auto simp add: INF_def image_def)
   726 
   727 lemma INT_I [intro!]: "(\<And>x. x \<in> A \<Longrightarrow> b \<in> B x) \<Longrightarrow> b \<in> (\<Inter>x\<in>A. B x)"
   728   by (auto simp add: INF_def image_def)
   729 
   730 lemma INT_D [elim, Pure.elim]: "b \<in> (\<Inter>x\<in>A. B x) \<Longrightarrow> a \<in> A \<Longrightarrow> b \<in> B a"
   731   by auto
   732 
   733 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"
   734   -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a\<in>A"}. *}
   735   by (auto simp add: INF_def image_def)
   736 
   737 lemma INT_cong [cong]:
   738   "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)"
   739   by (fact INF_cong)
   740 
   741 lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   742   by blast
   743 
   744 lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
   745   by blast
   746 
   747 lemma INT_lower: "a \<in> A \<Longrightarrow> (\<Inter>x\<in>A. B x) \<subseteq> B a"
   748   by (fact INF_lower)
   749 
   750 lemma INT_greatest: "(\<And>x. x \<in> A \<Longrightarrow> C \<subseteq> B x) \<Longrightarrow> C \<subseteq> (\<Inter>x\<in>A. B x)"
   751   by (fact INF_greatest)
   752 
   753 lemma INT_empty: "(\<Inter>x\<in>{}. B x) = UNIV"
   754   by (fact INF_empty)
   755 
   756 lemma INT_absorb: "k \<in> I \<Longrightarrow> A k \<inter> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. A i)"
   757   by (fact INF_absorb)
   758 
   759 lemma INT_subset_iff: "B \<subseteq> (\<Inter>i\<in>I. A i) \<longleftrightarrow> (\<forall>i\<in>I. B \<subseteq> A i)"
   760   by (fact le_INF_iff)
   761 
   762 lemma INT_insert [simp]: "(\<Inter>x \<in> insert a A. B x) = B a \<inter> INTER A B"
   763   by (fact INF_insert)
   764 
   765 lemma INT_Un: "(\<Inter>i \<in> A \<union> B. M i) = (\<Inter>i \<in> A. M i) \<inter> (\<Inter>i\<in>B. M i)"
   766   by (fact INF_union)
   767 
   768 lemma INT_insert_distrib:
   769   "u \<in> A \<Longrightarrow> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)"
   770   by blast
   771 
   772 lemma INT_constant [simp]: "(\<Inter>y\<in>A. c) = (if A = {} then UNIV else c)"
   773   by (fact INF_constant)
   774 
   775 lemma INTER_UNIV_conv:
   776  "(UNIV = (\<Inter>x\<in>A. B x)) = (\<forall>x\<in>A. B x = UNIV)"
   777  "((\<Inter>x\<in>A. B x) = UNIV) = (\<forall>x\<in>A. B x = UNIV)"
   778   by (fact INF_top_conv)+ (* already simp *)
   779 
   780 lemma INT_bool_eq: "(\<Inter>b. A b) = A True \<inter> A False"
   781   by (fact INF_UNIV_bool_expand)
   782 
   783 lemma INT_anti_mono:
   784   "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)"
   785   -- {* The last inclusion is POSITIVE! *}
   786   by (fact INF_superset_mono)
   787 
   788 lemma Pow_INT_eq: "Pow (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. Pow (B x))"
   789   by blast
   790 
   791 lemma vimage_INT: "f -` (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. f -` B x)"
   792   by blast
   793 
   794 
   795 subsection {* Union *}
   796 
   797 abbreviation Union :: "'a set set \<Rightarrow> 'a set" where
   798   "Union S \<equiv> \<Squnion>S"
   799 
   800 notation (xsymbols)
   801   Union  ("\<Union>_" [90] 90)
   802 
   803 lemma Union_eq:
   804   "\<Union>A = {x. \<exists>B \<in> A. x \<in> B}"
   805 proof (rule set_eqI)
   806   fix x
   807   have "(\<exists>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<exists>B\<in>A. x \<in> B)"
   808     by auto
   809   then show "x \<in> \<Union>A \<longleftrightarrow> x \<in> {x. \<exists>B\<in>A. x \<in> B}"
   810     by (simp add: Sup_fun_def) (simp add: mem_def)
   811 qed
   812 
   813 lemma Union_iff [simp, no_atp]:
   814   "A \<in> \<Union>C \<longleftrightarrow> (\<exists>X\<in>C. A\<in>X)"
   815   by (unfold Union_eq) blast
   816 
   817 lemma UnionI [intro]:
   818   "X \<in> C \<Longrightarrow> A \<in> X \<Longrightarrow> A \<in> \<Union>C"
   819   -- {* The order of the premises presupposes that @{term C} is rigid;
   820     @{term A} may be flexible. *}
   821   by auto
   822 
   823 lemma UnionE [elim!]:
   824   "A \<in> \<Union>C \<Longrightarrow> (\<And>X. A \<in> X \<Longrightarrow> X \<in> C \<Longrightarrow> R) \<Longrightarrow> R"
   825   by auto
   826 
   827 lemma Union_upper: "B \<in> A \<Longrightarrow> B \<subseteq> \<Union>A"
   828   by (fact Sup_upper)
   829 
   830 lemma Union_least: "(\<And>X. X \<in> A \<Longrightarrow> X \<subseteq> C) \<Longrightarrow> \<Union>A \<subseteq> C"
   831   by (fact Sup_least)
   832 
   833 lemma Union_empty: "\<Union>{} = {}"
   834   by (fact Sup_empty) (* already simp *)
   835 
   836 lemma Union_UNIV: "\<Union>UNIV = UNIV"
   837   by (fact Sup_UNIV) (* already simp *)
   838 
   839 lemma Union_insert: "\<Union>insert a B = a \<union> \<Union>B"
   840   by (fact Sup_insert) (* already simp *)
   841 
   842 lemma Union_Un_distrib [simp]: "\<Union>(A \<union> B) = \<Union>A \<union> \<Union>B"
   843   by (fact Sup_union_distrib)
   844 
   845 lemma Union_Int_subset: "\<Union>(A \<inter> B) \<subseteq> \<Union>A \<inter> \<Union>B"
   846   by (fact Sup_inter_less_eq)
   847 
   848 lemma Union_empty_conv [no_atp]: "(\<Union>A = {}) \<longleftrightarrow> (\<forall>x\<in>A. x = {})"
   849   by (fact Sup_bot_conv) (* already simp *)
   850 
   851 lemma empty_Union_conv [no_atp]: "({} = \<Union>A) \<longleftrightarrow> (\<forall>x\<in>A. x = {})"
   852   by (fact Sup_bot_conv) (* already simp *)
   853 
   854 lemma subset_Pow_Union: "A \<subseteq> Pow (\<Union>A)"
   855   by blast
   856 
   857 lemma Union_Pow_eq [simp]: "\<Union>(Pow A) = A"
   858   by blast
   859 
   860 lemma Union_mono: "A \<subseteq> B \<Longrightarrow> \<Union>A \<subseteq> \<Union>B"
   861   by (fact Sup_subset_mono)
   862 
   863 
   864 subsection {* Unions of families *}
   865 
   866 abbreviation UNION :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
   867   "UNION \<equiv> SUPR"
   868 
   869 text {*
   870   Note: must use name @{const UNION} here instead of @{text UN}
   871   to allow the following syntax coexist with the plain constant name.
   872 *}
   873 
   874 syntax
   875   "_UNION1"     :: "pttrns => 'b set => 'b set"           ("(3UN _./ _)" [0, 10] 10)
   876   "_UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3UN _:_./ _)" [0, 0, 10] 10)
   877 
   878 syntax (xsymbols)
   879   "_UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>_./ _)" [0, 10] 10)
   880   "_UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Union>_\<in>_./ _)" [0, 0, 10] 10)
   881 
   882 syntax (latex output)
   883   "_UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
   884   "_UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Union>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 0, 10] 10)
   885 
   886 translations
   887   "UN x y. B"   == "UN x. UN y. B"
   888   "UN x. B"     == "CONST UNION CONST UNIV (%x. B)"
   889   "UN x. B"     == "UN x:CONST UNIV. B"
   890   "UN x:A. B"   == "CONST UNION A (%x. B)"
   891 
   892 text {*
   893   Note the difference between ordinary xsymbol syntax of indexed
   894   unions and intersections (e.g.\ @{text"\<Union>a\<^isub>1\<in>A\<^isub>1. B"})
   895   and their \LaTeX\ rendition: @{term"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}. The
   896   former does not make the index expression a subscript of the
   897   union/intersection symbol because this leads to problems with nested
   898   subscripts in Proof General.
   899 *}
   900 
   901 print_translation {*
   902   [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax UNION} @{syntax_const "_UNION"}]
   903 *} -- {* to avoid eta-contraction of body *}
   904 
   905 lemma UNION_eq [no_atp]:
   906   "(\<Union>x\<in>A. B x) = {y. \<exists>x\<in>A. y \<in> B x}"
   907   by (auto simp add: SUP_def)
   908 
   909 lemma Union_image_eq [simp]:
   910   "\<Union>(B ` A) = (\<Union>x\<in>A. B x)"
   911   by (rule sym) (fact SUP_def)
   912 
   913 lemma UN_iff [simp]: "(b \<in> (\<Union>x\<in>A. B x)) = (\<exists>x\<in>A. b \<in> B x)"
   914   by (auto simp add: SUP_def image_def)
   915 
   916 lemma UN_I [intro]: "a \<in> A \<Longrightarrow> b \<in> B a \<Longrightarrow> b \<in> (\<Union>x\<in>A. B x)"
   917   -- {* The order of the premises presupposes that @{term A} is rigid;
   918     @{term b} may be flexible. *}
   919   by auto
   920 
   921 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"
   922   by (auto simp add: SUP_def image_def)
   923 
   924 lemma UN_cong [cong]:
   925   "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)"
   926   by (fact SUP_cong)
   927 
   928 lemma strong_UN_cong:
   929   "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)"
   930   by (unfold simp_implies_def) (fact UN_cong)
   931 
   932 lemma image_eq_UN: "f ` A = (\<Union>x\<in>A. {f x})"
   933   by blast
   934 
   935 lemma UN_upper: "a \<in> A \<Longrightarrow> B a \<subseteq> (\<Union>x\<in>A. B x)"
   936   by (fact SUP_upper)
   937 
   938 lemma UN_least: "(\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C) \<Longrightarrow> (\<Union>x\<in>A. B x) \<subseteq> C"
   939   by (fact SUP_least)
   940 
   941 lemma Collect_bex_eq [no_atp]: "{x. \<exists>y\<in>A. P x y} = (\<Union>y\<in>A. {x. P x y})"
   942   by blast
   943 
   944 lemma UN_insert_distrib: "u \<in> A \<Longrightarrow> (\<Union>x\<in>A. insert a (B x)) = insert a (\<Union>x\<in>A. B x)"
   945   by blast
   946 
   947 lemma UN_empty [no_atp]: "(\<Union>x\<in>{}. B x) = {}"
   948   by (fact SUP_empty)
   949 
   950 lemma UN_empty2: "(\<Union>x\<in>A. {}) = {}"
   951   by (fact SUP_bot) (* already simp *)
   952 
   953 lemma UN_absorb: "k \<in> I \<Longrightarrow> A k \<union> (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. A i)"
   954   by (fact SUP_absorb)
   955 
   956 lemma UN_insert [simp]: "(\<Union>x\<in>insert a A. B x) = B a \<union> UNION A B"
   957   by (fact SUP_insert)
   958 
   959 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)"
   960   by (fact SUP_union)
   961 
   962 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)"
   963   by blast
   964 
   965 lemma UN_subset_iff: "((\<Union>i\<in>I. A i) \<subseteq> B) = (\<forall>i\<in>I. A i \<subseteq> B)"
   966   by (fact SUP_le_iff)
   967 
   968 lemma UN_constant [simp]: "(\<Union>y\<in>A. c) = (if A = {} then {} else c)"
   969   by (fact SUP_constant)
   970 
   971 lemma image_Union: "f ` \<Union>S = (\<Union>x\<in>S. f ` x)"
   972   by blast
   973 
   974 lemma UNION_empty_conv:
   975   "{} = (\<Union>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. B x = {})"
   976   "(\<Union>x\<in>A. B x) = {} \<longleftrightarrow> (\<forall>x\<in>A. B x = {})"
   977   by (fact SUP_bot_conv)+ (* already simp *)
   978 
   979 lemma Collect_ex_eq [no_atp]: "{x. \<exists>y. P x y} = (\<Union>y. {x. P x y})"
   980   by blast
   981 
   982 lemma ball_UN: "(\<forall>z \<in> UNION A B. P z) \<longleftrightarrow> (\<forall>x\<in>A. \<forall>z \<in> B x. P z)"
   983   by blast
   984 
   985 lemma bex_UN: "(\<exists>z \<in> UNION A B. P z) \<longleftrightarrow> (\<exists>x\<in>A. \<exists>z\<in>B x. P z)"
   986   by blast
   987 
   988 lemma Un_eq_UN: "A \<union> B = (\<Union>b. if b then A else B)"
   989   by (auto simp add: split_if_mem2)
   990 
   991 lemma UN_bool_eq: "(\<Union>b. A b) = (A True \<union> A False)"
   992   by (fact SUP_UNIV_bool_expand)
   993 
   994 lemma UN_Pow_subset: "(\<Union>x\<in>A. Pow (B x)) \<subseteq> Pow (\<Union>x\<in>A. B x)"
   995   by blast
   996 
   997 lemma UN_mono:
   998   "A \<subseteq> B \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<subseteq> g x) \<Longrightarrow>
   999     (\<Union>x\<in>A. f x) \<subseteq> (\<Union>x\<in>B. g x)"
  1000   by (fact SUP_subset_mono)
  1001 
  1002 lemma vimage_Union: "f -` (\<Union>A) = (\<Union>X\<in>A. f -` X)"
  1003   by blast
  1004 
  1005 lemma vimage_UN: "f -` (\<Union>x\<in>A. B x) = (\<Union>x\<in>A. f -` B x)"
  1006   by blast
  1007 
  1008 lemma vimage_eq_UN: "f -` B = (\<Union>y\<in>B. f -` {y})"
  1009   -- {* NOT suitable for rewriting *}
  1010   by blast
  1011 
  1012 lemma image_UN: "f ` UNION A B = (\<Union>x\<in>A. f ` B x)"
  1013   by blast
  1014 
  1015 lemma UN_singleton [simp]: "(\<Union>x\<in>A. {x}) = A"
  1016   by blast
  1017 
  1018 
  1019 subsection {* Distributive laws *}
  1020 
  1021 lemma Int_Union: "A \<inter> \<Union>B = (\<Union>C\<in>B. A \<inter> C)"
  1022   by (fact inf_Sup)
  1023 
  1024 lemma Un_Inter: "A \<union> \<Inter>B = (\<Inter>C\<in>B. A \<union> C)"
  1025   by (fact sup_Inf)
  1026 
  1027 lemma Int_Union2: "\<Union>B \<inter> A = (\<Union>C\<in>B. C \<inter> A)"
  1028   by (fact Sup_inf)
  1029 
  1030 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)"
  1031   by (rule sym) (rule INF_inf_distrib)
  1032 
  1033 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)"
  1034   by (rule sym) (rule SUP_sup_distrib)
  1035 
  1036 lemma Int_Inter_image: "(\<Inter>x\<in>C. A x \<inter> B x) = \<Inter>(A ` C) \<inter> \<Inter>(B ` C)"
  1037   by (simp only: INT_Int_distrib INF_def)
  1038 
  1039 lemma Un_Union_image: "(\<Union>x\<in>C. A x \<union> B x) = \<Union>(A ` C) \<union> \<Union>(B ` C)"
  1040   -- {* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: *}
  1041   -- {* Union of a family of unions *}
  1042   by (simp only: UN_Un_distrib SUP_def)
  1043 
  1044 lemma Un_INT_distrib: "B \<union> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. B \<union> A i)"
  1045   by (fact sup_INF)
  1046 
  1047 lemma Int_UN_distrib: "B \<inter> (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. B \<inter> A i)"
  1048   -- {* Halmos, Naive Set Theory, page 35. *}
  1049   by (fact inf_SUP)
  1050 
  1051 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)"
  1052   by (fact SUP_inf_distrib2)
  1053 
  1054 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)"
  1055   by (fact INF_sup_distrib2)
  1056 
  1057 lemma Union_disjoint: "(\<Union>C \<inter> A = {}) \<longleftrightarrow> (\<forall>B\<in>C. B \<inter> A = {})"
  1058   by (fact Sup_inf_eq_bot_iff)
  1059 
  1060 
  1061 subsection {* Complement *}
  1062 
  1063 lemma Compl_INT [simp]: "- (\<Inter>x\<in>A. B x) = (\<Union>x\<in>A. -B x)"
  1064   by (fact uminus_INF)
  1065 
  1066 lemma Compl_UN [simp]: "- (\<Union>x\<in>A. B x) = (\<Inter>x\<in>A. -B x)"
  1067   by (fact uminus_SUP)
  1068 
  1069 
  1070 subsection {* Miniscoping and maxiscoping *}
  1071 
  1072 text {* \medskip Miniscoping: pushing in quantifiers and big Unions
  1073            and Intersections. *}
  1074 
  1075 lemma UN_simps [simp]:
  1076   "\<And>a B C. (\<Union>x\<in>C. insert a (B x)) = (if C={} then {} else insert a (\<Union>x\<in>C. B x))"
  1077   "\<And>A B C. (\<Union>x\<in>C. A x \<union> B) = ((if C={} then {} else (\<Union>x\<in>C. A x) \<union> B))"
  1078   "\<And>A B C. (\<Union>x\<in>C. A \<union> B x) = ((if C={} then {} else A \<union> (\<Union>x\<in>C. B x)))"
  1079   "\<And>A B C. (\<Union>x\<in>C. A x \<inter> B) = ((\<Union>x\<in>C. A x) \<inter> B)"
  1080   "\<And>A B C. (\<Union>x\<in>C. A \<inter> B x) = (A \<inter>(\<Union>x\<in>C. B x))"
  1081   "\<And>A B C. (\<Union>x\<in>C. A x - B) = ((\<Union>x\<in>C. A x) - B)"
  1082   "\<And>A B C. (\<Union>x\<in>C. A - B x) = (A - (\<Inter>x\<in>C. B x))"
  1083   "\<And>A B. (\<Union>x\<in>\<Union>A. B x) = (\<Union>y\<in>A. \<Union>x\<in>y. B x)"
  1084   "\<And>A B C. (\<Union>z\<in>UNION A B. C z) = (\<Union>x\<in>A. \<Union>z\<in>B x. C z)"
  1085   "\<And>A B f. (\<Union>x\<in>f`A. B x) = (\<Union>a\<in>A. B (f a))"
  1086   by auto
  1087 
  1088 lemma INT_simps [simp]:
  1089   "\<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)"
  1090   "\<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))"
  1091   "\<And>A B C. (\<Inter>x\<in>C. A x - B) = (if C={} then UNIV else (\<Inter>x\<in>C. A x) - B)"
  1092   "\<And>A B C. (\<Inter>x\<in>C. A - B x) = (if C={} then UNIV else A - (\<Union>x\<in>C. B x))"
  1093   "\<And>a B C. (\<Inter>x\<in>C. insert a (B x)) = insert a (\<Inter>x\<in>C. B x)"
  1094   "\<And>A B C. (\<Inter>x\<in>C. A x \<union> B) = ((\<Inter>x\<in>C. A x) \<union> B)"
  1095   "\<And>A B C. (\<Inter>x\<in>C. A \<union> B x) = (A \<union> (\<Inter>x\<in>C. B x))"
  1096   "\<And>A B. (\<Inter>x\<in>\<Union>A. B x) = (\<Inter>y\<in>A. \<Inter>x\<in>y. B x)"
  1097   "\<And>A B C. (\<Inter>z\<in>UNION A B. C z) = (\<Inter>x\<in>A. \<Inter>z\<in>B x. C z)"
  1098   "\<And>A B f. (\<Inter>x\<in>f`A. B x) = (\<Inter>a\<in>A. B (f a))"
  1099   by auto
  1100 
  1101 lemma UN_ball_bex_simps [simp, no_atp]:
  1102   "\<And>A P. (\<forall>x\<in>\<Union>A. P x) \<longleftrightarrow> (\<forall>y\<in>A. \<forall>x\<in>y. P x)"
  1103   "\<And>A B P. (\<forall>x\<in>UNION A B. P x) = (\<forall>a\<in>A. \<forall>x\<in> B a. P x)"
  1104   "\<And>A P. (\<exists>x\<in>\<Union>A. P x) \<longleftrightarrow> (\<exists>y\<in>A. \<exists>x\<in>y. P x)"
  1105   "\<And>A B P. (\<exists>x\<in>UNION A B. P x) \<longleftrightarrow> (\<exists>a\<in>A. \<exists>x\<in>B a. P x)"
  1106   by auto
  1107 
  1108 
  1109 text {* \medskip Maxiscoping: pulling out big Unions and Intersections. *}
  1110 
  1111 lemma UN_extend_simps:
  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)))"
  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))"
  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))"
  1115   "\<And>A B C. ((\<Union>x\<in>C. A x) \<inter> B) = (\<Union>x\<in>C. A x \<inter> B)"
  1116   "\<And>A B C. (A \<inter> (\<Union>x\<in>C. B x)) = (\<Union>x\<in>C. A \<inter> B x)"
  1117   "\<And>A B C. ((\<Union>x\<in>C. A x) - B) = (\<Union>x\<in>C. A x - B)"
  1118   "\<And>A B C. (A - (\<Inter>x\<in>C. B x)) = (\<Union>x\<in>C. A - B x)"
  1119   "\<And>A B. (\<Union>y\<in>A. \<Union>x\<in>y. B x) = (\<Union>x\<in>\<Union>A. B x)"
  1120   "\<And>A B C. (\<Union>x\<in>A. \<Union>z\<in>B x. C z) = (\<Union>z\<in>UNION A B. C z)"
  1121   "\<And>A B f. (\<Union>a\<in>A. B (f a)) = (\<Union>x\<in>f`A. B x)"
  1122   by auto
  1123 
  1124 lemma INT_extend_simps:
  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))"
  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))"
  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))"
  1128   "\<And>A B C. A - (\<Union>x\<in>C. B x) = (if C={} then A else (\<Inter>x\<in>C. A - B x))"
  1129   "\<And>a B C. insert a (\<Inter>x\<in>C. B x) = (\<Inter>x\<in>C. insert a (B x))"
  1130   "\<And>A B C. ((\<Inter>x\<in>C. A x) \<union> B) = (\<Inter>x\<in>C. A x \<union> B)"
  1131   "\<And>A B C. A \<union> (\<Inter>x\<in>C. B x) = (\<Inter>x\<in>C. A \<union> B x)"
  1132   "\<And>A B. (\<Inter>y\<in>A. \<Inter>x\<in>y. B x) = (\<Inter>x\<in>\<Union>A. B x)"
  1133   "\<And>A B C. (\<Inter>x\<in>A. \<Inter>z\<in>B x. C z) = (\<Inter>z\<in>UNION A B. C z)"
  1134   "\<And>A B f. (\<Inter>a\<in>A. B (f a)) = (\<Inter>x\<in>f`A. B x)"
  1135   by auto
  1136 
  1137 text {* Finally *}
  1138 
  1139 no_notation
  1140   less_eq  (infix "\<sqsubseteq>" 50) and
  1141   less (infix "\<sqsubset>" 50) and
  1142   bot ("\<bottom>") and
  1143   top ("\<top>") and
  1144   inf  (infixl "\<sqinter>" 70) and
  1145   sup  (infixl "\<squnion>" 65) and
  1146   Inf  ("\<Sqinter>_" [900] 900) and
  1147   Sup  ("\<Squnion>_" [900] 900)
  1148 
  1149 no_syntax (xsymbols)
  1150   "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
  1151   "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
  1152   "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Squnion>_./ _)" [0, 10] 10)
  1153   "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Squnion>_\<in>_./ _)" [0, 0, 10] 10)
  1154 
  1155 lemmas mem_simps =
  1156   insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff
  1157   mem_Collect_eq UN_iff Union_iff INT_iff Inter_iff
  1158   -- {* Each of these has ALREADY been added @{text "[simp]"} above. *}
  1159 
  1160 end