-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Structured model #170
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
Open
Jlh18
wants to merge
1
commit into
master
Choose a base branch
from
ForMathlibUpdate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import Mathlib.CategoryTheory.Adjunction.Basic | ||
|
|
||
| namespace CategoryTheory | ||
|
|
||
| open CategoryTheory.Functor NatIso Category | ||
|
|
||
| -- declare the `v`'s first; see `CategoryTheory.Category` for an explanation | ||
| universe v₁ v₂ v₃ u₁ u₂ u₃ | ||
| variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} | ||
|
|
||
| /-- The natural hom-set isomorphism `C(F(-),⋆) ≅ D(-,G(⋆))` given by an adjunction. -/ | ||
| def Adjunction.homIso [Category.{v₁} D] {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) : | ||
| yoneda ⋙ (Functor.whiskeringLeft _ _ _).obj (F.op) ≅ G ⋙ yoneda := | ||
| NatIso.ofComponents | ||
| (fun X => (adj.representableBy X).toIso.symm) | ||
| (fun {X Y} f => by ext; simp [Functor.RepresentableBy.toIso, Functor.representableByEquiv, | ||
| adj.homEquiv_naturality_right]) | ||
|
|
||
| namespace Equivalence | ||
|
|
||
| variable [Category.{v₂} D] {e : C ≌ D} | ||
|
|
||
| def isoCompInverse {J : Type*} [Category J] {X : J ⥤ C} {Y : J ⥤ D} (α : X ⋙ e.functor ≅ Y) : | ||
| X ≅ Y ⋙ e.inverse := | ||
| calc X | ||
| _ ≅ X ⋙ 𝟭 _ := X.rightUnitor.symm | ||
| _ ≅ X ⋙ e.functor ⋙ e.inverse := Functor.isoWhiskerLeft X e.unitIso | ||
| _ ≅ (X ⋙ e.functor) ⋙ e.inverse := Functor.associator .. | ||
| _ ≅ Y ⋙ e.inverse := Functor.isoWhiskerRight α e.inverse | ||
|
|
||
| @[simp] | ||
| lemma isoCompInverse_hom_app {J : Type*} [Category J] {X : J ⥤ C} {Y : J ⥤ D} | ||
| (α : X ⋙ e.functor ≅ Y) (A : J) : | ||
| (isoCompInverse α).hom.app A = e.unitIso.hom.app (X.obj A) ≫ e.inverse.map (α.hom.app A) := by | ||
| simp [isoCompInverse, Trans.trans] | ||
|
|
||
| @[simp] | ||
| lemma isoCompInverse_inv_app {J : Type*} [Category J] {X : J ⥤ C} {Y : J ⥤ D} | ||
| (α : X ⋙ e.functor ≅ Y) (A : J) : | ||
| (isoCompInverse α).inv.app A = e.inverse.map (α.inv.app A) ≫ e.unitIso.inv.app (X.obj A) := by | ||
| simp [isoCompInverse, Trans.trans] | ||
|
|
||
| @[simps] | ||
| def compFunctorNatIsoEquiv {J : Type*} [Category J] (X : J ⥤ C) (Y : J ⥤ D) : | ||
| (X ⋙ e.functor ≅ Y) ≃ (X ≅ Y ⋙ e.inverse) where | ||
| toFun := isoCompInverse | ||
| invFun α := (e.symm.isoCompInverse α.symm).symm | ||
| left_inv := by cat_disch | ||
| right_inv := by cat_disch |
66 changes: 66 additions & 0 deletions
66
HoTTLean/ForMathlib/CategoryTheory/Adjunction/PartialAdjoint.lean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import Mathlib.CategoryTheory.Adjunction.PartialAdjoint | ||
|
|
||
|
|
||
| universe v₁ v₂ u₁ u₂ | ||
|
|
||
| namespace CategoryTheory | ||
|
|
||
| namespace Functor | ||
|
|
||
| open Category Opposite Limits | ||
|
|
||
| section PartialRightAdjoint | ||
|
|
||
| variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D) | ||
|
|
||
| structure PartialRightAdjoint (G : F.PartialRightAdjointSource ⥤ C) where | ||
| (repr : ∀ Y, (F.op ⋙ yoneda.obj Y.obj).RepresentableBy (G.obj Y)) | ||
| (repr_homEquiv : ∀ X Y (f : X ⟶ Y), (repr Y).homEquiv (G.map f) = | ||
| (repr X).homEquiv (𝟙 _) ≫ f) | ||
|
|
||
| @[simps] | ||
| noncomputable def PartialRightAdjoint.partialRightAdjoint : | ||
| PartialRightAdjoint F (partialRightAdjoint F) where | ||
| repr _ := Functor.representableBy _ | ||
| repr_homEquiv _ _ _ := by | ||
| simp only [partialRightAdjoint_obj, comp_obj, op_obj, yoneda_obj_obj, partialRightAdjoint_map, | ||
| partialRightAdjointMap, partialRightAdjointHomEquiv] | ||
| erw [Equiv.apply_symm_apply] | ||
|
|
||
| @[simps] | ||
| noncomputable def rightAdjoint.partialRightAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : | ||
| PartialRightAdjoint L (ObjectProperty.ι _ ⋙ rightAdjoint L) where | ||
| repr Y := Adjunction.representableBy (Adjunction.ofIsLeftAdjoint L) _ | ||
| repr_homEquiv a b c := by | ||
| simp [Equiv.symm_apply_eq, Adjunction.homEquiv_naturality_right] | ||
|
|
||
| lemma PartialRightAdjoint.repr_homEquiv_comp {G : F.PartialRightAdjointSource ⥤ C} | ||
| (P : PartialRightAdjoint F G) {X Y Z} (f : X ⟶ Y) (a : Z ⟶ G.obj X) : | ||
| (P.repr Y).homEquiv (a ≫ G.map f) = (P.repr X).homEquiv a ≫ f := by | ||
| have := (P.repr X).homEquiv_comp a (𝟙 _) | ||
| rw [(P.repr Y).homEquiv_comp, P.repr_homEquiv] | ||
| cat_disch | ||
|
|
||
| lemma PartialRightAdjoint.repr_homEquiv_symm_comp {G : F.PartialRightAdjointSource ⥤ C} | ||
| (P : PartialRightAdjoint F G) {X Y Z} (f : X ⟶ Y) (a : F.obj Z ⟶ X.obj) : | ||
| (P.repr Y).homEquiv.symm (a ≫ f) = (P.repr X).homEquiv.symm a ≫ G.map f := by | ||
| rw [Equiv.symm_apply_eq, repr_homEquiv_comp, Equiv.apply_symm_apply] | ||
|
|
||
| def PartialRightAdjoint.uniqueUpToIso {G G' : F.PartialRightAdjointSource ⥤ C} | ||
| (P : PartialRightAdjoint F G) (P' : PartialRightAdjoint F G') : G ≅ G' := | ||
| NatIso.ofComponents (fun X => (P.repr _).uniqueUpToIso (P'.repr _)) | ||
| (fun {X Y} f => by | ||
| apply yoneda.map_injective | ||
| ext Z a | ||
| simp only [yoneda_obj_obj, RepresentableBy.uniqueUpToIso_hom, comp_obj, op_obj, map_comp, | ||
| FullyFaithful.map_preimage, FunctorToTypes.comp, yoneda_map_app, NatIso.ofComponents_hom_app, | ||
| Function.comp_apply] | ||
| calc (P'.repr Y).homEquiv.symm ((P.repr Y).homEquiv (a ≫ G.map f)) | ||
| _ = (P'.repr Y).homEquiv.symm ((P.repr X).homEquiv a ≫ f) := by | ||
| simpa using PartialRightAdjoint.repr_homEquiv_comp .. | ||
| _ = (P'.repr X).homEquiv.symm ((P.repr X).homEquiv a) ≫ G'.map f := by | ||
| apply repr_homEquiv_symm_comp) | ||
|
|
||
| noncomputable abbrev isoPartialRightAdjoint (G : F.PartialRightAdjointSource ⥤ C) | ||
| (P : PartialRightAdjoint F G) : G ≅ partialRightAdjoint F := | ||
| PartialRightAdjoint.uniqueUpToIso _ P (PartialRightAdjoint.partialRightAdjoint _) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have a docstring?