-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathCompactSystem.lean
More file actions
449 lines (383 loc) · 18.9 KB
/
CompactSystem.lean
File metadata and controls
449 lines (383 loc) · 18.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
/-
Copyright (c) 2025 Peter Pfaffelhuber. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Rémy Degenne, Peter Pfaffelhuber
-/
module
public import Mathlib.Data.Set.Constructions
public import Mathlib.MeasureTheory.PiSystem
public import Mathlib.Order.SupClosed
public import Mathlib.Topology.Separation.Hausdorff
/-!
# Compact systems
This file defines compact systems of sets.
## Main definitions
* `IsCompactSystem`: A set of sets is a compact system if, whenever a countable subfamily has empty
intersection, then finitely many of them already have empty intersection.
## Main results
* `isCompactSystem_insert_univ_iff`: A set system is a compact system iff inserting `univ`
gives a compact system.
* `isCompactSystem_isCompact_isClosed`: The set of closed and compact sets is a compact system.
* `isCompactSystem_isCompact`: In a `T2Space`, the set of compact sets is a compact system.
* `IsCompactSystem.union_isCompactSystem`If `IsCompactSystem S`, the set of finite unions of sets
in `S` is also a compact system.
-/
@[expose] public section
open Set Finset Nat
variable {α : Type*} {S : Set (Set α)} {C : ℕ → Set α}
section definition
/-- A set of sets is a compact system if, whenever a countable subfamily has empty intersection,
then finitely many of them already have empty intersection. -/
def IsCompactSystem (S : Set (Set α)) : Prop :=
∀ C : ℕ → Set α, (∀ i, C i ∈ S) → ⋂ i, C i = ∅ → ∃ (n : ℕ), dissipate C n = ∅
end definition
namespace IsCompactSystem
lemma of_nonempty_iInter
(h : ∀ C : ℕ → Set α, (∀ i, C i ∈ S) → (∀ n, (dissipate C n).Nonempty) → (⋂ i, C i).Nonempty) :
IsCompactSystem S := by
intro C hC
contrapose!
exact h C hC
lemma nonempty_iInter (hp : IsCompactSystem S) {C : ℕ → Set α} (hC : ∀ i, C i ∈ S)
(h_nonempty : ∀ n, (dissipate C n).Nonempty) :
(⋂ i, C i).Nonempty := by
revert h_nonempty
contrapose!
exact hp C hC
theorem iff_nonempty_iInter (S : Set (Set α)) :
IsCompactSystem S ↔
∀ C : ℕ → Set α, (∀ i, C i ∈ S) → (∀ n, (dissipate C n).Nonempty) → (⋂ i, C i).Nonempty :=
⟨nonempty_iInter, of_nonempty_iInter⟩
lemma iff_nonempty_iInter_of_lt' (S : Set (Set α)) : IsCompactSystem S ↔
∀ C : ℕ → Set α, (∀ i, C i ∈ S) →
(∀ n, (⋂ k : Fin (n + 1), C k).Nonempty) → (⋂ i, C i).Nonempty := by
rw [iff_nonempty_iInter]
simp_rw [dissipate_eq_ofFin]
@[simp]
lemma of_IsEmpty [IsEmpty α] (S : Set (Set α)) : IsCompactSystem S :=
fun s _ _ ↦ ⟨0, Set.eq_empty_of_isEmpty (dissipate s 0)⟩
/-- Any subset of a compact system is a compact system. -/
theorem mono {T : Set (Set α)} (hT : IsCompactSystem T) (hST : S ⊆ T) :
IsCompactSystem S := fun C hC1 hC2 ↦ hT C (fun i ↦ hST (hC1 i)) hC2
/-- Inserting `∅` into a compact system gives a compact system. -/
lemma insert_empty (h : IsCompactSystem S) : IsCompactSystem (insert ∅ S) := by
intro s h' hd
by_cases! g : ∃ n, s n = ∅
· use g.choose
rw [← subset_empty_iff] at hd ⊢
exact (dissipate_subset le_rfl).trans g.choose_spec.le
· exact h s (fun i ↦ (mem_of_mem_insert_of_ne (h' i) (g i).ne_empty)) hd
/-- Inserting `univ` into a compact system gives a compact system. -/
lemma insert_univ (h : IsCompactSystem S) : IsCompactSystem (insert univ S) := by
rcases isEmpty_or_nonempty α with hα | _
· simp
rw [IsCompactSystem.iff_nonempty_iInter] at h ⊢
intro s h' hd
by_cases! h₀ : ∀ n, s n ∉ S
· simp_all
classical
let n := Nat.find h₀
let s' := fun i ↦ if s i ∈ S then s i else s n
have h₁ : ∀ i, s' i ∈ S := by grind
have h₂ : ⋂ i, s i = ⋂ i, s' i := by ext; simp; grind
apply h₂ ▸ h s' h₁
by_contra! ⟨j, hj⟩
have h₃ (v : ℕ) (hv : n ≤ v) : dissipate s v = dissipate s' v := by ext; simp; grind
have h₇ : dissipate s' (max j n) = ∅ := by
rw [← subset_empty_iff] at hj ⊢
exact (antitone_dissipate (Nat.le_max_left j n)).trans hj
specialize h₃ (max j n) (Nat.le_max_right j n)
specialize hd (max j n)
simp [h₃, h₇] at hd
end IsCompactSystem
/-- In this equivalent formulation for a compact system,
note that we use `⋂ k < n, C k` rather than `⋂ k ≤ n, C k`. -/
lemma isCompactSystem_iff_nonempty_iInter_of_lt (S : Set (Set α)) :
IsCompactSystem S ↔
∀ C : ℕ → Set α, (∀ i, C i ∈ S) → (∀ n, (⋂ k < n, C k).Nonempty) → (⋂ i, C i).Nonempty := by
simp_rw [IsCompactSystem.iff_nonempty_iInter]
refine ⟨fun h C hi h'↦ h C hi (fun n ↦ dissipate_eq_biInter_lt ▸ (h' (n + 1))),
fun h C hi h' ↦ h C hi ?_⟩
simp_rw [Set.nonempty_iff_ne_empty] at h' ⊢
refine fun n g ↦ h' n ?_
simp_rw [← subset_empty_iff, dissipate] at g ⊢
exact le_trans (fun x ↦ by simp; grind) g
/-- A set system is a compact system iff adding `∅` gives a compact system. -/
lemma isCompactSystem_insert_empty_iff :
IsCompactSystem (insert ∅ S) ↔ IsCompactSystem S :=
⟨fun h ↦ h.mono (subset_insert _ _), .insert_empty⟩
/-- A set system is a compact system iff adding `univ` gives a compact system. -/
lemma isCompactSystem_insert_univ_iff : IsCompactSystem (insert univ S) ↔ IsCompactSystem S :=
⟨fun h ↦ h.mono (subset_insert _ _), .insert_univ⟩
/-- To prove that a set of sets is a compact system, it suffices to consider directed families of
sets. -/
theorem isCompactSystem_iff_of_directed (hpi : IsPiSystem S) :
IsCompactSystem S ↔
∀ (C : ℕ → Set α), Directed (· ⊇ ·) C → (∀ i, C i ∈ S) → ⋂ i, C i = ∅ → ∃ n, C n = ∅ := by
rw [← isCompactSystem_insert_empty_iff]
refine ⟨fun h ↦ fun C hdi hi ↦ ?_, fun h C h1 h2 ↦ ?_⟩
· rw [← exists_dissipate_eq_empty_iff_of_directed hdi]
exact h C (by simp [hi])
rw [← biInter_le_eq_iInter] at h2
suffices (∀ n, dissipate C n ∈ S ∨ dissipate C n = ∅) ∧ (⋂ n, dissipate C n = ∅) by
by_cases! f : ∀ n, dissipate C n ∈ S
· exact h (dissipate C) directed_dissipate f this.2
· obtain ⟨n, hn⟩ := f
exact ⟨n, by simpa [hn] using this.1 n⟩
refine ⟨fun n ↦ ?_, h2⟩
by_cases g : (dissipate C n).Nonempty
· simpa [or_comm] using hpi.insert_empty.dissipate_mem h1 n g
· exact .inr (Set.not_nonempty_iff_eq_empty.mp g)
/-- To prove that a set of sets is a compact system, it suffices to consider directed families of
sets. -/
theorem isCompactSystem_iff_nonempty_iInter_of_directed (hpi : IsPiSystem S) :
IsCompactSystem S ↔
∀ (C : ℕ → Set α), (Directed (· ⊇ ·) C) → (∀ i, C i ∈ S) → (∀ n, (C n).Nonempty) →
(⋂ i, C i).Nonempty := by
rw [isCompactSystem_iff_of_directed hpi]
refine ⟨fun h1 C h3 h4 ↦ ?_, fun h1 C h3 s ↦ ?_⟩ <;> contrapose!
· exact h1 C h3 h4
· exact h1 C h3 s
section IsCompactIsClosed
/-- The set of compact and closed sets is a compact system. -/
theorem isCompactSystem_isCompact_isClosed (α : Type*) [TopologicalSpace α] :
IsCompactSystem {s : Set α | IsCompact s ∧ IsClosed s} := by
refine IsCompactSystem.of_nonempty_iInter fun C hC_cc h_nonempty ↦ ?_
rw [← iInter_dissipate]
refine IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed (Set.dissipate C)
(fun n ↦ ?_) h_nonempty ?_ (fun n ↦ isClosed_biInter (fun i _ ↦ (hC_cc i).2))
· exact Set.antitone_dissipate (by lia)
· simpa using (hC_cc 0).1
/-- In a `T2Space` the set of compact sets is a compact system. -/
theorem isCompactSystem_isCompact (α : Type*) [TopologicalSpace α] [T2Space α] :
IsCompactSystem {s : Set α | IsCompact s} := by
convert isCompactSystem_isCompact_isClosed α with s
simpa using IsCompact.isClosed
/-- The set of sets which are either compact and closed, or `univ`, is a compact system. -/
theorem isCompactSystem_insert_univ_isCompact_isClosed (α : Type*) [TopologicalSpace α] :
IsCompactSystem (insert univ {s : Set α | IsCompact s ∧ IsClosed s}) :=
(isCompactSystem_isCompact_isClosed α).insert_univ
end IsCompactIsClosed
section PrefixInduction
-- Should this section be private, or moved to a different file?
/- In this section, we prove a general induction principle, which we need for the construction
`Nat.prefixInduction q step0 step : (k : ℕ) → (β k)` based on some
`q : (n : ℕ) → (k : (i : Fin n) → (β i)) → Prop`. For
the induction start, `step0 : q 0 _` always holds since `Fin 0` cannot be satisfied, and
`step : (n : ℕ) → (k : (i : Fin n) → β i) → q n k → { a : β n // q (n + 1) (Fin.snoc k a) })`
`(n : ℕ) : β n` constructs the next element satisfying `q (n + 1) _` from a proof of `q n k`
and finding the next element.
In comparison to other induction principles, the proofs of `q n k` are needed in order to find
the next element. -/
variable {β : ℕ → Type*} (q : ∀ n, (k : (i : Fin n) → β i) → Prop) (step0 : q 0 Fin.rec0)
(step : ∀ n (k : (i : Fin n) → β i) (_ : q n k), { a : β n // q (n + 1) (Fin.snoc k a)})
def Nat.prefixInduction.aux : ∀ (n : Nat), { k : (i : Fin n) → β i // q n k }
| 0 => ⟨Fin.rec0, step0⟩
| n + 1 =>
let ⟨k, hk⟩ := aux n
let ⟨a, ha⟩ := step n k hk
⟨Fin.snoc k a, ha⟩
theorem Nat.prefixInduction.auxConsistent (n : ℕ) (i : Fin n) :
(Nat.prefixInduction.aux q step0 step (i + 1)).1 (Fin.last i) =
(Nat.prefixInduction.aux q step0 step n).1 i := by
revert i
induction n with
| zero => simp
| succ n ih =>
apply Fin.lastCases
case last => simp
case cast =>
intro i
simp_rw [Fin.val_castSucc, ih, aux]
simp
/-- An induction principle showing that `q : (n : ℕ) → (k : (i : Fin n) → (β i)) → Prop` holds
for all `n`. `step0` is satisfied by construction since `Fin 0` is empty.
In the induction `step`, we use that `q n k` holds for showing that `q (n + 1) (Fin.snoc k a)`
holds for some `a : β n`. -/
def Nat.prefixInduction (n : Nat) : β n :=
(Nat.prefixInduction.aux q step0 step (n + 1)).1 (Fin.last n)
theorem Nat.prefixInduction_spec (n : Nat) : q n (Nat.prefixInduction q step0 step ·) := by
cases n with
| zero => convert step0
| succ n =>
have hk := (Nat.prefixInduction.aux q step0 step (n + 1)).2
convert hk with i
apply Nat.prefixInduction.auxConsistent
/- Often, `step` can only be proved by showing an `∃` statement. For this case, we use `step'`. -/
variable (step' : ∀ n (k : (i : Fin n) → β i) (_ : q n k), ∃ a, q (n + 1) (Fin.snoc k a))
/-- This version is noncomputable since it relies on an `∃`-statement -/
noncomputable def Nat.prefixInduction' (n : Nat) : β n :=
(Nat.prefixInduction.aux q step0
(fun n k hn ↦ ⟨(step' n k hn).choose, (step' n k hn).choose_spec⟩) (n + 1)).1 (Fin.last n)
theorem Nat.prefixInduction'_spec (n : Nat) : q n (Nat.prefixInduction' q step0 step' ·) := by
apply prefixInduction_spec
end PrefixInduction
section Union
/- For a reference of `union.isCompactSystem`, see Pfanzagl, Pierlo.
Compact Systems of Sets. Springer, 1966, Lemma 1.4. -/
namespace IsCompactSystem
variable {L : ℕ → Finset (Set α)} {n : ℕ} {K : (k : Fin n) → Set α}
/-- `q n K` is the joint property that `∀ (k : Fin n), K k ∈ L k` and
`∀ N, (⋂ (j : Fin n), K j) ∩ (⋂ (k < N), ⋃₀ ↑(L (n + k))) ≠ ∅`.` holds. -/
def q (L : ℕ → Finset (Set α)) (n : ℕ) (K : (k : Fin n) → Set α) : Prop :=
(∀ k : Fin n, K k ∈ L k) ∧ ∀ N, ((⋂ j, K j) ∩ ⋂ k < N, ⋃₀ L (n + k)).Nonempty
lemma q_iff_iInter (hK : ∀ k : Fin n, K k ∈ L k) :
q L n K ↔
∀ N, ((⋂ (j : ℕ) (hj : j < n), K ⟨j, hj⟩) ∩
(⋂ k < N, ⋃₀ L (n + k))).Nonempty := by
simp only [q, hK, implies_true, true_and]
congr! 2 with N
ext
simp
grind
lemma q_snoc_iff_iInter (hK : ∀ k : Fin n, K k ∈ L k) (y : Set α) :
q L (n + 1) (Fin.snoc K y) ↔
y ∈ L n ∧
(∀ N, ((⋂ (j : ℕ) (hj : j < n), K ⟨j, hj⟩) ∩ y ∩ (⋂ k < N, ⋃₀ L (n + k))).Nonempty) := by
simp only [q]
have h_imp : q L (n + 1) (Fin.snoc K y) → y ∈ L n := by
intro ⟨h_mem, h⟩
specialize h_mem ⟨n, by grind⟩
simpa [Fin.snoc] using h_mem
refine ⟨fun h' ↦ ⟨h_imp h', fun N ↦ ?_⟩, fun ⟨hy, h⟩ ↦ ⟨fun k ↦ ?_, fun N ↦ ?_⟩⟩
· have ⟨h_mem, h⟩ := h'
obtain ⟨x, ⟨hx1, hx2⟩⟩ := h N
use x
simp only [mem_iInter, mem_sUnion, SetLike.mem_coe, mem_inter_iff] at hx1 hx2 ⊢
refine ⟨⟨fun i hi ↦ ?_, ?_⟩, fun i hi ↦ ?_⟩
· simpa [Fin.snoc, hi] using hx1 ⟨i, hi.trans_le (le_succ n)⟩
· simpa [Fin.snoc] using hx1 ⟨n, Nat.lt_add_one n⟩
· have hy := h_imp h'
cases i with
| zero =>
specialize hx1 ⟨n, Nat.lt_add_one n⟩
simp only [Fin.snoc, lt_self_iff_false, ↓reduceDIte, cast_eq] at hx1
exact ⟨y, hy, hx1⟩
| succ n =>
have hj' : n < N := by grind
grind
· unfold Fin.snoc
by_cases hkn : k = n
· simpa [hkn]
· have hkn' : k < n := by grind
grind
· specialize h (N + 1)
rw [Set.inter_nonempty_iff_exists_left] at h ⊢
obtain ⟨x, ⟨hx1, hx2⟩⟩ := h
use x
simp only [mem_inter_iff, mem_iInter, mem_sUnion, SetLike.mem_coe] at hx1 hx2 ⊢
exact ⟨by simp [Fin.snoc]; grind, by grind⟩
lemma step0 {L : ℕ → Finset (Set α)} (hL : ∀ N, (⋂ k < N, ⋃₀ (L k : Set (Set α))).Nonempty) :
q L 0 Fin.rec0 :=
⟨by simp, by simpa using hL⟩
lemma inter_sUnion_eq_empty (s : Set α) (L : Set (Set α)) :
(∀ a ∈ L, s ∩ a = ∅) ↔ s ∩ ⋃₀ L = ∅ := by
simp_rw [← disjoint_iff_inter_eq_empty]
exact Iff.symm disjoint_sUnion_right
lemma step' {L : ℕ → Finset (Set α)} (n : ℕ) (K : (k : Fin n) → Set α) (hK : q L n K) :
∃ a, q L (n + 1) (Fin.snoc K a) := by
have hK' := hK.1
simp_rw [q_iff_iInter hK'] at hK
simp_rw [q_snoc_iff_iInter hK'] at ⊢
by_contra! h
choose b hb using h
classical
let b' := fun x ↦ dite (x ∈ (L n)) (fun c ↦ b x c) (fun _ ↦ 0)
have hs : (L n : Set (Set α)).Nonempty := by
specialize hK 1
rw [Set.nonempty_def] at hK ⊢
simp only [lt_one_iff, iInter_iInter_eq_left, add_zero, mem_inter_iff, mem_iInter, mem_sUnion,
Finset.mem_coe] at hK ⊢
obtain ⟨x, ⟨hx1, ⟨t, ⟨ht1, ht2⟩⟩⟩⟩ := hK
use t
obtain ⟨K0Max, ⟨hK0₁, hK0₂⟩⟩ := Finset.exists_max_image (L (Fin.last n)) b' hs
simp_rw [Set.nonempty_iff_ne_empty] at hK
apply hK (b' K0Max + 1)
have h₂ (a : Set α) (ha : a ∈ L n) :
⋂ k < b' K0Max, ⋃₀ L (n + k) ⊆ ⋂ k < b a ha, ⋃₀ (L (n + k) : Set (Set α)) := by
intro x hx
simp only [mem_iInter, mem_sUnion, SetLike.mem_coe] at hx ⊢
have f : b' a = b a ha := by simp [b', ha]
exact fun i hi ↦ hx i (hi.trans_le (f ▸ hK0₂ a ha))
have h₃ (a : Set α) (ha : a ∈ L (Fin.last n)) : (⋂ (j) (hj : j < n), K ⟨j, hj⟩) ∩ a ∩
⋂ k < b' K0Max, ⋃₀ L (n + k) = ∅ := by
rw [← subset_empty_iff, ← hb a ha]
exact inter_subset_inter (fun ⦃a⦄ a ↦ a) (h₂ a ha)
simp_rw [inter_comm, inter_assoc] at h₃
simp_rw [← disjoint_iff_inter_eq_empty] at h₃ ⊢
simp only [Fin.val_last] at h₃
have h₃'' := disjoint_iff_inter_eq_empty.mp (disjoint_sUnion_left.mpr h₃)
rw [inter_comm, inter_assoc, ← disjoint_iff_inter_eq_empty] at h₃''
apply disjoint_of_subset (fun ⦃a⦄ a ↦ a) _ h₃''
simp only [subset_inter_iff, subset_iInter_iff]
refine ⟨fun i hi x hx ↦ ?_, fun x hx ↦ ?_⟩
· simp only [mem_iInter, mem_sUnion, SetLike.mem_coe] at hx ⊢
obtain ⟨t, ht⟩ := hx i (lt_trans hi (Nat.lt_add_one _))
use t
· simp only [mem_iInter, mem_sUnion, SetLike.mem_coe] at hx ⊢
obtain ⟨t, ht⟩ := hx 0 (zero_lt_succ _)
use t
simpa
/-- For `L : ℕ → Finset (Set α)` such that `L n ⊆ K` and
`h : ∀ N, ⋂ k < N, ⋃₀ L k ≠ ∅`, `memOfUnion h n` is some `K : ℕ → Set α` such that `K n ∈ L n`
for all `n` (this is `prop₀`) and `∀ N, ⋂ (j < n, K j) ∩ ⋂ (k < N), (⋃₀ L (n + k)) ≠ ∅`
(this is `prop₁`.) -/
noncomputable def memOfUnion (L : ℕ → Finset (Set α))
(hL : ∀ N, (⋂ k < N, ⋃₀ (L k : Set (Set α))).Nonempty) :
ℕ → Set α :=
Nat.prefixInduction' (q L) (step0 hL) step'
theorem memOfUnion.spec (L : ℕ → Finset (Set α))
(hL : ∀ N, (⋂ k < N, ⋃₀ (L k : Set (Set α))).Nonempty) (n : ℕ) :
q L n (fun k : Fin n ↦ memOfUnion L hL k) :=
Nat.prefixInduction'_spec (β := fun _ ↦ Set α) (q L) (step0 hL) step' n
lemma sInter_memOfUnion_nonempty (L : ℕ → Finset (Set α))
(hL : ∀ N, (⋂ k, ⋂ (_ : k < N), ⋃₀ (L k : Set (Set α))).Nonempty) (n : ℕ) :
(⋂ (j : Fin n), memOfUnion L hL j).Nonempty := by
simpa using (memOfUnion.spec L hL n).2 0
lemma sInter_memOfUnion_isSubset (L : ℕ → Finset (Set α))
(hL : ∀ N, (⋂ k < N, ⋃₀ (L k : Set (Set α))).Nonempty) :
(⋂ j, memOfUnion L hL j) ⊆ ⋂ k, ⋃₀ L k := by
exact iInter_mono <| fun n ↦
subset_sUnion_of_subset (L n) (memOfUnion L hL n) (fun ⦃a⦄ a ↦ a)
((memOfUnion.spec L hL (n + 1)).1 ⟨n, by grind⟩)
lemma mem_subClosure_set_iff (s : Set α) :
s ∈ supClosure S ↔ ∃ L : Finset (Set α), L.Nonempty ∧ s = ⋃₀ L ∧ ↑L ⊆ S := by
refine ⟨fun ⟨L, hL⟩ ↦ ?_, fun h ↦ ?_⟩
· choose hL_nonempty hL_subset hL_sup using hL
refine ⟨L, hL_nonempty, ?_, hL_subset⟩
rw [← hL_sup, ← Finset.sup_id_set_eq_sUnion, Finset.sup'_eq_sup]
· obtain ⟨L, hL_nonempty, hL_eq, hL_subset⟩ := h
refine ⟨L, hL_nonempty, hL_subset, ?_⟩
rw [hL_eq, ← Finset.sup_id_set_eq_sUnion, Finset.sup'_eq_sup]
lemma mem_subClosure_insert_empty_iff (s : Set α) :
s ∈ supClosure (insert ∅ S) ↔
∃ L : Finset (Set α), s = ⋃₀ L ∧ ↑L ⊆ insert ∅ S := by
rw [mem_subClosure_set_iff]
refine ⟨fun ⟨L, hL_nonempty, hL_eq, hL_subset⟩ ↦ ⟨L, hL_eq, hL_subset⟩,
fun ⟨L, hL_eq, hL_subset⟩ ↦ ?_⟩
classical
refine ⟨if L.Nonempty then L else {∅}, ?_, ?_, ?_⟩
· split_ifs
· simpa
· simp
· rcases Finset.eq_empty_or_nonempty L with (rfl | hL_nonempty)
· simpa using hL_eq
· simpa [hL_nonempty]
· intro
simp
grind
/- If `IsCompactSystem S`, the set of finite unions of sets in `S` is also a compact system. -/
theorem isCompactSystem_supClosure_insert_empty (S : Set (Set α)) (hS : IsCompactSystem S) :
IsCompactSystem (supClosure (insert ∅ S)) := by
simp_rw [isCompactSystem_iff_nonempty_iInter_of_lt, mem_subClosure_insert_empty_iff]
intro C hi
choose L' hL'_eq hL'_mem using hi
simp_rw [hL'_eq]
intro hL'_nonempty
refine Nonempty.mono (sInter_memOfUnion_isSubset L' hL'_nonempty) ?_
exact (IsCompactSystem.iff_nonempty_iInter_of_lt' (insert ∅ S)).mp hS.insert_empty
(fun k ↦ memOfUnion L' hL'_nonempty k)
(fun i ↦ hL'_mem i <| (memOfUnion.spec L' hL'_nonempty (i + 1)).1 ⟨i, by grind⟩)
(fun n ↦ sInter_memOfUnion_nonempty L' hL'_nonempty (n + 1))
end IsCompactSystem
end Union