2
2
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
3
3
Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Johannes Hölzl
5
+ -/
6
+ import data.set.lattice
7
+
8
+ /-!
9
+ # Chains and Zorn's lemmas
10
+
11
+ This file defines chains for an arbitrary relation and proves several formulations of Zorn's Lemma,
12
+ along with Hausdorff's Maximality Principle.
13
+
14
+ ## Main declarations
15
+
16
+ * `chain c`: A chain `c` is a set of comparable elements.
17
+ * `max_chain_spec`: Hausdorff's Maximality Principle.
18
+ * `exists_maximal_of_chains_bounded`: Zorn's Lemma. Many variants are offered.
5
19
6
- Zorn's lemmas.
20
+ ## Notes
7
21
8
- Ported from Isabelle/HOL (written by Jacques D. Fleuriot, Tobias Nipkow, and Christian Sternagel).
22
+ Ported from Isabelle/HOL. The
23
+ [ original file ] (https://isabelle.in.tum.de/dist/library/HOL/HOL/Zorn.html) was written by Jacques D.
24
+ Fleuriot, Tobias Nipkow, Christian Sternagel.
9
25
-/
10
- import data.set.lattice
26
+
11
27
noncomputable theory
12
28
13
29
universes u
@@ -20,36 +36,35 @@ section chain
20
36
parameters {α : Type u} (r : α → α → Prop )
21
37
local infix ` ≺ `:50 := r
22
38
23
- /-- A chain is a subset `c` satisfying
24
- `x ≺ y ∨ x = y ∨ y ≺ x` for all `x y ∈ c`. -/
39
+ /-- A chain is a subset `c` satisfying `x ≺ y ∨ x = y ∨ y ≺ x` for all `x y ∈ c`. -/
25
40
def chain (c : set α) := pairwise_on c (λ x y, x ≺ y ∨ y ≺ x)
26
41
parameters {r}
27
42
28
- theorem chain.total_of_refl [is_refl α r]
43
+ lemma chain.total_of_refl [is_refl α r]
29
44
{c} (H : chain c) {x y} (hx : x ∈ c) (hy : y ∈ c) :
30
45
x ≺ y ∨ y ≺ x :=
31
46
if e : x = y then or.inl (e ▸ refl _) else H _ hx _ hy e
32
47
33
- theorem chain.mono {c c'} :
48
+ lemma chain.mono {c c'} :
34
49
c' ⊆ c → chain c → chain c' :=
35
50
pairwise_on.mono
36
51
37
- theorem chain.directed_on [is_refl α r] {c} (H : chain c) :
52
+ lemma chain.directed_on [is_refl α r] {c} (H : chain c) :
38
53
directed_on (≺) c :=
39
- assume x hx y hy,
54
+ λ x hx y hy,
40
55
match H.total_of_refl hx hy with
41
56
| or.inl h := ⟨y, hy, h, refl _⟩
42
57
| or.inr h := ⟨x, hx, refl _, h⟩
43
58
end
44
59
45
- theorem chain_insert {c : set α} {a : α} (hc : chain c) (ha : ∀ b ∈ c, b ≠ a → a ≺ b ∨ b ≺ a) :
60
+ lemma chain_insert {c : set α} {a : α} (hc : chain c) (ha : ∀ b ∈ c, b ≠ a → a ≺ b ∨ b ≺ a) :
46
61
chain (insert a c) :=
47
62
forall_insert_of_forall
48
- (assume x hx, forall_insert_of_forall (hc x hx) (assume hneq, (ha x hx hneq).symm))
63
+ (λ x hx, forall_insert_of_forall (hc x hx) (λ hneq, (ha x hx hneq).symm))
49
64
(forall_insert_of_forall
50
- (assume x hx hneq, ha x hx $ assume h', hneq h'.symm) (assume h, (h rfl).rec _))
65
+ (λ x hx hneq, ha x hx $ λ h', hneq h'.symm) (λ h, (h rfl).rec _))
51
66
52
- /-- `super_chain c₁ c₂` means that `c₂ is a chain that strictly includes `c₁`. -/
67
+ /-- `super_chain c₁ c₂` means that `c₂` is a chain that strictly includes `c₁`. -/
53
68
def super_chain (c₁ c₂ : set α) : Prop := chain c₂ ∧ c₁ ⊂ c₂
54
69
55
70
/-- A chain `c` is a maximal chain if there does not exists a chain strictly including `c`. -/
@@ -60,54 +75,54 @@ is one of these chains. Otherwise it is `c`. -/
60
75
def succ_chain (c : set α) : set α :=
61
76
if h : ∃ c', chain c ∧ super_chain c c' then some h else c
62
77
63
- theorem succ_spec {c : set α} (h : ∃ c', chain c ∧ super_chain c c') :
78
+ lemma succ_spec {c : set α} (h : ∃ c', chain c ∧ super_chain c c') :
64
79
super_chain c (succ_chain c) :=
65
80
let ⟨c', hc'⟩ := h in
66
81
have chain c ∧ super_chain c (some h),
67
82
from @some_spec _ (λc', chain c ∧ super_chain c c') _,
68
83
by simp [succ_chain, dif_pos, h, this.right]
69
84
70
- theorem chain_succ {c : set α} (hc : chain c) :
85
+ lemma chain_succ {c : set α} (hc : chain c) :
71
86
chain (succ_chain c) :=
72
87
if h : ∃ c', chain c ∧ super_chain c c' then
73
88
(succ_spec h).left
74
89
else
75
90
by simp [succ_chain, dif_neg, h]; exact hc
76
91
77
- theorem super_of_not_max {c : set α} (hc₁ : chain c) (hc₂ : ¬ is_max_chain c) :
92
+ lemma super_of_not_max {c : set α} (hc₁ : chain c) (hc₂ : ¬ is_max_chain c) :
78
93
super_chain c (succ_chain c) :=
79
94
begin
80
95
simp [is_max_chain, not_and_distrib, not_forall_not] at hc₂,
81
96
cases hc₂.neg_resolve_left hc₁ with c' hc',
82
97
exact succ_spec ⟨c', hc₁, hc'⟩
83
98
end
84
99
85
- theorem succ_increasing {c : set α} :
100
+ lemma succ_increasing {c : set α} :
86
101
c ⊆ succ_chain c :=
87
102
if h : ∃ c', chain c ∧ super_chain c c' then
88
103
have super_chain c (succ_chain c), from succ_spec h,
89
104
this.right.left
90
105
else by simp [succ_chain, dif_neg, h, subset.refl]
91
106
92
107
/-- Set of sets reachable from `∅` using `succ_chain` and `⋃₀`. -/
93
- inductive chain_closure : set α → Prop
108
+ inductive chain_closure : set (set α)
94
109
| succ : ∀ {s}, chain_closure s → chain_closure (succ_chain s)
95
110
| union : ∀ {s}, (∀ a ∈ s, chain_closure a) → chain_closure (⋃₀ s)
96
111
97
- theorem chain_closure_empty :
98
- chain_closure ∅ :=
112
+ lemma chain_closure_empty :
113
+ ∅ ∈ chain_closure :=
99
114
have chain_closure (⋃₀ ∅),
100
- from chain_closure.union $ assume a h, h.rec _,
115
+ from chain_closure.union $ λ a h, h.rec _,
101
116
by simp at this ; assumption
102
117
103
- theorem chain_closure_closure :
104
- chain_closure ( ⋃₀ chain_closure) :=
105
- chain_closure.union $ assume s hs, hs
118
+ lemma chain_closure_closure :
119
+ ⋃₀ chain_closure ∈ chain_closure :=
120
+ chain_closure.union $ λ s hs, hs
106
121
107
122
variables {c c₁ c₂ c₃ : set α}
108
123
109
- private lemma chain_closure_succ_total_aux (hc₁ : chain_closure c₁ ) (hc₂ : chain_closure c₂ )
110
- (h : ∀ {c₃}, chain_closure c₃ → c₃ ⊆ c₂ → c₂ = c₃ ∨ succ_chain c₃ ⊆ c₂) :
124
+ private lemma chain_closure_succ_total_aux (hc₁ : c₁ ∈ chain_closure ) (hc₂ : c₂ ∈ chain_closure )
125
+ (h : ∀ {c₃}, c₃ ∈ chain_closure → c₃ ⊆ c₂ → c₂ = c₃ ∨ succ_chain c₃ ⊆ c₂) :
111
126
c₁ ⊆ c₂ ∨ succ_chain c₂ ⊆ c₁ :=
112
127
begin
113
128
induction hc₁,
@@ -125,26 +140,26 @@ begin
125
140
exact subset.trans h (subset_sUnion_of_mem ha) }
126
141
end
127
142
128
- private lemma chain_closure_succ_total (hc₁ : chain_closure c₁ ) (hc₂ : chain_closure c₂ )
143
+ private lemma chain_closure_succ_total (hc₁ : c₁ ∈ chain_closure ) (hc₂ : c₂ ∈ chain_closure )
129
144
(h : c₁ ⊆ c₂) :
130
145
c₂ = c₁ ∨ succ_chain c₁ ⊆ c₂ :=
131
146
begin
132
147
induction hc₂ generalizing c₁ hc₁ h,
133
148
case succ : c₂ hc₂ ih {
134
149
have h₁ : c₁ ⊆ c₂ ∨ @succ_chain α r c₂ ⊆ c₁ :=
135
- (chain_closure_succ_total_aux hc₁ hc₂ $ assume c₁, ih),
150
+ (chain_closure_succ_total_aux hc₁ hc₂ $ λ c₁, ih),
136
151
cases h₁ with h₁ h₁,
137
152
{ have h₂ := ih hc₁ h₁,
138
153
cases h₂ with h₂ h₂,
139
154
{ exact (or.inr $ h₂ ▸ subset.refl _) },
140
155
{ exact (or.inr $ subset.trans h₂ succ_increasing) } },
141
156
{ exact (or.inl $ subset.antisymm h₁ h) } },
142
157
case union : s hs ih {
143
- apply or.imp_left (assume h', subset.antisymm h' h),
158
+ apply or.imp_left (λ h', subset.antisymm h' h),
144
159
apply classical.by_contradiction,
145
160
simp [not_or_distrib, sUnion_subset_iff, not_forall],
146
161
intros c₃ hc₃ h₁ h₂,
147
- have h := chain_closure_succ_total_aux hc₁ (hs c₃ hc₃) (assume c₄, ih _ hc₃),
162
+ have h := chain_closure_succ_total_aux hc₁ (hs c₃ hc₃) (λ c₄, ih _ hc₃),
148
163
cases h with h h,
149
164
{ have h' := ih c₃ hc₃ hc₁ h,
150
165
cases h' with h' h',
@@ -153,52 +168,51 @@ begin
153
168
{ exact (h₁ $ subset.trans succ_increasing h) } }
154
169
end
155
170
156
- theorem chain_closure_total (hc₁ : chain_closure c₁ ) (hc₂ : chain_closure c₂ ) :
171
+ lemma chain_closure_total (hc₁ : c₁ ∈ chain_closure ) (hc₂ : c₂ ∈ chain_closure ) :
157
172
c₁ ⊆ c₂ ∨ c₂ ⊆ c₁ :=
158
- have c₁ ⊆ c₂ ∨ succ_chain c₂ ⊆ c₁,
159
- from chain_closure_succ_total_aux hc₁ hc₂ $ assume c₃ hc₃, chain_closure_succ_total hc₃ hc₂,
160
- or.imp_right (assume : succ_chain c₂ ⊆ c₁, subset.trans succ_increasing this ) this
173
+ or.imp_right succ_increasing.trans $ chain_closure_succ_total_aux hc₁ hc₂ $ λ c₃ hc₃,
174
+ chain_closure_succ_total hc₃ hc₂
161
175
162
- theorem chain_closure_succ_fixpoint (hc₁ : chain_closure c₁ ) (hc₂ : chain_closure c₂ )
176
+ lemma chain_closure_succ_fixpoint (hc₁ : c₁ ∈ chain_closure ) (hc₂ : c₂ ∈ chain_closure )
163
177
(h_eq : succ_chain c₂ = c₂) :
164
178
c₁ ⊆ c₂ :=
165
179
begin
166
180
induction hc₁,
167
181
case succ : c₁ hc₁ h {
168
182
exact or.elim (chain_closure_succ_total hc₁ hc₂ h)
169
- (assume h, h ▸ h_eq.symm ▸ subset.refl c₂) id },
183
+ (λ h, h ▸ h_eq.symm ▸ subset.refl c₂) id },
170
184
case union : s hs ih {
171
- exact (sUnion_subset $ assume c₁ hc₁, ih c₁ hc₁) }
185
+ exact (sUnion_subset $ λ c₁ hc₁, ih c₁ hc₁) }
172
186
end
173
187
174
- theorem chain_closure_succ_fixpoint_iff (hc : chain_closure c ) :
188
+ lemma chain_closure_succ_fixpoint_iff (hc : c ∈ chain_closure ) :
175
189
succ_chain c = c ↔ c = ⋃₀ chain_closure :=
176
- ⟨assume h, subset.antisymm
177
- (subset_sUnion_of_mem hc)
190
+ ⟨λ h, (subset_sUnion_of_mem hc).antisymm
178
191
(chain_closure_succ_fixpoint chain_closure_closure hc h),
179
- assume : c = ⋃₀{c : set α | chain_closure c} ,
192
+ λ h ,
180
193
subset.antisymm
181
- (calc succ_chain c ⊆ ⋃₀{c : set α | chain_closure c } :
194
+ (calc succ_chain c ⊆ ⋃₀{c : set α | c ∈ chain_closure } :
182
195
subset_sUnion_of_mem $ chain_closure.succ hc
183
- ... = c : this .symm)
196
+ ... = c : h .symm)
184
197
succ_increasing⟩
185
198
186
- theorem chain_chain_closure (hc : chain_closure c ) :
199
+ lemma chain_chain_closure (hc : c ∈ chain_closure ) :
187
200
chain c :=
188
201
begin
189
202
induction hc,
190
203
case succ : c hc h {
191
204
exact chain_succ h },
192
205
case union : s hs h {
193
206
have h : ∀ c ∈ s, zorn.chain c := h,
194
- exact assume c₁ ⟨t₁, ht₁, (hc₁ : c₁ ∈ t₁)⟩ c₂ ⟨t₂, ht₂, (hc₂ : c₂ ∈ t₂)⟩ hneq,
207
+ exact λ c₁ ⟨t₁, ht₁, (hc₁ : c₁ ∈ t₁)⟩ c₂ ⟨t₂, ht₂, (hc₂ : c₂ ∈ t₂)⟩ hneq,
195
208
have t₁ ⊆ t₂ ∨ t₂ ⊆ t₁, from chain_closure_total (hs _ ht₁) (hs _ ht₂),
196
209
or.elim this
197
- (assume : t₁ ⊆ t₂ , h t₂ ht₂ c₁ (this hc₁) c₂ hc₂ hneq)
198
- (assume : t₂ ⊆ t₁ , h t₁ ht₁ c₁ hc₁ c₂ (this hc₂) hneq) }
210
+ (λ ht , h t₂ ht₂ c₁ (ht hc₁) c₂ hc₂ hneq)
211
+ (λ ht , h t₁ ht₁ c₁ hc₁ c₂ (ht hc₂) hneq) }
199
212
end
200
213
201
- /-- `max_chain` is the union of all sets in the chain closure. -/
214
+ /-- An explicit maximal chain. `max_chain` is taken to be the union of all sets in `chain_closure`.
215
+ -/
202
216
def max_chain := ⋃₀ chain_closure
203
217
204
218
/-- Hausdorff's maximality principle
@@ -207,36 +221,32 @@ There exists a maximal totally ordered subset of `α`.
207
221
Note that we do not require `α` to be partially ordered by `r`. -/
208
222
theorem max_chain_spec :
209
223
is_max_chain max_chain :=
210
- classical.by_contradiction $
211
- assume : ¬ is_max_chain (⋃₀ chain_closure),
212
- have super_chain (⋃₀ chain_closure) (succ_chain (⋃₀ chain_closure)),
213
- from super_of_not_max (chain_chain_closure chain_closure_closure) this ,
214
- let ⟨h₁, H⟩ := this ,
215
- ⟨h₂, (h₃ : (⋃₀ chain_closure) ≠ succ_chain (⋃₀ chain_closure))⟩ := ssubset_iff_subset_ne.1 H in
216
- have succ_chain (⋃₀ chain_closure) = (⋃₀ chain_closure),
217
- from (chain_closure_succ_fixpoint_iff chain_closure_closure).mpr rfl,
218
- h₃ this.symm
224
+ classical.by_contradiction $ λ h,
225
+ begin
226
+ obtain ⟨h₁, H⟩ := super_of_not_max (chain_chain_closure chain_closure_closure) h,
227
+ obtain ⟨h₂, h₃⟩ := ssubset_iff_subset_ne.1 H,
228
+ exact h₃ ((chain_closure_succ_fixpoint_iff chain_closure_closure).mpr rfl).symm,
229
+ end
219
230
220
231
/-- Zorn's lemma
221
232
222
- If every chain has an upper bound, then there is a maximal element -/
233
+ If every chain has an upper bound, then there exists a maximal element. -/
223
234
theorem exists_maximal_of_chains_bounded (h : ∀ c, chain c → ∃ ub, ∀ a ∈ c, a ≺ ub)
224
235
(trans : ∀ {a b c}, a ≺ b → b ≺ c → a ≺ c) :
225
236
∃ m, ∀ a, m ≺ a → a ≺ m :=
226
237
have ∃ ub, ∀ a ∈ max_chain, a ≺ ub,
227
238
from h _ $ max_chain_spec.left,
228
239
let ⟨ub, (hub : ∀ a ∈ max_chain, a ≺ ub)⟩ := this in
229
- ⟨ub, assume a ha,
240
+ ⟨ub, λ a ha,
230
241
have chain (insert a max_chain),
231
- from chain_insert max_chain_spec.left $ assume b hb _, or.inr $ trans (hub b hb) ha,
242
+ from chain_insert max_chain_spec.left $ λ b hb _, or.inr $ trans (hub b hb) ha,
232
243
have a ∈ max_chain, from
233
- classical.by_contradiction $ assume h : a ∉ max_chain,
244
+ classical.by_contradiction $ λ h : a ∉ max_chain,
234
245
max_chain_spec.right $ ⟨insert a max_chain, this , ssubset_insert h⟩,
235
246
hub a this ⟩
236
247
237
- /--
238
- If every nonempty chain of a nonempty type has an upper bound, then there is a maximal element.
239
- (A variant of Zorn's lemma.)
248
+ /-- A variant of Zorn's lemma. If every nonempty chain of a nonempty type has an upper bound, then
249
+ there is a maximal element.
240
250
-/
241
251
theorem exists_maximal_of_nonempty_chains_bounded [nonempty α]
242
252
(h : ∀ c, chain c → c.nonempty → ∃ ub, ∀ a ∈ c, a ≺ ub)
@@ -253,15 +263,15 @@ end chain
253
263
254
264
-- This lemma isn't under section `chain` because `parameters` messes up with it. Feel free to fix it
255
265
/-- This can be used to turn `zorn.chain (≥)` into `zorn.chain (≤)` and vice-versa. -/
256
- theorem chain.symm {α : Type u} {s : set α} {q : α → α → Prop } (h : chain q s) :
266
+ lemma chain.symm {α : Type u} {s : set α} {q : α → α → Prop } (h : chain q s) :
257
267
chain (flip q) s :=
258
268
h.mono' (λ _ _, or.symm)
259
269
260
270
theorem zorn_partial_order {α : Type u} [partial_order α]
261
271
(h : ∀ c : set α, chain (≤) c → ∃ ub, ∀ a ∈ c, a ≤ ub) :
262
272
∃ m : α, ∀ a, m ≤ a → a = m :=
263
- let ⟨m, hm⟩ := @exists_maximal_of_chains_bounded α (≤) h (assume a b c, le_trans) in
264
- ⟨m, assume a ha, le_antisymm (hm a ha) ha⟩
273
+ let ⟨m, hm⟩ := @exists_maximal_of_chains_bounded α (≤) h (λ a b c, le_trans) in
274
+ ⟨m, λ a ha, le_antisymm (hm a ha) ha⟩
265
275
266
276
theorem zorn_nonempty_partial_order {α : Type u} [partial_order α] [nonempty α]
267
277
(h : ∀ (c : set α), chain (≤) c → c.nonempty → ∃ ub, ∀ a ∈ c, a ≤ ub) :
@@ -285,8 +295,8 @@ theorem zorn_nonempty_partial_order₀ {α : Type u} [partial_order α] (s : set
285
295
∃ m ∈ s, x ≤ m ∧ ∀ z ∈ s, m ≤ z → z = m :=
286
296
let ⟨⟨m, hms, hxm⟩, h⟩ := @zorn_partial_order {m // m ∈ s ∧ x ≤ m} _
287
297
(λ c hc, c.eq_empty_or_nonempty.elim
288
- (assume hce, hce.symm ▸ ⟨⟨x, hxs, le_refl _⟩, λ _, false.elim⟩)
289
- (assume ⟨m, hmc⟩,
298
+ (λ hce, hce.symm ▸ ⟨⟨x, hxs, le_refl _⟩, λ _, false.elim⟩)
299
+ (λ ⟨m, hmc⟩,
290
300
let ⟨ub, hubs, hub⟩ := ih (subtype.val '' c) (image_subset_iff.2 $ λ z hzc, z.2 .1 )
291
301
(by rintro _ ⟨p, hpc, rfl⟩ _ ⟨q, hqc, rfl⟩ hpq;
292
302
exact hc p hpc q hqc (mt (by rintro rfl; refl) hpq)) m.1 (mem_image_of_mem _ hmc) in
@@ -315,11 +325,11 @@ theorem zorn_superset_nonempty {α : Type u} (S : set (set α))
315
325
@zorn_nonempty_partial_order₀ (order_dual (set α)) _ S (λ c cS hc y yc, H _ cS
316
326
hc.symm ⟨y, yc⟩) _ hx
317
327
318
- theorem chain.total {α : Type u} [preorder α] {c : set α} (H : chain (≤) c) :
328
+ lemma chain.total {α : Type u} [preorder α] {c : set α} (H : chain (≤) c) :
319
329
∀ {x y}, x ∈ c → y ∈ c → x ≤ y ∨ y ≤ x :=
320
330
λ x y, H.total_of_refl
321
331
322
- theorem chain.image {α β : Type *} (r : α → α → Prop ) (s : β → β → Prop ) (f : α → β)
332
+ lemma chain.image {α β : Type *} (r : α → α → Prop ) (s : β → β → Prop ) (f : α → β)
323
333
(h : ∀ x y, r x y → s (f x) (f y)) {c : set α} (hrc : chain r c) :
324
334
chain s (f '' c) :=
325
335
λ x ⟨a, ha₁, ha₂⟩ y ⟨b, hb₁, hb₂⟩, ha₂ ▸ hb₂ ▸ λ hxy,
@@ -328,12 +338,12 @@ theorem chain.image {α β : Type*} (r : α → α → Prop) (s : β → β →
328
338
329
339
end zorn
330
340
331
- theorem directed_of_chain {α β r} [is_refl β r] {f : α → β} {c : set α}
341
+ lemma directed_of_chain {α β r} [is_refl β r] {f : α → β} {c : set α}
332
342
(h : zorn.chain (f ⁻¹'o r) c) :
333
343
directed r (λ x : {a : α // a ∈ c}, f x) :=
334
- assume ⟨a, ha⟩ ⟨b, hb⟩, classical.by_cases
335
- (assume : a = b, by simp only [this , exists_prop, and_self, subtype.exists];
344
+ λ ⟨a, ha⟩ ⟨b, hb⟩, classical.by_cases
345
+ (λ hab : a = b, by simp only [hab , exists_prop, and_self, subtype.exists];
336
346
exact ⟨b, hb, refl _⟩)
337
- (assume : a ≠ b , (h a ha b hb this ).elim
347
+ (λ hab , (h a ha b hb hab ).elim
338
348
(λ h : r (f a) (f b), ⟨⟨b, hb⟩, h, refl _⟩)
339
349
(λ h : r (f b) (f a), ⟨⟨a, ha⟩, refl _, h⟩))
0 commit comments