Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(CategoryTheory/Closed/Enrichment): a closed monoidal category is enriched in itself #17326

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
160ccd6
added file Enrichment.lean showing that a closed monoidal cat is enri…
daniel-carranza Oct 1, 2024
1d648c6
forgot to add end namespace
daniel-carranza Oct 1, 2024
280c191
update Mathlib imports to include Enrichment.lean
daniel-carranza Oct 1, 2024
4723972
rewrote Eq.symm to use field notation
daniel-carranza Oct 1, 2024
e9a487e
changed "instance" to "scoped instance"
daniel-carranza Oct 1, 2024
5bba548
used backticks in comments to display Lean code in `verbatim`
daniel-carranza Oct 1, 2024
235a5ba
moved 3 proofs to inside the instance, merged rewrites, and removed s…
daniel-carranza Oct 1, 2024
5c41733
removed simp attribute from the equality lemmas
daniel-carranza Oct 1, 2024
3aca876
improved spacing on lemma compTranspose_eq
daniel-carranza Oct 1, 2024
e752312
corrected newline to be after colon
daniel-carranza Oct 1, 2024
43b9750
added type ascription for readability
daniel-carranza Oct 21, 2024
c8f9b2b
corrected typo in lemma name
daniel-carranza Oct 21, 2024
614b031
added type ascription for readability
daniel-carranza Oct 21, 2024
2ce7f76
corrected typo in doctoring
daniel-carranza Oct 21, 2024
8fb07c1
separate different tactics into new lines
daniel-carranza Oct 21, 2024
b3b137d
condensed definition of the hom structure
daniel-carranza Oct 21, 2024
614504b
condensed definition of the id structure
daniel-carranza Oct 21, 2024
2c5f67b
implementing alternate proof of comp_id
daniel-carranza Oct 21, 2024
8d04258
corrected typo compTranspose in proofs
daniel-carranza Oct 21, 2024
51a9cbf
added variable name to correct error in comp_id proof
daniel-carranza Oct 21, 2024
fb6c338
corrected spacing in definition (suggested by lint bot)
daniel-carranza Oct 21, 2024
26c22d2
moved all enriched lemmas to Monoidal.Closed
daniel-carranza Oct 22, 2024
a822910
Added comments and docstrings to lemmas in Monoidal.Closed
daniel-carranza Oct 22, 2024
322cbe5
rewrote file to use lemmas in Monoidal.Closed, added comments about t…
daniel-carranza Oct 22, 2024
e74257e
Merge branch 'enriched_from_closed' of https://github.com/leanprover-…
daniel-carranza Oct 22, 2024
747c2cb
removed unused argument of Closed y
daniel-carranza Oct 22, 2024
458192b
corrected typos in comments and docstrings
daniel-carranza Oct 22, 2024
730d0ab
Corrected comment to remove an `exact` step in the proof that no long…
daniel-carranza Oct 23, 2024
96e3a33
added reassoc and simp attributes to `id_comp`
daniel-carranza Oct 24, 2024
510ffc1
added reassoc and simp attributes to `comp_id`
daniel-carranza Oct 24, 2024
784a3d9
added reassoc attribute to `MonoidalClosed.assoc`
daniel-carranza Oct 24, 2024
a2aeee1
removed a newline
daniel-carranza Oct 24, 2024
1558edf
removed `@` from certain structure fields
daniel-carranza Oct 24, 2024
54d751f
docstring: uses verbatim to write category name C
daniel-carranza Oct 24, 2024
577256d
docstring: wrote variable C in verbatim
daniel-carranza Oct 24, 2024
4cbc112
docstring: wrote variable C in verbatim
daniel-carranza Oct 24, 2024
726054b
docstring: wrapped variable name C in verbatim
daniel-carranza Oct 24, 2024
d95b95c
Update Mathlib/CategoryTheory/Closed/Enrichment.lean
joelriou Oct 24, 2024
f461a2c
Update Mathlib/CategoryTheory/Closed/Enrichment.lean
joelriou Oct 24, 2024
814906e
Update Mathlib/CategoryTheory/Closed/Enrichment.lean
joelriou Oct 24, 2024
ee837df
Update Mathlib/CategoryTheory/Closed/Enrichment.lean
joelriou Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,7 @@ import Mathlib.CategoryTheory.ChosenFiniteProducts
import Mathlib.CategoryTheory.ChosenFiniteProducts.Cat
import Mathlib.CategoryTheory.ChosenFiniteProducts.FunctorCategory
import Mathlib.CategoryTheory.Closed.Cartesian
import Mathlib.CategoryTheory.Closed.Enrichment
import Mathlib.CategoryTheory.Closed.Functor
import Mathlib.CategoryTheory.Closed.FunctorCategory
import Mathlib.CategoryTheory.Closed.FunctorToTypes
Expand Down
99 changes: 99 additions & 0 deletions Mathlib/CategoryTheory/Closed/Enrichment.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/-
Copyright (c) 2024 Daniel Carranza. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Daniel Carranza
-/
import Mathlib.CategoryTheory.Enriched.Basic
import Mathlib.CategoryTheory.Closed.Monoidal

/-!
# A closed monoidal category is enriched in itself

From the data of a closed monoidal category V, we define a V-category structure for V
where the hom-object is given by the internal hom (coming from the closed structure).

The instance is given at the end of the file.

joelriou marked this conversation as resolved.
Show resolved Hide resolved
All structure field values are defined separately

In particular, the proofs of associativity and unitality use the following outline:
1. Take adjoint transpose on each side of the equality (uncurry_injective)
2. Do whatever rewrites/simps are necessary to apply uncurry_curry
3. Conclude with simp (+ a possible exact)
-/

universe u u₁ v w

namespace CategoryTheory

open MonoidalCategory

namespace MonoidalClosed

variable {V : Type u} [Category.{u₁, u} V] [MonoidalCategory V] [MonoidalClosed V]

/-- The V-identity morphism
`𝟙_ V ⟶ hom(V, v)`
used to equip V with the structure of a V-category -/
def id (x : V) : 𝟙_ V ⟶ (ihom x).obj x := curry (ρ_ x).hom

/-- The *uncurried* composition morphism
`x ⊗ (hom(x, y) ⊗ hom(y, z)) ⟶ (x ⊗ hom(x, y)) ⊗ hom(y, z) ⟶ y ⊗ hom(y, z) ⟶ z`.
The V-composition morphism is defined as the adjoint transpose of this map. -/
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
def compTranspose (x y z : V) :=
(α_ x ((ihom x).obj y) ((ihom y).obj z)).inv ≫
(ihom.ev x).app y ▷ ((ihom y).obj z) ≫
(ihom.ev y).app z
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved

/-- The V-composition morphism
`hom(x, y) ⊗ hom(y, z) ⟶ hom(x, z)`
used to equip V with the structure of a V-category -/
def comp (x y z : V) := curry (compTranspose x y z)
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved

/-- Unfold the definition of id.
This exists to streamline the proofs of MonoidalClosed.id_comp and MonoidalClosed.comp_id -/
lemma id_eq (x : V) : id x = curry (ρ_ x).hom := rfl

/-- Unfold the definition of compTranspose.
This exists to streamline the proof of MonoidalClosed.assoc -/
lemma compTranpose_eq (x y z : V) :
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
compTranspose x y z = (α_ _ _ _).inv ≫ (ihom.ev x).app y ▷ _ ≫ (ihom.ev y).app z :=
rfl

/-- Unfold the definition of comp.
This exists to streamline the proof of MonoidalClosed.assoc -/
lemma comp_eq (x y z : V) : comp x y z = curry (compTranspose x y z) := rfl

/-- For V closed monoidal, build an instance of V as a V-category -/
scoped instance : EnrichedCategory V V where
Hom := fun x => (ihom x).obj
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
id := id
comp := comp
id_comp := fun _ _ => by
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
apply uncurry_injective; simp only [uncurry_natural_left, comp_eq, id_eq]
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
rw [uncurry_curry, whisker_assoc_symm]; simp only [compTranpose_eq, Category.assoc]
rw [Iso.hom_inv_id_assoc, ← comp_whiskerRight_assoc, ← uncurry_eq, uncurry_curry]
simp only [Functor.id_obj, triangle_assoc_comp_right_assoc, whiskerLeft_inv_hom_assoc]
exact (uncurry_id_eq_ev _ _).symm
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
comp_id := fun _ _ => by
apply uncurry_injective
simp only [uncurry_natural_left, comp_eq, id_eq]
rw [uncurry_curry]; simp only [compTranpose_eq, Category.assoc]
rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc]; dsimp
rw [← uncurry_eq, uncurry_curry]
simp only [whiskerLeft_rightUnitor_inv, MonoidalCategory.whiskerRight_id, Category.assoc,
Iso.inv_hom_id, Category.comp_id, Iso.hom_inv_id_assoc, Iso.inv_hom_id_assoc]
exact (uncurry_id_eq_ev _ _).symm
daniel-carranza marked this conversation as resolved.
Show resolved Hide resolved
assoc := fun _ _ _ _ => by
apply uncurry_injective
simp only [uncurry_natural_left, comp_eq]
rw [uncurry_curry, uncurry_curry]; simp only [compTranpose_eq, Category.assoc]
rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc]; dsimp
rw [← uncurry_eq, uncurry_curry, associator_inv_naturality_right_assoc, whisker_exchange_assoc,
← uncurry_eq, uncurry_curry]
simp only [comp_whiskerRight, tensorLeft_obj, Category.assoc, pentagon_inv_assoc,
whiskerRight_tensor, Iso.hom_inv_id_assoc]

end MonoidalClosed

end CategoryTheory
Loading