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

Commit b0b61e6

Browse files
b-mehtakim-embryangingechen
committed
feat(order/category/omega-complete): omega-complete partial orders form a complete category (#4397)
as discussed in #4348. Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
1 parent 3e12a7b commit b0b61e6

File tree

7 files changed

+119
-22
lines changed

7 files changed

+119
-22
lines changed

src/category_theory/limits/shapes/biproducts.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ by simp [biproduct.ι_π, h]
227227
/-- Given a collection of maps into the summands, we obtain a map into the biproduct. -/
228228
abbreviation biproduct.lift
229229
{f : J → C} [has_biproduct f] {P : C} (p : Π b, P ⟶ f b) : P ⟶ ⨁ f :=
230-
(biproduct.is_limit f).lift (fan.mk p)
230+
(biproduct.is_limit f).lift (fan.mk P p)
231231
/-- Given a collection of maps out of the summands, we obtain a map out of the biproduct. -/
232232
abbreviation biproduct.desc
233233
{f : J → C} [has_biproduct f] {P : C} (p : Π b, f b ⟶ P) : ⨁ f ⟶ P :=
234-
(biproduct.is_colimit f).desc (cofan.mk p)
234+
(biproduct.is_colimit f).desc (cofan.mk P p)
235235

236236
@[simp, reassoc]
237237
lemma biproduct.lift_π {f : J → C} [has_biproduct f] {P : C} (p : Π b, P ⟶ f b) (j : J) :
@@ -822,7 +822,7 @@ has_biproduct_of_total
822822
ι_π := λ j j', by simp, }
823823
begin
824824
ext,
825-
simp only [comp_sum, limits.cofan.mk_π_app, limits.colimit.ι_desc_assoc, eq_self_iff_true,
825+
simp only [comp_sum, limits.colimit.ι_desc_assoc, eq_self_iff_true,
826826
limits.colimit.ι_desc, category.comp_id],
827827
dsimp,
828828
simp only [dite_comp, finset.sum_dite_eq, finset.mem_univ, if_true, category.id_comp,

src/category_theory/limits/shapes/equalizers.lean

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ by rw [←s.w right, parallel_pair_map_right]
156156

157157
/-- A fork on `f g : X ⟶ Y` is determined by the morphism `ι : P ⟶ X` satisfying `ι ≫ f = ι ≫ g`.
158158
-/
159+
@[simps]
159160
def fork.of_ι {P : C} (ι : P ⟶ X) (w : ι ≫ f = ι ≫ g) : fork f g :=
160161
{ X := P,
161162
π :=
@@ -170,6 +171,7 @@ def fork.of_ι {P : C} (ι : P ⟶ X) (w : ι ≫ f = ι ≫ g) : fork f g :=
170171

171172
/-- A cofork on `f g : X ⟶ Y` is determined by the morphism `π : Y ⟶ P` satisfying
172173
`f ≫ π = g ≫ π`. -/
174+
@[simps]
173175
def cofork.of_π {P : C} (π : Y ⟶ P) (w : f ≫ π = g ≫ π) : cofork f g :=
174176
{ X := P,
175177
ι :=
@@ -182,15 +184,6 @@ def cofork.of_π {P : C} (π : Y ⟶ P) (w : f ≫ π = g ≫ π) : cofork f g :
182184
{ dsimp, simp, },
183185
end } }
184186

185-
@[simp] lemma fork.of_ι_app_zero {P : C} (ι : P ⟶ X) (w : ι ≫ f = ι ≫ g) :
186-
(fork.of_ι ι w).π.app zero = ι := rfl
187-
@[simp] lemma fork.of_ι_app_one {P : C} (ι : P ⟶ X) (w : ι ≫ f = ι ≫ g) :
188-
(fork.of_ι ι w).π.app one = ι ≫ f := rfl
189-
@[simp] lemma cofork.of_π_app_zero {P : C} (π : Y ⟶ P) (w : f ≫ π = g ≫ π) :
190-
(cofork.of_π π w).ι.app zero = f ≫ π := rfl
191-
@[simp] lemma cofork.of_π_app_one {P : C} (π : Y ⟶ P) (w : f ≫ π = g ≫ π) :
192-
(cofork.of_π π w).ι.app one = π := rfl
193-
194187
/-- A fork `t` on the parallel pair `f g : X ⟶ Y` consists of two morphisms `t.π.app zero : t.X ⟶ X`
195188
and `t.π.app one : t.X ⟶ Y`. Of these, only the first one is interesting, and we give it the
196189
shorter name `fork.ι t`. -/

src/category_theory/limits/shapes/products.lean

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@ abbreviation fan (f : β → C) := cone (discrete.functor f)
2626
abbreviation cofan (f : β → C) := cocone (discrete.functor f)
2727

2828
/-- A fan over `f : β → C` consists of a collection of maps from an object `P` to every `f b`. -/
29-
def fan.mk {f : β → C} {P : C} (p : Π b, P ⟶ f b) : fan f :=
29+
@[simps]
30+
def fan.mk {f : β → C} (P : C) (p : Π b, P ⟶ f b) : fan f :=
3031
{ X := P,
3132
π := { app := p } }
3233

3334
/-- A cofan over `f : β → C` consists of a collection of maps from every `f b` to an object `P`. -/
34-
def cofan.mk {f : β → C} {P : C} (p : Π b, f b ⟶ P) : cofan f :=
35+
@[simps]
36+
def cofan.mk {f : β → C} (P : C) (p : Π b, f b ⟶ P) : cofan f :=
3537
{ X := P,
3638
ι := { app := p } }
3739

38-
@[simp] lemma fan.mk_π_app {f : β → C} {P : C} (p : Π b, P ⟶ f b) (b : β) : (fan.mk p).π.app b = p b := rfl
39-
@[simp] lemma cofan.mk_π_app {f : β → C} {P : C} (p : Π b, f b ⟶ P) (b : β) : (cofan.mk p).ι.app b = p b := rfl
40-
4140
/-- An abbreviation for `has_limit (discrete.functor f)`. -/
4241
abbreviation has_product (f : β → C) := has_limit (discrete.functor f)
4342

@@ -74,10 +73,10 @@ colimit.ι (discrete.functor f) b
7473

7574
/-- A collection of morphisms `P ⟶ f b` induces a morphism `P ⟶ ∏ f`. -/
7675
abbreviation pi.lift {f : β → C} [has_product f] {P : C} (p : Π b, P ⟶ f b) : P ⟶ ∏ f :=
77-
limit.lift _ (fan.mk p)
76+
limit.lift _ (fan.mk P p)
7877
/-- A collection of morphisms `f b ⟶ P` induces a morphism `∐ f ⟶ P`. -/
7978
abbreviation sigma.desc {f : β → C} [has_coproduct f] {P : C} (p : Π b, f b ⟶ P) : ∐ f ⟶ P :=
80-
colimit.desc _ (cofan.mk p)
79+
colimit.desc _ (cofan.mk P p)
8180

8281
/--
8382
Construct a morphism between categorical products (indexed by the same type)

src/category_theory/limits/shapes/types.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace category_theory.limits.types
3939
@[simp]
4040
lemma pi_lift_π_apply {β : Type u} (f : β → Type u) {P : Type u} (s : Π b, P ⟶ f b) (b : β) (x : P) :
4141
(pi.π f b : (∏ f) → f b) (@pi.lift β _ _ f _ P s x) = s b x :=
42-
congr_fun (limit.lift_π (fan.mk s) b) x
42+
congr_fun (limit.lift_π (fan.mk P s) b) x
4343

4444
/-- A restatement of `types.map_π_apply` that uses `pi.π` and `pi.map`. -/
4545
@[simp]

src/order/category/omega_complete_partial_order.lean

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Author: Simon Hudon
66

77
import order.omega_complete_partial_order
88
import order.category.Preorder
9+
import category_theory.limits.shapes.products
10+
import category_theory.limits.shapes.equalizers
11+
import category_theory.limits.shapes.constructions.limits_of_products_and_equalizers
912

1013
/-!
1114
# Category of types with a omega complete partial order
@@ -26,7 +29,7 @@ open category_theory
2629
universes u v
2730

2831
/-- The category of types with a omega complete partial order. -/
29-
def ωCPO := bundled omega_complete_partial_order
32+
def ωCPO : Type (u+1) := bundled omega_complete_partial_order
3033

3134
namespace ωCPO
3235

@@ -47,4 +50,85 @@ instance : inhabited ωCPO := ⟨of punit⟩
4750

4851
instance (α : ωCPO) : omega_complete_partial_order α := α.str
4952

53+
section
54+
55+
open category_theory.limits
56+
57+
namespace has_products
58+
59+
/-- The pi-type gives a cone for a product. -/
60+
def product {J : Type v} (f : J → ωCPO.{v}) : fan f :=
61+
fan.mk (of (Π j, f j)) (λ j, continuous_hom.of_mono (pi.monotone_apply j : _) (λ c, rfl))
62+
63+
/-- The pi-type is a limit cone for the product. -/
64+
def is_product (J : Type v) (f : J → ωCPO) : is_limit (product f) :=
65+
{ lift := λ s,
66+
⟨λ t j, s.π.app j t, λ x y h j, (s.π.app j).monotone h,
67+
λ x, funext (λ j, (s.π.app j).continuous x)⟩,
68+
uniq' := λ s m w,
69+
begin
70+
ext t j,
71+
change m t j = s.π.app j t,
72+
rw ← w j,
73+
refl,
74+
end }.
75+
76+
instance (J : Type v) (f : J → ωCPO.{v}) : has_product f :=
77+
has_limit.mk ⟨_, is_product _ f⟩
78+
79+
end has_products
80+
81+
instance omega_complete_partial_order_equalizer
82+
{α β : Type*} [omega_complete_partial_order α] [omega_complete_partial_order β]
83+
(f g : α →𝒄 β) : omega_complete_partial_order {a : α // f a = g a} :=
84+
omega_complete_partial_order.subtype _ $ λ c hc,
85+
begin
86+
rw [f.continuous, g.continuous],
87+
congr' 1,
88+
ext,
89+
apply hc _ ⟨_, rfl⟩,
90+
end
91+
92+
namespace has_equalizers
93+
94+
/-- The equalizer inclusion function as a `continuous_hom`. -/
95+
def equalizer_ι {α β : Type*} [omega_complete_partial_order α] [omega_complete_partial_order β]
96+
(f g : α →𝒄 β) :
97+
{a : α // f a = g a} →𝒄 α :=
98+
continuous_hom.of_mono (preorder_hom.subtype.val _) (λ c, rfl)
99+
100+
/-- A construction of the equalizer fork. -/
101+
def equalizer {X Y : ωCPO.{v}} (f g : X ⟶ Y) :
102+
fork f g :=
103+
@fork.of_ι _ _ _ _ _ _ (ωCPO.of {a // f a = g a}) (equalizer_ι f g)
104+
(continuous_hom.ext _ _ (λ x, x.2))
105+
106+
/-- The equalizer fork is a limit. -/
107+
def is_equalizer {X Y : ωCPO.{v}} (f g : X ⟶ Y) : is_limit (equalizer f g) :=
108+
fork.is_limit.mk' _ $ λ s,
109+
⟨{ to_fun := λ x, ⟨s.ι x, by apply continuous_hom.congr_fun s.condition⟩,
110+
monotone' := λ x y h, s.ι.monotone h,
111+
cont := λ x, subtype.ext (s.ι.continuous x) },
112+
by { ext, refl },
113+
λ m hm,
114+
begin
115+
ext,
116+
apply continuous_hom.congr_fun hm,
117+
end
118+
119+
end has_equalizers
120+
121+
instance : has_products ωCPO.{v} :=
122+
λ J, { has_limit := λ F, has_limit_of_iso discrete.nat_iso_functor.symm }
123+
124+
instance {X Y : ωCPO.{v}} (f g : X ⟶ Y) : has_limit (parallel_pair f g) :=
125+
has_limit.mk ⟨_, has_equalizers.is_equalizer f g⟩
126+
127+
instance : has_equalizers ωCPO.{v} := has_equalizers_of_has_limit_parallel_pair _
128+
129+
instance : has_limits ωCPO.{v} := limits_from_equalizers_and_products
130+
131+
end
132+
133+
50134
end ωCPO

src/order/omega_complete_partial_order.lean

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ begin
238238
apply ωSup_le _ _ a,
239239
end
240240

241+
/-- A subset `p : α → Prop` of the type closed under `ωSup` induces an
242+
`omega_complete_partial_order` on the subtype `{a : α // p a}`. -/
243+
def subtype {α : Type*} [omega_complete_partial_order α] (p : α → Prop)
244+
(hp : ∀ (c : chain α), (∀ i ∈ c, p i) → p (ωSup c)) :
245+
omega_complete_partial_order (subtype p) :=
246+
omega_complete_partial_order.lift
247+
(preorder_hom.subtype.val p)
248+
(λ c, ⟨ωSup _, hp (c.map (preorder_hom.subtype.val p)) (λ i ⟨n, q⟩, q.symm ▸ (c n).2)⟩)
249+
(λ x y h, h)
250+
(λ c, rfl)
251+
241252
section continuity
242253
open chain
243254

@@ -582,6 +593,12 @@ end old_struct
582593

583594
namespace continuous_hom
584595

596+
theorem congr_fun {f g : α →𝒄 β} (h : f = g) (x : α) : f x = g x :=
597+
congr_arg (λ h : α →𝒄 β, h x) h
598+
599+
theorem congr_arg (f : α →𝒄 β) {x y : α} (h : x = y) : f x = f y :=
600+
congr_arg (λ x : α, f x) h
601+
585602
@[mono]
586603
lemma monotone (f : α →𝒄 β) : monotone f :=
587604
continuous_hom.monotone' f
@@ -670,7 +687,7 @@ protected lemma ext (f g : α →𝒄 β) (h : ∀ x, f x = g x) : f = g :=
670687
by cases f; cases g; congr; ext; apply h
671688

672689
protected lemma coe_inj (f g : α →𝒄 β) (h : (f : α → β) = g) : f = g :=
673-
continuous_hom.ext _ _ $ congr_fun h
690+
continuous_hom.ext _ _ $ _root_.congr_fun h
674691

675692
@[simp]
676693
lemma comp_id (f : β →𝒄 γ) : f.comp id = f := by ext; refl

src/order/preorder_hom.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ by { ext, refl }
6262
@[simp] lemma id_comp (f : preorder_hom α β) : id.comp f = f :=
6363
by { ext, refl }
6464

65+
/-- `subtype.val` as a bundled monotone function. -/
66+
def subtype.val (p : α → Prop) : subtype p →ₘ α :=
67+
⟨subtype.val, λ x y h, h⟩
68+
6569
/-- The preorder structure of `α →ₘ β` is pointwise inequality: `f ≤ g ↔ ∀ a, f a ≤ g a`. -/
6670
instance : preorder (α →ₘ β) :=
6771
preorder.lift preorder_hom.to_fun

0 commit comments

Comments
 (0)