# Documentation

Mathlib.Order.Zorn

# Zorn's lemmas #

This file proves several formulations of Zorn's Lemma.

## Variants #

The primary statement of Zorn's lemma is exists_maximal_of_chains_bounded. Then it is specialized to particular relations:

• (≤)≤) with zorn_partialOrder
• (⊆)⊆) with zorn_subset
• (⊇)⊇) with zorn_superset

Lemma names carry modifiers:

• ₀: Quantifies over a set, as opposed to over a type.
• _nonempty: Doesn't ask to prove that the empty chain is bounded and lets you give an element that will be smaller than the maximal element found (the maximal element is no smaller than any other element, but it can also be incomparable to some).

## How-to #

This file comes across as confusing to those who haven't yet used it, so here is a detailed walkthrough:

1. Know what relation on which type/set you're looking for. See Variants above. You can discharge some conditions to Zorn's lemma directly using a _nonempty variant.
2. Write down the definition of your type/set, put a suffices : ∃ m, ∀ a, m ≺ a → a ≺ m, { ... },∃ m, ∀ a, m ≺ a → a ≺ m, { ... },∀ a, m ≺ a → a ≺ m, { ... },≺ a → a ≺ m, { ... },→ a ≺ m, { ... },≺ m, { ... }, (or whatever you actually need) followed by a apply some_version_of_zorn.
3. Fill in the details. This is where you start talking about chains.

A typical proof using Zorn could look like this (TODO: update to mathlib4)

lemma zorny_lemma : zorny_statement :=
begin
let s : set α := {x | whatever x},
suffices : ∃ x ∈ s, ∀ y ∈ s, y ⊆ x → y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end
∃ x ∈ s, ∀ y ∈ s, y ⊆ x → y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end
∈ s, ∀ y ∈ s, y ⊆ x → y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end
∀ y ∈ s, y ⊆ x → y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end
∈ s, y ⊆ x → y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end
⊆ x → y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end
→ y = x, -- or with another operator
{ exact proof_post_zorn },
apply zorn_subset, -- or another variant
rintro c hcs hc,
obtain rfl | hcnemp := c.eq_empty_or_nonempty, -- you might need to disjunct on c empty or not
{ exact ⟨edge_case_construction,
proof_that_edge_case_construction_respects_whatever,
proof_that_edge_case_construction_contains_all_stuff_in_c⟩ },
exact ⟨construction,
proof_that_construction_respects_whatever,
proof_that_construction_contains_all_stuff_in_c⟩,
end


## Notes #

Originally ported from Isabelle/HOL. The original file was written by Jacques D. Fleuriot, Tobias Nipkow, Christian Sternagel.

theorem exists_maximal_of_chains_bounded {α : Type u_1} {r : ααProp} (h : ∀ (c : Set α), IsChain r cub, (a : α) → a cr a ub) (trans : {a b c : α} → r a br b cr a c) :
m, (a : α) → r m ar a m

Zorn's lemma

If every chain has an upper bound, then there exists a maximal element.

theorem exists_maximal_of_nonempty_chains_bounded {α : Type u_1} {r : ααProp} [inst : ] (h : ∀ (c : Set α), IsChain r cub, (a : α) → a cr a ub) (trans : {a b c : α} → r a br b cr a c) :
m, (a : α) → r m ar a m

A variant of Zorn's lemma. If every nonempty chain of a nonempty type has an upper bound, then there is a maximal element.

theorem zorn_preorder {α : Type u_1} [inst : ] (h : ∀ (c : Set α), IsChain (fun x x_1 => x x_1) c) :
m, ∀ (a : α), m aa m
theorem zorn_nonempty_preorder {α : Type u_1} [inst : ] [inst : ] (h : ∀ (c : Set α), IsChain (fun x x_1 => x x_1) c) :
m, ∀ (a : α), m aa m
theorem zorn_preorder₀ {α : Type u_1} [inst : ] (s : Set α) (ih : ∀ (c : Set α), c sIsChain (fun x x_1 => x x_1) cub, ub s ∀ (z : α), z cz ub) :
m, m s ∀ (z : α), z sm zz m
theorem zorn_nonempty_preorder₀ {α : Type u_1} [inst : ] (s : Set α) (ih : ∀ (c : Set α), c sIsChain (fun x x_1 => x x_1) c∀ (y : α), y cub, ub s ∀ (z : α), z cz ub) (x : α) (hxs : x s) :
m, m s x m ∀ (z : α), z sm zz m
theorem zorn_nonempty_Ici₀ {α : Type u_1} [inst : ] (a : α) (ih : ∀ (c : Set α), c IsChain (fun x x_1 => x x_1) c∀ (y : α), y cub, a ub ∀ (z : α), z cz ub) (x : α) (hax : a x) :
m, x m ∀ (z : α), m zz m
theorem zorn_partialOrder {α : Type u_1} [inst : ] (h : ∀ (c : Set α), IsChain (fun x x_1 => x x_1) c) :
m, ∀ (a : α), m aa = m
theorem zorn_nonempty_partialOrder {α : Type u_1} [inst : ] [inst : ] (h : ∀ (c : Set α), IsChain (fun x x_1 => x x_1) c) :
m, ∀ (a : α), m aa = m
theorem zorn_partialOrder₀ {α : Type u_1} [inst : ] (s : Set α) (ih : ∀ (c : Set α), c sIsChain (fun x x_1 => x x_1) cub, ub s ∀ (z : α), z cz ub) :
m, m s ∀ (z : α), z sm zz = m
theorem zorn_nonempty_partialOrder₀ {α : Type u_1} [inst : ] (s : Set α) (ih : ∀ (c : Set α), c sIsChain (fun x x_1 => x x_1) c∀ (y : α), y cub, ub s ∀ (z : α), z cz ub) (x : α) (hxs : x s) :
m, m s x m ∀ (z : α), z sm zz = m
theorem zorn_subset {α : Type u_1} (S : Set (Set α)) (h : ∀ (c : Set (Set α)), c SIsChain (fun x x_1 => x x_1) cub, ub S ∀ (s : Set α), s cs ub) :
m, m S ∀ (a : Set α), a Sm aa = m
theorem zorn_subset_nonempty {α : Type u_1} (S : Set (Set α)) (H : ∀ (c : Set (Set α)), c SIsChain (fun x x_1 => x x_1) cub, ub S ∀ (s : Set α), s cs ub) (x : Set α) (hx : x S) :
m, m S x m ∀ (a : Set α), a Sm aa = m
theorem zorn_superset {α : Type u_1} (S : Set (Set α)) (h : ∀ (c : Set (Set α)), c SIsChain (fun x x_1 => x x_1) clb, lb S ∀ (s : Set α), s clb s) :
m, m S ∀ (a : Set α), a Sa ma = m
theorem zorn_superset_nonempty {α : Type u_1} (S : Set (Set α)) (H : ∀ (c : Set (Set α)), c SIsChain (fun x x_1 => x x_1) clb, lb S ∀ (s : Set α), s clb s) (x : Set α) (hx : x S) :
m, m S m x ∀ (a : Set α), a Sa ma = m
theorem IsChain.exists_maxChain {α : Type u_1} {r : ααProp} {c : Set α} (hc : IsChain r c) :
M, c M

Every chain is contained in a maximal chain. This generalizes Hausdorff's maximality principle.