Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/CategoryTheory/Abelian/     Datei vom 15.10.2026 mit Größe 1 kB image not shown  

Quelle  Extension.lean   Sprache: Lean

 

/-
Copyright (c) 2023 Yuma Mizuno. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yuma Mizuno
-/

module

public import Mathlib.CategoryTheory.Bicategory.Basic
public import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic

/-!
# Extensions and lifts in bicategories

We introduce the concept of extensions and lifts within the bicategorical framework. These concepts
are defined by commutative diagrams in the (1-)categorical context. Within the bicategorical
framework, commutative diagrams are replaced by 2-morphisms. Depending on the orientation of the
2-morphisms, we define both left and right extensions (likewise for lifts). The use of left and
right here is a common one in the theory of Kan extensions.

## Implementation notes
We define extensions and lifts as objects in certain comma categories (`StructuredArrow` for left,
and `CostructuredArrow` for right). See the file `CategoryTheory.StructuredArrow` for properties
about these categories. We introduce some intuitive aliases. For example, `LeftExtension.extension`
is an alias for `Comma.right`.

## References
* https://ncatlab.org/nlab/show/lifts+and+extensions
* https://ncatlab.org/nlab/show/Kan+extension
-/


@[expose] public section

namespace CategoryTheory

namespace Bicategory

universe w v u

variable {B : Type u} [Bicategory.{w, v} B] {a b c : B}

/-- Triangle diagrams for (left) extensions.
```
  b
  △ \
  |   \ extension  △
f |     \          | unit
  |       ◿
  a - - - ▷ c
      g
```
-/

abbrev LeftExtension (f : a ⟶ b) (g : a ⟶ c) := StructuredArrow g (precomp _ f)

namespace LeftExtension

variable {f : a ⟶ b} {g : a ⟶ c}

/-- The extension of `g` along `f`. -/
abbrev extension (t : LeftExtension f g) : b ⟶ c := t.right

/-- The 2-morphism filling the triangle diagram. -/
abbrev unit (t : LeftExtension f g) : g ⟶ f ≫ t.extension := t.hom

/-- Construct a left extension from a 1-morphism and a 2-morphism. -/
abbrev mk (h : b ⟶ c) (unit : g ⟶ f ≫ h) : LeftExtension f g :=
  StructuredArrow.mk unit

variable {s t : LeftExtension f g}

/-- To construct a morphism between left extensions, we need a 2-morphism between the extensions,
and to check that it is compatible with the units. -/

abbrev homMk (η : s.extension ⟶ t.extension) (w : s.unit ≫ f ◁ η = t.unit := by cat_disch) :
    s ⟶ t :=
  StructuredArrow.homMk η w

@[reassoc (attr := simp)]
theorem w (η : s ⟶ t) : s.unit ≫ f ◁ η.right = t.unit :=
  StructuredArrow.w η

@[simp]
theorem homMk_right (η : s.extension ⟶ t.extension) (w : s.unit ≫ f ◁ η = t.unit) :
    (homMk η w).right = η :=
  rfl

/-- The left extension along the identity. -/
def alongId (g : a ⟶ c) : LeftExtension (�� a) g := .mk _ (λ_ g).inv

instance : Inhabited (LeftExtension (�� a) g) := ⟨alongId g⟩

/-- Construct a left extension of `g : a ⟶ c` from a left extension of `g ≫ �� c`. -/
@[implicit_reducible, simps!]
def ofCompId (t : LeftExtension f (g ≫ �� c)) : LeftExtension f g :=
  mk t.extension ((ρ_ g).inv ≫ t.unit)

/-- Whisker a 1-morphism to an extension.
```
  b
  △ \
  |   \ extension  △
f |     \          | unit
  |       ◿
  a - - - ▷ c - - - ▷ x
      g         h
```
-/

@[implicit_reducible]
def whisker (t : LeftExtension f g) {x : B} (h : c ⟶ x) : LeftExtension f (g ≫ h) :=
  .mk _ <| t.unit ▷ h ≫ (α_ _ _ _).hom

@[simp]
theorem whisker_extension (t : LeftExtension f g) {x : B} (h : c ⟶ x) :
    (t.whisker h).extension = t.extension ≫ h :=
  rfl

@[simp]
theorem whisker_unit (t : LeftExtension f g) {x : B} (h : c ⟶ x) :
    (t.whisker h).unit = t.unit ▷ h ≫ (α_ _ _ _).hom :=
  rfl

/-- Whiskering a 1-morphism is a functor. -/
@[implicit_reducible, simps]
def whiskering {x : B} (h : c ⟶ x) : LeftExtension f g ⥤ LeftExtension f (g ≫ h) where
  obj t := t.whisker h
  map η := LeftExtension.homMk (η.right ▷ h) <| by
    simp [-LeftExtension.w, ← LeftExtension.w η]

/-- Define a morphism between left extensions by cancelling the whiskered identities. -/
@[simps! right]
def whiskerIdCancel
    (s : LeftExtension f (g ≫ �� c)) {t : LeftExtension f g} (τ : s ⟶ t.whisker (�� c)) :
    s.ofCompId ⟶ t :=
  LeftExtension.homMk (τ.right ≫ (ρ_ _).hom)

/-- Construct a morphism between whiskered extensions. -/
@[simps! right]
def whiskerHom (i : s ⟶ t) {x : B} (h : c ⟶ x) :
    s.whisker h ⟶ t.whisker h :=
  StructuredArrow.homMk (i.right ▷ h) <| by
    dsimp only [precomp]
    rw [← cancel_mono (α_ _ _ _).inv]
    calc
      _ = (s.unit ≫ f ◁ i.right) ▷ h := by simp [-LeftExtension.w]
      _ = t.unit ▷ h := congrArg (· ▷ h) (LeftExtension.w i)
      _ = _ := by simp

/-- Construct an isomorphism between whiskered extensions. -/
@[simps]
def whiskerIso (i : s ≅ t) {x : B} (h : c ⟶ x) :
    s.whisker h ≅ t.whisker h where
  hom := whiskerHom i.hom h
  inv := whiskerHom i.inv h
  hom_inv_id := StructuredArrow.hom_ext _ _ <|
    calc
      _ = (i.hom ≫ i.inv).right ▷ h := by simp [-Iso.hom_inv_id]
      _ = �� _ := by simp [Iso.hom_inv_id]
  inv_hom_id := StructuredArrow.hom_ext _ _ <|
    calc
      _ = (i.inv ≫ i.hom).right ▷ h := by simp [-Iso.inv_hom_id]
      _ = �� _ := by simp [Iso.inv_hom_id]

/-- The isomorphism between left extensions induced by a right unitor. -/
@[simps! hom_right inv_right]
def whiskerOfCompIdIsoSelf (t : LeftExtension f g) : (t.whisker (�� c)).ofCompId ≅ t :=
  StructuredArrow.isoMk (ρ_ t.extension) (by simp [precomp])

section OfIso

variable {f f' : a ⟶ b} (ef : f ≅ f') {g g' : a ⟶ c} (eg : g ≅ g')

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, the induced equivalence between their
categories of left extensions. -/

@[implicit_reducible]
def mapIso : LeftExtension f g ≌ LeftExtension f' g' :=
  (StructuredArrow.mapNatIso ((precomposing a b c).mapIso ef)).trans (StructuredArrow.mapIso eg)

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, and a left extension
`t : LeftExtension f g`, the induced left extension `t.ofIso : LeftExtension f' g'`. -/

abbrev ofIso (t : LeftExtension f g) : LeftExtension f' g' :=
  (mapIso ef eg).functor.obj t

@[simp]
theorem ofIso_extension (t : LeftExtension f g) :
    (t.ofIso ef eg).extension = t.extension :=
  rfl

@[simp]
theorem ofIso_unit (t : LeftExtension f g) :
    (t.ofIso ef eg).unit = eg.inv ≫ t.unit ≫ ef.hom ▷ t.extension :=
  rfl

/-- Whiskering commutes with `LeftExtension.ofIso`. -/
@[simps!]
def whiskerOfIso (t : LeftExtension f g) {x : B} (h : c ⟶ x) :
    (t.whisker h).ofIso ef (whiskerRightIso eg h) ≅ (t.ofIso ef eg).whisker h :=
  StructuredArrow.isoMk (Iso.refl _) <| by simp [precomp]

end OfIso

section Paste

variable {d : B} {f : a ⟶ b} {g : a ⟶ c} {h : b ⟶ d}

/-- Given a left extension `t` of `g` along `f` and a left extension `s` of `t` along `h`, we
obtain a left extension `t.paste s` of `g` along `f ≫ h`.
```
  b                 d                    d
  △ \               △ \                  △ \
  |   \ t.ext       |   \ s.ext          |   \ paste.ext
f |  ⇓  \         h |  ⇓  \        f ≫ h |  ⇓  \
  |       ◿         |       ◿            |       ◿
  a - - - ▷ c       b - - - ▷ c          a - - - ▷ c
       g                t.ext                 g
```
-/

@[implicit_reducible]
def paste (t : LeftExtension f g) (s : LeftExtension h t.extension) : LeftExtension (f ≫ h) g :=
  .mk s.extension (t.unit ≫ f ◁ s.unit ≫ (α_ f h s.extension).inv)

variable {t : LeftExtension f g} {s : LeftExtension h t.extension}

@[simp]
theorem paste_extension : (t.paste s).extension = s.extension :=
  rfl

@[simp]
theorem paste_unit :
    (t.paste s).unit = t.unit ≫ f ◁ s.unit ≫ (α_ f h s.extension).inv :=
  rfl

/-- Whiskering a pasted left extension is isomorphic to pasting the whiskered left extensions. -/
def pasteWhiskerIso (t : LeftExtension f g) (s : LeftExtension h t.extension) {x : B} (k : c ⟶ x) :
    (t.paste s).whisker k ≅ (t.whisker k).paste (s.whisker k) :=
  StructuredArrow.isoMk (Iso.refl _) <| by simp [precomp]

end Paste

end LeftExtension

/-- Triangle diagrams for (left) lifts.
```
            b
          ◹ |
   lift /   |      △
      /     | f    | unit
    /       ▽
  c - - - ▷ a
       g
```
-/

abbrev LeftLift (f : b ⟶ a) (g : c ⟶ a) := StructuredArrow g (postcomp _ f)

namespace LeftLift

variable {f : b ⟶ a} {g : c ⟶ a}

/-- The lift of `g` along `f`. -/
abbrev lift (t : LeftLift f g) : c ⟶ b := t.right

/-- The 2-morphism filling the triangle diagram. -/
abbrev unit (t : LeftLift f g) : g ⟶ t.lift ≫ f := t.hom

/-- Construct a left lift from a 1-morphism and a 2-morphism. -/
abbrev mk (h : c ⟶ b) (unit : g ⟶ h ≫ f) : LeftLift f g :=
  StructuredArrow.mk unit

variable {s t : LeftLift f g}

/-- To construct a morphism between left lifts, we need a 2-morphism between the lifts,
and to check that it is compatible with the units. -/

abbrev homMk (η : s.lift ⟶ t.lift) (w : s.unit ≫ η ▷ f = t.unit := by cat_disch) :
    s ⟶ t :=
  StructuredArrow.homMk η w

@[reassoc (attr := simp)]
theorem w (η : s ⟶ t) : s.unit ≫ η.right ▷ f = t.unit :=
  StructuredArrow.w η

@[simp]
theorem homMk_right (η : s.lift ⟶ t.lift) (w : s.unit ≫ η ▷ f = t.unit) :
    (homMk η w).right = η :=
  rfl

/-- The left lift along the identity. -/
def alongId (g : c ⟶ a) : LeftLift (�� a) g := .mk _ (ρ_ g).inv

instance : Inhabited (LeftLift (�� a) g) := ⟨alongId g⟩

/-- Construct a left lift of `g : c ⟶ a` from a left lift of `�� c ≫ g`. -/
@[implicit_reducible, simps!]
def ofIdComp (t : LeftLift f (�� c ≫ g)) : LeftLift f g :=
  mk t.lift ((λ_ _).inv ≫ t.unit)

/-- Whisker a 1-morphism to a lift.
```
                    b
                  ◹ |
           lift /   |      △
              /     | f    | unit
            /       ▽
x - - - ▷ c - - - ▷ a
     h         g
```
-/

@[implicit_reducible]
def whisker (t : LeftLift f g) {x : B} (h : x ⟶ c) : LeftLift f (h ≫ g) :=
  .mk _ <| h ◁ t.unit ≫ (α_ _ _ _).inv

@[simp]
theorem whisker_lift (t : LeftLift f g) {x : B} (h : x ⟶ c) :
    (t.whisker h).lift = h ≫ t.lift :=
  rfl

@[simp]
theorem whisker_unit (t : LeftLift f g) {x : B} (h : x ⟶ c) :
    (t.whisker h).unit = h ◁ t.unit ≫ (α_ _ _ _).inv :=
  rfl

/-- Whiskering a 1-morphism is a functor. -/
@[implicit_reducible, simps]
def whiskering {x : B} (h : x ⟶ c) : LeftLift f g ⥤ LeftLift f (h ≫ g) where
  obj t := t.whisker h
  map η := LeftLift.homMk (h ◁ η.right) <| by
    simp [-LeftLift.w, ← LeftLift.w η]

/-- Define a morphism between left lifts by cancelling the whiskered identities. -/
@[simps! right]
def whiskerIdCancel
    (s : LeftLift f (�� c ≫ g)) {t : LeftLift f g} (τ : s ⟶ t.whisker (�� c)) :
    s.ofIdComp ⟶ t :=
  LeftLift.homMk (τ.right ≫ (λ_ _).hom)

/-- Construct a morphism between whiskered lifts. -/
@[simps! right]
def whiskerHom (i : s ⟶ t) {x : B} (h : x ⟶ c) :
    s.whisker h ⟶ t.whisker h :=
  StructuredArrow.homMk (h ◁ i.right) <| by
    dsimp only [postcomp]
    rw [← cancel_mono (α_ _ _ _).hom]
    calc
      _ = h ◁ (s.unit ≫ i.right ▷ f) := by simp [-LeftLift.w]
      _ = h ◁ t.unit := congrArg (h ◁ ·) (LeftLift.w i)
      _ = _ := by simp

/-- Construct an isomorphism between whiskered lifts. -/
@[simps]
def whiskerIso (i : s ≅ t) {x : B} (h : x ⟶ c) :
    s.whisker h ≅ t.whisker h where
  hom := whiskerHom i.hom h
  inv := whiskerHom i.inv h
  hom_inv_id := StructuredArrow.hom_ext _ _ <|
    calc
      _ = h ◁ (i.hom ≫ i.inv).right := by simp [-Iso.hom_inv_id]
      _ = �� _ := by simp [Iso.hom_inv_id]
  inv_hom_id := StructuredArrow.hom_ext _ _ <|
    calc
      _ = h ◁ (i.inv ≫ i.hom).right := by simp [-Iso.inv_hom_id]
      _ = �� _ := by simp [Iso.inv_hom_id]

/-- The isomorphism between left lifts induced by a left unitor. -/
@[simps! hom_right inv_right]
def whiskerOfIdCompIsoSelf (t : LeftLift f g) : (t.whisker (�� c)).ofIdComp ≅ t :=
  StructuredArrow.isoMk (λ_ t.lift) (by simp [postcomp])

section OfIso

variable {f f' : b ⟶ a} (ef : f ≅ f') {g g' : c ⟶ a} (eg : g ≅ g')

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, the induced equivalence between their
categories of left lifts. -/

@[implicit_reducible]
def mapIso : LeftLift f g ≌ LeftLift f' g' :=
  (StructuredArrow.mapNatIso ((postcomposing c b a).mapIso ef)).trans (StructuredArrow.mapIso eg)

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, and a left lift `t : LeftLift f g`, the
induced left lift `t.ofIso : LeftLift f' g'`. -/

abbrev ofIso (t : LeftLift f g) : LeftLift f' g' :=
  (mapIso ef eg).functor.obj t

@[simp]
theorem ofIso_lift (t : LeftLift f g) :
    (t.ofIso ef eg).lift = t.lift :=
  rfl

@[simp]
theorem ofIso_unit (t : LeftLift f g) :
    (t.ofIso ef eg).unit = eg.inv ≫ t.unit ≫ t.lift ◁ ef.hom :=
  rfl

/-- Whiskering commutes with `LeftLift.ofIso`. -/
@[simps!]
def whiskerOfIso (t : LeftLift f g) {x : B} (h : x ⟶ c) :
    (t.whisker h).ofIso ef (whiskerLeftIso h eg) ≅ (t.ofIso ef eg).whisker h :=
  StructuredArrow.isoMk (Iso.refl _) <| by simp [postcomp]

end OfIso

section Paste

variable {d : B} {f : b ⟶ a} {g : d ⟶ a} {h : c ⟶ b}

/-- Given a left lift `t` of `g` along `f` and a left lift `s` of `t` along `h`, we obtain a
left lift `t.paste s` of `g` along `h ≫ f`.
```
            b                 c                     c
          ◹ |               ◹ |                   ◹ |
 t.lift /   |      s.lift /   |      paste.lift /   |
      /  ⇑  | f         /  ⇑  | h             /  ⇑  | h ≫ f
    /       ▽         /       ▽             /       ▽
  d - - - ▷ a       d - - - ▷ b           d - - - ▷ a
       g              t.lift                   g
```
-/

@[implicit_reducible]
def paste (t : LeftLift f g) (s : LeftLift h t.lift) : LeftLift (h ≫ f) g :=
  .mk s.lift (t.unit ≫ s.unit ▷ f ≫ (α_ s.lift h f).hom)

variable {t : LeftLift f g} {s : LeftLift h t.lift}

@[simp]
theorem paste_lift : (t.paste s).lift = s.lift :=
  rfl

@[simp]
theorem paste_unit :
    (t.paste s).unit = t.unit ≫ s.unit ▷ f ≫ (α_ s.lift h f).hom :=
  rfl

/-- Whiskering a pasted left lift is isomorphic to pasting the whiskered left lifts. -/
def pasteWhiskerIso (t : LeftLift f g) (s : LeftLift h t.lift) {x : B} (k : x ⟶ d) :
    (t.paste s).whisker k ≅ (t.whisker k).paste (s.whisker k) :=
  StructuredArrow.isoMk (Iso.refl _) <| by simp [postcomp]

end Paste

end LeftLift

/-- Triangle diagrams for (right) extensions.
```
  b
  △ \
  |   \ extension  | counit
f |     \          ▽
  |       ◿
  a - - - ▷ c
      g
```
-/

abbrev RightExtension (f : a ⟶ b) (g : a ⟶ c) := CostructuredArrow (precomp _ f) g

namespace RightExtension

variable {f : a ⟶ b} {g : a ⟶ c}

/-- The extension of `g` along `f`. -/
abbrev extension (t : RightExtension f g) : b ⟶ c := t.left

/-- The 2-morphism filling the triangle diagram. -/
abbrev counit (t : RightExtension f g) : f ≫ t.extension ⟶ g := t.hom

/-- Construct a right extension from a 1-morphism and a 2-morphism. -/
abbrev mk (h : b ⟶ c) (counit : f ≫ h ⟶ g) : RightExtension f g :=
  CostructuredArrow.mk counit

variable {s t : RightExtension f g}

/-- To construct a morphism between right extensions, we need a 2-morphism between the extensions,
and to check that it is compatible with the counits. -/

abbrev homMk (η : s.extension ⟶ t.extension)
    (w : f ◁ η ≫ t.counit = s.counit := by cat_disch) : s ⟶ t :=
  CostructuredArrow.homMk η w

@[reassoc (attr := simp)]
theorem w (η : s ⟶ t) : f ◁ η.left ≫ t.counit = s.counit :=
  CostructuredArrow.w η

@[simp]
theorem homMk_left (η : s.extension ⟶ t.extension) (w : f ◁ η ≫ t.counit = s.counit) :
    (homMk η w).left = η :=
  rfl

/-- The right extension along the identity. -/
def alongId (g : a ⟶ c) : RightExtension (�� a) g := .mk _ (λ_ g).hom

instance : Inhabited (RightExtension (�� a) g) := ⟨alongId g⟩

/-- Construct a right extension of `g : a ⟶ c` from a right extension of `g ≫ �� c`. -/
@[implicit_reducible, simps!]
def ofCompId (t : RightExtension f (g ≫ �� c)) : RightExtension f g :=
  mk t.extension (t.counit ≫ (ρ_ g).hom)

/-- Whisker a 1-morphism to an extension.
```
  b
  △ \
  |   \ extension  | counit
f |     \          ▽
  |       ◿
  a - - - ▷ c - - - ▷ x
      g         h
```
-/

@[implicit_reducible]
def whisker (t : RightExtension f g) {x : B} (h : c ⟶ x) : RightExtension f (g ≫ h) :=
  .mk _ <| (α_ _ _ _).inv ≫ t.counit ▷ h

@[simp]
theorem whisker_extension (t : RightExtension f g) {x : B} (h : c ⟶ x) :
    (t.whisker h).extension = t.extension ≫ h :=
  rfl

@[simp]
theorem whisker_counit (t : RightExtension f g) {x : B} (h : c ⟶ x) :
    (t.whisker h).counit = (α_ _ _ _).inv ≫ t.counit ▷ h :=
  rfl

/-- Whiskering a 1-morphism is a functor. -/
@[implicit_reducible, simps]
def whiskering {x : B} (h : c ⟶ x) : RightExtension f g ⥤ RightExtension f (g ≫ h) where
  obj t := t.whisker h
  map η := RightExtension.homMk (η.left ▷ h) <| by
    simp [-RightExtension.w, ← RightExtension.w η]

/-- Define a morphism between right extensions by cancelling the whiskered identities. -/
@[simps! left]
def whiskerIdCancel
    (t : RightExtension f (g ≫ �� c)) {s : RightExtension f g} (τ : s.whisker (�� c) ⟶ t) :
    s ⟶ t.ofCompId :=
  RightExtension.homMk ((ρ_ _).inv ≫ τ.left)

/-- Construct a morphism between whiskered extensions. -/
@[simps! left]
def whiskerHom (i : s ⟶ t) {x : B} (h : c ⟶ x) :
    s.whisker h ⟶ t.whisker h :=
  CostructuredArrow.homMk (i.left ▷ h) <| by
    dsimp only [precomp]
    rw [← cancel_epi (α_ _ _ _).hom]
    calc
      _ = (f ◁ i.left ≫ t.counit) ▷ h := by simp [-RightExtension.w]
      _ = s.counit ▷ h := congrArg (· ▷ h) (RightExtension.w i)
      _ = _ := by simp

/-- Construct an isomorphism between whiskered extensions. -/
@[simps]
def whiskerIso (i : s ≅ t) {x : B} (h : c ⟶ x) :
    s.whisker h ≅ t.whisker h where
  hom := whiskerHom i.hom h
  inv := whiskerHom i.inv h
  hom_inv_id := CostructuredArrow.hom_ext _ _ <|
    calc
      _ = (i.hom ≫ i.inv).left ▷ h := by simp [-Iso.hom_inv_id]
      _ = �� _ := by simp [Iso.hom_inv_id]
  inv_hom_id := CostructuredArrow.hom_ext _ _ <|
    calc
      _ = (i.inv ≫ i.hom).left ▷ h := by simp [-Iso.inv_hom_id]
      _ = �� _ := by simp [Iso.inv_hom_id]

/-- The isomorphism between right extensions induced by a right unitor. -/
@[simps! hom_left inv_left]
def whiskerOfCompIdIsoSelf (t : RightExtension f g) : (t.whisker (�� c)).ofCompId ≅ t :=
  CostructuredArrow.isoMk (ρ_ t.extension) (by simp [precomp])

section OfIso

variable {f f' : a ⟶ b} (ef : f ≅ f') {g g' : a ⟶ c} (eg : g ≅ g')

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, the induced equivalence between their
categories of right extensions. -/

@[implicit_reducible]
def mapIso : RightExtension f g ≌ RightExtension f' g' :=
  (CostructuredArrow.mapNatIso ((precomposing a b c).mapIso ef)).trans (CostructuredArrow.mapIso eg)

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, and a right extension
`t : RightExtension f g`, the induced right extension `t.ofIso : RightExtension f' g'`. -/

abbrev ofIso (t : RightExtension f g) : RightExtension f' g' :=
  (mapIso ef eg).functor.obj t

@[simp]
theorem ofIso_extension (t : RightExtension f g) :
    (t.ofIso ef eg).extension = t.extension :=
  rfl

@[simp]
theorem ofIso_counit (t : RightExtension f g) :
    (t.ofIso ef eg).counit = ef.inv ▷ t.extension ≫ t.counit ≫ eg.hom := by
  rw [← Category.assoc]; rfl

/-- Whiskering commutes with `RightExtension.ofIso`. -/
@[simps!]
def whiskerOfIso (t : RightExtension f g) {x : B} (h : c ⟶ x) :
    (t.whisker h).ofIso ef (whiskerRightIso eg h) ≅ (t.ofIso ef eg).whisker h :=
  CostructuredArrow.isoMk (Iso.refl _) <| by simp [precomp]

end OfIso

section Paste

variable {d : B} {f : a ⟶ b} {g : a ⟶ c} {h : b ⟶ d}

/-- Given a right extension `t` of `g` along `f` and a right extension `s` of `t` along `h`, we
obtain a right extension `t.paste s` of `g` along `f ≫ h`.
```
  b                 d                    d
  △ \               △ \                  △ \
  |   \ t.ext       |   \ s.ext          |   \ paste.ext
f |  ⇑  \         h |  ⇑  \        f ≫ h |  ⇑  \
  |       ◿         |       ◿            |       ◿
  a - - - ▷ c       b - - - ▷ c          a - - - ▷ c
       g                t.ext                 g
```
-/

@[implicit_reducible]
def paste (t : RightExtension f g) (s : RightExtension h t.extension) : RightExtension (f ≫ h) g :=
  .mk s.extension ((α_ f h s.extension).hom ≫ f ◁ s.counit ≫ t.counit)

variable {t : RightExtension f g} {s : RightExtension h t.extension}

@[simp]
theorem paste_extension : (t.paste s).extension = s.extension :=
  rfl

@[simp]
theorem paste_counit :
    (t.paste s).counit = (α_ f h s.extension).hom ≫ f ◁ s.counit ≫ t.counit :=
  rfl

/-- Whiskering a pasted right extension is isomorphic to pasting the whiskered right extensions. -/
def pasteWhiskerIso (t : RightExtension f g) (s : RightExtension h t.extension) {x : B}
    (k : c ⟶ x) :
    (t.paste s).whisker k ≅ (t.whisker k).paste (s.whisker k) :=
  CostructuredArrow.isoMk (Iso.refl _) <| by simp [precomp]

end Paste

end RightExtension

/-- Triangle diagrams for (right) lifts.
```
            b
          ◹ |
   lift /   |      | counit
      /     | f    ▽
    /       ▽
  c - - - ▷ a
       g
```
-/

abbrev RightLift (f : b ⟶ a) (g : c ⟶ a) := CostructuredArrow (postcomp _ f) g

namespace RightLift

variable {f : b ⟶ a} {g : c ⟶ a}

/-- The lift of `g` along `f`. -/
abbrev lift (t : RightLift f g) : c ⟶ b := t.left

/-- The 2-morphism filling the triangle diagram. -/
abbrev counit (t : RightLift f g) : t.lift ≫ f ⟶ g := t.hom

/-- Construct a right lift from a 1-morphism and a 2-morphism. -/
abbrev mk (h : c ⟶ b) (counit : h ≫ f ⟶ g) : RightLift f g :=
  CostructuredArrow.mk counit

variable {s t : RightLift f g}

/-- To construct a morphism between right lifts, we need a 2-morphism between the lifts,
and to check that it is compatible with the counits. -/

abbrev homMk (η : s.lift ⟶ t.lift) (w : η ▷ f ≫ t.counit = s.counit := by cat_disch) :
    s ⟶ t :=
  CostructuredArrow.homMk η w

@[reassoc (attr := simp)]
theorem w (η : s ⟶ t) : η.left ▷ f ≫ t.counit = s.counit :=
  CostructuredArrow.w η

@[simp]
theorem homMk_left (η : s.lift ⟶ t.lift) (w : η ▷ f ≫ t.counit = s.counit) :
    (homMk η w).left = η :=
  rfl

/-- The right lift along the identity. -/
def alongId (g : c ⟶ a) : RightLift (�� a) g := .mk _ (ρ_ g).hom

instance : Inhabited (RightLift (�� a) g) := ⟨alongId g⟩

/-- Construct a right lift of `g : c ⟶ a` from a right lift of `�� c ≫ g`. -/
@[implicit_reducible, simps!]
def ofIdComp (t : RightLift f (�� c ≫ g)) : RightLift f g :=
  mk t.lift (t.counit ≫ (λ_ _).hom)

/-- Whisker a 1-morphism to a lift.
```
                    b
                  ◹ |
           lift /   |      | counit
              /     | f    ▽
            /       ▽
x - - - ▷ c - - - ▷ a
     h         g
```
-/

@[implicit_reducible]
def whisker (t : RightLift f g) {x : B} (h : x ⟶ c) : RightLift f (h ≫ g) :=
  .mk _ <| (α_ _ _ _).hom ≫ h ◁ t.counit

@[simp]
theorem whisker_lift (t : RightLift f g) {x : B} (h : x ⟶ c) :
    (t.whisker h).lift = h ≫ t.lift :=
  rfl

@[simp]
theorem whisker_counit (t : RightLift f g) {x : B} (h : x ⟶ c) :
    (t.whisker h).counit = (α_ _ _ _).hom ≫ h ◁ t.counit :=
  rfl

/-- Whiskering a 1-morphism is a functor. -/
@[implicit_reducible, simps]
def whiskering {x : B} (h : x ⟶ c) : RightLift f g ⥤ RightLift f (h ≫ g) where
  obj t := t.whisker h
  map η := RightLift.homMk (h ◁ η.left) <| by
    simp [-RightLift.w, ← RightLift.w η]

/-- Define a morphism between right lifts by cancelling the whiskered identities. -/
@[simps! left]
def whiskerIdCancel
    (t : RightLift f (�� c ≫ g)) {s : RightLift f g} (τ : s.whisker (�� c) ⟶ t) :
    s ⟶ t.ofIdComp :=
  RightLift.homMk ((λ_ _).inv ≫ τ.left)

/-- Construct a morphism between whiskered lifts. -/
@[simps! left]
def whiskerHom (i : s ⟶ t) {x : B} (h : x ⟶ c) :
    s.whisker h ⟶ t.whisker h :=
  CostructuredArrow.homMk (h ◁ i.left) <| by
    dsimp only [postcomp]
    rw [← cancel_epi (α_ _ _ _).inv]
    calc
      _ = h ◁ (i.left ▷ f ≫ t.counit) := by simp [-RightLift.w]
      _ = h ◁ s.counit := congrArg (h ◁ ·) (RightLift.w i)
      _ = _ := by simp

/-- Construct an isomorphism between whiskered lifts. -/
@[simps]
def whiskerIso (i : s ≅ t) {x : B} (h : x ⟶ c) :
    s.whisker h ≅ t.whisker h where
  hom := whiskerHom i.hom h
  inv := whiskerHom i.inv h
  hom_inv_id := CostructuredArrow.hom_ext _ _ <|
    calc
      _ = h ◁ (i.hom ≫ i.inv).left := by simp [-Iso.hom_inv_id]
      _ = �� _ := by simp [Iso.hom_inv_id]
  inv_hom_id := CostructuredArrow.hom_ext _ _ <|
    calc
      _ = h ◁ (i.inv ≫ i.hom).left := by simp [-Iso.inv_hom_id]
      _ = �� _ := by simp [Iso.inv_hom_id]

/-- The isomorphism between right lifts induced by a left unitor. -/
@[simps! hom_left inv_left]
def whiskerOfIdCompIsoSelf (t : RightLift f g) : (t.whisker (�� c)).ofIdComp ≅ t :=
  CostructuredArrow.isoMk (λ_ t.lift) (by simp [postcomp])

section OfIso

variable {f f' : b ⟶ a} (ef : f ≅ f') {g g' : c ⟶ a} (eg : g ≅ g')

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, the induced equivalence between their
categories of right lifts. -/

@[implicit_reducible]
def mapIso : RightLift f g ≌ RightLift f' g' :=
  (CostructuredArrow.mapNatIso ((postcomposing c b a).mapIso ef)).trans
    (CostructuredArrow.mapIso eg)

/-- Given isomorphisms `ef : f ≅ f'` and `eg : g ≅ g'`, and a right lift `t : RightLift f g`, the
induced right lift `t.ofIso : RightLift f' g'`. -/

abbrev ofIso (t : RightLift f g) : RightLift f' g' :=
  (mapIso ef eg).functor.obj t

@[simp]
theorem ofIso_lift (t : RightLift f g) :
    (t.ofIso ef eg).lift = t.lift :=
  rfl

@[simp]
theorem ofIso_counit (t : RightLift f g) :
    (t.ofIso ef eg).counit = t.lift ◁ ef.inv ≫ t.counit ≫ eg.hom := by
  rw [← Category.assoc]; rfl

/-- Whiskering commutes with `RightLift.ofIso`. -/
@[simps!]
def whiskerOfIso (t : RightLift f g) {x : B} (h : x ⟶ c) :
    (t.whisker h).ofIso ef (whiskerLeftIso h eg) ≅ (t.ofIso ef eg).whisker h :=
  CostructuredArrow.isoMk (Iso.refl _) <| by simp [postcomp]

end OfIso

section Paste

variable {d : B} {f : b ⟶ a} {g : d ⟶ a} {h : c ⟶ b}

/-- Given a right lift `t` of `g` along `f` and a right lift `s` of `t` along `h`, we obtain a
right lift `t.paste s` of `g` along `h ≫ f`.
```
            b                 c                     c
          ◹ |               ◹ |                   ◹ |
 t.lift /   |      s.lift /   |      paste.lift /   |
      /  ⇓  | f         /  ⇓  | h             /  ⇓  | h ≫ f
    /       ▽         /       ▽             /       ▽
  d - - - ▷ a       d - - - ▷ b           d - - - ▷ a
       g              t.lift                   g
```
-/

@[implicit_reducible]
def paste (t : RightLift f g) (s : RightLift h t.lift) : RightLift (h ≫ f) g :=
  .mk s.lift ((α_ s.lift h f).inv ≫ s.counit ▷ f ≫ t.counit)

variable {t : RightLift f g} {s : RightLift h t.lift}

@[simp]
theorem paste_lift : (t.paste s).lift = s.lift :=
  rfl

@[simp]
theorem paste_counit :
    (t.paste s).counit = (α_ s.lift h f).inv ≫ s.counit ▷ f ≫ t.counit :=
  rfl

/-- Whiskering a pasted right lift is isomorphic to pasting the whiskered right lifts. -/
def pasteWhiskerIso (t : RightLift f g) (s : RightLift h t.lift) {x : B} (k : x ⟶ d) :
    (t.paste s).whisker k ≅ (t.whisker k).paste (s.whisker k) :=
  CostructuredArrow.isoMk (Iso.refl _) <| by simp [postcomp]

end Paste

end RightLift

end Bicategory

end CategoryTheory

Messung
CHZG
9210010097

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*Bot Zugriff