-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Merged by Bors] - feat(Kernel/Category): Stoch is a Markov category #36779
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
Closed
gaetanserre
wants to merge
48
commits into
leanprover-community:master
from
gaetanserre:kernel_categories
Closed
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
54dbb98
WIP: `Stoch` is a monoidal category
gaetanserre b275559
`SFinKer` `ComonObj`
gaetanserre 661f32d
feat(Kernel/Category): Stoch is a Markov category.
gaetanserre 87be28a
lint
gaetanserre 316a050
add exception to `overrideAllowedImportDirs`
gaetanserre bea1c71
Use `Monoidal.induced`
gaetanserre ba6f398
Introduce several typeclasses for stability of `MorphismProperty`
gaetanserre da2db3a
Create `CategoryTheory.Monoidal.Widesubcategory`
gaetanserre 7d3c86d
naming
gaetanserre d53a3e0
`SFinKer` is a copy-discard category
gaetanserre 270d0be
use the fact that `SFinKer` is a `CopyDiscardCategory`
gaetanserre ec0dc7c
change the definition of morphism in `WideSubcategory`
gaetanserre c1ec062
use @[simps] and move instances to the `WideSubcategory` namespace
gaetanserre b17fb7d
refactor
gaetanserre fd64ba8
`IsStableUnderComonoid` gives `CopyDiscardCategory`
gaetanserre bd73749
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre ba3e71d
Make `P` explicit
gaetanserre 8c3ab69
`isoMK`
gaetanserre c0904f7
`tensorμ_hom`
gaetanserre 3f41471
`IsStableUnderComonoid`
gaetanserre e9e83c2
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre ad6cdf9
include variables in instances
gaetanserre 51ede28
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre bad11df
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre d21c912
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre f9cbc59
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre 325033d
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre 016ec7c
Move `IsStableUnderComonoid` to another file
gaetanserre f3b80c1
update `Mathlib.lean`
gaetanserre 129c081
remove custom tactics
gaetanserre aadc6d9
docstring
gaetanserre d55954e
Update Mathlib/Probability/Kernel/Category/SFinKer.lean
gaetanserre 9616846
Update Mathlib/Probability/Kernel/Category/SFinKer.lean
gaetanserre bb063ad
Update Mathlib/Probability/Kernel/Category/SFinKer.lean
gaetanserre 9a2d2af
Update Mathlib/Probability/Kernel/Category/SFinKer.lean
gaetanserre 7d6dbce
Update Mathlib/Probability/Kernel/Category/SFinKer.lean
gaetanserre 1fe7aa2
Fix issues in `Stoch`
gaetanserre dd3be17
refactor
gaetanserre c726a42
remove useless universe annotation
gaetanserre 3daf613
Update Mathlib/Probability/Kernel/Category/Stoch.lean
gaetanserre dcb7adb
Update Mathlib/Probability/Kernel/Category/Stoch.lean
gaetanserre 871f2e9
Update Mathlib/CategoryTheory/Monoidal/Widesubcategory.lean
gaetanserre 2c12c72
Update Mathlib/CategoryTheory/CopyDiscardCategory/Widesubcategory.lean
gaetanserre f01fdfa
`id_parallelComp_comp_parallelComp_id`
gaetanserre 730a10d
Update Mathlib/Probability/Kernel/Composition/ParallelComp.lean
gaetanserre b36425e
Remove `parallelComp_id_id_map` and `parallelComp_id_map_id`
gaetanserre 1bfcb5a
shorten lines
gaetanserre 642be7d
shorten lines
gaetanserre 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
53 changes: 53 additions & 0 deletions
53
Mathlib/CategoryTheory/CopyDiscardCategory/Widesubcategory.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,53 @@ | ||
| /- | ||
| Copyright (c) 2026 Gaëtan Serré. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Gaëtan Serré | ||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.CategoryTheory.Monoidal.Widesubcategory | ||
|
|
||
| /-! | ||
| # Copy-discard structures on wide subcategories | ||
|
|
||
| Given a monoidal category `C`, a morphism property `P : MorphismProperty C` satisfying | ||
| `P.IsMonoidalStable` and a comonoid object `c : C`, we introduce a condition `P. | ||
| IsStableUnderComonoid c` saying that `c` inherits a comonoid object structure in the category of | ||
| `WideSubcategory P`. If `C` is a copy-discard category, if `P` is also stable under braiding and | ||
| that this condition `P. IsStableUnderComonoid` holds for all objects `c : C`, we show that | ||
| `WideSubcategory P` is also a copy-discard category. | ||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace CategoryTheory.MorphismProperty | ||
|
|
||
| open scoped ComonObj | ||
|
|
||
| variable {C : Type*} [Category* C] (P : MorphismProperty C) [MonoidalCategory C] | ||
|
|
||
| /-- A braided-stable morphism property stable under comonoid counit and comultiplication. -/ | ||
| class IsStableUnderComonoid (P : MorphismProperty C) (c : C) [ComonObj c] : Prop where | ||
| counit_mem (P) : P ε[c] | ||
| comul_mem (P) : P Δ[c] | ||
|
|
||
| export IsStableUnderComonoid (counit_mem comul_mem) | ||
|
|
||
| @[simps] | ||
| instance [P.IsMonoidalStable] (c : WideSubcategory P) [ComonObj c.obj] | ||
| [P.IsStableUnderComonoid c.obj] : ComonObj c where | ||
| counit := ⟨ε[c.obj], P.counit_mem⟩ | ||
| comul := ⟨Δ[c.obj], P.comul_mem⟩ | ||
|
|
||
| instance [BraidedCategory C] [P.IsStableUnderBraiding] (c : WideSubcategory P) [ComonObj c.obj] | ||
| [IsCommComonObj c.obj] [P.IsStableUnderComonoid c.obj] : IsCommComonObj c where | ||
| comul_comm := by | ||
| ext | ||
| exact IsCommComonObj.comul_comm _ | ||
|
|
||
| open CopyDiscardCategory in | ||
| attribute [local simp] copy_tensor discard_tensor copy_unit discard_unit in | ||
| instance [CopyDiscardCategory C] [P.IsStableUnderBraiding] [∀ c, P.IsStableUnderComonoid c] : | ||
| CopyDiscardCategory (WideSubcategory P) where | ||
|
|
||
| end CategoryTheory.MorphismProperty |
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,107 @@ | ||
| /- | ||
| Copyright (c) 2026 Gaëtan Serré. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Gaëtan Serré | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Mathlib.CategoryTheory.CopyDiscardCategory.Basic | ||
| public import Mathlib.CategoryTheory.Localization.Monoidal.Basic | ||
| public import Mathlib.CategoryTheory.Widesubcategory | ||
|
|
||
| /-! | ||
| # Monoidal structures on wide subcategories | ||
|
|
||
| Given a monoidal category `C` and a morphism property `P : MorphismProperty C`, | ||
| this file introduces conditions on `P` ensuring that `WideSubcategory P` inherits | ||
| additional structures. | ||
|
|
||
| We define stability classes under associators, unitors, and braidings, and use | ||
| them to construct monoidal, braided, and symmetric structures on | ||
| `WideSubcategory P`. | ||
|
|
||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace CategoryTheory | ||
|
|
||
| open scoped MonoidalCategory ComonObj | ||
|
|
||
| variable {C : Type*} [Category* C] (P : MorphismProperty C) [MonoidalCategory C] | ||
|
|
||
| namespace MorphismProperty | ||
|
|
||
| /-- A morphism property stable under associator isomorphisms of a monoidal category. -/ | ||
| class IsStableUnderAssociator (P : MorphismProperty C) : Prop where | ||
| associator_hom_mem (P) (c c' c'' : C) : P (α_ c c' c'').hom | ||
| associator_inv_mem (P) (c c' c'' : C) : P (α_ c c' c'').inv | ||
|
|
||
| export IsStableUnderAssociator (associator_hom_mem associator_inv_mem) | ||
|
|
||
| /-- A morphism property stable under left and right unitor isomorphisms. -/ | ||
| class IsStableUnderUnitor (P : MorphismProperty C) : Prop where | ||
| leftUnitor_hom_mem (P) (c : C) : P ((λ_ c).hom) | ||
| leftUnitor_inv_mem (P) (c : C) : P ((λ_ c).inv) | ||
| rightUnitor_hom_mem (P) (c : C) : P ((ρ_ c).hom) | ||
| rightUnitor_inv_mem (P) (c : C) : P ((ρ_ c).inv) | ||
|
|
||
| export IsStableUnderUnitor (leftUnitor_hom_mem leftUnitor_inv_mem rightUnitor_hom_mem | ||
| rightUnitor_inv_mem) | ||
|
|
||
| /-- A morphism property stable under tensoring, associators, and unitors. -/ | ||
| class IsMonoidalStable : Prop extends IsMonoidal P, IsStableUnderAssociator P, | ||
| IsStableUnderUnitor P | ||
|
|
||
| /-- A monoidal-stable morphism property also stable under braiding isomorphisms. -/ | ||
| class IsStableUnderBraiding [BraidedCategory C] (P : MorphismProperty C) : Prop | ||
| extends IsMonoidalStable P where | ||
| braiding_hom_mem (P) (c c' : C) : P (β_ c c').hom | ||
| braiding_inv_mem (P) (c c' : C) : P (β_ c c').inv | ||
|
|
||
| export IsStableUnderBraiding (braiding_hom_mem braiding_inv_mem) | ||
|
|
||
| end MorphismProperty | ||
|
|
||
| namespace WideSubcategory | ||
|
|
||
| @[simps] | ||
| instance [P.IsMonoidalStable] : MonoidalCategoryStruct (WideSubcategory P) where | ||
| tensorObj c c' := ⟨c.obj ⊗ c'.obj⟩ | ||
| whiskerLeft c _ _ f := ⟨c.obj ◁ f.1, P.whiskerLeft_mem _ _ f.2⟩ | ||
| whiskerRight f c' := ⟨f.1 ▷ c'.obj, P.whiskerRight_mem _ f.2 _⟩ | ||
| tensorUnit := ⟨𝟙_ C⟩ | ||
| associator _ _ _ := | ||
| isoMk (α_ _ _ _) (P.associator_hom_mem _ _ _) (P.associator_inv_mem _ _ _) | ||
| leftUnitor _ := | ||
| isoMk (λ_ _) (P.leftUnitor_hom_mem _) (P.leftUnitor_inv_mem _) | ||
| rightUnitor _ := | ||
| isoMk (ρ_ _) (P.rightUnitor_hom_mem _) (P.rightUnitor_inv_mem _) | ||
| tensorHom f g := ⟨f.1 ⊗ₘ g.1, P.tensorHom_mem _ _ f.2 g.2⟩ | ||
|
|
||
| instance [P.IsMonoidalStable] : MonoidalCategory (WideSubcategory P) := | ||
| Monoidal.induced (wideSubcategoryInclusion P) | ||
| { εIso := Iso.refl _ | ||
| μIso _ _ := Iso.refl _ } | ||
|
|
||
| instance [BraidedCategory C] [P.IsStableUnderBraiding] : | ||
| BraidedCategory (WideSubcategory P) where | ||
| braiding _ _ := | ||
| isoMk (β_ _ _) (P.braiding_hom_mem _ _) (P.braiding_inv_mem _ _) | ||
|
|
||
gaetanserre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| variable {P} in | ||
| open MonoidalCategory in | ||
| @[simp] | ||
| lemma tensorμ_hom [BraidedCategory C] [P.IsStableUnderBraiding] (X Y Z T : WideSubcategory P) : | ||
| (tensorμ X Y Z T).hom = tensorμ _ _ _ _ := rfl | ||
|
|
||
| instance [SymmetricCategory C] [P.IsStableUnderBraiding] : | ||
| SymmetricCategory (WideSubcategory P) where | ||
| symmetry c c' := by | ||
| ext | ||
| exact SymmetricCategory.symmetry _ _ | ||
|
|
||
| end WideSubcategory | ||
|
|
||
| end CategoryTheory | ||
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.
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.
Uh oh!
There was an error while loading. Please reload this page.