Skip to content

Commit a692b47

Browse files
committed
feat(CategoryTheory/SmallObject/Iteration): the unique morphism (limit case) (#18137)
Co-authored-by: Joël Riou <37772949+joelriou@users.noreply.github.com>
1 parent fd96b56 commit a692b47

File tree

1 file changed

+107
-3
lines changed

1 file changed

+107
-3
lines changed

Mathlib/CategoryTheory/SmallObject/Iteration/UniqueHom.lean

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Mathlib.CategoryTheory.SmallObject.Iteration.Basic
99
# Uniqueness of morphisms in the category of iterations of functors
1010
1111
Given a functor `Φ : C ⥤ C` and a natural transformation `ε : 𝟭 C ⟶ Φ`,
12-
we shall show in this file that there exists a unique morphism (TODO)
12+
we show in this file that there exists a unique morphism
1313
between two arbitrary objects in the category `Functor.Iteration ε j`
1414
when `j : J` and `J` is a well orderered set.
1515
@@ -30,8 +30,6 @@ namespace Iteration
3030

3131
namespace Hom
3232

33-
variable (j : J)
34-
3533
/-- The (unique) morphism between two objects in `Iteration ε ⊥` -/
3634
def mkOfBot (iter₁ iter₂ : Iteration ε (⊥ : J)) : iter₁ ⟶ iter₂ where
3735
natTrans :=
@@ -136,8 +134,114 @@ noncomputable def mkOfSucc
136134
rfl
137135
· simp [mkOfSuccNatTransApp_eq_of_le hi φ k (by rfl)]
138136

137+
variable {j : J} {iter₁ iter₂ : Iteration ε j}
138+
139+
section
140+
141+
variable (φ : ∀ (i : J) (hi : i < j), iter₁.trunc hi.le ⟶ iter₂.trunc hi.le)
142+
[WellFoundedLT J] (hj : Order.IsSuccLimit j)
143+
144+
/-- Auxiliary definition for `mkOfLimit`. -/
145+
def mkOfLimitNatTransApp (i : J) (hi : i ≤ j) :
146+
iter₁.F.obj ⟨i, hi⟩ ⟶ iter₂.F.obj ⟨i, hi⟩ :=
147+
if h : i < j
148+
then
149+
(φ i h).natTrans.app ⟨i, by simp⟩
150+
else by
151+
obtain rfl : i = j := by
152+
obtain h' | rfl := hi.lt_or_eq
153+
· exfalso
154+
exact h h'
155+
· rfl
156+
exact (iter₁.isColimit i hj (by simp)).desc (Cocone.mk _
157+
{ app := fun ⟨k, hk⟩ => (φ k hk).natTrans.app ⟨k, by simp⟩ ≫
158+
iter₂.F.map (homOfLE (by exact hk.le))
159+
naturality := fun ⟨k₁, hk₁⟩ ⟨k₂, hk₂⟩ f => by
160+
have hf : k₁ ≤ k₂ := by simpa using leOfHom f
161+
dsimp
162+
rw [comp_id, congr_app (φ k₁ hk₁) ((truncFunctor ε hf).map (φ k₂ hk₂))]
163+
erw [natTrans_naturality_assoc (φ k₂ hk₂) k₁ k₂ hf (by rfl)]
164+
dsimp
165+
rw [← Functor.map_comp, homOfLE_comp] })
166+
167+
lemma mkOfLimitNatTransApp_eq_of_lt (i : J) (hi : i < j) :
168+
mkOfLimitNatTransApp φ hj i hi.le = (φ i hi).natTrans.app ⟨i, by simp⟩ :=
169+
dif_pos hi
170+
171+
lemma mkOfLimitNatTransApp_naturality_top (i : J) (hi : i < j) :
172+
iter₁.F.map (homOfLE (by simpa using hi.le) : ⟨i, hi.le⟩ ⟶ ⟨j, by simp⟩) ≫
173+
mkOfLimitNatTransApp φ hj j (by rfl) =
174+
mkOfLimitNatTransApp φ hj i hi.le ≫ iter₂.F.map (homOfLE (by simpa using hi.le)) := by
175+
rw [mkOfLimitNatTransApp_eq_of_lt φ hj i hi, mkOfLimitNatTransApp, dif_neg (by simp)]
176+
exact (iter₁.isColimit j hj (by rfl)).fac _ ⟨i, hi⟩
177+
178+
/-- Auxiliary definition for `mkOfLimit`. -/
179+
@[simps]
180+
def mkOfLimitNatTrans : iter₁.F ⟶ iter₂.F where
181+
app := fun ⟨k, hk⟩ => mkOfLimitNatTransApp φ hj k hk
182+
naturality := fun ⟨k₁, hk₁⟩ ⟨k₂, hk₂⟩ f => by
183+
have hk : k₁ ≤ k₂ := leOfHom f
184+
obtain h₂ | rfl := hk₂.lt_or_eq
185+
· dsimp
186+
rw [mkOfLimitNatTransApp_eq_of_lt _ hj k₂ h₂,
187+
mkOfLimitNatTransApp_eq_of_lt _ hj k₁ (lt_of_le_of_lt hk h₂),
188+
congr_app (φ k₁ (lt_of_le_of_lt hk h₂)) ((truncFunctor ε hk).map (φ k₂ h₂))]
189+
exact natTrans_naturality (φ k₂ h₂) k₁ k₂ hk (by rfl)
190+
· obtain h₁ | rfl := hk₁.lt_or_eq
191+
· exact mkOfLimitNatTransApp_naturality_top _ hj _ h₁
192+
· obtain rfl : f = 𝟙 _ := rfl
193+
simp only [map_id, id_comp, comp_id]
194+
195+
/-- The (unique) morphism between two objects in `Iteration ε j` when `j` is a limit element,
196+
assuming we have a morphism between the truncations to `Iteration ε i` for all `i < j`. -/
197+
def mkOfLimit : iter₁ ⟶ iter₂ where
198+
natTrans := mkOfLimitNatTrans φ hj
199+
natTrans_app_zero := by
200+
simp [mkOfLimitNatTransApp_eq_of_lt φ _ ⊥ (by simpa only [bot_lt_iff_ne_bot] using hj.ne_bot)]
201+
natTrans_app_succ i h := by
202+
dsimp
203+
have h' := hj.succ_lt h
204+
rw [mkOfLimitNatTransApp_eq_of_lt φ hj _ h',
205+
(φ _ h').natTrans_app_succ i (Order.lt_succ_of_not_isMax (not_isMax_of_lt h)),
206+
mkOfLimitNatTransApp_eq_of_lt φ _ _ h,
207+
congr_app (φ i h) ((truncFunctor ε (Order.le_succ i)).map (φ (Order.succ i) h'))]
208+
dsimp
209+
210+
end
211+
212+
variable [WellFoundedLT J]
213+
214+
instance : Nonempty (iter₁ ⟶ iter₂) := by
215+
let P := fun (i : J) => ∀ (hi : i ≤ j),
216+
Nonempty ((truncFunctor ε hi).obj iter₁ ⟶ (truncFunctor ε hi).obj iter₂)
217+
suffices ∀ i, P i from this j (by rfl)
218+
intro i
219+
induction i using SuccOrder.limitRecOn with
220+
| hm i hi =>
221+
obtain rfl : i = ⊥ := by simpa using hi
222+
exact fun hi' ↦ ⟨Hom.mkOfBot _ _⟩
223+
| hs i hi hi' =>
224+
exact fun hi'' ↦ ⟨Hom.mkOfSucc _ _ hi (hi' ((Order.le_succ i).trans hi'')).some⟩
225+
| hl i hi hi' =>
226+
exact fun hi'' ↦ ⟨Hom.mkOfLimit (fun k hk ↦ (hi' k hk (hk.le.trans hi'')).some) hi⟩
227+
228+
noncomputable instance : Unique (iter₁ ⟶ iter₂) :=
229+
uniqueOfSubsingleton (Nonempty.some inferInstance)
230+
139231
end Hom
140232

233+
variable [WellFoundedLT J] {j : J} (iter₁ iter₂ iter₃ : Iteration ε j)
234+
235+
/-- The canonical isomorphism between two objects in the category `Iteration ε j`. -/
236+
noncomputable def iso : iter₁ ≅ iter₂ where
237+
hom := default
238+
inv := default
239+
240+
@[simp]
241+
lemma iso_refl : iso iter₁ iter₁ = Iso.refl _ := by aesop_cat
242+
243+
lemma iso_trans : iso iter₁ iter₂ ≪≫ iso iter₂ iter₃ = iso iter₁ iter₃ := by aesop_cat
244+
141245
end Iteration
142246

143247
end Functor

0 commit comments

Comments
 (0)