-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_injective (L40-L41)
theorem mop_injective : Function.Injective (mop : C → Cᴹᵒᵖ) := @mop.inj C

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_injective (L42-L44)
theorem unmop_injective : Function.Injective (unmop : Cᴹᵒᵖ → C) :=
fun _ _ h => congrArg mop h

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj_iff (L45-L46)
theorem mop_inj_iff (x y : C) : mop x = mop y ↔ x = y := mop_injective.eq_iff

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj_iff (L48-L49)
theorem unmop_inj_iff (x y : Cᴹᵒᵖ) : unmop x = unmop y ↔ x = y := unmop_injective.eq_iff

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L51-L53)
theorem mop_unmop (X : Cᴹᵒᵖ) : mop (unmop X) = X := rfl
-- can't be simp bc after putting the lhs in whnf it's `X = X`

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L54-L55)
theorem unmop_mop (X : C) : unmop (mop X) = X := rfl

-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L72-L74)
def Quiver.Hom.mop {X Y : C} (f : X ⟶ Y) : mop X ⟶ mop Y := MonoidalOpposite.mop f
/-- We can think of a morphism `f : mop X ⟶ mop Y` as a morphism `X ⟶ Y`. -/

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj (L81-L84)
theorem mop_inj {X Y : C} :
    Function.Injective (Quiver.Hom.mop : (X ⟶ Y) → (mop' X ⟶ mop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.unmop H

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj (L85-L88)
theorem unmop_inj {X Y : Cᴹᵒᵖ} :
    Function.Injective (Quiver.Hom.unmop : (X ⟶ Y) → (unmop' X ⟶ unmop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.mop H

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L90-L92)
theorem unmop_mop {X Y : C} {f : X ⟶ Y} : f.mop.unmop = f :=
rfl

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L94-L100)
theorem mop_unmop {X Y : Cᴹᵒᵖ} {f : X ⟶ Y} : f.unmop.mop = f :=
rfl

end Quiver.Hom

namespace CategoryTheory

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_comp (L102-L104)
theorem mop_comp {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} :
    (f ≫ g).mop = f.mop ≫ g.mop := rfl

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id (L106-L107)
theorem mop_id {X : C} : (𝟙 X).mop = 𝟙 (mop X) := rfl

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id (L113-L114)
theorem unmop_id {X : Cᴹᵒᵖ} : (𝟙 X).unmop = 𝟙 (unmop X) := rfl

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id_mop (L116-L117)
theorem unmop_id_mop {X : C} : (𝟙 (mop X)).unmop = 𝟙 X := rfl

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id_unmop (L119-L121)
theorem mop_id_unmop {X : Cᴹᵒᵖ} : (𝟙 (unmop X)).mop = 𝟙 X := rfl
-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj

-- Mathlib.CategoryTheory.Monoidal.Opposite.mopFunctor (L130-L131)
def mopFunctor : C ⥤ Cᴹᵒᵖ := Functor.mk mop .mop
/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmopFunctor (L133-L139)
def unmopFunctor : Cᴹᵒᵖ ⥤ C := Functor.mk unmop .unmop
variable {C}

namespace Iso

/-- An isomorphism in `C` gives an isomorphism in `Cᴹᵒᵖ`. -/

-- Mathlib.CategoryTheory.Monoidal.Opposite.mop (L140-L142)
abbrev mop {X Y : C} (f : X ≅ Y) : mop X ≅ mop Y := (mopFunctor C).mapIso f
/-- An isomorphism in `Cᴹᵒᵖ` gives an isomorphism in `C`. -/

-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop (L143-L148)
abbrev unmop {X Y : Cᴹᵒᵖ} (f : X ≅ Y) : unmop X ≅ unmop Y := (unmopFunctor C).mapIso f
end Iso

namespace IsIso

-- Mathlib.CategoryTheory.Monoidal.Opposite.op_tensor_op (L235-L236)
theorem op_tensor_op {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f.op ⊗ₘ g.op = (f ⊗ₘ g).op := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionObj_mop (L309-L311)
lemma monoidalOppositeRightAction_actionObj_mop (c : C) (d : D) :
    d ⊙ᵣ mop c = c ⊙ₗ d := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionLeft (L337-L340)
abbrev actionLeft (c : C) : D ⥤ D := curriedAction C D |>.obj c
variable {D} in
/-- Bundle `c ↦ c ⊙ₗ d` as a functor. -/

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHomLeft_op (L209-L212)
lemma oppositeLeftAction_actionHomLeft_op
    {c c' : C} (f : c ⟶ c') (d : D) :
    f.op ⊵ₗ op d = op (f ⊵ₗ d) := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_μₗ (L189-L192)
lemma inv_μₗ :
    CategoryTheory.inv (μₗ F c d) = δₗ F c d :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| μₗ_comp_δₗ F c d

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHomLeft_mop (L100-L103)
lemma monoidalOppositeLeftAction_actionHomLeft_mop
    {c c' : C} (f : c ⟶ c') (d : D) :
    f.mop ⊵ₗ d = d ⊴ᵣ f := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionRight_mop (L316-L319)
lemma monoidalOppositeRightAction_actionRight_mop
    (c : C) {d d' : D} (f : d ⟶ d') :
    f ⊵ᵣ mop c = c ⊴ₗ f := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_def' (L236-L239)
theorem actionHom_def' {x₁ y₁ : C} {x₂ y₂ : D} (f : x₁ ⟶ y₁) (g : x₂ ⟶ y₂) :
    f ⊙ₗₘ g = x₁ ⊴ₗ g ≫ f ⊵ₗ y₂ :=
action_exchange f g ▸ actionHom_def f g

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitNatIso (L355-L356)
def actionUnitNatIso : actionLeft D (𝟙_ C) ≅ 𝟭 D := NatIso.ofComponents (λₗ ·)

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHom_op (L217-L220)
lemma oppositeLeftAction_actionHom_op
    {c c' : C} {d d' : D} (f : c ⟶ c') (g : d ⟶ d') :
    f.op ⊙ₗₘ g.op = op (f ⊙ₗₘ g) := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionAssocIso_op (L221-L223)
lemma oppositeLeftAction_actionAssocIso_op (c c' : C) (d : D) :
    αₗ (op c) (op c') (op d) = (αₗ c c' d).symm.op := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomLeft (L296-L299)
instance isIso_actionHomLeft {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    IsIso (f ⊵ₗ z) :=
⟨inv f ⊵ₗ z, by simp⟩

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionHomRight_mop (L312-L315)
lemma monoidalOppositeRightAction_actionHomRight_mop
    {c c' : C} (f : c ⟶ c') (d : D) :
    d ⊴ᵣ f.mop = f ⊵ₗ d := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomRight (L292-L295)
instance isIso_actionHomRight (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    IsIso (x ⊴ₗ f) :=
⟨x ⊴ₗ inv f, by simp⟩

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionRight_op (L213-L216)
lemma oppositeLeftAction_actionRight_op
    (c : C) {d d' : D} (f : d ⟶ d') :
    op c ⊴ₗ f.op = op (c ⊴ₗ f) := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_id (L198-L201)
lemma actionHom_id {c c' : C} (f : c ⟶ c') (d : D) :
    f ⊙ₗₘ (𝟙 d) = f ⊵ₗ d := by
simp [actionHom_def]

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionObj_op (L206-L208)
lemma oppositeLeftAction_actionObj_op (c : C) (d : D) :
    (op c) ⊙ₗ (op d) = op (c ⊙ₗ d) := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_μᵣ (L351-L354)
lemma inv_μᵣ :
    CategoryTheory.inv (μᵣ F d c) = δᵣ F d c :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| μᵣ_comp_δᵣ F d c

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionObj_mop (L97-L99)
lemma monoidalOppositeLeftAction_actionObj_mop (c : C) (d : D) :
    mop c ⊙ₗ d = d ⊙ᵣ c := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionRight_mop (L104-L107)
lemma monoidalOppositeLeftAction_actionRight_mop
    (c : C) {d d' : D} (f : d ⟶ d') :
    mop c ⊴ₗ f = f ⊵ᵣ c := rfl

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.id_actionHom (L193-L196)
lemma id_actionHom (c : C) {d d' : D} (f : d ⟶ d') :
    (𝟙 c) ⊙ₗₘ f = c ⊴ₗ f := by
simp [actionHom_def]

-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionRight (L342-L344)
abbrev actionRight (d : D) : C ⥤ D := curriedAction C D |>.flip.obj d
/-- Bundle `αₗ _ _ _` as an isomorphism of trifunctors. -/

theorem unmop_comp {X Y Z : Cᴹᵒᵖ} {f : X ⟶ Y} {g : Y ⟶ Z} :
    (f ≫ g).unmop = f.unmop ≫ g.unmop

[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Monoidal.Opposite).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
theorem unmop_comp {X Y Z : Cᴹᵒᵖ} {f : X ⟶ Y} {g : Y ⟶ Z} :
    (f ≫ g).unmop = f.unmop ≫ g.unmop
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_injective (L40-L41)
theorem mop_injective : Function.Injective (mop : C → Cᴹᵒᵖ) := @mop.inj C
```

-- snippet 2
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_injective (L42-L44)
theorem unmop_injective : Function.Injective (unmop : Cᴹᵒᵖ → C) :=
fun _ _ h => congrArg mop h
```

-- snippet 3
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj_iff (L45-L46)
theorem mop_inj_iff (x y : C) : mop x = mop y ↔ x = y := mop_injective.eq_iff
```

-- snippet 4
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj_iff (L48-L49)
theorem unmop_inj_iff (x y : Cᴹᵒᵖ) : unmop x = unmop y ↔ x = y := unmop_injective.eq_iff
```

-- snippet 5
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L51-L53)
theorem mop_unmop (X : Cᴹᵒᵖ) : mop (unmop X) = X := rfl
-- can't be simp bc after putting the lhs in whnf it's `X = X`
```

-- snippet 6
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L54-L55)
theorem unmop_mop (X : C) : unmop (mop X) = X := rfl
```

-- snippet 7
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalOppositeCategory (L56-L71)
instance monoidalOppositeCategory [Category.{v₁} C] : Category Cᴹᵒᵖ where
  Hom X Y := (unmop X ⟶ unmop Y)ᴹᵒᵖ
id X := mop (𝟙 (unmop X))
  comp f g := mop (unmop f ≫ unmop g)

end MonoidalOpposite

end CategoryTheory

open CategoryTheory

open CategoryTheory.MonoidalOpposite

variable [Category.{v₁} C]

/-- The monoidal opposite of a morphism `f : X ⟶ Y` is just `f`, thought of as `mop X ⟶ mop Y`. -/
```

-- snippet 8
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L72-L74)
def Quiver.Hom.mop {X Y : C} (f : X ⟶ Y) : mop X ⟶ mop Y := MonoidalOpposite.mop f
/-- We can think of a morphism `f : mop X ⟶ mop Y` as a morphism `X ⟶ Y`. -/
```

-- snippet 9
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L75-L80)
def Quiver.Hom.unmop {X Y : Cᴹᵒᵖ} (f : X ⟶ Y) : unmop X ⟶ unmop Y := MonoidalOpposite.unmop f
namespace Quiver.Hom

open MonoidalOpposite renaming mop → mop', unmop → unmop'
```

-- snippet 10
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj (L81-L84)
theorem mop_inj {X Y : C} :
    Function.Injective (Quiver.Hom.mop : (X ⟶ Y) → (mop' X ⟶ mop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.unmop H
```

-- snippet 11
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj (L85-L88)
theorem unmop_inj {X Y : Cᴹᵒᵖ} :
    Function.Injective (Quiver.Hom.unmop : (X ⟶ Y) → (unmop' X ⟶ unmop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.mop H
```

-- snippet 12
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L90-L92)
theorem unmop_mop {X Y : C} {f : X ⟶ Y} : f.mop.unmop = f :=
rfl
```

-- snippet 13
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L94-L100)
theorem mop_unmop {X Y : Cᴹᵒᵖ} {f : X ⟶ Y} : f.unmop.mop = f :=
rfl

end Quiver.Hom

namespace CategoryTheory
```

-- snippet 14
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_comp (L102-L104)
theorem mop_comp {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} :
    (f ≫ g).mop = f.mop ≫ g.mop := rfl
```

-- snippet 15
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id (L106-L107)
theorem mop_id {X : C} : (𝟙 X).mop = 𝟙 (mop X) := rfl
```

-- snippet 16
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id (L113-L114)
theorem unmop_id {X : Cᴹᵒᵖ} : (𝟙 X).unmop = 𝟙 (unmop X) := rfl
```

-- snippet 17
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id_mop (L116-L117)
theorem unmop_id_mop {X : C} : (𝟙 (mop X)).unmop = 𝟙 X := rfl
```

-- snippet 18
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id_unmop (L119-L121)
theorem mop_id_unmop {X : Cᴹᵒᵖ} : (𝟙 (unmop X)).mop = 𝟙 X := rfl
-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj
```

-- snippet 19
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.MonoidalOpposite (L122-L128)
lemma MonoidalOpposite.hom_ext {x y : Cᴹᵒᵖ} {f g : x ⟶ y} (h : f.unmop = g.unmop) :
    f = g :=
Quiver.Hom.unmop_inj h

variable (C)

/-- The identity functor on `C`, viewed as a functor from `C` to its monoidal opposite. -/
```

-- snippet 20
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mopFunctor (L130-L131)
def mopFunctor : C ⥤ Cᴹᵒᵖ := Functor.mk mop .mop
/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/
```

-- snippet 21
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmopFunctor (L133-L139)
def unmopFunctor : Cᴹᵒᵖ ⥤ C := Functor.mk unmop .unmop
variable {C}

namespace Iso

/-- An isomorphism in `C` gives an isomorphism in `Cᴹᵒᵖ`. -/
```

-- snippet 22
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop (L140-L142)
abbrev mop {X Y : C} (f : X ≅ Y) : mop X ≅ mop Y := (mopFunctor C).mapIso f
/-- An isomorphism in `Cᴹᵒᵖ` gives an isomorphism in `C`. -/
```

-- snippet 23
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop (L143-L148)
abbrev unmop {X Y : Cᴹᵒᵖ} (f : X ≅ Y) : unmop X ≅ unmop Y := (unmopFunctor C).mapIso f
end Iso

namespace IsIso
```

-- snippet 24
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalCategoryOp (L160-L178)
instance monoidalCategoryOp : MonoidalCategory Cᵒᵖ where
  tensorObj X Y := op (unop X ⊗ unop Y)
whiskerLeft X _ _ f := (X.unop ◁ f.unop).op
  whiskerRight f X := (f.unop ▷ X.unop).op
  tensorHom f g := (f.unop ⊗ₘ g.unop).op
  tensorHom_def _ _ := Quiver.Hom.unop_inj (tensorHom_def' _ _)
  tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unop_inj <| by simp
  tensorUnit := op (𝟙_ C)
  associator X Y Z := (α_ (unop X) (unop Y) (unop Z)).symm.op
  leftUnitor X := (λ_ (unop X)).symm.op
  rightUnitor X := (ρ_ (unop X)).symm.op
  associator_naturality f g h := Quiver.Hom.unop_inj <| by simp
  leftUnitor_naturality f := Quiver.Hom.unop_inj <| by simp
  rightUnitor_naturality f := Quiver.Hom.unop_inj <| by simp
  triangle X Y := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence
  pentagon W X Y Z := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence

section OppositeLemmas
```

-- snippet 25
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.op_tensor_op (L235-L236)
theorem op_tensor_op {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f.op ⊗ₘ g.op = (f ⊗ₘ g).op := rfl
```

-- snippet 26
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctor (L187-L201)
def actionOfMonoidalFunctorToEndofunctor (F : C ⥤ D ⥤ D) [F.Monoidal] :
    MonoidalRightAction C D where
  actionObj d c := (F.obj c).obj d
actionHomLeft f c := (F.obj c).map f
  actionHomRight d _ _ f := (F.map f).app d
  actionAssocIso d c c' := Functor.Monoidal.μIso F c c' |>.app d |>.symm
  actionUnitIso d := Functor.Monoidal.εIso F |>.app d |>.symm
  actionAssocIso_hom_naturality {c₁ c₁' c₂ c₂' c₃ c₃'} f g h := by
    have e := congrArg (fun t ↦ t.app c₁) <|
      Functor.OplaxMonoidal.δ_natural F g h
    dsimp at e
    simp [reassoc_of% e]

/-- If the action of `C` on `D` comes from a monoidal functor `C ⥤ (D ⥤ D)`,
then `curriedActionMop C D` is naturally isomorphic to that functor. -/
```

-- snippet 27
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionObj_mop (L309-L311)
lemma monoidalOppositeRightAction_actionObj_mop (c : C) (d : D) :
    d ⊙ᵣ mop c = c ⊙ₗ d := rfl
```

-- snippet 28
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δₗ_associativity_inv (L135-L143)
lemma δₗ_associativity_inv (c c' : C) (d : D) :
    δₗ F c (c' ⊙ₗ d) ≫
      c ⊴ₗ δₗ F c' d ≫ (αₗ _ _ _).inv =
    F.map (αₗ _ _ _).inv ≫ δₗ F (c ⊗ c' : C) d := by
simpa [-δₗ_associativity, -δₗ_associativity_assoc] using
    F.map (αₗ _ _ _).inv ≫=
      (δₗ_associativity F c c' d).symm =≫
      (αₗ _ _ _).inv
```

-- snippet 29
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionLeft (L337-L340)
abbrev actionLeft (c : C) : D ⥤ D := curriedAction C D |>.obj c
variable {D} in
/-- Bundle `c ↦ c ⊙ₗ d` as a functor. -/
```

-- snippet 30
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft (L258-L261)
theorem hom_inv_actionHomLeft {x y : C} (f : x ≅ y) (z : D) :
    f.hom ⊵ₗ z ≫ f.inv ⊵ₗ z = 𝟙 (x ⊙ₗ z) := by
rw [← comp_actionHomLeft, Iso.hom_inv_id, id_actionHomLeft]
```

-- snippet 31
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δᵣ_associativity_inv (L297-L305)
lemma δᵣ_associativity_inv (d : D) (c c' : C) :
    δᵣ F (d ⊙ᵣ c) c' ≫
      δᵣ F d c ⊵ᵣ c' ≫ (αᵣ _ _ _).inv =
    F.map (αᵣ _ _ _).inv ≫ δᵣ F d (c ⊗ c' : C) := by
simpa [-δᵣ_associativity, -δᵣ_associativity_assoc] using
    F.map (αᵣ _ _ _).inv ≫=
      (δᵣ_associativity F d c c').symm =≫
      (αᵣ _ _ _).inv
```

-- snippet 32
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δᵣ_unitality_hom (L307-L335)
lemma δᵣ_unitality_hom (d : D) :
    δᵣ F d (𝟙_ C) ≫ (ρᵣ (F.obj d)).hom = F.map (ρᵣ d).hom := by
simpa [-δᵣ_unitality_inv] using
    F.map (ρᵣ[C] d).hom ≫=
      (δᵣ_unitality_inv F d).symm =≫
      (ρᵣ[C] (F.obj d)).hom

end OplaxRightLinear

/-- `F.RightLinear C` asserts that `F` is both lax and oplax left-linear,
in a compatible way, i.e that `μᵣ` is inverse to `δᵣ`. -/
class RightLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalRightAction C D] [MonoidalRightAction C D'] extends
    F.LaxRightLinear C, F.OplaxRightLinear C where
  μᵣ_comp_δᵣ (F) (d : D) (c : C) :
    LaxRightLinear.μᵣ F d c ≫ OplaxRightLinear.δᵣ F d c = 𝟙 _
  δᵣ_comp_μᵣ (F) (d : D) (c : C) :
    OplaxRightLinear.δᵣ F d c ≫ LaxRightLinear.μᵣ F d c = 𝟙 _

namespace RightLinear

open LaxRightLinear OplaxRightLinear

variable
  (F : D ⥤ D') {C : Type*} [Category* C] [MonoidalCategory C]
  [MonoidalRightAction C D] [MonoidalRightAction C D']
  [F.RightLinear C]
```

-- snippet 33
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom' (L283-L286)
theorem actionHomRight_inv_hom' (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    x ⊴ₗ inv f ≫ x ⊴ₗ f = 𝟙 (x ⊙ₗ z) := by
rw [← actionHomRight_comp, IsIso.inv_hom_id, actionHomRight_id]
```

-- snippet 34
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHomLeft_op (L209-L212)
lemma oppositeLeftAction_actionHomLeft_op
    {c c' : C} (f : c ⟶ c') (d : D) :
    f.op ⊵ₗ op d = op (f ⊵ₗ d) := rfl
```

-- snippet 35
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_action (L226-L229)
theorem actionHomLeft_action {x x' : C} (f : x ⟶ x') (y : C) (z : D) :
    f ⊵ₗ (y ⊙ₗ z) = (αₗ x y z).inv ≫ (f ▷ y) ⊵ₗ z ≫ (αₗ x' y z).hom := by
simp [whiskerRight_actionHomLeft]
```

-- snippet 36
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction (L70-L91)
def monoidalOppositeLeftAction [MonoidalRightAction C D] :
    MonoidalLeftAction Cᴹᵒᵖ D where
  actionObj c d := d ⊙ᵣ unmop c
actionHomLeft {c c'} f d := d ⊴ᵣ f.unmop
  actionHomRight c {d d'} f := f ⊵ᵣ unmop c
  actionHom {c c'} {d d} f g := g ⊙ᵣₘ f.unmop
  actionAssocIso _ _ _ := αᵣ _ _ _
  actionUnitIso _ := ρᵣ _
  actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalRightAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalRightAction.actionUnitIso_hom_naturality _
  rightUnitor_actionHom c d :=
    MonoidalRightAction.actionHom_leftUnitor _ _
  associator_actionHom c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalRightAction.actionHomRight_inv_hom_assoc] using
      (d ⊴ᵣ (α_ (unmop c₃) (unmop c₂) (unmop c₁)).inv) ≫=
        MonoidalRightAction.actionHom_associator
          (unmop c₃) (unmop c₂) (unmop c₁) d |>.symm
```

-- snippet 37
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_tensor (L524-L529)
theorem actionHomLeft_tensor {z z' : D} (f : z ⟶ z') (x y : C) :
    (f ⊵ᵣ (x ⊗ y)) = (αᵣ z x y).hom ≫ (f ⊵ᵣ x) ⊵ᵣ y ≫ (αᵣ z' x y).inv := by
simp only [← actionHom_id]
  rw [← Category.assoc, ← actionAssocIso_hom_naturality]
  simp
```

-- snippet 38
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μₗIso (L178-L183)
abbrev μₗIso (c : C) (d : D) : c ⊙ₗ F.obj d ≅ F.obj (c ⊙ₗ d) where
  hom := LaxLeftLinear.μₗ F c d
inv := OplaxLeftLinear.δₗ F c d

variable (c : C) (d : D)
```

-- snippet 39
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μᵣ_associativity_inv (L241-L248)
lemma μᵣ_associativity_inv (d : D) (c c' : C) :
    μᵣ F d c ⊵ᵣ c' ≫ μᵣ F (d ⊙ᵣ c) c' ≫ F.map (αᵣ _ _ _).inv =
    (αᵣ (F.obj d) c c').inv ≫ μᵣ F d (c ⊗ c') := by
simpa [-μᵣ_associativity, -μᵣ_associativity_assoc] using
    (αᵣ _ _ _).inv ≫=
      (μᵣ_associativity F d c c').symm =≫
      F.map (αᵣ _ _ _).inv
```

-- snippet 40
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_μₗ (L189-L192)
lemma inv_μₗ :
    CategoryTheory.inv (μₗ F c d) = δₗ F c d :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| μₗ_comp_δₗ F c d
```

-- snippet 41
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHomLeft_mop (L100-L103)
lemma monoidalOppositeLeftAction_actionHomLeft_mop
    {c c' : C} (f : c ⟶ c') (d : D) :
    f.mop ⊵ₗ d = d ⊴ᵣ f := rfl
```

-- snippet 42
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHom (L300-L304)
instance isIso_actionHom {x y : C} {x' y' : D}
    (f : x ⟶ y) (g : x' ⟶ y') [IsIso f] [IsIso g] :
    IsIso (f ⊙ₗₘ g) :=
⟨(inv f) ⊙ₗₘ (inv g), by simp [← actionHom_comp]⟩
```

-- snippet 43
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctorMop (L98-L145)
def actionOfMonoidalFunctorToEndofunctorMop (F : C ⥤ (D ⥤ D)ᴹᵒᵖ) [F.Monoidal] :
    MonoidalLeftAction C D where
  actionObj c d := (F.obj c).unmop.obj d
actionHomLeft f d := (F.map f).unmop.app d
  actionHomRight c _ _ f := (F.obj c).unmop.map f
  actionAssocIso c c' d := Functor.Monoidal.μIso F c c' |>.unmop.app d |>.symm
  actionUnitIso d := Functor.Monoidal.εIso F |>.unmop.app d |>.symm
  actionAssocIso_hom_naturality {c₁ c₁' c₂ c₂' c₃ c₃'} f g h := by
    have e := congrArg (fun t ↦ t.unmop.app c₃) <|
      Functor.OplaxMonoidal.δ_natural F f g
    dsimp at e
    simp [reassoc_of% e]
  whiskerRight_actionHomLeft {x y} c f d := by
    have e := congrArg (fun t ↦ t.unmop.app d) <|
      Functor.LaxMonoidal.μ_natural_left F f c
    dsimp at e
    simp [e, ← NatTrans.comp_app, ← unmop_comp]
  whiskerLeft_actionHomLeft c {x y} f d := by
    have e := congrArg (fun t ↦ t.unmop.app d) <|
      Functor.LaxMonoidal.μ_natural_right F c f
    dsimp at e
    simp [e, ← NatTrans.comp_app, ← unmop_comp]
  associator_actionHom c₁ c₂ c₃ d := by
    have e := congrArg (fun t ↦ t.unmop.app d) <|
      Functor.OplaxMonoidal.associativity F c₁ c₂ c₃
    dsimp at e
    simp only [Category.comp_id] at e
    simp [e]
  leftUnitor_actionHom c d := by
    have e := (F.map (λ_ c).hom).unmop.app d ≫=
      (congrArg (fun t ↦ t.unmop.app d) <|
        Functor.OplaxMonoidal.left_unitality F c)
    dsimp at e
    simp only [Category.comp_id, ← NatTrans.comp_app_assoc, ← unmop_comp,
      ← F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e
    simp [e]
  rightUnitor_actionHom c d := by
    have e := (F.map (ρ_ c).hom).unmop.app d ≫=
      (congrArg (fun t ↦ t.unmop.app d) <|
        Functor.OplaxMonoidal.right_unitality F c)
    dsimp at e
    simp only [Category.comp_id, ← NatTrans.comp_app_assoc, ← unmop_comp,
      ← F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e
    simp [e]

/-- If the (left) action of `C` on `D` comes from a monoidal functor
`C ⥤ (D ⥤ D)ᴹᵒᵖ`, then `curriedActionMop C D` is naturally isomorphic to that
functor. -/
```

-- snippet 44
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selRightfAction (L485-L501)
instance selRightfAction [MonoidalCategory C] : MonoidalRightAction C C where
  actionObj x y := x ⊗ y
actionHom f g := f ⊗ₘ g
  actionUnitIso x := ρ_ x
  actionAssocIso x y z := α_ x y z |>.symm
  actionHomLeft f x := f ▷ x
  actionHomRight x _ _ f := x ◁ f
  actionHom_def := by simp [tensorHom_def]

namespace MonoidalRightAction

open Category

variable {C D} [MonoidalCategory C] [MonoidalRightAction C D]

-- Simp normal forms are aligned with the ones in `MonoidalCategory`.
```

-- snippet 45
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.rightActionOfMonoidalOppositeLeftAction (L261-L282)
def rightActionOfMonoidalOppositeLeftAction [MonoidalLeftAction Cᴹᵒᵖ D] :
    MonoidalRightAction C D where
  actionObj d c := mop c ⊙ₗ d
actionHomLeft {d d'} f c := mop c ⊴ₗ f
  actionHomRight d _ _ f := f.mop ⊵ₗ d
  actionHom {c c'} {d d'} f g := g.mop ⊙ₗₘ f
  actionAssocIso _ _ _ := αₗ _ _ _
  actionUnitIso _ := λₗ _
  actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalLeftAction.actionUnitIso_hom_naturality _
  actionHom_associator c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using
      (α_ (mop c₃) (mop c₂) (mop c₁)).inv ⊵ₗ d ≫=
        MonoidalLeftAction.associator_actionHom
          (mop c₃) (mop c₂) (mop c₁) d |>.symm

/-- Define a right action of `Cᴹᵒᵖ` on `D` from a left action of `C` on `D` via
the formula `d ⊙ᵣ mop c = c ⊙ₗ d`. -/
```

-- snippet 46
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionRight_mop (L316-L319)
lemma monoidalOppositeRightAction_actionRight_mop
    (c : C) {d d' : D} (f : d ⟶ d') :
    f ⊵ᵣ mop c = c ⊴ₗ f := rfl
```

-- snippet 47
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction (L164-L200)
def leftActionOfOppositeLeftAction [MonoidalLeftAction Cᵒᵖ Dᵒᵖ] :
    MonoidalLeftAction C D where
  actionObj c d := unop <| op c ⊙ₗ op d
actionHomLeft {c c'} f d := (f.op ⊵ₗ op d).unop
  actionHomRight c {d d'} f := (op c ⊴ₗ f.op).unop
  actionHom {c c'} {d d} f g := (f.op ⊙ₗₘ g.op).unop
  actionAssocIso _ _ _ := Iso.unop <| (αₗ _ _ _).symm
  actionUnitIso _ := Iso.unop <| (λₗ _).symm
  actionHom_def f g := by
    apply Quiver.Hom.op_inj
    simpa [MonoidalLeftAction.action_exchange] using
      MonoidalLeftAction.actionHom_def f.op g.op
  actionAssocIso_hom_naturality f g h := by
    apply Quiver.Hom.op_inj
    haveI := (αₗ (op _) (op _) (op _)).inv ≫=
      MonoidalLeftAction.actionAssocIso_hom_naturality f.op g.op h.op
    simp only [Iso.inv_hom_id_assoc] at this
    simp [← this]
  actionUnitIso_hom_naturality _ := by
    apply Quiver.Hom.op_inj
    simp
  whiskerRight_actionHomLeft _ _ _ := by
    apply Quiver.Hom.op_inj
    simp
  associator_actionHom _ _ _ _ := by
    apply Quiver.Hom.op_inj
    apply IsIso.inv_eq_inv.mp
    simp
  leftUnitor_actionHom _ _ := by
    apply Quiver.Hom.op_inj
    apply IsIso.inv_eq_inv.mp
    simp
  rightUnitor_actionHom _ _ := by
    apply Quiver.Hom.op_inj
    apply IsIso.inv_eq_inv.mp
    simp
```

-- snippet 48
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_def' (L236-L239)
theorem actionHom_def' {x₁ y₁ : C} {x₂ y₂ : D} (f : x₁ ⟶ y₁) (g : x₂ ⟶ y₂) :
    f ⊙ₗₘ g = x₁ ⊴ₗ g ≫ f ⊵ₗ y₂ :=
action_exchange f g ▸ actionHom_def f g
```

-- snippet 49
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomRight (L311-L314)
lemma inv_actionHomRight (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    inv (x ⊴ₗ f) = x ⊴ₗ inv f :=
IsIso.inv_eq_of_hom_inv_id <| actionHomRight_hom_inv' x f
```

-- snippet 50
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv (L253-L256)
theorem actionHomRight_hom_inv (x : C) {y z : D} (f : y ≅ z) :
    x ⊴ₗ f.hom ≫ x ⊴ₗ f.inv = 𝟙 (x ⊙ₗ y : D) := by
rw [← actionHomRight_comp, Iso.hom_inv_id, actionHomRight_id]
```

-- snippet 51
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitNatIso (L355-L356)
def actionUnitNatIso : actionLeft D (𝟙_ C) ≅ 𝟭 D := NatIso.ofComponents (λₗ ·)
```

-- snippet 52
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionAssocIso_unop (L246-L249)
lemma leftActionOfOppositeLeftAction_actionAssocIso_unop
    (c c' : Cᵒᵖ) (d : Dᵒᵖ) :
    αₗ (unop c) (unop c') (unop d) = (αₗ c c' d).symm.unop := rfl
```

-- snippet 53
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction (L284-L303)
def monoidalOppositeRightAction [MonoidalLeftAction C D] :
    MonoidalRightAction Cᴹᵒᵖ D where
  actionObj d c := unmop c ⊙ₗ d
actionHomLeft {d d'} f c := unmop c ⊴ₗ f
  actionHomRight d _ _ f := f.unmop ⊵ₗ d
  actionHom {c c'} {d d'} f g := g.unmop ⊙ₗₘ f
  actionAssocIso _ _ _ := αₗ _ _ _
  actionUnitIso _ := λₗ _
  actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalLeftAction.actionUnitIso_hom_naturality _
  actionHom_associator c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using
      (α_ (unmop c₃) (unmop c₂) (unmop c₁)).inv ⊵ₗ d ≫=
        MonoidalLeftAction.associator_actionHom
          (unmop c₃) (unmop c₂) (unmop c₁) d |>.symm
```

-- snippet 54
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_comp (L203-L206)
theorem actionHomRight_comp (w : C) {x y z : D} (f : x ⟶ y) (g : y ⟶ z) :
    w ⊴ₗ (f ≫ g) = w ⊴ₗ f ≫ w ⊴ₗ g := by
simp [← id_actionHom, ← actionHom_comp]
```

-- snippet 55
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δₗ_unitality_hom (L145-L173)
lemma δₗ_unitality_hom (d : D) :
    δₗ F (𝟙_ C) d ≫ (λₗ (F.obj d)).hom = F.map (λₗ d).hom := by
simpa [-δₗ_unitality_inv] using
    F.map (λₗ[C] d).hom ≫=
      (δₗ_unitality_inv F d).symm =≫
      (λₗ[C] (F.obj d)).hom

end OplaxLeftLinear

/-- `F.LeftLinear C` asserts that `F` is both lax and oplax left-linear,
in a compatible way, i.e that `μₗ` is inverse to `δₗ`. -/
class LeftLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalLeftAction C D] [MonoidalLeftAction C D'] extends
    F.LaxLeftLinear C, F.OplaxLeftLinear C where
  μₗ_comp_δₗ (F) (c : C) (d : D) :
    LaxLeftLinear.μₗ F c d ≫ OplaxLeftLinear.δₗ F c d = 𝟙 _
  δₗ_comp_μₗ (F) (c : C) (d : D) :
    OplaxLeftLinear.δₗ F c d ≫ LaxLeftLinear.μₗ F c d = 𝟙 _

namespace LeftLinear

open LaxLeftLinear OplaxLeftLinear

variable
  (F : D ⥤ D') {C : Type*} [Category* C] [MonoidalCategory C]
  [MonoidalLeftAction C D] [MonoidalLeftAction C D']
  [F.LeftLinear C]
```

-- snippet 56
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft' (L278-L281)
theorem hom_inv_actionHomLeft' {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    f ⊵ₗ z ≫ inv f ⊵ₗ z = 𝟙 (x ⊙ₗ z) := by
rw [← comp_actionHomLeft, IsIso.hom_inv_id, id_actionHomLeft]
```

-- snippet 57
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHom_op (L217-L220)
lemma oppositeLeftAction_actionHom_op
    {c c' : C} {d d' : D} (f : c ⟶ c') (g : d ⟶ d') :
    f.op ⊙ₗₘ g.op = op (f ⊙ₗₘ g) := rfl
```

-- snippet 58
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorIso (L203-L216)
def curriedActionActionOfMonoidalFunctorToEndofunctorIso
    (F : C ⥤ (D ⥤ D)) [F.Monoidal] :
    letI := actionOfMonoidalFunctorToEndofunctor F
curriedAction C D ≅ F :=
  .refl _

end MonoidalRightAction

namespace endofunctorMonoidalCategory
/-- Functor evaluation gives a right action of `C ⥤ C`.

Note that in the literature, this is defined as a left action, but mathlib's
monoidal structure on `C ⥤ C` is the monoidal opposite of the one usually
considered in the literature. -/
```

-- snippet 59
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionRight_unop (L238-L241)
lemma leftActionOfOppositeLeftAction_actionRight_unop
    (c : Cᵒᵖ) {d d' : Dᵒᵖ} (f : d ⟶ d') :
    unop c ⊴ₗ f.unop = unop (c ⊴ₗ f) := rfl
```

-- snippet 60
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHom_mop_mop (L108-L111)
lemma monoidalOppositeLeftAction_actionHom_mop_mop
    {c c' : C} {d d' : D} (f : c ⟶ c') (g : d ⟶ d') :
    f.mop ⊙ₗₘ g = g ⊙ᵣₘ f := rfl
```

-- snippet 61
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μₗ_associativity_inv (L79-L86)
lemma μₗ_associativity_inv (c c' : C) (d : D) :
    c ⊴ₗ μₗ F c' d ≫ μₗ F c (c' ⊙ₗ d) ≫ F.map (αₗ _ _ _).inv =
    (αₗ c c' (F.obj d)).inv ≫ μₗ F (c ⊗ c') d := by
simpa [-μₗ_associativity, -μₗ_associativity_assoc] using
    (αₗ _ _ _).inv ≫=
      (μₗ_associativity F c c' d).symm =≫
      F.map (αₗ _ _ _).inv
```

-- snippet 62
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.tensor_actionHomRight (L214-L219)
theorem tensor_actionHomRight (x y : C) {z z' : D} (f : z ⟶ z') :
    (x ⊗ y) ⊴ₗ f = (αₗ x y z).hom ≫ x ⊴ₗ y ⊴ₗ f ≫ (αₗ x y z').inv := by
simp only [← id_actionHom]
  rw [← Category.assoc, ← actionAssocIso_hom_naturality]
  simp
```

-- snippet 63
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionAssocIso_op (L221-L223)
lemma oppositeLeftAction_actionAssocIso_op (c c' : C) (d : D) :
    αₗ (op c) (op c') (op d) = (αₗ c c' d).symm.op := rfl
```

-- snippet 64
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionObj_unop (L231-L233)
lemma leftActionOfOppositeLeftAction_actionObj_unop (c : Cᵒᵖ) (d : Dᵒᵖ) :
    (unop c) ⊙ₗ (unop d) = unop (c ⊙ₗ d) := rfl
```

-- snippet 65
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomLeft (L296-L299)
instance isIso_actionHomLeft {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    IsIso (f ⊵ₗ z) :=
⟨inv f ⊵ₗ z, by simp⟩
```

-- snippet 66
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionHomRight_mop (L312-L315)
lemma monoidalOppositeRightAction_actionHomRight_mop
    {c c' : C} (f : c ⟶ c') (d : D) :
    d ⊴ᵣ f.mop = f ⊵ₗ d := rfl
```

-- snippet 67
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorMopIso (L147-L161)
def curriedActionActionOfMonoidalFunctorToEndofunctorMopIso
    (F : C ⥤ (D ⥤ D)ᴹᵒᵖ) [F.Monoidal] :
    letI := actionOfMonoidalFunctorToEndofunctorMop F
curriedActionMop C D ≅ F :=
  .refl _

end MonoidalLeftAction

namespace MonoidalRightAction

variable {C D}

open MonoidalOpposite in
/-- When `C` acts on the right on `D`, the functor `curriedAction : C ⥤ (D ⥤ D)`
is monoidal, where `D ⥤ D` has the composition monoidal structure. -/
```

-- snippet 68
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomLeft (L306-L309)
lemma inv_actionHomLeft {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    inv (f ⊵ₗ z) = inv f ⊵ₗ z :=
IsIso.inv_eq_of_hom_inv_id <| hom_inv_actionHomLeft' f z
```

-- snippet 69
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_exchange (L231-L234)
theorem action_exchange {w x : C} {y z : D} (f : w ⟶ x) (g : y ⟶ z) :
    w ⊴ₗ g ≫ f ⊵ₗ z = f ⊵ₗ y ≫ x ⊴ₗ g := by
simp only [← id_actionHom, ← actionHom_id, ← actionHom_comp, id_comp, comp_id]
```

-- snippet 70
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_δₗ (L194-L229)
lemma inv_δₗ :
    CategoryTheory.inv (δₗ F c d) = μₗ F c d :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| δₗ_comp_μₗ F c d

end LeftLinear

end leftAction

section rightAction

open MonoidalRightAction

/-- `F.LaxLinear C` equips `F : D ⥤ D'` with a family of morphisms
`μₗ F : ∀ (c : C) (d : D), c ⊙ₗ F.obj d ⟶ F.obj (c ⊙ₗ d)`
that is natural in each variable and coherent with respect to left actions
of `C` on `D` and `D'`. -/
class LaxRightLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalRightAction C D] [MonoidalRightAction C D'] where
  /-- The "μᵣ" morphism. -/
  μᵣ (F) (d : D) (c : C) : F.obj d ⊙ᵣ c ⟶ F.obj (d ⊙ᵣ c)
  μᵣ_naturality_right (F) (d : D) {c c' : C} (f : c ⟶ c') :
    F.obj d ⊴ᵣ f ≫ μᵣ d c' = μᵣ d c ≫ F.map (d ⊴ᵣ f) := by cat_disch
  μᵣ_naturality_left (F) {d d' : D} (f : d ⟶ d') (c : C) :
    F.map f ⊵ᵣ c ≫ μᵣ d' c = μᵣ d c ≫ F.map (f ⊵ᵣ c) := by cat_disch
  μᵣ_associativity (F) (d : D) (c c' : C) :
    μᵣ d (c ⊗ c') ≫ F.map (αᵣ _ _ _).hom =
    (αᵣ (F.obj d) c c').hom ≫ (μᵣ d c) ⊵ᵣ c' ≫
      μᵣ (d ⊙ᵣ c) c' := by cat_disch
  μᵣ_unitality (F) (d : D) :
    (ρᵣ (F.obj d)).hom = μᵣ d (𝟙_ C) ≫ F.map (ρᵣ d).hom := by cat_disch

namespace LaxRightLinear

-- These are [reassoc (attr := simp)] on the basis that analog lemmas for
-- lax monoidal functors are also [reassoc (attr := simp)].
```

-- snippet 71
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop_map_unmop_app (L58-L66)
lemma curriedActionMop_map_unmop_app {c c' : C} (f : c ⟶ c') (d : D) :
    ((curriedActionMop C D).map f).unmop.app d = f ⊵ₗ d :=
rfl

set_option backward.isDefEq.respectTransparency false in
open MonoidalOpposite in
/-- When `C` acts on the left on `D`, the functor
`curriedActionMop : C ⥤ (D ⥤ D)ᴹᵒᵖ` is monoidal, where `D ⥤ D` has the
composition monoidal structure. -/
```

-- snippet 72
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.comp_actionHomLeft (L221-L224)
theorem comp_actionHomLeft {w x y : C} (f : w ⟶ x) (g : x ⟶ y) (z : D) :
    (f ≫ g) ⊵ₗ z = f ⊵ₗ z ≫ g ⊵ₗ z := by
simp only [← actionHom_id, ← actionHom_comp, Category.id_comp]
```

-- snippet 73
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.curriedAction (L326-L335)
def curriedAction : C ⥤ D ⥤ D where
  obj x :=
{ obj y := x ⊙ₗ y
      map f := x ⊴ₗ f }
  map f :=
    { app y := f ⊵ₗ y
      naturality _ _ _ := by simp [action_exchange] }

variable {C} in
/-- Bundle `d ↦ c ⊙ₗ d` as a functor. -/
```

-- snippet 74
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMopMonoidal (L68-L89)
instance curriedActionMopMonoidal : (curriedActionMop C D).Monoidal where
  ε := .mop <| (actionUnitNatIso C D).inv
μ _ _ := .mop <| { app _ := αₗ _ _ _ |>.inv }
  δ _ _ := .mop <| { app _ := αₗ _ _ _ |>.hom }
  η := .mop <| (actionUnitNatIso C D).hom
  associativity c₁ c₂ c₃ := by
    apply (mopEquiv (D ⥤ D)).fullyFaithfulInverse.map_injective
    ext d
    simpa [-associator_actionHom] using
      (IsIso.inv_eq_inv.mpr <| associator_actionHom c₁ c₂ c₃ d).symm =≫
        (α_ c₁ c₂ c₃).hom ⊵ₗ d
  oplax_right_unitality x := by
    apply MonoidalOpposite.hom_ext
    ext t
    simpa [-rightUnitor_actionHom] using
      (ρ_ x).inv ⊵ₗ t ≫= rightUnitor_actionHom x t
  oplax_left_unitality x := by
    apply MonoidalOpposite.hom_ext
    ext t
    simpa [-leftUnitor_actionHom] using
      (λ_ x).inv ⊵ₗ t ≫= leftUnitor_actionHom x t
```

-- snippet 75
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_δᵣ (L356-L364)
lemma inv_δᵣ :
    CategoryTheory.inv (δᵣ F d c) = μᵣ F d c :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| δᵣ_comp_μᵣ F d c

end RightLinear

end rightAction

end CategoryTheory.Functor
```

-- snippet 76
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfMonoidalOppositeRightAction (L45-L68)
def leftActionOfMonoidalOppositeRightAction [MonoidalRightAction Cᴹᵒᵖ D] :
    MonoidalLeftAction C D where
  actionObj c d := d ⊙ᵣ mop c
actionHomLeft {c c'} f d := d ⊴ᵣ f.mop
  actionHomRight c {d d'} f := f ⊵ᵣ mop c
  actionHom {c c'} {d d} f g := g ⊙ᵣₘ f.mop
  actionAssocIso _ _ _ := αᵣ _ _ _
  actionUnitIso _ := ρᵣ _
  actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalRightAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalRightAction.actionUnitIso_hom_naturality _
  rightUnitor_actionHom c d :=
    MonoidalRightAction.actionHom_leftUnitor _ _
  associator_actionHom c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalRightAction.actionHomRight_inv_hom_assoc] using
      (d ⊴ᵣ (α_ (mop c₃) (mop c₂) (mop c₁)).inv) ≫=
        MonoidalRightAction.actionHom_associator
          (mop c₃) (mop c₂) (mop c₁) d |>.symm

/-- Define a left action of `Cᴹᵒᵖ` on `D` from a right action of `C` on `D` via
the formula `mop c ⊙ₗ d = d ⊙ᵣ c`. -/
```

-- snippet 77
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomRight (L292-L295)
instance isIso_actionHomRight (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    IsIso (x ⊴ₗ f) :=
⟨x ⊴ₗ inv f, by simp⟩
```

-- snippet 78
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionAssocIso_mop_mop (L112-L114)
lemma monoidalOppositeLeftAction_actionAssocIso_mop_mop (c c' : C) (d : D) :
    αₗ (mop c) (mop c') d = αᵣ d c' c := rfl
```

-- snippet 79
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHom (L316-L320)
lemma inv_actionHom {x y : C} {x' y' : D}
    (f : x ⟶ y) (g : x' ⟶ y') [IsIso f] [IsIso g] :
    inv (f ⊙ₗₘ g) = (inv f) ⊙ₗₘ (inv g) :=
IsIso.inv_eq_of_hom_inv_id <| by simp [← actionHom_comp]
```

-- snippet 80
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionRight_op (L213-L216)
lemma oppositeLeftAction_actionRight_op
    (c : C) {d d' : D} (f : d ⟶ d') :
    op c ⊴ₗ f.op = op (c ⊴ₗ f) := rfl
```

-- snippet 81
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitIso_inv_naturality (L248-L251)
theorem actionUnitIso_inv_naturality {d d' : D} (f : d ⟶ d') :
      (λₗ d).inv ≫ (𝟙_ C) ⊴ₗ f = f ≫ (λₗ d').inv := by
rw [Iso.inv_comp_eq, ← Category.assoc, Eq.comm, Iso.comp_inv_eq, actionUnitIso_hom_naturality]
```

-- snippet 82
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_id (L198-L201)
lemma actionHom_id {c c' : C} (f : c ⟶ c') (d : D) :
    f ⊙ₗₘ (𝟙 d) = f ⊵ₗ d := by
simp [actionHom_def]
```

-- snippet 83
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop (L50-L56)
def curriedActionMop : C ⥤ (D ⥤ D)ᴹᵒᵖ :=
(curriedAction C D) ⋙ mopFunctor _

-- This simp lemma is necessary because the simps projection generated for
-- unmop of a morphism is actually its underlying unmop field, rather than
-- the application of `Quiver.Hom.unmop`.
variable {C D} in
```

-- snippet 84
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocNatIso (L346-L353)
def actionAssocNatIso :
    bifunctorComp₁₂ (curriedTensor C) (curriedAction C D) ≅
    bifunctorComp₂₃ (curriedAction C D) (curriedAction C D) :=
NatIso.ofComponents fun _ ↦
    NatIso.ofComponents fun _ ↦
     NatIso.ofComponents fun _ ↦ αₗ _ _ _

/-- Bundle `λₗ _` as an isomorphism of functors. -/
```

-- snippet 85
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selfLeftAction (L175-L191)
instance selfLeftAction [MonoidalCategory C] : MonoidalLeftAction C C where
  actionObj x y := x ⊗ y
actionHom f g := f ⊗ₘ g
  actionUnitIso x := λ_ x
  actionAssocIso x y z := α_ x y z
  actionHomLeft f x := f ▷ x
  actionHomRight x _ _ f := x ◁ f
  actionHom_def := by simp [tensorHom_def]

namespace MonoidalLeftAction

open Category

variable {C D} [MonoidalCategory C] [MonoidalLeftAction C D]

-- Simp normal forms are aligned with the ones in `MonoidalCategory`.
```

-- snippet 86
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction (L122-L162)
def oppositeLeftAction [MonoidalLeftAction C D] :
    MonoidalLeftAction Cᵒᵖ Dᵒᵖ where
  actionObj c d := op <| c.unop ⊙ₗ d.unop
actionHomLeft f d := (f.unop ⊵ₗ unop d).op
  actionHomRight c _ _ f := (unop c ⊴ₗ f.unop).op
  actionHom f g := (f.unop ⊙ₗₘ g.unop).op
  actionAssocIso _ _ _ := Iso.op <| (αₗ _ _ _).symm
  actionUnitIso _ := Iso.op <| (λₗ _).symm
  actionHom_def
    | op f, op g => by
        apply Quiver.Hom.unop_inj
        simpa [MonoidalLeftAction.action_exchange] using
          MonoidalLeftAction.actionHom_def f g
  actionAssocIso_hom_naturality
    | op f, op g, op h => by
        apply Quiver.Hom.unop_inj
        haveI := (αₗ (unop _) (unop _) (unop _)).inv ≫=
          MonoidalLeftAction.actionAssocIso_hom_naturality f g h
        simp only [Iso.inv_hom_id_assoc] at this
        simp [← this]
  actionUnitIso_hom_naturality _ := by
    apply Quiver.Hom.unop_inj
    simp
  whiskerRight_actionHomLeft _ _ _ := by
    apply Quiver.Hom.unop_inj
    simp
  associator_actionHom _ _ _ _ := by
    apply Quiver.Hom.unop_inj
    apply IsIso.inv_eq_inv.mp
    simp
  leftUnitor_actionHom _ _ := by
    apply Quiver.Hom.unop_inj
    apply IsIso.inv_eq_inv.mp
    simp
  rightUnitor_actionHom _ _ := by
    apply Quiver.Hom.unop_inj
    apply IsIso.inv_eq_inv.mp
    simp

/-- Define a left action of `C` on `D` from a left action of `Cᵒᵖ` on `Dᵒᵖ` via
the formula `c ⊙ₗ d = unop ((op c) ⊙ₗ (op d))`. -/
```

-- snippet 87
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft' (L288-L291)
theorem inv_hom_actionHomLeft' {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    inv f ⊵ₗ z ≫ f ⊵ₗ z = 𝟙 (y ⊙ₗ z) := by
rw [← comp_actionHomLeft, IsIso.inv_hom_id, id_actionHomLeft]
```

-- snippet 88
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionObj_op (L206-L208)
lemma oppositeLeftAction_actionObj_op (c : C) (d : D) :
    (op c) ⊙ₗ (op d) = op (c ⊙ₗ d) := rfl
```

-- snippet 89
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft (L268-L271)
theorem inv_hom_actionHomLeft {x y : C} (f : x ≅ y) (z : D) :
    f.inv ⊵ₗ z ≫ f.hom ⊵ₗ z = 𝟙 (y ⊙ₗ z) := by
rw [← comp_actionHomLeft, Iso.inv_hom_id, id_actionHomLeft]
```

-- snippet 90
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μᵣ_unitality_inv (L250-L285)
lemma μᵣ_unitality_inv (d : D) :
     (ρᵣ (F.obj d)).inv ≫ μᵣ F d (𝟙_ C) = F.map (ρᵣ d).inv := by
simpa [-μᵣ_unitality] using
    (ρᵣ[C] (F.obj d)).inv ≫=
      (μᵣ_unitality F d).symm =≫
      F.map (ρᵣ[C] d).inv

end LaxRightLinear

/-- `F.OplaxLinear C` equips `F : D ⥤ D'` with a family of morphisms
`δₗ F : ∀ (c : C) (d : D), c ⊙ₗ F.obj d ⟶ F.obj (c ⊙ₗ d)`
that is natural in each variable and coherent with respect to left actions
of `C` on `D` and `D'`. -/
class OplaxRightLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalRightAction C D] [MonoidalRightAction C D'] where
  /-- The oplax lineator morphism. -/
  δᵣ (F) (d : D) (c : C) : F.obj (d ⊙ᵣ c) ⟶ (F.obj d) ⊙ᵣ c
  δᵣ_naturality_right (F) (d : D) {c c' : C} (f : c ⟶ c') :
    F.map (d ⊴ᵣ f) ≫ δᵣ d c' =
    δᵣ d c ≫ F.obj d ⊴ᵣ f := by cat_disch
  δᵣ_naturality_left (F) {d d' : D} (f : d ⟶ d') (c : C) :
    F.map (f ⊵ᵣ c) ≫ δᵣ d' c =
    δᵣ d c ≫ F.map f ⊵ᵣ c := by cat_disch
  δᵣ_associativity (F) (d : D) (c c' : C) :
    δᵣ d (c ⊗ c') ≫ (αᵣ _ _ _).hom =
    F.map (αᵣ _ _ _).hom ≫ δᵣ (d ⊙ᵣ c) c' ≫
      δᵣ d c ⊵ᵣ c' := by cat_disch
  δᵣ_unitality_inv (F) (d : D) :
    (ρᵣ (F.obj d)).inv =
    F.map (ρᵣ d).inv ≫ δᵣ d (𝟙_ C) := by cat_disch

namespace OplaxRightLinear

-- These are [reassoc (attr := simp)] on the basis that analog lemmas for
-- oplax monoidal functors are also [reassoc (attr := simp)].
```

-- snippet 91
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMonoidal (L163-L185)
instance curriedActionMonoidal [MonoidalRightAction C D] :
    (curriedAction C D).Monoidal where
  ε := (actionUnitNatIso C D).inv
μ _ _ := { app _ := αᵣ _ _ _ |>.inv }
  δ _ _ := { app _ := αᵣ _ _ _ |>.hom }
  η := (actionUnitNatIso C D).hom
  associativity c₁ c₂ c₃ := by
    ext d
    simpa [-actionHom_associator] using
      (IsIso.inv_eq_inv.mpr <| actionHom_associator c₁ c₂ c₃ d).symm =≫
        d ⊴ᵣ (α_ c₁ c₂ c₃).hom
  oplax_right_unitality x := by
    ext t
    simpa [-actionHom_rightUnitor] using
      t ⊴ᵣ (ρ_ x).inv ≫= actionHom_rightUnitor x t
  oplax_left_unitality x := by
    ext t
    simpa [-actionHom_leftUnitor] using
      t ⊴ᵣ (λ_ x).inv ≫= actionHom_leftUnitor x t

set_option backward.isDefEq.respectTransparency false in
/-- A monoidal functor `F : C ⥤ D ⥤ D` can be thought of as a right action
of `C` on `D`. -/
```

-- snippet 92
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_actionHomRight (L536-L539)
theorem action_actionHomRight (y : D) (z : C) {x x' : C} (f : x ⟶ x') :
    (y ⊙ᵣ z) ⊴ᵣ f = (αᵣ y z x).inv ≫ y ⊴ᵣ (z ◁ f) ≫ (αᵣ y z x').hom := by
simp [whiskerRight_actionHomLeft]
```

-- snippet 93
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHom_unop (L242-L245)
lemma leftActionOfOppositeLeftAction_actionHom_unop
    {c c' : Cᵒᵖ} {d d' : Dᵒᵖ} (f : c ⟶ c') (g : d ⟶ d') :
    f.unop ⊙ₗₘ g.unop = unop (f ⊙ₗₘ g) := rfl
```

-- snippet 94
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μₗ_unitality_inv (L88-L123)
lemma μₗ_unitality_inv (d : D) :
     (λₗ (F.obj d)).inv ≫ μₗ F (𝟙_ C) d = F.map (λₗ d).inv := by
simpa [-μₗ_unitality] using
    (λₗ[C] (F.obj d)).inv ≫=
      (μₗ_unitality F d).symm =≫
      F.map (λₗ[C] d).inv

end LaxLeftLinear

/-- `F.OplaxLinear C` equips `F : D ⥤ D'` with a family of morphisms
`δₗ F : ∀ (c : C) (d : D), c ⊙ₗ F.obj d ⟶ F.obj (c ⊙ₗ d)`
that is natural in each variable and coherent with respect to left actions
of `C` on `D` and `D'`. -/
class OplaxLeftLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalLeftAction C D] [MonoidalLeftAction C D'] where
  /-- The oplax lineator morphism. -/
  δₗ (F) (c : C) (d : D) : F.obj (c ⊙ₗ d) ⟶ c ⊙ₗ F.obj d
  δₗ_naturality_left (F) {c c' : C} (f : c ⟶ c') (d : D) :
    F.map (f ⊵ₗ d) ≫ δₗ c' d =
    δₗ c d ≫ f ⊵ₗ F.obj d := by cat_disch
  δₗ_naturality_right (F) (c : C) {d d' : D} (f : d ⟶ d') :
    F.map (c ⊴ₗ f) ≫ δₗ c d' =
    δₗ c d ≫ c ⊴ₗ F.map f := by cat_disch
  δₗ_associativity (F) (c c' : C) (d : D) :
    δₗ (c ⊗ c') d ≫ (αₗ _ _ _).hom =
    F.map (αₗ _ _ _).hom ≫ δₗ c (c' ⊙ₗ d) ≫
      c ⊴ₗ δₗ c' d := by cat_disch
  δₗ_unitality_inv (F) (d : D) :
    (λₗ (F.obj d)).inv =
    F.map (λₗ d).inv ≫ δₗ (𝟙_ C) d := by cat_disch

namespace OplaxLeftLinear

-- These are [reassoc (attr := simp)] on the basis that analog lemmas for
-- oplax monoidal functors are also [reassoc (attr := simp)].
```

-- snippet 95
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μᵣIso (L340-L345)
abbrev μᵣIso (d : D) (c : C) : F.obj d ⊙ᵣ c ≅ F.obj (d ⊙ᵣ c) where
  hom := LaxRightLinear.μᵣ F d c
inv := OplaxRightLinear.δᵣ F d c

variable (c : C) (d : D)
```

-- snippet 96
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHomLeft_unop (L234-L237)
lemma leftActionOfOppositeLeftAction_actionHomLeft_unop
    {c c' : Cᵒᵖ} (f : c ⟶ c') (d : Dᵒᵖ) :
    f.unop ⊵ₗ unop d = unop (f ⊵ₗ d) := rfl
```

-- snippet 97
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocIso_inv_naturality (L241-L246)
theorem actionAssocIso_inv_naturality
    {c₁ c₂ c₃ c₄ : C} {d₁ d₂ : D} (f : c₁ ⟶ c₂) (g : c₃ ⟶ c₄) (h : d₁ ⟶ d₂) :
    (f ⊙ₗₘ g ⊙ₗₘ h) ≫ (αₗ c₂ c₄ d₂).inv =
    (αₗ c₁ c₃ d₁).inv ≫ ((f ⊗ₘ g) ⊙ₗₘ h) := by
rw [Iso.comp_inv_eq, Category.assoc, Eq.comm, Iso.inv_comp_eq, actionAssocIso_hom_naturality]
```

-- snippet 98
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_μᵣ (L351-L354)
lemma inv_μᵣ :
    CategoryTheory.inv (μᵣ F d c) = δᵣ F d c :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| μᵣ_comp_δᵣ F d c
```

-- snippet 99
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionObj_mop (L97-L99)
lemma monoidalOppositeLeftAction_actionObj_mop (c : C) (d : D) :
    mop c ⊙ₗ d = d ⊙ᵣ c := rfl
```

-- snippet 100
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.unit_actionHomRight (L208-L212)
theorem unit_actionHomRight {x y : D} (f : x ⟶ y) :
    (𝟙_ C) ⊴ₗ f = (λₗ x).hom ≫ f ≫ (λₗ y).inv := by
rw [← Category.assoc, actionUnitIso_hom_naturality]
  simp
```

-- snippet 101
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionRight_mop (L104-L107)
lemma monoidalOppositeLeftAction_actionRight_mop
    (c : C) {d d' : D} (f : d ⟶ d') :
    mop c ⊴ₗ f = f ⊵ᵣ c := rfl
```

-- snippet 102
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv' (L273-L276)
theorem actionHomRight_hom_inv' (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    x ⊴ₗ f ≫ x ⊴ₗ inv f = 𝟙 (x ⊙ₗ y) := by
rw [← actionHomRight_comp, IsIso.hom_inv_id, actionHomRight_id]
```

-- snippet 103
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.id_actionHom (L193-L196)
lemma id_actionHom (c : C) {d d' : D} (f : d ⟶ d') :
    (𝟙 c) ⊙ₗₘ f = c ⊴ₗ f := by
simp [actionHom_def]
```

-- snippet 104
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionRight (L342-L344)
abbrev actionRight (d : D) : C ⥤ D := curriedAction C D |>.flip.obj d
/-- Bundle `αₗ _ _ _` as an isomorphism of trifunctors. -/
```

-- snippet 105
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom (L263-L266)
theorem actionHomRight_inv_hom (x : C) {y z : D} (f : y ≅ z) :
    x ⊴ₗ f.inv ≫ x ⊴ₗ f.hom = 𝟙 (x ⊙ₗ z) := by
rw [← actionHomRight_comp, Iso.inv_hom_id, actionHomRight_id]
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Monoidal.Opposite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
theorem unmop_comp {X Y Z : Cᴹᵒᵖ} {f : X ⟶ Y} {g : Y ⟶ Z} :
    (f ≫ g).unmop = f.unmop ≫ g.unmop
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_injective (L40-L41)
theorem mop_injective : Function.Injective (mop : C → Cᴹᵒᵖ) := @mop.inj C
```

-- snippet 2
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_injective (L42-L44)
theorem unmop_injective : Function.Injective (unmop : Cᴹᵒᵖ → C) :=
fun _ _ h => congrArg mop h
```

-- snippet 3
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj_iff (L45-L46)
theorem mop_inj_iff (x y : C) : mop x = mop y ↔ x = y := mop_injective.eq_iff
```

-- snippet 4
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj_iff (L48-L49)
theorem unmop_inj_iff (x y : Cᴹᵒᵖ) : unmop x = unmop y ↔ x = y := unmop_injective.eq_iff
```

-- snippet 5
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L51-L53)
theorem mop_unmop (X : Cᴹᵒᵖ) : mop (unmop X) = X := rfl
-- can't be simp bc after putting the lhs in whnf it's `X = X`
```

-- snippet 6
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L54-L55)
theorem unmop_mop (X : C) : unmop (mop X) = X := rfl
```

-- snippet 7
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalOppositeCategory (L56-L71)
instance monoidalOppositeCategory [Category.{v₁} C] : Category Cᴹᵒᵖ where
  Hom X Y := (unmop X ⟶ unmop Y)ᴹᵒᵖ
id X := mop (𝟙 (unmop X))
  comp f g := mop (unmop f ≫ unmop g)

end MonoidalOpposite

end CategoryTheory

open CategoryTheory

open CategoryTheory.MonoidalOpposite

variable [Category.{v₁} C]

/-- The monoidal opposite of a morphism `f : X ⟶ Y` is just `f`, thought of as `mop X ⟶ mop Y`. -/
```

-- snippet 8
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L72-L74)
def Quiver.Hom.mop {X Y : C} (f : X ⟶ Y) : mop X ⟶ mop Y := MonoidalOpposite.mop f
/-- We can think of a morphism `f : mop X ⟶ mop Y` as a morphism `X ⟶ Y`. -/
```

-- snippet 9
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L75-L80)
def Quiver.Hom.unmop {X Y : Cᴹᵒᵖ} (f : X ⟶ Y) : unmop X ⟶ unmop Y := MonoidalOpposite.unmop f
namespace Quiver.Hom

open MonoidalOpposite renaming mop → mop', unmop → unmop'
```

-- snippet 10
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj (L81-L84)
theorem mop_inj {X Y : C} :
    Function.Injective (Quiver.Hom.mop : (X ⟶ Y) → (mop' X ⟶ mop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.unmop H
```

-- snippet 11
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj (L85-L88)
theorem unmop_inj {X Y : Cᴹᵒᵖ} :
    Function.Injective (Quiver.Hom.unmop : (X ⟶ Y) → (unmop' X ⟶ unmop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.mop H
```

-- snippet 12
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L90-L92)
theorem unmop_mop {X Y : C} {f : X ⟶ Y} : f.mop.unmop = f :=
rfl
```

-- snippet 13
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L94-L100)
theorem mop_unmop {X Y : Cᴹᵒᵖ} {f : X ⟶ Y} : f.unmop.mop = f :=
rfl

end Quiver.Hom

namespace CategoryTheory
```

-- snippet 14
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_comp (L102-L104)
theorem mop_comp {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} :
    (f ≫ g).mop = f.mop ≫ g.mop := rfl
```

-- snippet 15
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id (L106-L107)
theorem mop_id {X : C} : (𝟙 X).mop = 𝟙 (mop X) := rfl
```

-- snippet 16
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id (L113-L114)
theorem unmop_id {X : Cᴹᵒᵖ} : (𝟙 X).unmop = 𝟙 (unmop X) := rfl
```

-- snippet 17
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id_mop (L116-L117)
theorem unmop_id_mop {X : C} : (𝟙 (mop X)).unmop = 𝟙 X := rfl
```

-- snippet 18
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id_unmop (L119-L121)
theorem mop_id_unmop {X : Cᴹᵒᵖ} : (𝟙 (unmop X)).mop = 𝟙 X := rfl
-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj
```

-- snippet 19
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.MonoidalOpposite (L122-L128)
lemma MonoidalOpposite.hom_ext {x y : Cᴹᵒᵖ} {f g : x ⟶ y} (h : f.unmop = g.unmop) :
    f = g :=
Quiver.Hom.unmop_inj h

variable (C)

/-- The identity functor on `C`, viewed as a functor from `C` to its monoidal opposite. -/
```

-- snippet 20
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mopFunctor (L130-L131)
def mopFunctor : C ⥤ Cᴹᵒᵖ := Functor.mk mop .mop
/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/
```

-- snippet 21
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmopFunctor (L133-L139)
def unmopFunctor : Cᴹᵒᵖ ⥤ C := Functor.mk unmop .unmop
variable {C}

namespace Iso

/-- An isomorphism in `C` gives an isomorphism in `Cᴹᵒᵖ`. -/
```

-- snippet 22
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.mop (L140-L142)
abbrev mop {X Y : C} (f : X ≅ Y) : mop X ≅ mop Y := (mopFunctor C).mapIso f
/-- An isomorphism in `Cᴹᵒᵖ` gives an isomorphism in `C`. -/
```

-- snippet 23
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop (L143-L148)
abbrev unmop {X Y : Cᴹᵒᵖ} (f : X ≅ Y) : unmop X ≅ unmop Y := (unmopFunctor C).mapIso f
end Iso

namespace IsIso
```

-- snippet 24
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalCategoryOp (L160-L178)
instance monoidalCategoryOp : MonoidalCategory Cᵒᵖ where
  tensorObj X Y := op (unop X ⊗ unop Y)
whiskerLeft X _ _ f := (X.unop ◁ f.unop).op
  whiskerRight f X := (f.unop ▷ X.unop).op
  tensorHom f g := (f.unop ⊗ₘ g.unop).op
  tensorHom_def _ _ := Quiver.Hom.unop_inj (tensorHom_def' _ _)
  tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unop_inj <| by simp
  tensorUnit := op (𝟙_ C)
  associator X Y Z := (α_ (unop X) (unop Y) (unop Z)).symm.op
  leftUnitor X := (λ_ (unop X)).symm.op
  rightUnitor X := (ρ_ (unop X)).symm.op
  associator_naturality f g h := Quiver.Hom.unop_inj <| by simp
  leftUnitor_naturality f := Quiver.Hom.unop_inj <| by simp
  rightUnitor_naturality f := Quiver.Hom.unop_inj <| by simp
  triangle X Y := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence
  pentagon W X Y Z := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence

section OppositeLemmas
```

-- snippet 25
```lean
-- Mathlib.CategoryTheory.Monoidal.Opposite.op_tensor_op (L235-L236)
theorem op_tensor_op {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f.op ⊗ₘ g.op = (f ⊗ₘ g).op := rfl
```

-- snippet 26
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctor (L187-L201)
def actionOfMonoidalFunctorToEndofunctor (F : C ⥤ D ⥤ D) [F.Monoidal] :
    MonoidalRightAction C D where
  actionObj d c := (F.obj c).obj d
actionHomLeft f c := (F.obj c).map f
  actionHomRight d _ _ f := (F.map f).app d
  actionAssocIso d c c' := Functor.Monoidal.μIso F c c' |>.app d |>.symm
  actionUnitIso d := Functor.Monoidal.εIso F |>.app d |>.symm
  actionAssocIso_hom_naturality {c₁ c₁' c₂ c₂' c₃ c₃'} f g h := by
    have e := congrArg (fun t ↦ t.app c₁) <|
      Functor.OplaxMonoidal.δ_natural F g h
    dsimp at e
    simp [reassoc_of% e]

/-- If the action of `C` on `D` comes from a monoidal functor `C ⥤ (D ⥤ D)`,
then `curriedActionMop C D` is naturally isomorphic to that functor. -/
```

-- snippet 27
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionObj_mop (L309-L311)
lemma monoidalOppositeRightAction_actionObj_mop (c : C) (d : D) :
    d ⊙ᵣ mop c = c ⊙ₗ d := rfl
```

-- snippet 28
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δₗ_associativity_inv (L135-L143)
lemma δₗ_associativity_inv (c c' : C) (d : D) :
    δₗ F c (c' ⊙ₗ d) ≫
      c ⊴ₗ δₗ F c' d ≫ (αₗ _ _ _).inv =
    F.map (αₗ _ _ _).inv ≫ δₗ F (c ⊗ c' : C) d := by
simpa [-δₗ_associativity, -δₗ_associativity_assoc] using
    F.map (αₗ _ _ _).inv ≫=
      (δₗ_associativity F c c' d).symm =≫
      (αₗ _ _ _).inv
```

-- snippet 29
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionLeft (L337-L340)
abbrev actionLeft (c : C) : D ⥤ D := curriedAction C D |>.obj c
variable {D} in
/-- Bundle `c ↦ c ⊙ₗ d` as a functor. -/
```

-- snippet 30
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft (L258-L261)
theorem hom_inv_actionHomLeft {x y : C} (f : x ≅ y) (z : D) :
    f.hom ⊵ₗ z ≫ f.inv ⊵ₗ z = 𝟙 (x ⊙ₗ z) := by
rw [← comp_actionHomLeft, Iso.hom_inv_id, id_actionHomLeft]
```

-- snippet 31
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δᵣ_associativity_inv (L297-L305)
lemma δᵣ_associativity_inv (d : D) (c c' : C) :
    δᵣ F (d ⊙ᵣ c) c' ≫
      δᵣ F d c ⊵ᵣ c' ≫ (αᵣ _ _ _).inv =
    F.map (αᵣ _ _ _).inv ≫ δᵣ F d (c ⊗ c' : C) := by
simpa [-δᵣ_associativity, -δᵣ_associativity_assoc] using
    F.map (αᵣ _ _ _).inv ≫=
      (δᵣ_associativity F d c c').symm =≫
      (αᵣ _ _ _).inv
```

-- snippet 32
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δᵣ_unitality_hom (L307-L335)
lemma δᵣ_unitality_hom (d : D) :
    δᵣ F d (𝟙_ C) ≫ (ρᵣ (F.obj d)).hom = F.map (ρᵣ d).hom := by
simpa [-δᵣ_unitality_inv] using
    F.map (ρᵣ[C] d).hom ≫=
      (δᵣ_unitality_inv F d).symm =≫
      (ρᵣ[C] (F.obj d)).hom

end OplaxRightLinear

/-- `F.RightLinear C` asserts that `F` is both lax and oplax left-linear,
in a compatible way, i.e that `μᵣ` is inverse to `δᵣ`. -/
class RightLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalRightAction C D] [MonoidalRightAction C D'] extends
    F.LaxRightLinear C, F.OplaxRightLinear C where
  μᵣ_comp_δᵣ (F) (d : D) (c : C) :
    LaxRightLinear.μᵣ F d c ≫ OplaxRightLinear.δᵣ F d c = 𝟙 _
  δᵣ_comp_μᵣ (F) (d : D) (c : C) :
    OplaxRightLinear.δᵣ F d c ≫ LaxRightLinear.μᵣ F d c = 𝟙 _

namespace RightLinear

open LaxRightLinear OplaxRightLinear

variable
  (F : D ⥤ D') {C : Type*} [Category* C] [MonoidalCategory C]
  [MonoidalRightAction C D] [MonoidalRightAction C D']
  [F.RightLinear C]
```

-- snippet 33
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom' (L283-L286)
theorem actionHomRight_inv_hom' (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    x ⊴ₗ inv f ≫ x ⊴ₗ f = 𝟙 (x ⊙ₗ z) := by
rw [← actionHomRight_comp, IsIso.inv_hom_id, actionHomRight_id]
```

-- snippet 34
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHomLeft_op (L209-L212)
lemma oppositeLeftAction_actionHomLeft_op
    {c c' : C} (f : c ⟶ c') (d : D) :
    f.op ⊵ₗ op d = op (f ⊵ₗ d) := rfl
```

-- snippet 35
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_action (L226-L229)
theorem actionHomLeft_action {x x' : C} (f : x ⟶ x') (y : C) (z : D) :
    f ⊵ₗ (y ⊙ₗ z) = (αₗ x y z).inv ≫ (f ▷ y) ⊵ₗ z ≫ (αₗ x' y z).hom := by
simp [whiskerRight_actionHomLeft]
```

-- snippet 36
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction (L70-L91)
def monoidalOppositeLeftAction [MonoidalRightAction C D] :
    MonoidalLeftAction Cᴹᵒᵖ D where
  actionObj c d := d ⊙ᵣ unmop c
actionHomLeft {c c'} f d := d ⊴ᵣ f.unmop
  actionHomRight c {d d'} f := f ⊵ᵣ unmop c
  actionHom {c c'} {d d} f g := g ⊙ᵣₘ f.unmop
  actionAssocIso _ _ _ := αᵣ _ _ _
  actionUnitIso _ := ρᵣ _
  actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalRightAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalRightAction.actionUnitIso_hom_naturality _
  rightUnitor_actionHom c d :=
    MonoidalRightAction.actionHom_leftUnitor _ _
  associator_actionHom c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalRightAction.actionHomRight_inv_hom_assoc] using
      (d ⊴ᵣ (α_ (unmop c₃) (unmop c₂) (unmop c₁)).inv) ≫=
        MonoidalRightAction.actionHom_associator
          (unmop c₃) (unmop c₂) (unmop c₁) d |>.symm
```

-- snippet 37
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_tensor (L524-L529)
theorem actionHomLeft_tensor {z z' : D} (f : z ⟶ z') (x y : C) :
    (f ⊵ᵣ (x ⊗ y)) = (αᵣ z x y).hom ≫ (f ⊵ᵣ x) ⊵ᵣ y ≫ (αᵣ z' x y).inv := by
simp only [← actionHom_id]
  rw [← Category.assoc, ← actionAssocIso_hom_naturality]
  simp
```

-- snippet 38
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μₗIso (L178-L183)
abbrev μₗIso (c : C) (d : D) : c ⊙ₗ F.obj d ≅ F.obj (c ⊙ₗ d) where
  hom := LaxLeftLinear.μₗ F c d
inv := OplaxLeftLinear.δₗ F c d

variable (c : C) (d : D)
```

-- snippet 39
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μᵣ_associativity_inv (L241-L248)
lemma μᵣ_associativity_inv (d : D) (c c' : C) :
    μᵣ F d c ⊵ᵣ c' ≫ μᵣ F (d ⊙ᵣ c) c' ≫ F.map (αᵣ _ _ _).inv =
    (αᵣ (F.obj d) c c').inv ≫ μᵣ F d (c ⊗ c') := by
simpa [-μᵣ_associativity, -μᵣ_associativity_assoc] using
    (αᵣ _ _ _).inv ≫=
      (μᵣ_associativity F d c c').symm =≫
      F.map (αᵣ _ _ _).inv
```

-- snippet 40
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_μₗ (L189-L192)
lemma inv_μₗ :
    CategoryTheory.inv (μₗ F c d) = δₗ F c d :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| μₗ_comp_δₗ F c d
```

-- snippet 41
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHomLeft_mop (L100-L103)
lemma monoidalOppositeLeftAction_actionHomLeft_mop
    {c c' : C} (f : c ⟶ c') (d : D) :
    f.mop ⊵ₗ d = d ⊴ᵣ f := rfl
```

-- snippet 42
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHom (L300-L304)
instance isIso_actionHom {x y : C} {x' y' : D}
    (f : x ⟶ y) (g : x' ⟶ y') [IsIso f] [IsIso g] :
    IsIso (f ⊙ₗₘ g) :=
⟨(inv f) ⊙ₗₘ (inv g), by simp [← actionHom_comp]⟩
```

-- snippet 43
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctorMop (L98-L145)
def actionOfMonoidalFunctorToEndofunctorMop (F : C ⥤ (D ⥤ D)ᴹᵒᵖ) [F.Monoidal] :
    MonoidalLeftAction C D where
  actionObj c d := (F.obj c).unmop.obj d
actionHomLeft f d := (F.map f).unmop.app d
  actionHomRight c _ _ f := (F.obj c).unmop.map f
  actionAssocIso c c' d := Functor.Monoidal.μIso F c c' |>.unmop.app d |>.symm
  actionUnitIso d := Functor.Monoidal.εIso F |>.unmop.app d |>.symm
  actionAssocIso_hom_naturality {c₁ c₁' c₂ c₂' c₃ c₃'} f g h := by
    have e := congrArg (fun t ↦ t.unmop.app c₃) <|
      Functor.OplaxMonoidal.δ_natural F f g
    dsimp at e
    simp [reassoc_of% e]
  whiskerRight_actionHomLeft {x y} c f d := by
    have e := congrArg (fun t ↦ t.unmop.app d) <|
      Functor.LaxMonoidal.μ_natural_left F f c
    dsimp at e
    simp [e, ← NatTrans.comp_app, ← unmop_comp]
  whiskerLeft_actionHomLeft c {x y} f d := by
    have e := congrArg (fun t ↦ t.unmop.app d) <|
      Functor.LaxMonoidal.μ_natural_right F c f
    dsimp at e
    simp [e, ← NatTrans.comp_app, ← unmop_comp]
  associator_actionHom c₁ c₂ c₃ d := by
    have e := congrArg (fun t ↦ t.unmop.app d) <|
      Functor.OplaxMonoidal.associativity F c₁ c₂ c₃
    dsimp at e
    simp only [Category.comp_id] at e
    simp [e]
  leftUnitor_actionHom c d := by
    have e := (F.map (λ_ c).hom).unmop.app d ≫=
      (congrArg (fun t ↦ t.unmop.app d) <|
        Functor.OplaxMonoidal.left_unitality F c)
    dsimp at e
    simp only [Category.comp_id, ← NatTrans.comp_app_assoc, ← unmop_comp,
      ← F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e
    simp [e]
  rightUnitor_actionHom c d := by
    have e := (F.map (ρ_ c).hom).unmop.app d ≫=
      (congrArg (fun t ↦ t.unmop.app d) <|
        Functor.OplaxMonoidal.right_unitality F c)
    dsimp at e
    simp only [Category.comp_id, ← NatTrans.comp_app_assoc, ← unmop_comp,
      ← F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e
    simp [e]

/-- If the (left) action of `C` on `D` comes from a monoidal functor
`C ⥤ (D ⥤ D)ᴹᵒᵖ`, then `curriedActionMop C D` is naturally isomorphic to that
functor. -/
```

-- snippet 44
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selRightfAction (L485-L501)
instance selRightfAction [MonoidalCategory C] : MonoidalRightAction C C where
  actionObj x y := x ⊗ y
actionHom f g := f ⊗ₘ g
  actionUnitIso x := ρ_ x
  actionAssocIso x y z := α_ x y z |>.symm
  actionHomLeft f x := f ▷ x
  actionHomRight x _ _ f := x ◁ f
  actionHom_def := by simp [tensorHom_def]

namespace MonoidalRightAction

open Category

variable {C D} [MonoidalCategory C] [MonoidalRightAction C D]

-- Simp normal forms are aligned with the ones in `MonoidalCategory`.
```

-- snippet 45
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.rightActionOfMonoidalOppositeLeftAction (L261-L282)
def rightActionOfMonoidalOppositeLeftAction [MonoidalLeftAction Cᴹᵒᵖ D] :
    MonoidalRightAction C D where
  actionObj d c := mop c ⊙ₗ d
actionHomLeft {d d'} f c := mop c ⊴ₗ f
  actionHomRight d _ _ f := f.mop ⊵ₗ d
  actionHom {c c'} {d d'} f g := g.mop ⊙ₗₘ f
  actionAssocIso _ _ _ := αₗ _ _ _
  actionUnitIso _ := λₗ _
  actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalLeftAction.actionUnitIso_hom_naturality _
  actionHom_associator c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using
      (α_ (mop c₃) (mop c₂) (mop c₁)).inv ⊵ₗ d ≫=
        MonoidalLeftAction.associator_actionHom
          (mop c₃) (mop c₂) (mop c₁) d |>.symm

/-- Define a right action of `Cᴹᵒᵖ` on `D` from a left action of `C` on `D` via
the formula `d ⊙ᵣ mop c = c ⊙ₗ d`. -/
```

-- snippet 46
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionRight_mop (L316-L319)
lemma monoidalOppositeRightAction_actionRight_mop
    (c : C) {d d' : D} (f : d ⟶ d') :
    f ⊵ᵣ mop c = c ⊴ₗ f := rfl
```

-- snippet 47
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction (L164-L200)
def leftActionOfOppositeLeftAction [MonoidalLeftAction Cᵒᵖ Dᵒᵖ] :
    MonoidalLeftAction C D where
  actionObj c d := unop <| op c ⊙ₗ op d
actionHomLeft {c c'} f d := (f.op ⊵ₗ op d).unop
  actionHomRight c {d d'} f := (op c ⊴ₗ f.op).unop
  actionHom {c c'} {d d} f g := (f.op ⊙ₗₘ g.op).unop
  actionAssocIso _ _ _ := Iso.unop <| (αₗ _ _ _).symm
  actionUnitIso _ := Iso.unop <| (λₗ _).symm
  actionHom_def f g := by
    apply Quiver.Hom.op_inj
    simpa [MonoidalLeftAction.action_exchange] using
      MonoidalLeftAction.actionHom_def f.op g.op
  actionAssocIso_hom_naturality f g h := by
    apply Quiver.Hom.op_inj
    haveI := (αₗ (op _) (op _) (op _)).inv ≫=
      MonoidalLeftAction.actionAssocIso_hom_naturality f.op g.op h.op
    simp only [Iso.inv_hom_id_assoc] at this
    simp [← this]
  actionUnitIso_hom_naturality _ := by
    apply Quiver.Hom.op_inj
    simp
  whiskerRight_actionHomLeft _ _ _ := by
    apply Quiver.Hom.op_inj
    simp
  associator_actionHom _ _ _ _ := by
    apply Quiver.Hom.op_inj
    apply IsIso.inv_eq_inv.mp
    simp
  leftUnitor_actionHom _ _ := by
    apply Quiver.Hom.op_inj
    apply IsIso.inv_eq_inv.mp
    simp
  rightUnitor_actionHom _ _ := by
    apply Quiver.Hom.op_inj
    apply IsIso.inv_eq_inv.mp
    simp
```

-- snippet 48
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_def' (L236-L239)
theorem actionHom_def' {x₁ y₁ : C} {x₂ y₂ : D} (f : x₁ ⟶ y₁) (g : x₂ ⟶ y₂) :
    f ⊙ₗₘ g = x₁ ⊴ₗ g ≫ f ⊵ₗ y₂ :=
action_exchange f g ▸ actionHom_def f g
```

-- snippet 49
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomRight (L311-L314)
lemma inv_actionHomRight (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    inv (x ⊴ₗ f) = x ⊴ₗ inv f :=
IsIso.inv_eq_of_hom_inv_id <| actionHomRight_hom_inv' x f
```

-- snippet 50
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv (L253-L256)
theorem actionHomRight_hom_inv (x : C) {y z : D} (f : y ≅ z) :
    x ⊴ₗ f.hom ≫ x ⊴ₗ f.inv = 𝟙 (x ⊙ₗ y : D) := by
rw [← actionHomRight_comp, Iso.hom_inv_id, actionHomRight_id]
```

-- snippet 51
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitNatIso (L355-L356)
def actionUnitNatIso : actionLeft D (𝟙_ C) ≅ 𝟭 D := NatIso.ofComponents (λₗ ·)
```

-- snippet 52
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionAssocIso_unop (L246-L249)
lemma leftActionOfOppositeLeftAction_actionAssocIso_unop
    (c c' : Cᵒᵖ) (d : Dᵒᵖ) :
    αₗ (unop c) (unop c') (unop d) = (αₗ c c' d).symm.unop := rfl
```

-- snippet 53
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction (L284-L303)
def monoidalOppositeRightAction [MonoidalLeftAction C D] :
    MonoidalRightAction Cᴹᵒᵖ D where
  actionObj d c := unmop c ⊙ₗ d
actionHomLeft {d d'} f c := unmop c ⊴ₗ f
  actionHomRight d _ _ f := f.unmop ⊵ₗ d
  actionHom {c c'} {d d'} f g := g.unmop ⊙ₗₘ f
  actionAssocIso _ _ _ := αₗ _ _ _
  actionUnitIso _ := λₗ _
  actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalLeftAction.actionUnitIso_hom_naturality _
  actionHom_associator c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using
      (α_ (unmop c₃) (unmop c₂) (unmop c₁)).inv ⊵ₗ d ≫=
        MonoidalLeftAction.associator_actionHom
          (unmop c₃) (unmop c₂) (unmop c₁) d |>.symm
```

-- snippet 54
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_comp (L203-L206)
theorem actionHomRight_comp (w : C) {x y z : D} (f : x ⟶ y) (g : y ⟶ z) :
    w ⊴ₗ (f ≫ g) = w ⊴ₗ f ≫ w ⊴ₗ g := by
simp [← id_actionHom, ← actionHom_comp]
```

-- snippet 55
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.δₗ_unitality_hom (L145-L173)
lemma δₗ_unitality_hom (d : D) :
    δₗ F (𝟙_ C) d ≫ (λₗ (F.obj d)).hom = F.map (λₗ d).hom := by
simpa [-δₗ_unitality_inv] using
    F.map (λₗ[C] d).hom ≫=
      (δₗ_unitality_inv F d).symm =≫
      (λₗ[C] (F.obj d)).hom

end OplaxLeftLinear

/-- `F.LeftLinear C` asserts that `F` is both lax and oplax left-linear,
in a compatible way, i.e that `μₗ` is inverse to `δₗ`. -/
class LeftLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalLeftAction C D] [MonoidalLeftAction C D'] extends
    F.LaxLeftLinear C, F.OplaxLeftLinear C where
  μₗ_comp_δₗ (F) (c : C) (d : D) :
    LaxLeftLinear.μₗ F c d ≫ OplaxLeftLinear.δₗ F c d = 𝟙 _
  δₗ_comp_μₗ (F) (c : C) (d : D) :
    OplaxLeftLinear.δₗ F c d ≫ LaxLeftLinear.μₗ F c d = 𝟙 _

namespace LeftLinear

open LaxLeftLinear OplaxLeftLinear

variable
  (F : D ⥤ D') {C : Type*} [Category* C] [MonoidalCategory C]
  [MonoidalLeftAction C D] [MonoidalLeftAction C D']
  [F.LeftLinear C]
```

-- snippet 56
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft' (L278-L281)
theorem hom_inv_actionHomLeft' {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    f ⊵ₗ z ≫ inv f ⊵ₗ z = 𝟙 (x ⊙ₗ z) := by
rw [← comp_actionHomLeft, IsIso.hom_inv_id, id_actionHomLeft]
```

-- snippet 57
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHom_op (L217-L220)
lemma oppositeLeftAction_actionHom_op
    {c c' : C} {d d' : D} (f : c ⟶ c') (g : d ⟶ d') :
    f.op ⊙ₗₘ g.op = op (f ⊙ₗₘ g) := rfl
```

-- snippet 58
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorIso (L203-L216)
def curriedActionActionOfMonoidalFunctorToEndofunctorIso
    (F : C ⥤ (D ⥤ D)) [F.Monoidal] :
    letI := actionOfMonoidalFunctorToEndofunctor F
curriedAction C D ≅ F :=
  .refl _

end MonoidalRightAction

namespace endofunctorMonoidalCategory
/-- Functor evaluation gives a right action of `C ⥤ C`.

Note that in the literature, this is defined as a left action, but mathlib's
monoidal structure on `C ⥤ C` is the monoidal opposite of the one usually
considered in the literature. -/
```

-- snippet 59
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionRight_unop (L238-L241)
lemma leftActionOfOppositeLeftAction_actionRight_unop
    (c : Cᵒᵖ) {d d' : Dᵒᵖ} (f : d ⟶ d') :
    unop c ⊴ₗ f.unop = unop (c ⊴ₗ f) := rfl
```

-- snippet 60
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHom_mop_mop (L108-L111)
lemma monoidalOppositeLeftAction_actionHom_mop_mop
    {c c' : C} {d d' : D} (f : c ⟶ c') (g : d ⟶ d') :
    f.mop ⊙ₗₘ g = g ⊙ᵣₘ f := rfl
```

-- snippet 61
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μₗ_associativity_inv (L79-L86)
lemma μₗ_associativity_inv (c c' : C) (d : D) :
    c ⊴ₗ μₗ F c' d ≫ μₗ F c (c' ⊙ₗ d) ≫ F.map (αₗ _ _ _).inv =
    (αₗ c c' (F.obj d)).inv ≫ μₗ F (c ⊗ c') d := by
simpa [-μₗ_associativity, -μₗ_associativity_assoc] using
    (αₗ _ _ _).inv ≫=
      (μₗ_associativity F c c' d).symm =≫
      F.map (αₗ _ _ _).inv
```

-- snippet 62
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.tensor_actionHomRight (L214-L219)
theorem tensor_actionHomRight (x y : C) {z z' : D} (f : z ⟶ z') :
    (x ⊗ y) ⊴ₗ f = (αₗ x y z).hom ≫ x ⊴ₗ y ⊴ₗ f ≫ (αₗ x y z').inv := by
simp only [← id_actionHom]
  rw [← Category.assoc, ← actionAssocIso_hom_naturality]
  simp
```

-- snippet 63
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionAssocIso_op (L221-L223)
lemma oppositeLeftAction_actionAssocIso_op (c c' : C) (d : D) :
    αₗ (op c) (op c') (op d) = (αₗ c c' d).symm.op := rfl
```

-- snippet 64
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionObj_unop (L231-L233)
lemma leftActionOfOppositeLeftAction_actionObj_unop (c : Cᵒᵖ) (d : Dᵒᵖ) :
    (unop c) ⊙ₗ (unop d) = unop (c ⊙ₗ d) := rfl
```

-- snippet 65
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomLeft (L296-L299)
instance isIso_actionHomLeft {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    IsIso (f ⊵ₗ z) :=
⟨inv f ⊵ₗ z, by simp⟩
```

-- snippet 66
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionHomRight_mop (L312-L315)
lemma monoidalOppositeRightAction_actionHomRight_mop
    {c c' : C} (f : c ⟶ c') (d : D) :
    d ⊴ᵣ f.mop = f ⊵ₗ d := rfl
```

-- snippet 67
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorMopIso (L147-L161)
def curriedActionActionOfMonoidalFunctorToEndofunctorMopIso
    (F : C ⥤ (D ⥤ D)ᴹᵒᵖ) [F.Monoidal] :
    letI := actionOfMonoidalFunctorToEndofunctorMop F
curriedActionMop C D ≅ F :=
  .refl _

end MonoidalLeftAction

namespace MonoidalRightAction

variable {C D}

open MonoidalOpposite in
/-- When `C` acts on the right on `D`, the functor `curriedAction : C ⥤ (D ⥤ D)`
is monoidal, where `D ⥤ D` has the composition monoidal structure. -/
```

-- snippet 68
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomLeft (L306-L309)
lemma inv_actionHomLeft {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    inv (f ⊵ₗ z) = inv f ⊵ₗ z :=
IsIso.inv_eq_of_hom_inv_id <| hom_inv_actionHomLeft' f z
```

-- snippet 69
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_exchange (L231-L234)
theorem action_exchange {w x : C} {y z : D} (f : w ⟶ x) (g : y ⟶ z) :
    w ⊴ₗ g ≫ f ⊵ₗ z = f ⊵ₗ y ≫ x ⊴ₗ g := by
simp only [← id_actionHom, ← actionHom_id, ← actionHom_comp, id_comp, comp_id]
```

-- snippet 70
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_δₗ (L194-L229)
lemma inv_δₗ :
    CategoryTheory.inv (δₗ F c d) = μₗ F c d :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| δₗ_comp_μₗ F c d

end LeftLinear

end leftAction

section rightAction

open MonoidalRightAction

/-- `F.LaxLinear C` equips `F : D ⥤ D'` with a family of morphisms
`μₗ F : ∀ (c : C) (d : D), c ⊙ₗ F.obj d ⟶ F.obj (c ⊙ₗ d)`
that is natural in each variable and coherent with respect to left actions
of `C` on `D` and `D'`. -/
class LaxRightLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalRightAction C D] [MonoidalRightAction C D'] where
  /-- The "μᵣ" morphism. -/
  μᵣ (F) (d : D) (c : C) : F.obj d ⊙ᵣ c ⟶ F.obj (d ⊙ᵣ c)
  μᵣ_naturality_right (F) (d : D) {c c' : C} (f : c ⟶ c') :
    F.obj d ⊴ᵣ f ≫ μᵣ d c' = μᵣ d c ≫ F.map (d ⊴ᵣ f) := by cat_disch
  μᵣ_naturality_left (F) {d d' : D} (f : d ⟶ d') (c : C) :
    F.map f ⊵ᵣ c ≫ μᵣ d' c = μᵣ d c ≫ F.map (f ⊵ᵣ c) := by cat_disch
  μᵣ_associativity (F) (d : D) (c c' : C) :
    μᵣ d (c ⊗ c') ≫ F.map (αᵣ _ _ _).hom =
    (αᵣ (F.obj d) c c').hom ≫ (μᵣ d c) ⊵ᵣ c' ≫
      μᵣ (d ⊙ᵣ c) c' := by cat_disch
  μᵣ_unitality (F) (d : D) :
    (ρᵣ (F.obj d)).hom = μᵣ d (𝟙_ C) ≫ F.map (ρᵣ d).hom := by cat_disch

namespace LaxRightLinear

-- These are [reassoc (attr := simp)] on the basis that analog lemmas for
-- lax monoidal functors are also [reassoc (attr := simp)].
```

-- snippet 71
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop_map_unmop_app (L58-L66)
lemma curriedActionMop_map_unmop_app {c c' : C} (f : c ⟶ c') (d : D) :
    ((curriedActionMop C D).map f).unmop.app d = f ⊵ₗ d :=
rfl

set_option backward.isDefEq.respectTransparency false in
open MonoidalOpposite in
/-- When `C` acts on the left on `D`, the functor
`curriedActionMop : C ⥤ (D ⥤ D)ᴹᵒᵖ` is monoidal, where `D ⥤ D` has the
composition monoidal structure. -/
```

-- snippet 72
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.comp_actionHomLeft (L221-L224)
theorem comp_actionHomLeft {w x y : C} (f : w ⟶ x) (g : x ⟶ y) (z : D) :
    (f ≫ g) ⊵ₗ z = f ⊵ₗ z ≫ g ⊵ₗ z := by
simp only [← actionHom_id, ← actionHom_comp, Category.id_comp]
```

-- snippet 73
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.curriedAction (L326-L335)
def curriedAction : C ⥤ D ⥤ D where
  obj x :=
{ obj y := x ⊙ₗ y
      map f := x ⊴ₗ f }
  map f :=
    { app y := f ⊵ₗ y
      naturality _ _ _ := by simp [action_exchange] }

variable {C} in
/-- Bundle `d ↦ c ⊙ₗ d` as a functor. -/
```

-- snippet 74
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMopMonoidal (L68-L89)
instance curriedActionMopMonoidal : (curriedActionMop C D).Monoidal where
  ε := .mop <| (actionUnitNatIso C D).inv
μ _ _ := .mop <| { app _ := αₗ _ _ _ |>.inv }
  δ _ _ := .mop <| { app _ := αₗ _ _ _ |>.hom }
  η := .mop <| (actionUnitNatIso C D).hom
  associativity c₁ c₂ c₃ := by
    apply (mopEquiv (D ⥤ D)).fullyFaithfulInverse.map_injective
    ext d
    simpa [-associator_actionHom] using
      (IsIso.inv_eq_inv.mpr <| associator_actionHom c₁ c₂ c₃ d).symm =≫
        (α_ c₁ c₂ c₃).hom ⊵ₗ d
  oplax_right_unitality x := by
    apply MonoidalOpposite.hom_ext
    ext t
    simpa [-rightUnitor_actionHom] using
      (ρ_ x).inv ⊵ₗ t ≫= rightUnitor_actionHom x t
  oplax_left_unitality x := by
    apply MonoidalOpposite.hom_ext
    ext t
    simpa [-leftUnitor_actionHom] using
      (λ_ x).inv ⊵ₗ t ≫= leftUnitor_actionHom x t
```

-- snippet 75
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_δᵣ (L356-L364)
lemma inv_δᵣ :
    CategoryTheory.inv (δᵣ F d c) = μᵣ F d c :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| δᵣ_comp_μᵣ F d c

end RightLinear

end rightAction

end CategoryTheory.Functor
```

-- snippet 76
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfMonoidalOppositeRightAction (L45-L68)
def leftActionOfMonoidalOppositeRightAction [MonoidalRightAction Cᴹᵒᵖ D] :
    MonoidalLeftAction C D where
  actionObj c d := d ⊙ᵣ mop c
actionHomLeft {c c'} f d := d ⊴ᵣ f.mop
  actionHomRight c {d d'} f := f ⊵ᵣ mop c
  actionHom {c c'} {d d} f g := g ⊙ᵣₘ f.mop
  actionAssocIso _ _ _ := αᵣ _ _ _
  actionUnitIso _ := ρᵣ _
  actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _
  actionAssocIso_hom_naturality _ _ _ :=
    MonoidalRightAction.actionAssocIso_hom_naturality _ _ _
  actionUnitIso_hom_naturality _ :=
    MonoidalRightAction.actionUnitIso_hom_naturality _
  rightUnitor_actionHom c d :=
    MonoidalRightAction.actionHom_leftUnitor _ _
  associator_actionHom c₁ c₂ c₃ d := by
    simpa only [mop_tensorObj, mop_hom_associator,
      MonoidalRightAction.actionHomRight_inv_hom_assoc] using
      (d ⊴ᵣ (α_ (mop c₃) (mop c₂) (mop c₁)).inv) ≫=
        MonoidalRightAction.actionHom_associator
          (mop c₃) (mop c₂) (mop c₁) d |>.symm

/-- Define a left action of `Cᴹᵒᵖ` on `D` from a right action of `C` on `D` via
the formula `mop c ⊙ₗ d = d ⊙ᵣ c`. -/
```

-- snippet 77
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomRight (L292-L295)
instance isIso_actionHomRight (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    IsIso (x ⊴ₗ f) :=
⟨x ⊴ₗ inv f, by simp⟩
```

-- snippet 78
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionAssocIso_mop_mop (L112-L114)
lemma monoidalOppositeLeftAction_actionAssocIso_mop_mop (c c' : C) (d : D) :
    αₗ (mop c) (mop c') d = αᵣ d c' c := rfl
```

-- snippet 79
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHom (L316-L320)
lemma inv_actionHom {x y : C} {x' y' : D}
    (f : x ⟶ y) (g : x' ⟶ y') [IsIso f] [IsIso g] :
    inv (f ⊙ₗₘ g) = (inv f) ⊙ₗₘ (inv g) :=
IsIso.inv_eq_of_hom_inv_id <| by simp [← actionHom_comp]
```

-- snippet 80
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionRight_op (L213-L216)
lemma oppositeLeftAction_actionRight_op
    (c : C) {d d' : D} (f : d ⟶ d') :
    op c ⊴ₗ f.op = op (c ⊴ₗ f) := rfl
```

-- snippet 81
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitIso_inv_naturality (L248-L251)
theorem actionUnitIso_inv_naturality {d d' : D} (f : d ⟶ d') :
      (λₗ d).inv ≫ (𝟙_ C) ⊴ₗ f = f ≫ (λₗ d').inv := by
rw [Iso.inv_comp_eq, ← Category.assoc, Eq.comm, Iso.comp_inv_eq, actionUnitIso_hom_naturality]
```

-- snippet 82
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_id (L198-L201)
lemma actionHom_id {c c' : C} (f : c ⟶ c') (d : D) :
    f ⊙ₗₘ (𝟙 d) = f ⊵ₗ d := by
simp [actionHom_def]
```

-- snippet 83
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop (L50-L56)
def curriedActionMop : C ⥤ (D ⥤ D)ᴹᵒᵖ :=
(curriedAction C D) ⋙ mopFunctor _

-- This simp lemma is necessary because the simps projection generated for
-- unmop of a morphism is actually its underlying unmop field, rather than
-- the application of `Quiver.Hom.unmop`.
variable {C D} in
```

-- snippet 84
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocNatIso (L346-L353)
def actionAssocNatIso :
    bifunctorComp₁₂ (curriedTensor C) (curriedAction C D) ≅
    bifunctorComp₂₃ (curriedAction C D) (curriedAction C D) :=
NatIso.ofComponents fun _ ↦
    NatIso.ofComponents fun _ ↦
     NatIso.ofComponents fun _ ↦ αₗ _ _ _

/-- Bundle `λₗ _` as an isomorphism of functors. -/
```

-- snippet 85
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selfLeftAction (L175-L191)
instance selfLeftAction [MonoidalCategory C] : MonoidalLeftAction C C where
  actionObj x y := x ⊗ y
actionHom f g := f ⊗ₘ g
  actionUnitIso x := λ_ x
  actionAssocIso x y z := α_ x y z
  actionHomLeft f x := f ▷ x
  actionHomRight x _ _ f := x ◁ f
  actionHom_def := by simp [tensorHom_def]

namespace MonoidalLeftAction

open Category

variable {C D} [MonoidalCategory C] [MonoidalLeftAction C D]

-- Simp normal forms are aligned with the ones in `MonoidalCategory`.
```

-- snippet 86
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction (L122-L162)
def oppositeLeftAction [MonoidalLeftAction C D] :
    MonoidalLeftAction Cᵒᵖ Dᵒᵖ where
  actionObj c d := op <| c.unop ⊙ₗ d.unop
actionHomLeft f d := (f.unop ⊵ₗ unop d).op
  actionHomRight c _ _ f := (unop c ⊴ₗ f.unop).op
  actionHom f g := (f.unop ⊙ₗₘ g.unop).op
  actionAssocIso _ _ _ := Iso.op <| (αₗ _ _ _).symm
  actionUnitIso _ := Iso.op <| (λₗ _).symm
  actionHom_def
    | op f, op g => by
        apply Quiver.Hom.unop_inj
        simpa [MonoidalLeftAction.action_exchange] using
          MonoidalLeftAction.actionHom_def f g
  actionAssocIso_hom_naturality
    | op f, op g, op h => by
        apply Quiver.Hom.unop_inj
        haveI := (αₗ (unop _) (unop _) (unop _)).inv ≫=
          MonoidalLeftAction.actionAssocIso_hom_naturality f g h
        simp only [Iso.inv_hom_id_assoc] at this
        simp [← this]
  actionUnitIso_hom_naturality _ := by
    apply Quiver.Hom.unop_inj
    simp
  whiskerRight_actionHomLeft _ _ _ := by
    apply Quiver.Hom.unop_inj
    simp
  associator_actionHom _ _ _ _ := by
    apply Quiver.Hom.unop_inj
    apply IsIso.inv_eq_inv.mp
    simp
  leftUnitor_actionHom _ _ := by
    apply Quiver.Hom.unop_inj
    apply IsIso.inv_eq_inv.mp
    simp
  rightUnitor_actionHom _ _ := by
    apply Quiver.Hom.unop_inj
    apply IsIso.inv_eq_inv.mp
    simp

/-- Define a left action of `C` on `D` from a left action of `Cᵒᵖ` on `Dᵒᵖ` via
the formula `c ⊙ₗ d = unop ((op c) ⊙ₗ (op d))`. -/
```

-- snippet 87
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft' (L288-L291)
theorem inv_hom_actionHomLeft' {x y : C} (f : x ⟶ y) [IsIso f] (z : D) :
    inv f ⊵ₗ z ≫ f ⊵ₗ z = 𝟙 (y ⊙ₗ z) := by
rw [← comp_actionHomLeft, IsIso.inv_hom_id, id_actionHomLeft]
```

-- snippet 88
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionObj_op (L206-L208)
lemma oppositeLeftAction_actionObj_op (c : C) (d : D) :
    (op c) ⊙ₗ (op d) = op (c ⊙ₗ d) := rfl
```

-- snippet 89
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft (L268-L271)
theorem inv_hom_actionHomLeft {x y : C} (f : x ≅ y) (z : D) :
    f.inv ⊵ₗ z ≫ f.hom ⊵ₗ z = 𝟙 (y ⊙ₗ z) := by
rw [← comp_actionHomLeft, Iso.inv_hom_id, id_actionHomLeft]
```

-- snippet 90
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μᵣ_unitality_inv (L250-L285)
lemma μᵣ_unitality_inv (d : D) :
     (ρᵣ (F.obj d)).inv ≫ μᵣ F d (𝟙_ C) = F.map (ρᵣ d).inv := by
simpa [-μᵣ_unitality] using
    (ρᵣ[C] (F.obj d)).inv ≫=
      (μᵣ_unitality F d).symm =≫
      F.map (ρᵣ[C] d).inv

end LaxRightLinear

/-- `F.OplaxLinear C` equips `F : D ⥤ D'` with a family of morphisms
`δₗ F : ∀ (c : C) (d : D), c ⊙ₗ F.obj d ⟶ F.obj (c ⊙ₗ d)`
that is natural in each variable and coherent with respect to left actions
of `C` on `D` and `D'`. -/
class OplaxRightLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalRightAction C D] [MonoidalRightAction C D'] where
  /-- The oplax lineator morphism. -/
  δᵣ (F) (d : D) (c : C) : F.obj (d ⊙ᵣ c) ⟶ (F.obj d) ⊙ᵣ c
  δᵣ_naturality_right (F) (d : D) {c c' : C} (f : c ⟶ c') :
    F.map (d ⊴ᵣ f) ≫ δᵣ d c' =
    δᵣ d c ≫ F.obj d ⊴ᵣ f := by cat_disch
  δᵣ_naturality_left (F) {d d' : D} (f : d ⟶ d') (c : C) :
    F.map (f ⊵ᵣ c) ≫ δᵣ d' c =
    δᵣ d c ≫ F.map f ⊵ᵣ c := by cat_disch
  δᵣ_associativity (F) (d : D) (c c' : C) :
    δᵣ d (c ⊗ c') ≫ (αᵣ _ _ _).hom =
    F.map (αᵣ _ _ _).hom ≫ δᵣ (d ⊙ᵣ c) c' ≫
      δᵣ d c ⊵ᵣ c' := by cat_disch
  δᵣ_unitality_inv (F) (d : D) :
    (ρᵣ (F.obj d)).inv =
    F.map (ρᵣ d).inv ≫ δᵣ d (𝟙_ C) := by cat_disch

namespace OplaxRightLinear

-- These are [reassoc (attr := simp)] on the basis that analog lemmas for
-- oplax monoidal functors are also [reassoc (attr := simp)].
```

-- snippet 91
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMonoidal (L163-L185)
instance curriedActionMonoidal [MonoidalRightAction C D] :
    (curriedAction C D).Monoidal where
  ε := (actionUnitNatIso C D).inv
μ _ _ := { app _ := αᵣ _ _ _ |>.inv }
  δ _ _ := { app _ := αᵣ _ _ _ |>.hom }
  η := (actionUnitNatIso C D).hom
  associativity c₁ c₂ c₃ := by
    ext d
    simpa [-actionHom_associator] using
      (IsIso.inv_eq_inv.mpr <| actionHom_associator c₁ c₂ c₃ d).symm =≫
        d ⊴ᵣ (α_ c₁ c₂ c₃).hom
  oplax_right_unitality x := by
    ext t
    simpa [-actionHom_rightUnitor] using
      t ⊴ᵣ (ρ_ x).inv ≫= actionHom_rightUnitor x t
  oplax_left_unitality x := by
    ext t
    simpa [-actionHom_leftUnitor] using
      t ⊴ᵣ (λ_ x).inv ≫= actionHom_leftUnitor x t

set_option backward.isDefEq.respectTransparency false in
/-- A monoidal functor `F : C ⥤ D ⥤ D` can be thought of as a right action
of `C` on `D`. -/
```

-- snippet 92
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_actionHomRight (L536-L539)
theorem action_actionHomRight (y : D) (z : C) {x x' : C} (f : x ⟶ x') :
    (y ⊙ᵣ z) ⊴ᵣ f = (αᵣ y z x).inv ≫ y ⊴ᵣ (z ◁ f) ≫ (αᵣ y z x').hom := by
simp [whiskerRight_actionHomLeft]
```

-- snippet 93
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHom_unop (L242-L245)
lemma leftActionOfOppositeLeftAction_actionHom_unop
    {c c' : Cᵒᵖ} {d d' : Dᵒᵖ} (f : c ⟶ c') (g : d ⟶ d') :
    f.unop ⊙ₗₘ g.unop = unop (f ⊙ₗₘ g) := rfl
```

-- snippet 94
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μₗ_unitality_inv (L88-L123)
lemma μₗ_unitality_inv (d : D) :
     (λₗ (F.obj d)).inv ≫ μₗ F (𝟙_ C) d = F.map (λₗ d).inv := by
simpa [-μₗ_unitality] using
    (λₗ[C] (F.obj d)).inv ≫=
      (μₗ_unitality F d).symm =≫
      F.map (λₗ[C] d).inv

end LaxLeftLinear

/-- `F.OplaxLinear C` equips `F : D ⥤ D'` with a family of morphisms
`δₗ F : ∀ (c : C) (d : D), c ⊙ₗ F.obj d ⟶ F.obj (c ⊙ₗ d)`
that is natural in each variable and coherent with respect to left actions
of `C` on `D` and `D'`. -/
class OplaxLeftLinear
    (F : D ⥤ D') (C : Type*) [Category* C] [MonoidalCategory C]
    [MonoidalLeftAction C D] [MonoidalLeftAction C D'] where
  /-- The oplax lineator morphism. -/
  δₗ (F) (c : C) (d : D) : F.obj (c ⊙ₗ d) ⟶ c ⊙ₗ F.obj d
  δₗ_naturality_left (F) {c c' : C} (f : c ⟶ c') (d : D) :
    F.map (f ⊵ₗ d) ≫ δₗ c' d =
    δₗ c d ≫ f ⊵ₗ F.obj d := by cat_disch
  δₗ_naturality_right (F) (c : C) {d d' : D} (f : d ⟶ d') :
    F.map (c ⊴ₗ f) ≫ δₗ c d' =
    δₗ c d ≫ c ⊴ₗ F.map f := by cat_disch
  δₗ_associativity (F) (c c' : C) (d : D) :
    δₗ (c ⊗ c') d ≫ (αₗ _ _ _).hom =
    F.map (αₗ _ _ _).hom ≫ δₗ c (c' ⊙ₗ d) ≫
      c ⊴ₗ δₗ c' d := by cat_disch
  δₗ_unitality_inv (F) (d : D) :
    (λₗ (F.obj d)).inv =
    F.map (λₗ d).inv ≫ δₗ (𝟙_ C) d := by cat_disch

namespace OplaxLeftLinear

-- These are [reassoc (attr := simp)] on the basis that analog lemmas for
-- oplax monoidal functors are also [reassoc (attr := simp)].
```

-- snippet 95
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.μᵣIso (L340-L345)
abbrev μᵣIso (d : D) (c : C) : F.obj d ⊙ᵣ c ≅ F.obj (d ⊙ᵣ c) where
  hom := LaxRightLinear.μᵣ F d c
inv := OplaxRightLinear.δᵣ F d c

variable (c : C) (d : D)
```

-- snippet 96
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHomLeft_unop (L234-L237)
lemma leftActionOfOppositeLeftAction_actionHomLeft_unop
    {c c' : Cᵒᵖ} (f : c ⟶ c') (d : Dᵒᵖ) :
    f.unop ⊵ₗ unop d = unop (f ⊵ₗ d) := rfl
```

-- snippet 97
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocIso_inv_naturality (L241-L246)
theorem actionAssocIso_inv_naturality
    {c₁ c₂ c₃ c₄ : C} {d₁ d₂ : D} (f : c₁ ⟶ c₂) (g : c₃ ⟶ c₄) (h : d₁ ⟶ d₂) :
    (f ⊙ₗₘ g ⊙ₗₘ h) ≫ (αₗ c₂ c₄ d₂).inv =
    (αₗ c₁ c₃ d₁).inv ≫ ((f ⊗ₘ g) ⊙ₗₘ h) := by
rw [Iso.comp_inv_eq, Category.assoc, Eq.comm, Iso.inv_comp_eq, actionAssocIso_hom_naturality]
```

-- snippet 98
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_μᵣ (L351-L354)
lemma inv_μᵣ :
    CategoryTheory.inv (μᵣ F d c) = δᵣ F d c :=
Eq.symm <| IsIso.eq_inv_of_hom_inv_id <| μᵣ_comp_δᵣ F d c
```

-- snippet 99
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionObj_mop (L97-L99)
lemma monoidalOppositeLeftAction_actionObj_mop (c : C) (d : D) :
    mop c ⊙ₗ d = d ⊙ᵣ c := rfl
```

-- snippet 100
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.unit_actionHomRight (L208-L212)
theorem unit_actionHomRight {x y : D} (f : x ⟶ y) :
    (𝟙_ C) ⊴ₗ f = (λₗ x).hom ≫ f ≫ (λₗ y).inv := by
rw [← Category.assoc, actionUnitIso_hom_naturality]
  simp
```

-- snippet 101
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionRight_mop (L104-L107)
lemma monoidalOppositeLeftAction_actionRight_mop
    (c : C) {d d' : D} (f : d ⟶ d') :
    mop c ⊴ₗ f = f ⊵ᵣ c := rfl
```

-- snippet 102
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv' (L273-L276)
theorem actionHomRight_hom_inv' (x : C) {y z : D} (f : y ⟶ z) [IsIso f] :
    x ⊴ₗ f ≫ x ⊴ₗ inv f = 𝟙 (x ⊙ₗ y) := by
rw [← actionHomRight_comp, IsIso.hom_inv_id, actionHomRight_id]
```

-- snippet 103
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.id_actionHom (L193-L196)
lemma id_actionHom (c : C) {d d' : D} (f : d ⟶ d') :
    (𝟙 c) ⊙ₗₘ f = c ⊴ₗ f := by
simp [actionHom_def]
```

-- snippet 104
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionRight (L342-L344)
abbrev actionRight (d : D) : C ⥤ D := curriedAction C D |>.flip.obj d
/-- Bundle `αₗ _ _ _` as an isomorphism of trifunctors. -/
```

-- snippet 105
```lean
-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom (L263-L266)
theorem actionHomRight_inv_hom (x : C) {y z : D} (f : y ≅ z) :
    x ⊴ₗ f.inv ≫ x ⊴ₗ f.hom = 𝟙 (x ⊙ₗ z) := by
rw [← actionHomRight_comp, Iso.inv_hom_id, actionHomRight_id]
```
[/INST]