Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit dbbd696

Browse files
committed
feat(order/ideal): order ideals, cofinal sets and the Rasiowa-Sikorski lemma (#2850)
We define order ideals and cofinal sets, and use them to prove the (very simple) Rasiowa-Sikorski lemma: given a countable family of cofinal subsets of an inhabited preorder, there is an upwards directed set meeting each one. This provides an API for certain recursive constructions.
1 parent d204daa commit dbbd696

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

src/order/ideal.lean

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/-
2+
Copyright (c) 2020 David Wärn. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: David Wärn
5+
-/
6+
import order.basic
7+
import data.equiv.encodable
8+
9+
/-!
10+
# Order ideals, cofinal sets, and the Rasiowa–Sikorski lemma
11+
12+
## Main definitions
13+
14+
We work with a preorder `P` throughout.
15+
16+
- `ideal P`: the type of upward directed, downward closed subsets of `P`.
17+
Dual to the notion of a filter on a preorder.
18+
- `cofinal P`: the type of subsets of `P` containing arbitrarily large elements.
19+
Dual to the notion of 'dense set' used in forcing.
20+
- `ideal_of_cofinals p 𝒟`, where `p : P`, and `𝒟` is a countable family of cofinal
21+
subsets of P: an ideal in `P` which contains `p` and intersects every set in `𝒟`.
22+
23+
## References
24+
25+
- https://en.wikipedia.org/wiki/Ideal_(order_theory)
26+
- https://en.wikipedia.org/wiki/Cofinal_(mathematics)
27+
- https://en.wikipedia.org/wiki/Rasiowa–Sikorski_lemma
28+
29+
Note that for the Rasiowa–Sikorski lemma, Wikipedia uses the opposite ordering on `P`,
30+
in line with most presentations of forcing.
31+
32+
## Tags
33+
34+
ideal, cofinal, dense, countable, generic
35+
36+
-/
37+
38+
namespace order
39+
40+
variables {P : Type*} [preorder P]
41+
42+
/-- An ideal on a preorder `P` is a subset of `P` that is
43+
- nonempty
44+
- upward directed
45+
- downward closed. -/
46+
structure ideal (P) [preorder P] :=
47+
(carrier : set P)
48+
(nonempty : carrier.nonempty)
49+
(directed : directed_on (≤) carrier)
50+
(mem_of_le : ∀ {x y : P}, x ≤ y → y ∈ carrier → x ∈ carrier)
51+
52+
namespace ideal
53+
54+
/-- The smallest ideal containing a given element. -/
55+
def principal (p : P) : ideal P :=
56+
{ carrier := { x | x ≤ p },
57+
nonempty := ⟨p, le_refl _⟩,
58+
directed := λ x hx y hy, ⟨p, le_refl _, hx, hy⟩,
59+
mem_of_le := λ x y hxy hy, le_trans hxy hy, }
60+
61+
instance [inhabited P] : inhabited (ideal P) :=
62+
⟨ideal.principal $ default P⟩
63+
64+
instance : has_mem P (ideal P) := ⟨λ x I, x ∈ I.carrier⟩
65+
66+
end ideal
67+
68+
/-- For a preorder `P`, `cofinal P` is the type of subsets of `P`
69+
containing arbitrarily large elements. They are the dense sets in
70+
the topology whose open sets are terminal segments. -/
71+
structure cofinal (P) [preorder P] :=
72+
(carrier : set P)
73+
(mem_gt : ∀ x : P, ∃ y ∈ carrier, x ≤ y)
74+
75+
instance : inhabited (cofinal P) :=
76+
⟨{ carrier := set.univ, mem_gt := λ x, ⟨x, trivial, le_refl _⟩}⟩
77+
78+
instance : has_mem P (cofinal P) := ⟨λ x D, x ∈ D.carrier⟩
79+
80+
namespace cofinal
81+
82+
variables (D : cofinal P) (x : P)
83+
/-- A (noncomputable) element of a cofinal set lying above a given element. -/
84+
noncomputable def above : P := classical.some $ D.mem_gt x
85+
86+
lemma above_mem : D.above x ∈ D :=
87+
exists.elim (classical.some_spec $ D.mem_gt x) $ λ a _, a
88+
89+
lemma le_above : x ≤ D.above x :=
90+
exists.elim (classical.some_spec $ D.mem_gt x) $ λ _ b, b
91+
92+
end cofinal
93+
94+
section ideal_of_cofinals
95+
96+
variables (p : P) {ι : Type*} [encodable ι] (𝒟 : ι → cofinal P)
97+
98+
/-- Given a starting point, and a countable family of cofinal sets,
99+
this is an increasing sequence that intersects each cofinal set. -/
100+
noncomputable def sequence_of_cofinals : ℕ → P
101+
| 0 := p
102+
| (n+1) := match encodable.decode ι n with
103+
| none := sequence_of_cofinals n
104+
| some i := (𝒟 i).above (sequence_of_cofinals n)
105+
end
106+
107+
lemma sequence_of_cofinals.monotone : monotone (sequence_of_cofinals p 𝒟) :=
108+
by { apply monotone_of_monotone_nat, intros n, dunfold sequence_of_cofinals,
109+
cases encodable.decode ι n, { refl }, { apply cofinal.le_above }, }
110+
111+
lemma sequence_of_cofinals.encode_mem (i : ι) :
112+
sequence_of_cofinals p 𝒟 (encodable.encode i + 1) ∈ 𝒟 i :=
113+
by { dunfold sequence_of_cofinals, rw encodable.encodek, apply cofinal.above_mem, }
114+
115+
/-- Given an element `p : P` and a family `𝒟` of cofinal subsets of a preorder `P`,
116+
indexed by a countable type, `ideal_of_cofinals p 𝒟` is an ideal in `P` which
117+
- contains `p`, according to `mem_ideal_of_cofinals p 𝒟`, and
118+
- intersects every set in `𝒟`, according to `cofinal_meets_ideal_of_cofinals p 𝒟`.
119+
120+
This proves the Rasiowa–Sikorski lemma. -/
121+
def ideal_of_cofinals : ideal P :=
122+
{ carrier := { x : P | ∃ n, x ≤ sequence_of_cofinals p 𝒟 n },
123+
nonempty := ⟨p, 0, le_refl _⟩,
124+
directed := λ x ⟨n, hn⟩ y ⟨m, hm⟩,
125+
⟨_, ⟨max n m, le_refl _⟩,
126+
le_trans hn $ sequence_of_cofinals.monotone p 𝒟 (le_max_left _ _),
127+
le_trans hm $ sequence_of_cofinals.monotone p 𝒟 (le_max_right _ _) ⟩,
128+
mem_of_le := λ x y hxy ⟨n, hn⟩, ⟨n, le_trans hxy hn⟩, }
129+
130+
lemma mem_ideal_of_cofinals : p ∈ ideal_of_cofinals p 𝒟 := ⟨0, le_refl _⟩
131+
132+
/-- `ideal_of_cofinals p 𝒟` is `𝒟`-generic. -/
133+
lemma cofinal_meets_ideal_of_cofinals (i : ι) : ∃ x : P, x ∈ 𝒟 i ∧ x ∈ ideal_of_cofinals p 𝒟 :=
134+
⟨_, sequence_of_cofinals.encode_mem p 𝒟 i, _, le_refl _⟩
135+
136+
end ideal_of_cofinals
137+
138+
end order

0 commit comments

Comments
 (0)