Dataset Viewer
Auto-converted to Parquet Duplicate
fact
stringlengths
18
10.3k
type
stringclasses
3 values
library
stringclasses
1 value
imports
listlengths
2
31
filename
stringlengths
20
76
symbolic_name
stringlengths
1
32
docstring
stringclasses
1 value
2-Category : (o ℓ e t : Level) → Set (suc (o ⊔ ℓ ⊔ e ⊔ t))
function
src
[ "open import Level", "open import Categories.Category.Monoidal.Instance.StrictCats using (module Product)", "open import Categories.Enriched.Category using (Category)" ]
src/Categories/2-Category.agda
2-Category
Adjoint (L : Functor C D) (R : Functor D C) : Set (levelOfTerm L ⊔ levelOfTerm R) where private module C = Category C module D = Category D module L = Functor L module R = Functor R field unit : NaturalTransformation idF (R ∘F L) counit : NaturalTransformation (L ∘F R) idF module unit = NaturalTransformation unit module counit = NaturalTransformation counit field zig : ∀ {A : C.Obj} → counit.η (L.F₀ A) D.∘ L.F₁ (unit.η A) D.≈ D.id zag : ∀ {B : D.Obj} → R.F₁ (counit.η B) C.∘ unit.η (R.F₀ B) C.≈ C.id private variable A : C.Obj B : D.Obj Ladjunct : L.F₀ A D.⇒ B → A C.⇒ R.F₀ B Ladjunct f = R.F₁ f C.∘ unit.η _ Radjunct : A C.⇒ R.F₀ B → L.F₀ A D.⇒ B Radjunct f = counit.η _ D.∘ L.F₁ f RLadjunct≈id : ∀ {f : L.F₀ A D.⇒ B} → Radjunct (Ladjunct f) D.≈ f RLadjunct≈id {f = f} = begin Radjunct (Ladjunct f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩ counit.η _ D.∘ L.F₁ (R.F₁ f) D.∘ L.F₁ (unit.η _) ≈⟨ pullˡ (counit.commute f) ⟩ (f D.∘ counit.η _) D.∘ L.F₁ (unit.η _) ≈⟨ pullʳ zig ⟩ f D.∘ D.id ≈⟨ D.identityʳ ⟩ f ∎ where open D.HomReasoning open MR D LRadjunct≈id : ∀ {f : A C.⇒ R.F₀ B} → Ladjunct (Radjunct f) C.≈ f LRadjunct≈id {f = f} = begin Ladjunct (Radjunct f) ≈⟨ R.homomorphism ⟩∘⟨refl ⟩ (R.F₁ (counit.η _) C.∘ R.F₁ (L.F₁ f)) C.∘ unit.η _ ≈˘⟨ pushʳ (unit.commute f) ⟩ R.F₁ (counit.η _) C.∘ unit.η _ C.∘ f ≈⟨ pullˡ zag ⟩ C.id C.∘ f ≈⟨ C.identityˡ ⟩ f ∎ where open C.HomReasoning open MR C Hom[L-,-] : Bifunctor C.op D (Setoids _ _) Hom[L-,-] = Hom[ D ][-,-] ∘F (L.op ⁂ idF) Hom[-,R-] : Bifunctor C.op D (Setoids _ _) Hom[-,R-] = Hom[ C ][-,-] ∘F (idF ⁂ R) module Hom[L-,-] = Functor Hom[L-,-] module Hom[-,R-] = Functor Hom[-,R-] -- Inverse is more 'categorical' than bijection defined via injection/surjection Hom-inverse : ∀ A B → Inverse (Hom[L-,-].F₀ (A , B)) (Hom[-,R-].F₀ (A , B)) Hom-inverse A B = record { to = Ladjunct {A} {B} ; to-cong = C.∘-resp-≈ˡ ∙ R.F-resp-≈ ; from = Radjunct {A} {B} ; from-cong = D.∘-resp-≈ʳ ∙ L.F-resp-≈ ; inverse = record { fst = λ p → C.∘-resp-≈ˡ (R.F-resp-≈ p) C.HomReasoning.○ LRadjunct≈id ; snd = λ p → D.∘-resp-≈ʳ (L.F-resp-≈ p) D.HomReasoning.○ RLadjunct≈id } } module Hom-inverse {A} {B} = Inverse (Hom-inverse A B) op : Adjoint R.op L.op op = record { unit = counit.op ; counit = unit.op ; zig = zag ; zag = zig } -- naturality condition on the two hom functors. -- these conditions are separated out because a complication due to the -- universe level in Agda. module _ where open C open HomReasoning open MR C Ladjunct-comm : ∀ {X Y A B} {h i : L.F₀ X D.⇒ Y} {f : A ⇒ X} {g : Y D.⇒ B} → h D.≈ i → R.F₁ (g D.∘ h D.∘ L.F₁ f) ∘ unit.η A ≈ R.F₁ g ∘ (R.F₁ i ∘ unit.η X) ∘ f Ladjunct-comm {X} {Y} {A} {B} {h} {i} {f} {g} eq = begin R.F₁ (g D.∘ h D.∘ L.F₁ f) ∘ unit.η A ≈⟨ R.homomorphism ⟩∘⟨refl ⟩ (R.F₁ g ∘ R.F₁ (h D.∘ L.F₁ f)) ∘ unit.η A ≈⟨ (refl⟩∘⟨ R.homomorphism) ⟩∘⟨refl ⟩ (R.F₁ g ∘ R.F₁ h ∘ R.F₁ (L.F₁ f)) ∘ unit.η A ≈⟨ pullʳ assoc ⟩ R.F₁ g ∘ R.F₁ h ∘ R.F₁ (L.F₁ f) ∘ unit.η A ≈˘⟨ refl⟩∘⟨ ⟺ (R.F-resp-≈ eq) ⟩∘⟨ unit.commute f ⟩ R.F₁ g ∘ R.F₁ i ∘ unit.η X ∘ f ≈⟨ refl⟩∘⟨ sym-assoc ⟩ R.F₁ g ∘ (R.F₁ i ∘ unit.η X) ∘ f ∎ Ladjunct-comm′ : ∀ {X A B} {f : A ⇒ X} {g : L.F₀ X D.⇒ B} → Ladjunct (g D.∘ L.F₁ f) ≈ Ladjunct g ∘ f Ladjunct-comm′ = ∘-resp-≈ˡ R.homomorphism ○ (pullʳ (⟺ (unit.commute _))) ○ sym-assoc Ladjunct-resp-≈ : ∀ {A B} {f g : L.F₀ A D.⇒ B} → f D.≈ g → Ladjunct f ≈ Ladjunct g Ladjunct-resp-≈ eq = ∘-resp-≈ˡ (R.F-resp-≈ eq) module _ where open D open HomReasoning open MR D Radjunct-comm : ∀ {X Y A B} {h i : X C.⇒ R.F₀ Y} {f : A C.⇒ X} {g : Y ⇒ B} → h C.≈ i → counit.η B ∘ L.F₁ (R.F₁ g C.∘ h C.∘ f) ≈ g ∘ (counit.η Y ∘ L.F₁ i) ∘ L.F₁ f Radjunct-comm {X} {Y} {A} {B} {h} {i} {f} {g} eq = begin counit.η B ∘ L.F₁ (R.F₁ g C.∘ h C.∘ f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩ counit.η B ∘ L.F₁ (R.F₁ g) ∘ L.F₁ (h C.∘ f) ≈⟨ pullˡ (counit.commute g) ⟩ (g ∘ counit.η Y) ∘ L.F₁ (h C.∘ f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩ (g ∘ counit.η Y) ∘ L.F₁ h ∘ L.F₁ f ≈⟨ refl⟩∘⟨ L.F-resp-≈ eq ⟩∘⟨refl ⟩ (g ∘ counit.η Y) ∘ L.F₁ i ∘ L.F₁ f ≈⟨ pullʳ sym-assoc ⟩ g ∘ (counit.η Y ∘ L.F₁ i) ∘ L.F₁ f ∎ Radjunct-comm′ : ∀ {Y A B} {f : A C.⇒ R.F₀ Y} {g : Y ⇒ B} → Radjunct (R.F₁ g C.∘ f) ≈ g ∘ Radjunct f Radjunct-comm′ = ∘-resp-≈ʳ L.homomorphism ○ pullˡ (counit.commute _) ○ assoc Radjunct-resp-≈ : ∀ {A B} {f g : A C.⇒ R.F₀ B} → f C.≈ g → Radjunct f ≈ Radjunct g Radjunct-resp-≈ eq = ∘-resp-≈ʳ (L.F-resp-≈ eq) -- a complication: the two hom functors do not live in the same Setoids, -- so they need to be mapped to the same Setoids first before establishing -- natural isomorphism! module _ where private levelℓ : Category o ℓ e → Level levelℓ {ℓ = ℓ} _ = ℓ levele : Category o ℓ e → Level levele {e = e} _ = e Hom[L-,-]′ : Bifunctor C.op D (Setoids _ _) Hom[L-,-]′ = LiftSetoids (levelℓ C) (levele C) ∘F Hom[ D ][-,-] ∘F (L.op ⁂ idF) Hom[-,R-]′ : Bifunctor C.op D (Setoids _ _) Hom[-,R-]′ = LiftSetoids (levelℓ D) (levele D) ∘F Hom[ C ][-,-] ∘F (idF ⁂ R) Hom-NI : NaturalIsomorphism Hom[L-,-]′ Hom[-,R-]′ Hom-NI = record { F⇒G = ntHelper record { η = λ _ → record { to = λ f → lift (Ladjunct (lower f)) ; cong = λ eq → lift (Ladjunct-resp-≈ (lower eq)) } ; commute = λ _ → lift $ Ladjunct-comm D.Equiv.refl } ; F⇐G = ntHelper record { η = λ _ → record { to = λ f → lift (Radjunct (lower f)) ; cong = λ eq → lift (Radjunct-resp-≈ (lower eq)) } ; commute = λ _ → lift $ Radjunct-comm C.Equiv.refl } ; iso = λ X → record { isoˡ = lift RLadjunct≈id ; isoʳ = lift LRadjunct≈id } } module Hom-NI = NaturalIsomorphism Hom-NI infix 5 _⊣_ _⊣_ = Adjoint ⊣-id : idF {C = C} ⊣ idF {C = C} ⊣-id {C = C} = record { unit = F⇐G unitorˡ ; counit = F⇒G unitorʳ ; zig = identityˡ ; zag = identityʳ } where open Category C open NaturalIsomorphism private op-involutive : ∀ {C : Category o ℓ e} {D : Category o′ ℓ′ e′} {L : Functor C D} {R : Functor D C} (L⊣R : L ⊣ R) → Adjoint.op (Adjoint.op L⊣R) ≡ L⊣R op-involutive _ = ≡.refl
record
src
[ "open import Level", "open import Data.Product using (_,_; _×_)", "open import Function using (_$_) renaming (_∘_ to _∙_)", "open import Function.Bundles using (Inverse)", "open import Relation.Binary using (Rel; IsEquivalence; Setoid)", "open import Relation.Binary.PropositionalEquality as ≡ using (_≡_)", "open import Categories.Category.Core using (Category)", "open import Categories.Category.Product using (Product; _⁂_)", "open import Categories.Category.Instance.Setoids using (Setoids)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.Functor.Bifunctor using (Bifunctor)", "open import Categories.Functor.Hom using (Hom[_][-,-])", "open import Categories.Functor.Construction.LiftSetoids", "open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper; _∘ₕ_; _∘ᵥ_; _∘ˡ_; _∘ʳ_)", "open import Categories.NaturalTransformation.NaturalIsomorphism", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Adjoint.agda
Adjoint
Bicategory o ℓ e t : Set (suc (o ⊔ ℓ ⊔ e ⊔ t)) where field enriched : Enriched (Product.Cats-Monoidal {o} {ℓ} {e}) t open Enriched enriched public module hom {A B} = Category (hom A B) module ComHom {A B} = Commutation (hom A B) infix 4 _⇒₁_ _⇒₂_ _≈_ infixr 7 _∘ᵥ_ _∘₁_ infixr 9 _▷_ infixl 9 _◁_ infixr 11 _⊚₀_ _⊚₁_ _∘ₕ_ _⇒₁_ : Obj → Obj → Set o A ⇒₁ B = Category.Obj (hom A B) _⇒₂_ : {A B : Obj} → A ⇒₁ B → A ⇒₁ B → Set ℓ _⇒₂_ = hom._⇒_ _⊚₀_ : {A B C : Obj} → B ⇒₁ C → A ⇒₁ B → A ⇒₁ C f ⊚₀ g = Functor.F₀ ⊚ (f , g) _⊚₁_ : {A B C : Obj} {f h : B ⇒₁ C} {g i : A ⇒₁ B} → f ⇒₂ h → g ⇒₂ i → f ⊚₀ g ⇒₂ h ⊚₀ i α ⊚₁ β = Functor.F₁ ⊚ (α , β) _≈_ : {A B : Obj} {f g : A ⇒₁ B} → Rel (f ⇒₂ g) e _≈_ = hom._≈_ id₁ : {A : Obj} → A ⇒₁ A id₁ {_} = Functor.F₀ id _ id₂ : {A B : Obj} {f : A ⇒₁ B} → f ⇒₂ f id₂ {A} {B} = Category.id (hom A B) -- 1-cell composition _∘₁_ : {A B C : Obj} → B ⇒₁ C → A ⇒₁ B → A ⇒₁ C _∘₁_ = _⊚₀_ -- horizontal composition _∘ₕ_ : {A B C : Obj} {f h : B ⇒₁ C} {g i : A ⇒₁ B} → f ⇒₂ h → g ⇒₂ i → f ⊚₀ g ⇒₂ h ⊚₀ i _∘ₕ_ = _⊚₁_ -- vertical composition _∘ᵥ_ : {A B : Obj} {f g h : A ⇒₁ B} (α : g ⇒₂ h) (β : f ⇒₂ g) → f ⇒₂ h _∘ᵥ_ = hom._∘_ _◁_ : {A B C : Obj} {g h : B ⇒₁ C} (α : g ⇒₂ h) (f : A ⇒₁ B) → g ∘₁ f ⇒₂ h ∘₁ f α ◁ _ = α ⊚₁ id₂ _▷_ : {A B C : Obj} {f g : A ⇒₁ B} (h : B ⇒₁ C) (α : f ⇒₂ g) → h ∘₁ f ⇒₂ h ∘₁ g _ ▷ α = id₂ ⊚₁ α private λ⇒ : {A B : Obj} {f : A ⇒₁ B} → id₁ ⊚₀ f hom.⇒ f λ⇒ {_} {_} {f} = NaturalIsomorphism.⇒.η unitˡ (_ , f) ρ⇒ : {A B : Obj} {f : A ⇒₁ B} → f ⊚₀ id₁ hom.⇒ f ρ⇒ {_} {_} {f} = NaturalIsomorphism.⇒.η unitʳ (f , _) α⇒ : {A B C D : Obj} {f : D ⇒₁ B} {g : C ⇒₁ D} {h : A ⇒₁ C} → ((f ⊚₀ g) ⊚₀ h) hom.⇒ (f ⊚₀ (g ⊚₀ h)) α⇒ {_} {_} {_} {_} {f} {g} {h} = NaturalIsomorphism.⇒.η ⊚-assoc ((f , g) , h) field triangle : {A B C : Obj} {f : A ⇒₁ B} {g : B ⇒₁ C} → let open ComHom {A} {C} in [ (g ∘₁ id₁) ∘₁ f ⇒ g ∘₁ f ]⟨ α⇒ ⇒⟨ g ∘₁ id₁ ∘₁ f ⟩ g ▷ λ⇒ ≈ ρ⇒ ◁ f ⟩ pentagon : {A B C D E : Obj} {f : A ⇒₁ B} {g : B ⇒₁ C} {h : C ⇒₁ D} {i : D ⇒₁ E} → let open ComHom {A} {E} in [ ((i ∘₁ h) ∘₁ g) ∘₁ f ⇒ i ∘₁ h ∘₁ g ∘₁ f ]⟨ α⇒ ◁ f ⇒⟨ (i ∘₁ h ∘₁ g) ∘₁ f ⟩ α⇒ ⇒⟨ i ∘₁ (h ∘₁ g) ∘₁ f ⟩ i ▷ α⇒ ≈ α⇒ ⇒⟨ (i ∘₁ h) ∘₁ g ∘₁ f ⟩ α⇒ ⟩
record
src
[ "open import Level", "open import Data.Product using (_,_)", "open import Relation.Binary using (Rel)", "open import Categories.Category using (Category; module Commutation)", "open import Categories.Category.Monoidal.Instance.Cats using (module Product)", "open import Categories.Enriched.Category using () renaming (Category to Enriched)", "open import Categories.Functor using (module Functor)", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)" ]
src/Categories/Bicategory.agda
Bicategory
Comonad {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where field F : Endofunctor C ε : NaturalTransformation F idF δ : NaturalTransformation F (F ∘F F) module F = Functor F module ε = NaturalTransformation ε module δ = NaturalTransformation δ open Category C open Functor F field assoc : ∀ {X : Obj} → δ.η (F₀ X) ∘ δ.η X ≈ F₁ (δ.η X) ∘ δ.η X sym-assoc : ∀ {X : Obj} → F₁ (δ.η X) ∘ δ.η X ≈ δ.η (F₀ X) ∘ δ.η X identityˡ : ∀ {X : Obj} → F₁ (ε.η X) ∘ δ.η X ≈ id identityʳ : ∀ {X : Obj} → ε.η (F₀ X) ∘ δ.η X ≈ id
record
src
[ "open import Level", "open import Categories.Category using (Category)", "open import Categories.Functor using (Functor; Endofunctor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation renaming (id to idN)", "open import Categories.NaturalTransformation.NaturalIsomorphism hiding (_≃_)", "open import Categories.NaturalTransformation.Equivalence" ]
src/Categories/Comonad.agda
Comonad
Endofunctor : Category o ℓ e → Set _
function
src
[ "open import Level", "open import Function renaming (id to id→; _∘_ to _●_) using ()", "open import Categories.Category", "open import Categories.Functor.Core public" ]
src/Categories/Functor.agda
Endofunctor
id : ∀ {C : Category o ℓ e} → Functor C C
function
src
[ "open import Level", "open import Function renaming (id to id→; _∘_ to _●_) using ()", "open import Categories.Category", "open import Categories.Functor.Core public" ]
src/Categories/Functor.agda
id
GlobularSet : (o : Level) → Set (suc o)
function
src
[ "open import Level", "open import Data.Unit using (⊤)", "open import Relation.Binary.PropositionalEquality using (refl)", "open import Categories.Category", "open import Categories.Category.Instance.Globe", "open import Categories.Category.Instance.Sets", "open import Categories.Functor", "open import Categories.Functor.Presheaf" ]
src/Categories/GlobularSet.agda
GlobularSet
Trivial : GlobularSet zero
function
src
[ "open import Level", "open import Data.Unit using (⊤)", "open import Relation.Binary.PropositionalEquality using (refl)", "open import Categories.Category", "open import Categories.Category.Instance.Globe", "open import Categories.Category.Instance.Sets", "open import Categories.Functor", "open import Categories.Functor.Presheaf" ]
src/Categories/GlobularSet.agda
Trivial
GlobularObject : Category o ℓ e → Set _
function
src
[ "open import Level", "open import Data.Unit using (⊤)", "open import Relation.Binary.PropositionalEquality using (refl)", "open import Categories.Category", "open import Categories.Category.Instance.Globe", "open import Categories.Category.Instance.Sets", "open import Categories.Functor", "open import Categories.Functor.Presheaf" ]
src/Categories/GlobularSet.agda
GlobularObject
-2-Category : Set (suc (o ⊔ ℓ ⊔ e)) where field cat : Category o ℓ e open Category cat public open M cat using (_≅_) field Obj-Contr : Σ Obj (λ x → (y : Obj) → x ≅ y) Hom-Conn : {x y : Obj} {f g : x ⇒ y} → f ≈ g
record
src
[ "open import Level", "open import Categories.Category", "open import Data.Product using (Σ)", "import Categories.Morphism as M" ]
src/Categories/Minus2-Category.agda
-2-Category
Monad {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where field F : Endofunctor C η : NaturalTransformation idF F μ : NaturalTransformation (F ∘F F) F module F = Functor F module η = NaturalTransformation η module μ = NaturalTransformation μ open Category C open F field assoc : ∀ {X : Obj} → μ.η X ∘ F₁ (μ.η X) ≈ μ.η X ∘ μ.η (F₀ X) sym-assoc : ∀ {X : Obj} → μ.η X ∘ μ.η (F₀ X) ≈ μ.η X ∘ F₁ (μ.η X) identityˡ : ∀ {X : Obj} → μ.η X ∘ F₁ (η.η X) ≈ id identityʳ : ∀ {X : Obj} → μ.η X ∘ η.η (F₀ X) ≈ id
record
src
[ "open import Level", "open import Categories.Category using (Category)", "open import Categories.Functor using (Functor; Endofunctor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation renaming (id to idN)", "open import Categories.NaturalTransformation.NaturalIsomorphism hiding (_≃_)", "open import Categories.NaturalTransformation.Equivalence" ]
src/Categories/Monad.agda
Monad
_ ↣_ (A B : Obj) : Set (o ⊔ ℓ ⊔ e) where field mor : A ⇒ B mono : Mono mor Epi : ∀ (f : A ⇒ B) → Set (o ⊔ ℓ ⊔ e) Epi {B = B} f = ∀ {C} → (g₁ g₂ : B ⇒ C) → g₁ ∘ f ≈ g₂ ∘ f → g₁ ≈ g₂ JointEpi : (I : Set) (A : I → Obj) → ((i : I) → A i ⇒ B) → Set (o ⊔ ℓ ⊔ e) JointEpi {B} I A f = ∀ {C} → (g₁ g₂ : B ⇒ C) → ((i : I) → g₁ ∘ f i ≈ g₂ ∘ f i) → g₁ ≈ g₂
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
_
_ ↠_ (A B : Obj) : Set (o ⊔ ℓ ⊔ e) where field mor : A ⇒ B epi : Epi mor _SectionOf_ : (g : B ⇒ A) (f : A ⇒ B) → Set e g SectionOf f = f ∘ g ≈ id _RetractOf_ : (g : B ⇒ A) (f : A ⇒ B) → Set e g RetractOf f = g ∘ f ≈ id
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
_
Retract (X U : Obj) : Set (ℓ ⊔ e) where field section : X ⇒ U retract : U ⇒ X is-retract : retract ∘ section ≈ id
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
Retract
Iso (from : A ⇒ B) (to : B ⇒ A) : Set e where field isoˡ : to ∘ from ≈ id isoʳ : from ∘ to ≈ id -- We often say that a morphism "is an iso" if there exists some inverse to it. -- This does buck the naming convention we use somewhat, but it lines up -- better with the literature.
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
Iso
IsIso (from : A ⇒ B) : Set (ℓ ⊔ e) where field inv : B ⇒ A iso : Iso from inv open Iso iso public infix 4 _≅_
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
IsIso
_ ≅_ (A B : Obj) : Set (ℓ ⊔ e) where field from : A ⇒ B to : B ⇒ A iso : Iso from to open Iso iso public -- don't pollute the name space too much private ≅-refl : Reflexive _≅_ ≅-refl = record { from = id ; to = id ; iso = record { isoˡ = identity² ; isoʳ = identity² } } ≅-sym : Symmetric _≅_ ≅-sym A≅B = record { from = to ; to = from ; iso = record { isoˡ = isoʳ ; isoʳ = isoˡ } } where open _≅_ A≅B ≅-trans : Transitive _≅_ ≅-trans A≅B B≅C = record { from = from B≅C ∘ from A≅B ; to = to A≅B ∘ to B≅C ; iso = record { isoˡ = begin (to A≅B ∘ to B≅C) ∘ from B≅C ∘ from A≅B ≈⟨ cancelInner (isoˡ B≅C) ⟩ to A≅B ∘ from A≅B ≈⟨ isoˡ A≅B ⟩ id ∎ ; isoʳ = begin (from B≅C ∘ from A≅B) ∘ to A≅B ∘ to B≅C ≈⟨ cancelInner (isoʳ A≅B) ⟩ from B≅C ∘ to B≅C ≈⟨ isoʳ B≅C ⟩ id ∎ } } where open _≅_ open HomReasoning open Equiv ≅-isEquivalence : IsEquivalence _≅_ ≅-isEquivalence = record { refl = ≅-refl ; sym = ≅-sym ; trans = ≅-trans } -- But make accessing it easy:
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
_
Mono : ∀ (f : A ⇒ B) → Set (o ⊔ ℓ ⊔ e)
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
Mono
JointMono : {ι : Level} (I : Set ι) (B : I → Obj) → ((i : I) → A ⇒ B i) → Set (o ⊔ ℓ ⊔ e ⊔ ι)
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
JointMono
Epi : ∀ (f : A ⇒ B) → Set (o ⊔ ℓ ⊔ e)
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
Epi
JointEpi : (I : Set) (A : I → Obj) → ((i : I) → A i ⇒ B) → Set (o ⊔ ℓ ⊔ e)
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
JointEpi
_SectionOf_ : (g : B ⇒ A) (f : A ⇒ B) → Set e
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
_SectionOf_
_RetractOf_ : (g : B ⇒ A) (f : A ⇒ B) → Set e
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary hiding (_⇒_)", "open import Categories.Morphism.Reasoning.Core 𝒞" ]
src/Categories/Morphism.agda
_RetractOf_
Pseudofunctor : Set (o ⊔ ℓ ⊔ e ⊔ t ⊔ o′ ⊔ ℓ′ ⊔ e′ ⊔ t′) where field P₀ : C.Obj → D.Obj P₁ : {x y : C.Obj} → Functor (C.hom x y) (D.hom (P₀ x) (P₀ y)) -- For maximal generality, shift the levels of One. P preserves id P-identity : {A : C.Obj} → D.id {P₀ A} ∘F shift o′ ℓ′ e′ ≃ P₁ ∘F (C.id {A}) -- P preserves composition P-homomorphism : {x y z : C.Obj} → D.⊚ ∘F (P₁ ⁂ P₁) ≃ P₁ ∘F C.⊚ {x} {y} {z} -- P preserves ≃ module P₁ {x} {y} = Functor (P₁ {x} {y}) module unitˡ {A} = NaturalTransformation (F⇒G (P-identity {A})) module unitʳ {A} = NaturalTransformation (F⇐G (P-identity {A})) module Hom {x} {y} {z} = NaturalTransformation (F⇒G (P-homomorphism {x} {y} {z})) -- For notational convenience, shorten some functor applications private F₀ = λ {x y} f → Functor.F₀ (P₁ {x} {y}) f F₁ = λ {x y f g} α → Functor.F₁ (P₁ {x} {y}) {f} {g} α Pid = λ {A} → NaturalTransformation.η (F⇒G (P-identity {A})) _ Phom = λ {x} {y} {z} f,g → NaturalTransformation.η (F⇒G (P-homomorphism {x} {y} {z})) f,g field unitaryˡ : {x y : C.Obj} → let open ComHom D in {f : Obj (C.hom x y)} → [ D.id₁ D.⊚₀ F₀ f ⇒ F₀ f ]⟨ Pid D.⊚₁ D.id₂ ⇒⟨ F₀ C.id₁ D.⊚₀ F₀ f ⟩ Phom (C.id₁ , f) ⇒⟨ F₀ (C.id₁ C.⊚₀ f) ⟩ F₁ C.unitorˡ.from ≈ D.unitorˡ.from ⟩ unitaryʳ : {x y : C.Obj} → let open ComHom D in {f : Obj (C.hom x y)} → [ F₀ f D.⊚₀ D.id₁ ⇒ F₀ f ]⟨ D.id₂ D.⊚₁ Pid ⇒⟨ F₀ f D.⊚₀ F₀ C.id₁ ⟩ Phom (f , C.id₁) ⇒⟨ F₀ (f C.⊚₀ C.id₁) ⟩ F₁ C.unitorʳ.from ≈ D.unitorʳ.from ⟩ assoc : {x y z w : C.Obj} → let open ComHom D in {f : Obj (C.hom x y)} {g : Obj (C.hom y z)} {h : Obj (C.hom z w)} → [ (F₀ h D.⊚₀ F₀ g) D.⊚₀ F₀ f ⇒ F₀ (h C.⊚₀ (g C.⊚₀ f)) ]⟨ Phom (h , g) D.⊚₁ D.id₂ ⇒⟨ F₀ (h C.⊚₀ g) D.⊚₀ F₀ f ⟩ Phom (_ , f) ⇒⟨ F₀ ((h C.⊚₀ g) C.⊚₀ f) ⟩ F₁ C.associator.from ≈ D.associator.from ⇒⟨ F₀ h D.⊚₀ (F₀ g D.⊚₀ F₀ f) ⟩ D.id₂ D.⊚₁ Phom (g , f) ⇒⟨ F₀ h D.⊚₀ F₀ (g C.⊚₀ f) ⟩ Phom (h , _) ⟩ -- Useful shorthands ₀ = P₀ module ₁ = P₁
record
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Level", "open import Data.Product using (_,_)", "import Categories.Bicategory.Extras as BicategoryExtras", "open import Categories.Category using (Category; _[_,_]; module Commutation)", "open import Categories.Category.Instance.One using (shift)", "open import Categories.Category.Product using (_⁂_)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation using (NaturalTransformation)", "open import Categories.NaturalTransformation.NaturalIsomorphism" ]
src/Categories/Pseudofunctor.agda
Pseudofunctor
Quiver o ℓ e : Set (suc (o ⊔ ℓ ⊔ e)) where infix 4 _≈_ _⇒_ field Obj : Set o _⇒_ : Rel Obj ℓ _≈_ : ∀ {A B} → Rel (A ⇒ B) e equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B}) setoid : {A B : Obj} → Setoid _ _ setoid {A} {B} = record { Carrier = A ⇒ B ; _≈_ = _≈_ ; isEquivalence = equiv } module Equiv {A B : Obj} = IsEquivalence (equiv {A} {B}) module EdgeReasoning {A B : Obj} = EqR (setoid {A} {B})
record
src
[ "open import Level", "open import Relation.Binary using (Rel; IsEquivalence; Setoid)", "import Relation.Binary.Reasoning.Setoid as EqR" ]
src/Data/Quiver.agda
Quiver
refl : ⊣Equivalence C C
function
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Adjoint.TwoSided", "open import Categories.Adjoint.TwoSided.Compose", "open import Categories.Category.Core using (Category)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃ using (_≃_)", "open import Relation.Binary using (Setoid; IsEquivalence)" ]
src/Categories/Adjoint/Equivalence.agda
refl
sym : ⊣Equivalence C D → ⊣Equivalence D C
function
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Adjoint.TwoSided", "open import Categories.Adjoint.TwoSided.Compose", "open import Categories.Category.Core using (Category)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃ using (_≃_)", "open import Relation.Binary using (Setoid; IsEquivalence)" ]
src/Categories/Adjoint/Equivalence.agda
sym
trans : ⊣Equivalence C D → ⊣Equivalence D E → ⊣Equivalence C E
function
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Adjoint.TwoSided", "open import Categories.Adjoint.TwoSided.Compose", "open import Categories.Category.Core using (Category)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃ using (_≃_)", "open import Relation.Binary using (Setoid; IsEquivalence)" ]
src/Categories/Adjoint/Equivalence.agda
trans
isEquivalence : ∀ {o ℓ e} → IsEquivalence (⊣Equivalence {o} {ℓ} {e})
function
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Adjoint.TwoSided", "open import Categories.Adjoint.TwoSided.Compose", "open import Categories.Category.Core using (Category)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃ using (_≃_)", "open import Relation.Binary using (Setoid; IsEquivalence)" ]
src/Categories/Adjoint/Equivalence.agda
isEquivalence
setoid : ∀ o ℓ e → Setoid _ _
function
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Adjoint.TwoSided", "open import Categories.Adjoint.TwoSided.Compose", "open import Categories.Category.Core using (Category)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃ using (_≃_)", "open import Relation.Binary using (Setoid; IsEquivalence)" ]
src/Categories/Adjoint/Equivalence.agda
setoid
Mate {L : Functor C D} (L⊣R : L ⊣ R) (L′⊣R′ : L′ ⊣ R′) (α : NaturalTransformation L L′) (β : NaturalTransformation R′ R) : Set (levelOfTerm L⊣R ⊔ levelOfTerm L′⊣R′) where private module L⊣R = Adjoint L⊣R module L′⊣R′ = Adjoint L′⊣R′ module C = Category C module D = Category D field commute₁ : (R ∘ˡ α) ∘ᵥ L⊣R.unit ≃ (β ∘ʳ L′) ∘ᵥ L′⊣R′.unit commute₂ : L⊣R.counit ∘ᵥ L ∘ˡ β ≃ L′⊣R′.counit ∘ᵥ (α ∘ʳ R′) -- there are two equivalent commutative diagram open NaturalTransformation renaming (commute to η-commute) open Functor module _ where open D open HomReasoning open MR D commute₃ : ∀ {X} → L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (η β (F₀ L′ X)) ∘ F₁ L (L′⊣R′.unit.η X) ≈ η α X commute₃ {X} = begin L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (η β (F₀ L′ X)) ∘ F₁ L (L′⊣R′.unit.η X) ≈˘⟨ refl⟩∘⟨ homomorphism L ⟩ L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (η β (F₀ L′ X) C.∘ L′⊣R′.unit.η X) ≈˘⟨ refl⟩∘⟨ F-resp-≈ L commute₁ ⟩ L⊣R.counit.η (F₀ L′ X) ∘ F₁ L (F₁ R (η α X) C.∘ L⊣R.unit.η X) ≈⟨ L⊣R.RLadjunct≈id ⟩ η α X ∎ module _ where open C open HomReasoning open MR C commute₄ : ∀ {X} → F₁ R (L′⊣R′.counit.η X) ∘ F₁ R (η α (F₀ R′ X)) ∘ L⊣R.unit.η (F₀ R′ X) ≈ η β X commute₄ {X} = begin F₁ R (L′⊣R′.counit.η X) ∘ F₁ R (η α (F₀ R′ X)) ∘ L⊣R.unit.η (F₀ R′ X) ≈˘⟨ pushˡ (homomorphism R) ⟩ F₁ R (L′⊣R′.counit.η X D.∘ η α (F₀ R′ X)) ∘ L⊣R.unit.η (F₀ R′ X) ≈˘⟨ F-resp-≈ R commute₂ ⟩∘⟨refl ⟩ F₁ R (L⊣R.counit.η X D.∘ F₁ L (η β X)) ∘ L⊣R.unit.η (F₀ R′ X) ≈⟨ L⊣R.LRadjunct≈id ⟩ η β X ∎
record
src
[ "open import Level", "open import Data.Product using (Σ; _,_)", "open import Function.Bundles using (Func; _⟨$⟩_)", "open import Function.Construct.Composition using (function)", "open import Function.Construct.Setoid using () renaming (setoid to _⇨_)", "open import Relation.Binary using (Setoid; IsEquivalence)", "open import Categories.Category", "open import Categories.Category.Instance.Setoids", "open import Categories.Functor", "open import Categories.Functor.Hom", "open import Categories.NaturalTransformation renaming (id to idN)", "open import Categories.NaturalTransformation.Equivalence using (_≃_)", "open import Categories.Adjoint", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Adjoint/Mate.agda
Mate
HaveMate {L L′ : Functor C D} {R R′ : Functor D C} (L⊣R : L ⊣ R) (L′⊣R′ : L′ ⊣ R′) : Set (levelOfTerm L⊣R ⊔ levelOfTerm L′⊣R′) where field α : NaturalTransformation L L′ β : NaturalTransformation R′ R mate : Mate L⊣R L′⊣R′ α β module α = NaturalTransformation α module β = NaturalTransformation β open Mate mate public -- show that the commutative diagram implies natural isomorphism between homsetoids. -- the problem is that two homsetoids live in two universe level, in a situation similar to the definition -- of adjoint via naturally isomorphic homsetoids.
record
src
[ "open import Level", "open import Data.Product using (Σ; _,_)", "open import Function.Bundles using (Func; _⟨$⟩_)", "open import Function.Construct.Composition using (function)", "open import Function.Construct.Setoid using () renaming (setoid to _⇨_)", "open import Relation.Binary using (Setoid; IsEquivalence)", "open import Categories.Category", "open import Categories.Category.Instance.Setoids", "open import Categories.Functor", "open import Categories.Functor.Hom", "open import Categories.NaturalTransformation renaming (id to idN)", "open import Categories.NaturalTransformation.Equivalence using (_≃_)", "open import Categories.Adjoint", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Adjoint/Mate.agda
HaveMate
IsMonadicAdjunction {L : Functor 𝒞 𝒟} {R : Functor 𝒟 𝒞} (adjoint : L ⊣ R) : Set (levelOfTerm 𝒞 ⊔ levelOfTerm 𝒟) where private T : Monad 𝒞 T = adjoint⇒monad adjoint field Comparison⁻¹ : Functor (EilenbergMoore T) 𝒟 comparison-equiv : WeakInverse (ComparisonF adjoint) Comparison⁻¹
record
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Adjoint.Properties", "open import Categories.Category", "open import Categories.Category.Equivalence", "open import Categories.Functor", "open import Categories.Monad", "open import Categories.Category.Construction.EilenbergMoore", "open import Categories.Category.Construction.Properties.EilenbergMoore" ]
src/Categories/Adjoint/Monadic.agda
IsMonadicAdjunction
ParametricAdjoint {C D E : Category o ℓ e} (L : Functor C (Functors D E)) (R : Functor (Category.op C) (Functors E D)) : Set (o ⊔ ℓ ⊔ e) where private module C = Category C module D = Category D module E = Category E module L = Functor L module R = Functor R -- use double letters whenever we refer to the two-parameters version of the functor module RR A = Functor (R.₀ A) module LL A = Functor (L.₀ A) field areAdjoint : ∀ A → Adjoint (L.₀ A) (R.₀ A) module A c = Adjoint (areAdjoint c) {- We seem to need a field ensuring that the adjunction L c ⊣ R c is natural in (c : C), which means that the square hom(L(c , x) , y) ----------------→ hom(x , R(c , y)) ↑ ↑ | | | | | | hom(L(c' , x) , y) ---------------→ hom(x , R(c' , y)) is commutative; unfolding the definitions, it seems that proving this exactly amounts to show that the *unit* η c of the adjunction is a *wedge*. Viceversa, one also needs this naturality when proving that the cowedge condition holds, so they seem to be logically equivalent. Mac Lane (IV.7.Thm 3) seems to claim, however, that this condition needs not to be assumed and can be derived from a better definition of parametric adjunction that we are not currently able to devise. More info at: https://math.stackexchange.com/questions/4581092/parametric-adjunctions-induce-cowedges-a-real-proof -} field param-nat : ∀ {c c' x y} {f : c C.⇒ c'} {u : LL.₀ c' x E.⇒ y} → RR.₁ c u D.∘ RR.₁ c (η (L.₁ f) x) D.∘ η (A.unit c) x D.≈ η (R.₁ f) y D.∘ RR.₁ c' u D.∘ η (A.unit c') x -- Every parametric adjunction Lc ⊣ Rc defines a bifunctor L(-,R(-,x)) : Cᵒ x C → E PABifunctor : {X : E.Obj} → Bifunctor C.op C E PABifunctor {X} = record { F₀ = λ { (c , c') → LL.₀ c' (RR.₀ c X)} ; F₁ = λ { {a , a'} {b , b'} (f , f') → η (L.₁ f') (RR.₀ b X) E.∘ LL.₁ a' (η (R.₁ f) X)} ; identity = λ { {a , a'} → begin _ ≈⟨ L.identity ⟩∘⟨ LL.F-resp-≈ a' R.identity ⟩ _ ≈⟨ refl⟩∘⟨ LL.identity a' ⟩ _ ≈⟨ E.identity² ⟩ _ ∎ } ; homomorphism = λ { {a , a'} {b , b'} → begin _ ≈⟨ pushˡ L.homomorphism ⟩ _ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ LL.F-resp-≈ a' R.homomorphism ⟩ _ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ LL.homomorphism a' ⟩ _ ≈⟨ refl⟩∘⟨ pullˡ (commute (L.₁ _) _) ⟩ _ ≈⟨ MR.assoc²δγ E ⟩ _ ∎ } ; F-resp-≈ = λ { {a , a'} {b , b'} {f} {g} (f≈g , f'≈g') → L.F-resp-≈ f'≈g' ⟩∘⟨ Functor.F-resp-≈ (L.₀ a') (R.F-resp-≈ f≈g)} } where open E.HomReasoning open MR E -- this is the main theorem of the module: a parametric adjunction Lc ⊣ Rc has a -- counit ε[c,x] : L(c,R(c,x)) → x; this map is a cowedge in c. counitCowedge : ∀ {A : Category.Obj E} → Cowedge {C = C} {D = E} (PABifunctor {A}) counitCowedge {A} = record { E = A ; dinatural = dtHelper record { α = λ c → A.counit.η c A ; commute = λ {X} {Y} f → comm′ {X} {Y} f } } where open Adjoint adjunction-isoˡ : ∀ {X Y} (f : X C.⇒ Y) → A.Ladjunct X (A.counit.η X A E.∘ LL.₁ X (η (R.₁ f) A)) D.≈ η (R.₁ f) A adjunction-isoˡ {X} {Y} f = LRadjunct≈id (areAdjoint X) -- note how the part inside the Ladjunct is not Radjunct adjunction-isoʳ : ∀ {X Y} (f : X C.⇒ Y) → A.Ladjunct X (A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A)) D.≈ η (R.₁ f) A adjunction-isoʳ {X} {Y} f = begin A.Ladjunct X (A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A)) ≈⟨ D.Equiv.refl ⟩ F₁ (R.₀ X) (A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A)) D.∘ A.unit.η X (RR.₀ Y A) ≈⟨ pushˡ (homomorphism (R.₀ X)) ⟩ F₁ (R.₀ X) (A.counit.η Y A) D.∘ F₁ (R.₀ X) (η (L.₁ f) (RR.₀ Y A)) D.∘ A.unit.η X (RR.₀ Y A) ≈⟨ param-nat ⟩ η (R.₁ f) _ D.∘ F₁ (R.₀ Y) (A.counit.η Y A) D.∘ A.unit.η Y (RR.₀ Y A) ≈⟨ (refl⟩∘⟨ zag (areAdjoint Y)) ⟩ η (R.₁ f) _ D.∘ D.id ≈⟨ D.identityʳ ⟩ η (R.₁ f) A ∎ where open D.HomReasoning open MR D adjunction-iso : ∀ {X Y} (f : X C.⇒ Y) → A.Ladjunct X (A.Radjunct X (η (R.₁ f) A)) D.≈ A.Ladjunct X (A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A)) adjunction-iso {X} {Y} f = adjunction-isoˡ f ○ ⟺ (adjunction-isoʳ f) where open D.HomReasoning is-cowedge : ∀ {X Y} (f : X C.⇒ Y) → A.Radjunct X (η (R.₁ f) A) E.≈ A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A) is-cowedge {X} {Y} f = Injection.injective (Inverse⇒Injection (Hom-inverse (areAdjoint X) (RR.₀ Y A) A)) (adjunction-iso f) -- the dinat needed is DinaturalTransformation F (const E) -- where F = PABifunctor {A} and E is A and G = const E -- here we inline the definitions comm′ : {X Y : C.Obj} (f : X C.⇒ Y) → E.id {A} E.∘ A.counit.η X A E.∘ (F₁ (PABifunctor {A}) (f , C.id)) E.≈ E.id {A} E.∘ A.counit.η Y A E.∘ F₁ (PABifunctor {A}) (C.id , f) comm′ {X} {Y} f = begin E.id {A} E.∘ A.counit.η X A E.∘ (F₁ (PABifunctor {A}) (f , C.id)) ≈⟨ (refl⟩∘⟨ refl⟩∘⟨ elimˡ L.identity) ⟩ E.id {A} E.∘ A.Radjunct X (η (R.₁ f) A) ≈⟨ (refl⟩∘⟨ is-cowedge f) ⟩ E.id {A} E.∘ A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A) ≈⟨ (refl⟩∘⟨ refl⟩∘⟨ introʳ (identity (L.₀ X))) ⟩ E.id {A} E.∘ A.counit.η Y A E.∘ η (L.₁ f) (RR.₀ Y A) E.∘ F₁ (L.₀ X) D.id ≈⟨ (refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ F-resp-≈ (L.₀ X) (D.Equiv.sym R.identity)) ⟩ E.id {A} E.∘ A.counit.η Y A E.∘ F₁ (PABifunctor {A}) (C.id , f) ∎ where open E.HomReasoning open MR E
record
src
[ "open import Level", "open import Data.Product using (_×_; _,_)", "open import Function.Bundles using (Injection; Inverse)", "open import Function.Properties.Inverse using (Inverse⇒Injection)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.Adjoint using (Adjoint)", "open import Categories.Category.Construction.Functors using (Functors)", "open import Categories.Diagram.Cowedge using (Cowedge)", "open import Categories.NaturalTransformation.Dinatural using (dtHelper)", "open import Categories.Functor.Bifunctor using (Bifunctor)", "import Categories.NaturalTransformation", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Adjoint/Parametric.agda
ParametricAdjoint
ra-preserves-diagram : {L : Functor J K} {R : Functor K J} (L⊣R : L ⊣ R) {F : Functor J C} → Colimit F → Colimit (F ∘F R)
function
src
[ "open import Level", "open import Data.Product using (Σ; _,_; -,_; proj₂; uncurry)", "open import Function.Base using (_$_)", "open import Categories.Adjoint using (_⊣_; Adjoint)", "open import Categories.Adjoint.Equivalents using (Hom-NI′⇒Adjoint)", "open import Categories.Adjoint.RAPL using (rapl)", "open import Categories.Category using (Category; _[_,_]; _[_≈_]; _[_∘_])", "open import Categories.Category.Product using (_⁂_; _⁂ⁿⁱ_)", "open import Categories.Category.Construction.Comma using (CommaObj; Comma⇒; _↙_)", "open import Categories.Diagram.Cone using (Cone; Cone⇒)", "open import Categories.Diagram.Cone.Properties using (F-map-Coneʳ)", "open import Categories.Diagram.Limit using (Limit)", "open import Categories.Diagram.Colimit using (Colimit)", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.Functor.Hom using (Hom[_][-,-])", "open import Categories.Functor.Construction.Constant using (const!)", "open import Categories.Functor.Construction.LiftSetoids using (LiftSetoids)", "open import Categories.Functor.Properties using ([_]-resp-square; [_]-resp-inverse)", "open import Categories.Functor.Limits using (Continuous; Cocontinuous)", "open import Categories.Functor.Bifunctor using (Bifunctor; appʳ; appˡ)", "open import Categories.Functor.Bifunctor.Properties using ([_]-decompose₁; [_]-decompose₂; [_]-commute)", "open import Categories.NaturalTransformation using (NaturalTransformation; _∘ˡ_; _∘ʳ_; ntHelper)", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism; _≃_; _ⓘₕ_; _ⓘˡ_; module ≃)", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (unlift-≃)", "open import Categories.Monad using (Monad)", "open import Categories.Monad.Duality using (coMonad⇒Comonad)", "open import Categories.Comonad using (Comonad)", "open import Categories.Morphism.Universal using (UniversalMorphism)", "import Categories.Yoneda.Properties as YP using (yoneda-NI)", "import Categories.Diagram.Duality as Duality using (coLimit⇒Colimit; Colimit⇒coLimit)", "import Categories.Morphism.Reasoning as MR using (pushʳ; pullˡ; pushˡ; elimʳ; center; center⁻¹;" ]
src/Categories/Adjoint/Properties.agda
ra-preserves-diagram
RelativeAdjoint {C : Category o ℓ e} (D : Category o ℓ e) (J : Functor E C) : Set (levelOfTerm D ⊔ levelOfTerm J) where field L : Functor E D R : Functor D C private module C = Category C module D = Category D module E = Category E module L = Functor L module R = Functor R module J = Functor J Hom[L-,-] : Bifunctor E.op D (Setoids _ _) Hom[L-,-] = Hom[ D ][-,-] ∘F (L.op ⁂ idF) Hom[J-,R-] : Bifunctor E.op D (Setoids _ _) Hom[J-,R-] = Hom[ C ][-,-] ∘F (J.op ⁂ R) module Hom[L-,-] = Functor Hom[L-,-] module Hom[J-,R-] = Functor Hom[J-,R-] field Hom-NI : NaturalIsomorphism Hom[J-,R-] Hom[L-,-] RA⇒RMonad : {C D : Category o ℓ e} {E : Category o′ ℓ′ e′} {J : Functor E C} → RelativeAdjoint D J → RMonad J RA⇒RMonad {C = C} {D} {E} {J} RA = record { F₀ = F₀ (R ∘F L) ; unit = λ {c} → ⇐.η (c , F₀ L c) ⟨$⟩ D.id {F₀ L c} ; extend = λ {X} {Y} k → F₁ R (⇒.η (X , F₀ L Y) ⟨$⟩ k) ; identityʳ = idʳ ; identityˡ = R.F-resp-≈ (iso.isoʳ _) ○ R.identity ; assoc = a ; sym-assoc = sym a ; extend-≈ = λ k≈h → F-resp-≈ R (Func.cong (⇒.η _) k≈h) } where open RelativeAdjoint RA open Functor open NaturalIsomorphism Hom-NI module D = Category D module E = Category E module J = Functor J module L = Functor L module R = Functor R open Category C open HomReasoning open MR C open Equiv using (sym) idʳ : {x y : E.Obj} {k : J.₀ x ⇒ F₀ (R ∘F L) y} → R.₁ (⇒.η (x , L.₀ y) ⟨$⟩ k) ∘ (⇐.η (x , L.₀ x) ⟨$⟩ D.id) ≈ k idʳ {x} {y} {k} = begin R.₁ (⇒.η (x , L.₀ y) ⟨$⟩ k) ∘ (⇐.η (x , L.₀ x) ⟨$⟩ D.id) ≈⟨ introʳ J.identity ⟩ (R.₁ (⇒.η (x , L.₀ y) ⟨$⟩ k) ∘ (⇐.η (x , L.₀ x) ⟨$⟩ D.id)) ∘ J.₁ E.id ≈⟨ assoc ⟩ R.₁ (⇒.η (x , L.₀ y) ⟨$⟩ k) ∘ (⇐.η (x , L.₀ x) ⟨$⟩ D.id) ∘ J.₁ E.id ≈⟨ ⇐.sym-commute (E.id , ⇒.η (x , L.₀ y) ⟨$⟩ k) ⟩ ⇐.η (x , L.₀ y) ⟨$⟩ ((⇒.η (x , L.₀ y) ⟨$⟩ k) D.∘ D.id D.∘ L.F₁ E.id) ≈⟨ Func.cong (⇐.η _) (MR.elimʳ D (MR.elimʳ D L.identity)) ⟩ ⇐.η (x , L.₀ y) ⟨$⟩ (⇒.η (x , L.₀ y) ⟨$⟩ k) ≈⟨ iso.isoˡ (x , _) ⟩ k ∎ a : {x y z : E.Obj} {k : J.₀ x ⇒ R.₀ (L.₀ y)} {l : J.₀ y ⇒ R.₀ (L.₀ z)} → R.₁ (⇒.η (x , L.₀ z) ⟨$⟩ R.₁ (⇒.η (y , L.₀ z) ⟨$⟩ l) ∘ k) ≈ R.₁ (⇒.η (y , L.₀ z) ⟨$⟩ l) ∘ R.₁ (⇒.η (x , L.₀ y) ⟨$⟩ k) a {x} {y} {z} {k} {l} = begin R.₁ (⇒.η (x , L.₀ z) ⟨$⟩ (R.₁ (⇒.η (y , L.₀ z) ⟨$⟩ l) ∘ k)) ≈⟨ R.F-resp-≈ lemma ⟩ R.₁ ((⇒.η (y , L.₀ z) ⟨$⟩ l) D.∘ (⇒.η (x , L.₀ y) ⟨$⟩ k)) ≈⟨ R.homomorphism ⟩ R.₁ (⇒.η (y , L.₀ z) ⟨$⟩ l) ∘ R.₁ (⇒.η (x , L.₀ y) ⟨$⟩ k) ∎ where xz = (x , L.₀ z) yz = (y , L.₀ z) xy = (x , L.₀ y) module DR = D.HomReasoning lemma : ⇒.η xz ⟨$⟩ R.₁ (⇒.η yz ⟨$⟩ l) ∘ k D.≈ (⇒.η yz ⟨$⟩ l) D.∘ (⇒.η xy ⟨$⟩ k) lemma = DR.begin ⇒.η xz ⟨$⟩ R.₁ (⇒.η yz ⟨$⟩ l) ∘ k DR.≈⟨ Func.cong (⇒.η xz) (refl⟩∘⟨ introʳ J.identity ) ⟩ ⇒.η xz ⟨$⟩ R.₁ (⇒.η yz ⟨$⟩ l) ∘ (k ∘ J.₁ E.id) DR.≈⟨ ⇒.commute (E.id , ⇒.η yz ⟨$⟩ l) ⟩ (⇒.η yz ⟨$⟩ l) D.∘ (⇒.η xy ⟨$⟩ k) D.∘ L.₁ E.id DR.≈⟨ D.sym-assoc ⟩ ((⇒.η yz ⟨$⟩ l) D.∘ (⇒.η xy ⟨$⟩ k)) D.∘ L.₁ E.id DR.≈⟨ MR.elimʳ D L.identity ⟩ (⇒.η yz ⟨$⟩ l) D.∘ (⇒.η xy ⟨$⟩ k) DR.∎ ⊣⇒RAdjoint : {C D : Category o ℓ e} {E : Category o′ ℓ′ e′} (L : Functor C D) (R : Functor D C) (J : Functor E C) → L ⊣ R → RelativeAdjoint D J ⊣⇒RAdjoint {C = C} {D} L R J A = record { L = L ∘F J ; R = R ; Hom-NI = record { F⇒G = ntHelper record { η = λ _ → record { to = Radjunct ; cong = ∘-resp-≈ʳ ∙ L.F-resp-≈ } ; commute = λ _ → Radjunct-comm C.Equiv.refl } ; F⇐G = ntHelper record { η = λ _ → record { to = Ladjunct ; cong = C.∘-resp-≈ˡ ∙ R.F-resp-≈ } ; commute = λ _ → Ladjunct-comm Equiv.refl } ; iso = λ X → record { isoˡ = LRadjunct≈id ; isoʳ = RLadjunct≈id } } } where open Adjoint A open Category D module C = Category C module L = Functor L module R = Functor R module J = Functor J open C.HomReasoning
record
src
[ "open import Level", "open import Data.Product using (_,_; _×_)", "open import Function using (_$_) renaming (_∘_ to _∙_)", "open import Function.Bundles using (Func; _⟨$⟩_)", "open import Relation.Binary using (Setoid)", "open import Categories.Adjoint", "open import Categories.Category.Core using (Category)", "open import Categories.Category.Product using (Product; _⁂_)", "open import Categories.Category.Instance.Setoids", "open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)", "open import Categories.Functor.Bifunctor using (Bifunctor)", "open import Categories.Functor.Hom using (Hom[_][-,-])", "open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper)", "open import Categories.NaturalTransformation.NaturalIsomorphism", "import Categories.Morphism.Reasoning as MR", "open import Categories.Monad.Relative renaming (Monad to RMonad)" ]
src/Categories/Adjoint/Relative.agda
RelativeAdjoint
_ ⊣⊢_ (L : Functor C D) (R : Functor D C) : Set (levelOfTerm L ⊔ levelOfTerm R) where field unit : idF ≃ (R ∘F L) counit : (L ∘F R) ≃ idF module unit = NaturalIsomorphism unit module counit = NaturalIsomorphism counit private module C = Category C using (Obj; id; _∘_; _≈_; module HomReasoning) module D = Category D using (Obj; id; _∘_; _≈_; module HomReasoning) module L = Functor L using (₀; ₁; op; identity) module R = Functor R using (₀; ₁; op; identity) field zig : ∀ {A : C.Obj} → counit.⇒.η (L.₀ A) D.∘ L.₁ (unit.⇒.η A) D.≈ D.id zag : ∀ {B : D.Obj} → R.₁ (counit.⇒.η B) C.∘ unit.⇒.η (R.₀ B) C.≈ C.id op₁ : R.op ⊣⊢ L.op op₁ = record { unit = counit.op ; counit = unit.op ; zig = zag ; zag = zig } zag⁻¹ : {B : D.Obj} → unit.⇐.η (R.₀ B) C.∘ R.₁ (counit.⇐.η B) C.≈ C.id zag⁻¹ {B} = begin unit.⇐.η (R.₀ B) C.∘ R.₁ (counit.⇐.η B) ≈˘⟨ flip-fromʳ unit.FX≅GX zag ⟩∘⟨refl ⟩ R.₁ (counit.⇒.η B) C.∘ R.₁ (counit.⇐.η B) ≈⟨ [ R ]-resp-inverse (counit.iso.isoʳ B) ⟩ C.id ∎ where open C.HomReasoning open MR C zig⁻¹ : {A : C.Obj} → L.₁ (unit.⇐.η A) D.∘ counit.⇐.η (L.₀ A) D.≈ D.id zig⁻¹ {A} = begin L.₁ (unit.⇐.η A) D.∘ counit.⇐.η (L.₀ A) ≈˘⟨ refl⟩∘⟨ flip-fromˡ counit.FX≅GX zig ⟩ L.₁ (unit.⇐.η A) D.∘ L.₁ (unit.⇒.η A) ≈⟨ [ L ]-resp-inverse (unit.iso.isoˡ A) ⟩ D.id ∎ where open D.HomReasoning open MR D op₂ : R ⊣⊢ L op₂ = record { unit = ≃.sym counit ; counit = ≃.sym unit ; zig = zag⁻¹ ; zag = zig⁻¹ } L⊣R : L ⊣ R L⊣R = record { unit = unit.F⇒G ; counit = counit.F⇒G ; zig = zig ; zag = zag } module L⊣R = Adjoint L⊣R open L⊣R hiding (unit; counit; zig; zag; op) public R⊣L : R ⊣ L R⊣L = record { unit = counit.F⇐G ; counit = unit.F⇐G ; zig = zag⁻¹ ; zag = zig⁻¹ } module R⊣L = Adjoint R⊣L private record WithZig (L : Functor C D) (R : Functor D C) : Set (levelOfTerm L ⊔ levelOfTerm R) where field unit : idF ≃ (R ∘F L) counit : (L ∘F R) ≃ idF private module unit = NaturalIsomorphism unit module counit = NaturalIsomorphism counit module C = Category C using (Obj; id; _∘_; _≈_; module HomReasoning) module D = Category D using (Obj; id; _∘_; _≈_; module HomReasoning) module L = Functor L using (₀; ₁; op; identity) module R = Functor R using (₀; ₁; op; identity; F-resp-≈) field zig : ∀ {A : C.Obj} → counit.⇒.η (L.₀ A) D.∘ L.₁ (unit.⇒.η A) D.≈ D.id zag : ∀ {B : D.Obj} → R.₁ (counit.⇒.η B) C.∘ unit.⇒.η (R.₀ B) C.≈ C.id zag {B} = F≃id⇒id (≃.sym unit) helper where open C open HomReasoning helper : R.₁ (L.₁ (R.₁ (counit.⇒.η B) ∘ unit.⇒.η (R.₀ B))) ≈ id helper = begin R.₁ (L.₁ (R.₁ (counit.⇒.η B) ∘ unit.⇒.η (R.₀ B))) ≈⟨ Functor.homomorphism (R ∘F L) ⟩ R.₁ (L.₁ (R.₁ (counit.⇒.η B))) ∘ R.₁ (L.₁ (unit.⇒.η (R.₀ B))) ≈˘⟨ R.F-resp-≈ (F≃id-comm₁ counit) ⟩∘⟨refl ⟩ R.₁ (counit.⇒.η (L.₀ (R.₀ B))) ∘ R.₁ (L.₁ (unit.⇒.η (R.₀ B))) ≈⟨ [ R ]-resp-inverse zig ⟩ id ∎ record WithZag (L : Functor C D) (R : Functor D C) : Set (levelOfTerm L ⊔ levelOfTerm R) where field unit : idF ≃ (R ∘F L) counit : (L ∘F R) ≃ idF private module unit = NaturalIsomorphism unit module counit = NaturalIsomorphism counit module C = Category C using (Obj; id; _∘_; _≈_; module HomReasoning) module D = Category D using (Obj; id; _∘_; _≈_; module HomReasoning) module L = Functor L using (₀; ₁; op; identity; F-resp-≈) module R = Functor R using (₀; ₁; op; identity) field zag : ∀ {B : D.Obj} → R.₁ (counit.⇒.η B) C.∘ unit.⇒.η (R.₀ B) C.≈ C.id zig : ∀ {A : C.Obj} → counit.⇒.η (L.₀ A) D.∘ L.₁ (unit.⇒.η A) D.≈ D.id zig {A} = F≃id⇒id counit helper where open D open HomReasoning helper : L.₁ (R.₁ (counit.⇒.η (L.₀ A) ∘ L.₁ (unit.⇒.η A))) ≈ id helper = begin L.₁ (R.₁ (counit.⇒.η (L.₀ A) ∘ L.₁ (unit.⇒.η A))) ≈⟨ Functor.homomorphism (L ∘F R) ⟩ (L.₁ (R.₁ (counit.⇒.η (L.₀ A))) ∘ L.₁ (R.₁ (L.₁ (unit.⇒.η A)))) ≈˘⟨ refl⟩∘⟨ L.F-resp-≈ (F≃id-comm₂ (≃.sym unit)) ⟩ L.₁ (R.₁ (counit.⇒.η (L.₀ A))) ∘ L.₁ (unit.⇒.η (R.₀ (L.₀ A))) ≈⟨ [ L ]-resp-inverse zag ⟩ id ∎
record
src
[ "open import Level", "open import Categories.Adjoint", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Properties", "open import Categories.NaturalTransformation using (ntHelper)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃ using (_≃_; NaturalIsomorphism)", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Adjoint/TwoSided.agda
_
IsBigroupoid {o ℓ e t} (C : Bicategory o ℓ e t) : Set (o ⊔ ℓ ⊔ e ⊔ t) where open BicategoryExtras C open Shorthands field hom-isGroupoid : ∀ A B → IsGroupoid (hom A B) hom[_,_]⁻¹ : ∀ A B → Functor (hom A B) (hom B A) cancel : ∀ A B → ⊚ ∘F (hom[ A , B ]⁻¹ ※ idF) ≃ const id₁ cancel′ : ∀ A B → ⊚ ∘F (idF ※ hom[ A , B ]⁻¹) ≃ const id₁ module hom⁻¹ {A B} = Functor (hom[ A , B ]⁻¹) module cancel {A B} = NaturalIsomorphism (cancel A B) module cancel′ {A B} = NaturalIsomorphism (cancel′ A B) infix 13 _⁻¹ _⁻¹′ _⁻¹ : ∀ {A B} → A ⇒₁ B → B ⇒₁ A _⁻¹ = hom⁻¹.F₀ _⁻¹′ : ∀ {A B} {f g : A ⇒₁ B} → f ⇒₂ g → f ⁻¹ ⇒₂ g ⁻¹ _⁻¹′ = hom⁻¹.F₁ field pentagon₁ : ∀ {A B} {f : A ⇒₁ B} → let open Commutation (hom A B) in [ (f ∘₁ f ⁻¹) ∘₁ f ⇒ f ]⟨ α⇒ ⇒⟨ f ∘₁ f ⁻¹ ∘₁ f ⟩ f ▷ cancel.⇒.η f ⇒⟨ f ∘₁ id₁ ⟩ ρ⇒ ≈ cancel′.⇒.η f ◁ f ⇒⟨ id₁ ∘₁ f ⟩ λ⇒ ⟩ pentagon₂ : ∀ {A B} {f : A ⇒₁ B} → let open Commutation (hom B A) in [ (f ⁻¹ ∘₁ f) ∘₁ f ⁻¹ ⇒ f ⁻¹ ]⟨ α⇒ ⇒⟨ f ⁻¹ ∘₁ f ∘₁ f ⁻¹ ⟩ f ⁻¹ ▷ cancel′.⇒.η f ⇒⟨ f ⁻¹ ∘₁ id₁ ⟩ ρ⇒ ≈ cancel.⇒.η f ◁ f ⁻¹ ⇒⟨ id₁ ∘₁ f ⁻¹ ⟩ λ⇒ ⟩ private variable A B : Obj f g : A ⇒₁ B α β : f ⇒₂ g open hom.HomReasoning open hom.Equiv module MR′ {A B} where open MR (hom A B) public open Mor (hom A B) public open MP (hom A B) public open MR′ module ℱ = Functor cancel-comm : ∀ {β : f ⇒₂ g} → cancel.⇒.η g ∘ᵥ (β ⁻¹′ ⊚₁ β) ≈ cancel.⇒.η f cancel-comm {β = β} = cancel.⇒.commute β ○ identity₂ˡ cancel⁻¹-comm : ∀ {β : f ⇒₂ g} → (β ⁻¹′ ⊚₁ β) ∘ᵥ cancel.⇐.η f ≈ cancel.⇐.η g cancel⁻¹-comm {β = β} = ⟺ (cancel.⇐.commute β) ○ identity₂ʳ cancel′-comm : ∀ {β : f ⇒₂ g} → cancel′.⇒.η g ∘ᵥ (β ⊚₁ β ⁻¹′) ≈ cancel′.⇒.η f cancel′-comm {β = β} = cancel′.⇒.commute β ○ identity₂ˡ cancel′⁻¹-comm : ∀ {β : f ⇒₂ g} → (β ⊚₁ β ⁻¹′) ∘ᵥ cancel′.⇐.η f ≈ cancel′.⇐.η g cancel′⁻¹-comm {β = β} = ⟺ (cancel′.⇐.commute β) ○ identity₂ʳ hom⁻¹⁻¹≃id : ∀ {A B} → hom[ B , A ]⁻¹ ∘F hom[ A , B ]⁻¹ ≃ idF hom⁻¹⁻¹≃id {A} {B} = record { F⇒G = ntHelper record { η = λ f → (((λ⇒ ∘ᵥ cancel.⇒.η (f ⁻¹) ◁ f) ∘ᵥ α⇐) ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ; commute = λ {f g} β → begin ((((λ⇒ ∘ᵥ cancel.⇒.η (g ⁻¹) ◁ g) ∘ᵥ α⇐) ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇐.η g) ∘ᵥ ρ⇐) ∘ᵥ β ⁻¹′ ⁻¹′ ≈˘⟨ pushʳ ◁-∘ᵥ-ρ⇐ ⟩ (((λ⇒ ∘ᵥ cancel.⇒.η (g ⁻¹) ◁ g) ∘ᵥ α⇐) ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇐.η g) ∘ᵥ ((β ⁻¹′ ⁻¹′ ◁ id₁) ∘ᵥ ρ⇐) ≈⟨ center ◁-▷-exchg ⟩ ((λ⇒ ∘ᵥ cancel.⇒.η (g ⁻¹) ◁ g) ∘ᵥ α⇐) ∘ᵥ (β ⁻¹′ ⁻¹′ ◁ (g ⁻¹ ∘₁ g) ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η g) ∘ᵥ ρ⇐ ≈⟨ center (⟺ assoc₂ ○ hom.∘-resp-≈ α⇐-◁-∘₁ (ℱ.F-resp-≈ ((f ⁻¹ ⁻¹) ⊚-) (⟺ cancel⁻¹-comm))) ⟩ (λ⇒ ∘ᵥ cancel.⇒.η (g ⁻¹) ◁ g) ∘ᵥ ((β ⁻¹′ ⁻¹′ ◁ g ⁻¹ ◁ g ∘ᵥ α⇐) ∘ᵥ f ⁻¹ ⁻¹ ▷ ((β ⁻¹′ ⊚₁ β) ∘ᵥ cancel.⇐.η f)) ∘ᵥ ρ⇐ ≈⟨ refl⟩∘⟨ (hom.∘-resp-≈ʳ (ℱ.homomorphism ((f ⁻¹ ⁻¹) ⊚-)) ○ center (⊚-assoc.⇐.commute _) ○ center⁻¹ ([ ⊚ ]-merge (⟺ [ ⊚ ]-decompose₁) identity₂ˡ) refl) ⟩∘⟨refl ⟩ (λ⇒ ∘ᵥ cancel.⇒.η (g ⁻¹) ◁ g) ∘ᵥ (((β ⁻¹′ ⁻¹′ ⊚₁ β ⁻¹′) ⊚₁ β) ∘ᵥ α⇐ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ≈˘⟨ assoc₂ ⟩ ((λ⇒ ∘ᵥ cancel.⇒.η (g ⁻¹) ◁ g) ∘ᵥ (((β ⁻¹′ ⁻¹′ ⊚₁ β ⁻¹′) ⊚₁ β) ∘ᵥ α⇐ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f)) ∘ᵥ ρ⇐ ≈⟨ center ([ ⊚ ]-merge cancel-comm identity₂ˡ) ⟩∘⟨refl ⟩ (λ⇒ ∘ᵥ cancel.⇒.η (f ⁻¹) ⊚₁ β ∘ᵥ α⇐ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ≈˘⟨ (assoc₂ ○ assoc₂) ⟩∘⟨refl ⟩ (((λ⇒ ∘ᵥ cancel.⇒.η (f ⁻¹) ⊚₁ β) ∘ᵥ α⇐) ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ≈⟨ (hom.∘-resp-≈ʳ [ ⊚ ]-decompose₂) ⟩∘⟨refl ⟩∘⟨refl ⟩∘⟨refl ⟩ (((λ⇒ ∘ᵥ id₁ ▷ β ∘ᵥ cancel.⇒.η (f ⁻¹) ◁ f) ∘ᵥ α⇐) ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ≈⟨ pullˡ λ⇒-∘ᵥ-▷ ⟩∘⟨refl ⟩∘⟨refl ⟩∘⟨refl ⟩ ((((β ∘ᵥ λ⇒) ∘ᵥ cancel.⇒.η (f ⁻¹) ◁ f) ∘ᵥ α⇐) ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ≈⟨ (assoc₂ ○ assoc₂ ○ assoc₂ ○ assoc₂) ⟩ β ∘ᵥ λ⇒ ∘ᵥ cancel.⇒.η (f ⁻¹) ◁ f ∘ᵥ α⇐ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f ∘ᵥ ρ⇐ ≈˘⟨ refl⟩∘⟨ (assoc₂ ○ assoc₂ ○ assoc₂) ⟩ β ∘ᵥ (((λ⇒ ∘ᵥ cancel.⇒.η (f ⁻¹) ◁ f) ∘ᵥ α⇐) ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇐.η f) ∘ᵥ ρ⇐ ∎ } ; F⇐G = ntHelper record { η = λ f → ρ⇒ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇒.η f ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (f ⁻¹) ◁ f ∘ᵥ λ⇐ ; commute = λ {f g} β → begin (ρ⇒ ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇒.η g ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (g ⁻¹) ◁ g ∘ᵥ λ⇐) ∘ᵥ β ≈⟨ assoc₂ ○ hom.∘-resp-≈ʳ (assoc₂ ○ hom.∘-resp-≈ʳ (assoc₂ ○ hom.∘-resp-≈ʳ assoc₂)) ⟩ ρ⇒ ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇒.η g ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (g ⁻¹) ◁ g ∘ᵥ λ⇐ ∘ᵥ β ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ ⟺ ▷-∘ᵥ-λ⇐ ⟩ ρ⇒ ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇒.η g ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (g ⁻¹) ◁ g ∘ᵥ id₁ ▷ β ∘ᵥ λ⇐ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ pullˡ (⟺ [ ⊚ ]-decompose₁ ○ ⊚-resp-≈ˡ (⟺ cancel⁻¹-comm)) ⟩ ρ⇒ ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇒.η g ∘ᵥ α⇒ ∘ᵥ (β ⁻¹′ ⁻¹′ ⊚₁ β ⁻¹′ ∘ᵥ cancel.⇐.η (f ⁻¹)) ⊚₁ β ∘ᵥ λ⇐ ≈˘⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ [ ⊚ ]-merge refl identity₂ʳ ⟩∘⟨refl ⟩ ρ⇒ ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇒.η g ∘ᵥ α⇒ ∘ᵥ ((β ⁻¹′ ⁻¹′ ⊚₁ β ⁻¹′) ⊚₁ β ∘ᵥ cancel.⇐.η (f ⁻¹) ◁ f) ∘ᵥ λ⇐ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ center⁻¹ (⊚-assoc.⇒.commute _) refl ⟩ ρ⇒ ∘ᵥ g ⁻¹ ⁻¹ ▷ cancel.⇒.η g ∘ᵥ (β ⁻¹′ ⁻¹′ ⊚₁ β ⁻¹′ ⊚₁ β ∘ᵥ α⇒) ∘ᵥ cancel.⇐.η (f ⁻¹) ◁ f ∘ᵥ λ⇐ ≈⟨ refl⟩∘⟨ (hom.∘-resp-≈ʳ assoc₂ ○ pullˡ ([ ⊚ ]-merge identity₂ˡ cancel-comm)) ⟩ ρ⇒ ∘ᵥ (β ⁻¹′ ⁻¹′) ⊚₁ (cancel.⇒.η f) ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (f ⁻¹) ◁ f ∘ᵥ λ⇐ ≈⟨ refl⟩∘⟨ (hom.∘-resp-≈ˡ [ ⊚ ]-decompose₁ ○ assoc₂) ⟩ ρ⇒ ∘ᵥ (β ⁻¹′ ⁻¹′) ◁ id₁ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇒.η f ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (f ⁻¹) ◁ f ∘ᵥ λ⇐ ≈⟨ (pullˡ ρ⇒-∘ᵥ-◁) ○ assoc₂ ⟩ β ⁻¹′ ⁻¹′ ∘ᵥ ρ⇒ ∘ᵥ f ⁻¹ ⁻¹ ▷ cancel.⇒.η f ∘ᵥ α⇒ ∘ᵥ cancel.⇐.η (f ⁻¹) ◁ f ∘ᵥ λ⇐ ∎ } ; iso = λ f → Iso-∘ (Iso-swap (unitʳ.iso _)) $ Iso-∘ ([ (f ⁻¹ ⁻¹) ⊚- ]-resp-Iso (Iso-swap (cancel.iso f))) $ Iso-∘ (Iso-swap associator.iso) $ Iso-∘ ([ -⊚ f ]-resp-Iso (cancel.iso _)) (unitˡ.iso _) } hom⁻¹-weakInverse : ∀ {A B} → WeakInverse hom[ A , B ]⁻¹ hom[ B , A ]⁻¹ hom⁻¹-weakInverse = record { F∘G≈id = hom⁻¹⁻¹≃id ; G∘F≈id = hom⁻¹⁻¹≃id } hom⁻¹-⊣Equivalence : ∀ {A} {B} → hom[ A , B ]⁻¹ ⊣⊢ hom[ B , A ]⁻¹ hom⁻¹-⊣Equivalence {A} {B} = EP.F⊣⊢G (hom⁻¹-weakInverse {A} {B}) open Bicategory C public -- A bigroupoid is a bicategory that has a bigroupoid structure
record
src
[ "open import Level", "open import Function using (_$_)", "open import Data.Product using (Σ; _,_)", "open import Categories.Adjoint.TwoSided using (_⊣⊢_)", "open import Categories.Category", "open import Categories.Category.Equivalence using (WeakInverse)", "import Categories.Category.Equivalence.Properties as EP", "open import Categories.Category.Product", "open import Categories.Category.Groupoid using (IsGroupoid)", "open import Categories.Bicategory", "import Categories.Bicategory.Extras as BicategoryExtras", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Properties", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.Functor.Construction.Constant", "open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper)", "open import Categories.NaturalTransformation.NaturalIsomorphism using (_≃_; NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Properties as MP", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Bicategory/Bigroupoid.agda
IsBigroupoid
Bigroupoid (o ℓ e t : Level) : Set (suc (o ⊔ ℓ ⊔ e ⊔ t)) where field bicategory : Bicategory o ℓ e t isBigroupoid : IsBigroupoid bicategory open IsBigroupoid isBigroupoid public
record
src
[ "open import Level", "open import Function using (_$_)", "open import Data.Product using (Σ; _,_)", "open import Categories.Adjoint.TwoSided using (_⊣⊢_)", "open import Categories.Category", "open import Categories.Category.Equivalence using (WeakInverse)", "import Categories.Category.Equivalence.Properties as EP", "open import Categories.Category.Product", "open import Categories.Category.Groupoid using (IsGroupoid)", "open import Categories.Bicategory", "import Categories.Bicategory.Extras as BicategoryExtras", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Properties", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.Functor.Construction.Constant", "open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper)", "open import Categories.NaturalTransformation.NaturalIsomorphism using (_≃_; NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Properties as MP", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Bicategory/Bigroupoid.agda
Bigroupoid
unitorˡ : {A B : Obj} {f : A ⇒₁ B} → id₁ ∘₁ f ≅ f
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
unitorˡ
unitorʳ : {A B : Obj} {f : A ⇒₁ B} → f ∘₁ id₁ ≅ f
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
unitorʳ
identity₂ˡ : id₂ ∘ᵥ α ≈ α
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
identity₂ˡ
identity₂ʳ : α ∘ᵥ id₂ ≈ α
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
identity₂ʳ
identity₂² : id₂ ∘ᵥ id₂ {f = g} ≈ id₂ {f = g}
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
identity₂²
assoc₂ : (α ∘ᵥ β) ∘ᵥ γ ≈ α ∘ᵥ β ∘ᵥ γ
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
assoc₂
sym-assoc₂ : α ∘ᵥ β ∘ᵥ γ ≈ (α ∘ᵥ β) ∘ᵥ γ
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
sym-assoc₂
triangle-inv : {f : A ⇒₁ B} {g : B ⇒₁ C} → α⇐ ∘ᵥ g ▷ λ⇐ ≈ ρ⇐ ◁ f
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Category.Construction.Core as Core", "open import Categories.Category.Construction.Functors using (Functors; module curry)", "open import Categories.Functor using (Functor)", "open import Categories.Functor.Bifunctor using (flip-bifunctor)", "open import Categories.Functor.Bifunctor.Properties", "open import Categories.NaturalTransformation", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "import Categories.Morphism as Mor", "import Categories.Morphism.Reasoning as MR", "open import Categories.NaturalTransformation.NaturalIsomorphism.Properties using (push-eq)" ]
src/Categories/Bicategory/Extras.agda
triangle-inv
LocalCoequalizers : Set (o ⊔ ℓ ⊔ e ⊔ t) where field localCoequalizers : (A B : Obj) → Coequalizers (hom A B) precompPreservesCoequalizer : {A B E : Obj} → (f : E ⇒₁ A) → PreservesCoequalizers (-⊚_ {E} {A} {B} f) postcompPreservesCoequalizer : {A B E : Obj} → (f : B ⇒₁ E) → PreservesCoequalizers (_⊚- {B} {E} {A} f)
record
src
[ "open import Categories.Bicategory", "open import Categories.Diagram.Coequalizer using (Coequalizer; Coequalizers)", "open import Level using (_⊔_)", "open import Categories.Functor.Properties using (PreservesCoequalizers)", "import Categories.Bicategory.Extras as Bicat" ]
src/Categories/Bicategory/LocalCoequalizers.agda
LocalCoequalizers
Monad {o ℓ e t} (𝒞 : Bicategory o ℓ e t) : Set (o ⊔ ℓ ⊔ e ⊔ t) where open Bicat 𝒞 field C : Obj T : C ⇒₁ C η : id₁ ⇒₂ T μ : (T ⊚₀ T) ⇒₂ T assoc : μ ∘ᵥ (T ▷ μ) ∘ᵥ associator.from ≈ (μ ∘ᵥ (μ ◁ T)) sym-assoc : μ ∘ᵥ (μ ◁ T) ∘ᵥ associator.to ≈ (μ ∘ᵥ (T ▷ μ)) identityˡ : μ ∘ᵥ (T ▷ η) ∘ᵥ unitorʳ.to ≈ id₂ identityʳ : μ ∘ᵥ (η ◁ T) ∘ᵥ unitorˡ.to ≈ id₂
record
src
[ "open import Level", "open import Data.Product using (_,_)", "open import Categories.Bicategory", "import Categories.Bicategory.Extras as Bicat", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)" ]
src/Categories/Bicategory/Monad.agda
Monad
coop : ∀ {o ℓ e t} → Bicategory o ℓ e t → Bicategory o ℓ e t
function
src
[ "open import Categories.Bicategory using (Bicategory)", "open import Data.Product using (_,_)", "import Categories.Bicategory.Extras as BicategoryExtras", "open import Categories.Category using (Category)", "import Categories.Category.Cartesian as Cartesian", "import Categories.Morphism as Morphism", "import Categories.Morphism.Reasoning as MorphismReasoning", "open import Categories.Category.Product using (Swap)", "open import Categories.Functor using (Functor; _∘F_)", "open import Categories.NaturalTransformation.NaturalIsomorphism" ]
src/Categories/Bicategory/Opposite.agda
coop
BicartesianClosed : Set (levelOfTerm 𝒞) where field cartesianClosed : CartesianClosed cocartesian : Cocartesian
record
src
[ "open import Categories.Category.Core using (Category)", "open import Level", "open import Categories.Category.CartesianClosed 𝒞", "open import Categories.Category.Cocartesian 𝒞" ]
src/Categories/Category/BicartesianClosed.agda
BicartesianClosed
BinaryProducts : Set (levelOfTerm 𝒞) where infixr 7 _×_ infixr 8 _⁂_ infix 11 ⟨_,_⟩ field product : ∀ {A B} → Product A B private module product {A} {B} = Product (product {A} {B}) _×_ : Obj → Obj → Obj A × B = Product.A×B (product {A} {B}) ×-comm : A × B ≅ B × A ×-comm = Commutative product product ×-assoc : X × Y × Z ≅ (X × Y) × Z ×-assoc = Associative product product product product open product hiding (⟨_,_⟩; ∘-distribʳ-⟨⟩) public -- define it like this instead of reexporting to redefine fixity ⟨_,_⟩ : X ⇒ A → X ⇒ B → X ⇒ A × B ⟨_,_⟩ = Product.⟨_,_⟩ product _⁂_ : A ⇒ B → C ⇒ D → A × C ⇒ B × D f ⁂ g = [ product ⇒ product ] f × g assocˡ : (A × B) × C ⇒ A × B × C assocˡ = _≅_.to ×-assoc assocʳ : A × B × C ⇒ (A × B) × C assocʳ = _≅_.from ×-assoc assocʳ∘assocˡ : assocʳ {A}{B}{C} ∘ assocˡ {A}{B}{C} ≈ id assocʳ∘assocˡ = Iso.isoʳ (_≅_.iso ×-assoc) assocˡ∘assocʳ : assocˡ {A}{B}{C} ∘ assocʳ {A}{B}{C} ≈ id assocˡ∘assocʳ = Iso.isoˡ (_≅_.iso ×-assoc) ⟨⟩-congʳ : f ≈ f′ → ⟨ f , g ⟩ ≈ ⟨ f′ , g ⟩ ⟨⟩-congʳ pf = ⟨⟩-cong₂ pf Equiv.refl ⟨⟩-congˡ : g ≈ g′ → ⟨ f , g ⟩ ≈ ⟨ f , g′ ⟩ ⟨⟩-congˡ pf = ⟨⟩-cong₂ Equiv.refl pf swap : A × B ⇒ B × A swap = ⟨ π₂ , π₁ ⟩ -- TODO: this is probably harder to use than necessary because of this definition. Maybe make a version -- that doesn't have an explicit id in it, too? first : A ⇒ B → A × C ⇒ B × C first f = f ⁂ id second : C ⇒ D → A × C ⇒ A × D second g = id ⁂ g -- Just to make this more obvious π₁∘⁂ : π₁ ∘ (f ⁂ g) ≈ f ∘ π₁ π₁∘⁂ {f = f} {g} = project₁ π₂∘⁂ : π₂ ∘ (f ⁂ g) ≈ g ∘ π₂ π₂∘⁂ {f = f} {g} = project₂ ⁂-cong₂ : f ≈ g → h ≈ i → f ⁂ h ≈ g ⁂ i ⁂-cong₂ = [ product ⇒ product ]×-cong₂ ⁂∘⟨⟩ : (f ⁂ g) ∘ ⟨ f′ , g′ ⟩ ≈ ⟨ f ∘ f′ , g ∘ g′ ⟩ ⁂∘⟨⟩ = [ product ⇒ product ]×∘⟨⟩ first∘⟨⟩ : first f ∘ ⟨ f′ , g′ ⟩ ≈ ⟨ f ∘ f′ , g′ ⟩ first∘⟨⟩ = [ product ⇒ product ]×id∘⟨⟩ second∘⟨⟩ : second g ∘ ⟨ f′ , g′ ⟩ ≈ ⟨ f′ , g ∘ g′ ⟩ second∘⟨⟩ = [ product ⇒ product ]id×∘⟨⟩ ⁂∘⁂ : (f ⁂ g) ∘ (f′ ⁂ g′) ≈ (f ∘ f′) ⁂ (g ∘ g′) ⁂∘⁂ = [ product ⇒ product ⇒ product ]×∘× ⟨⟩∘ : ⟨ f , g ⟩ ∘ h ≈ ⟨ f ∘ h , g ∘ h ⟩ ⟨⟩∘ = [ product ]⟨⟩∘ first∘first : ∀ {C} → first {C = C} f ∘ first g ≈ first (f ∘ g) first∘first = [ product ⇒ product ⇒ product ]×id∘×id second∘second : ∀ {A} → second {A = A} f ∘ second g ≈ second (f ∘ g) second∘second = [ product ⇒ product ⇒ product ]id×∘id× first∘second : first f ∘ second g ≈ f ⁂ g first∘second {f = f} {g = g} = begin first f ∘ second g ≈⟨ first∘⟨⟩ ⟩ ⟨ f ∘ id ∘ π₁ , g ∘ π₂ ⟩ ≈⟨ ⟨⟩-congʳ (∘-resp-≈ʳ identityˡ) ⟩ f ⁂ g ∎ second∘first : second f ∘ first g ≈ g ⁂ f second∘first {f = f} {g = g} = begin second f ∘ first g ≈⟨ second∘⟨⟩ ⟩ ⟨ g ∘ π₁ , f ∘ id ∘ π₂ ⟩ ≈⟨ ⟨⟩-congˡ (∘-resp-≈ʳ identityˡ) ⟩ g ⁂ f ∎ first↔second : first f ∘ second g ≈ second g ∘ first f first↔second = [ product ⇒ product , product ⇒ product ]first↔second firstid : ∀ {f : A ⇒ A} (g : A ⇒ C) → first {C = C} f ≈ id → f ≈ id firstid {f = f} g eq = begin f ≈˘⟨ elimʳ project₁ ⟩ f ∘ π₁ ∘ ⟨ id , g ⟩ ≈⟨ pullˡ fπ₁≈π₁ ⟩ π₁ ∘ ⟨ id , g ⟩ ≈⟨ project₁ ⟩ id ∎ where fπ₁≈π₁ = begin f ∘ π₁ ≈˘⟨ project₁ ⟩ π₁ ∘ first f ≈⟨ refl⟩∘⟨ eq ⟩ π₁ ∘ id ≈⟨ identityʳ ⟩ π₁ ∎ swap∘⟨⟩ : swap ∘ ⟨ f , g ⟩ ≈ ⟨ g , f ⟩ swap∘⟨⟩ {f = f} {g = g} = begin ⟨ π₂ , π₁ ⟩ ∘ ⟨ f , g ⟩ ≈⟨ ⟨⟩∘ ⟩ ⟨ π₂ ∘ ⟨ f , g ⟩ , π₁ ∘ ⟨ f , g ⟩ ⟩ ≈⟨ ⟨⟩-cong₂ project₂ project₁ ⟩ ⟨ g , f ⟩ ∎ swap∘⁂ : swap ∘ (f ⁂ g) ≈ (g ⁂ f) ∘ swap swap∘⁂ {f = f} {g = g} = begin swap ∘ (f ⁂ g) ≈⟨ swap∘⟨⟩ ⟩ ⟨ g ∘ π₂ , f ∘ π₁ ⟩ ≈˘⟨ ⁂∘⟨⟩ ⟩ (g ⁂ f) ∘ swap ∎ swap∘swap : (swap {A}{B}) ∘ (swap {B}{A}) ≈ id swap∘swap = Equiv.trans swap∘⟨⟩ η swap-epi : Epi (swap {A} {B}) swap-epi f g eq = (introʳ swap∘swap) ○ (pullˡ eq) ○ (cancelʳ swap∘swap) swap-mono : Mono (swap {A} {B}) swap-mono f g eq = (introˡ swap∘swap) ○ (pullʳ eq) ○ (cancelˡ swap∘swap) assocʳ∘⟨⟩ : assocʳ ∘ ⟨ f , ⟨ g , h ⟩ ⟩ ≈ ⟨ ⟨ f , g ⟩ , h ⟩ assocʳ∘⟨⟩ {f = f} {g = g} {h = h} = begin assocʳ ∘ ⟨ f , ⟨ g , h ⟩ ⟩ ≈⟨ ⟨⟩∘ ⟩ ⟨ ⟨ π₁ , π₁ ∘ π₂ ⟩ ∘ ⟨ f , ⟨ g , h ⟩ ⟩ , (π₂ ∘ π₂) ∘ ⟨ f , ⟨ g , h ⟩ ⟩ ⟩ ≈⟨ ⟨⟩-cong₂ ⟨⟩∘ (pullʳ project₂) ⟩ ⟨ ⟨ π₁ ∘ ⟨ f , ⟨ g , h ⟩ ⟩ , (π₁ ∘ π₂) ∘ ⟨ f , ⟨ g , h ⟩ ⟩ ⟩ , π₂ ∘ ⟨ g , h ⟩ ⟩ ≈⟨ ⟨⟩-cong₂ (⟨⟩-cong₂ project₁ (pullʳ project₂ ○ project₁)) project₂ ⟩ ⟨ ⟨ f , g ⟩ , h ⟩ ∎ assocˡ∘⟨⟩ : assocˡ ∘ ⟨ ⟨ f , g ⟩ , h ⟩ ≈ ⟨ f , ⟨ g , h ⟩ ⟩ assocˡ∘⟨⟩ {f = f} {g = g} {h = h} = begin assocˡ ∘ ⟨ ⟨ f , g ⟩ , h ⟩ ≈˘⟨ refl⟩∘⟨ assocʳ∘⟨⟩ ⟩ assocˡ ∘ assocʳ ∘ ⟨ f , ⟨ g , h ⟩ ⟩ ≈⟨ cancelˡ assocˡ∘assocʳ ⟩ ⟨ f , ⟨ g , h ⟩ ⟩ ∎ assocʳ∘⁂ : assocʳ ∘ (f ⁂ (g ⁂ h)) ≈ ((f ⁂ g) ⁂ h) ∘ assocʳ assocʳ∘⁂ {f = f} {g = g} {h = h} = begin assocʳ ∘ (f ⁂ (g ⁂ h)) ≈⟨ refl⟩∘⟨ ⟨⟩-congˡ ⟨⟩∘ ⟩ assocʳ ∘ ⟨ f ∘ π₁ , ⟨ (g ∘ π₁) ∘ π₂ , (h ∘ π₂) ∘ π₂ ⟩ ⟩ ≈⟨ assocʳ∘⟨⟩ ⟩ ⟨ ⟨ f ∘ π₁ , (g ∘ π₁) ∘ π₂ ⟩ , (h ∘ π₂) ∘ π₂ ⟩ ≈⟨ ⟨⟩-cong₂ (⟨⟩-congˡ assoc) assoc ⟩ ⟨ ⟨ f ∘ π₁ , g ∘ π₁ ∘ π₂ ⟩ , h ∘ π₂ ∘ π₂ ⟩ ≈˘⟨ ⟨⟩-congʳ ⁂∘⟨⟩ ⟩ ⟨ (f ⁂ g) ∘ ⟨ π₁ , π₁ ∘ π₂ ⟩ , h ∘ π₂ ∘ π₂ ⟩ ≈˘⟨ ⁂∘⟨⟩ ⟩ ((f ⁂ g) ⁂ h) ∘ assocʳ ∎ assocˡ∘⁂ : assocˡ ∘ ((f ⁂ g) ⁂ h) ≈ (f ⁂ (g ⁂ h)) ∘ assocˡ assocˡ∘⁂ {f = f} {g = g} {h = h} = begin assocˡ ∘ ((f ⁂ g) ⁂ h) ≈⟨ refl⟩∘⟨ ⟨⟩-congʳ ⟨⟩∘ ⟩ assocˡ ∘ ⟨ ⟨ (f ∘ π₁) ∘ π₁ , (g ∘ π₂) ∘ π₁ ⟩ , h ∘ π₂ ⟩ ≈⟨ assocˡ∘⟨⟩ ⟩ ⟨ (f ∘ π₁) ∘ π₁ , ⟨ (g ∘ π₂) ∘ π₁ , h ∘ π₂ ⟩ ⟩ ≈⟨ ⟨⟩-cong₂ assoc (⟨⟩-congʳ assoc) ⟩ ⟨ f ∘ π₁ ∘ π₁ , ⟨ g ∘ π₂ ∘ π₁ , h ∘ π₂ ⟩ ⟩ ≈˘⟨ ⟨⟩-congˡ ⁂∘⟨⟩ ⟩ ⟨ f ∘ π₁ ∘ π₁ , (g ⁂ h) ∘ ⟨ π₂ ∘ π₁ , π₂ ⟩ ⟩ ≈˘⟨ ⁂∘⟨⟩ ⟩ (f ⁂ (g ⁂ h)) ∘ assocˡ ∎ Δ : ∀ {C} → C ⇒ C × C Δ {C} = ⟨ id {C} , id ⟩ Δ∘ : Δ ∘ f ≈ ⟨ f , f ⟩ Δ∘ {f = f} = begin Δ ∘ f ≈⟨ ⟨⟩∘ ⟩ ⟨ id ∘ f , id ∘ f ⟩ ≈⟨ ⟨⟩-cong₂ identityˡ identityˡ ⟩ ⟨ f , f ⟩ ∎ ⁂∘Δ : (f ⁂ g) ∘ Δ ≈ ⟨ f , g ⟩ ⁂∘Δ {f = f} {g = g} = begin (f ⁂ g) ∘ Δ ≈⟨ ⁂∘⟨⟩ ⟩ ⟨ f ∘ id , g ∘ id ⟩ ≈⟨ ⟨⟩-cong₂ identityʳ identityʳ ⟩ ⟨ f , g ⟩ ∎ -×- : Bifunctor 𝒞 𝒞 𝒞 -×- = record { F₀ = uncurry _×_ ; F₁ = uncurry _⁂_ ; identity = id×id product ; homomorphism = ⟺ ⁂∘⁂ ; F-resp-≈ = uncurry [ product ⇒ product ]×-cong₂ } -×_ : Obj → Functor 𝒞 𝒞 -×_ = appʳ -×- _×- : Obj → Functor 𝒞 𝒞 _×- = appˡ -×-
record
src
[ "open import Categories.Category.Core using (Category)", "open import Level hiding (suc)", "open import Data.Product using (uncurry)", "open import Categories.Object.Product 𝒞", "open import Categories.Morphism 𝒞 using (_≅_; module Iso; Mono; Epi)", "open import Categories.Morphism.Reasoning 𝒞 using (pullʳ; pullˡ; elimʳ; cancelˡ; cancelʳ; introˡ; introʳ)", "open import Categories.Category.Monoidal.Core using (Monoidal)", "open import Categories.Functor using (Functor) renaming (id to idF)", "open import Categories.Functor.Bifunctor using (Bifunctor; appʳ; appˡ)" ]
src/Categories/Category/BinaryProducts.agda
BinaryProducts
Cartesian : Set (levelOfTerm 𝒞) where field terminal : Terminal products : BinaryProducts open BinaryProducts products using (_×_) power : Obj → ℕ → Obj power A 0 = Terminal.⊤ terminal power A 1 = A power A (suc (suc n)) = A × power A (suc n)
record
src
[ "open import Categories.Category using (Category)", "open import Level using (levelOfTerm)", "open import Data.Nat using (ℕ; zero; suc)", "open import Categories.Category.BinaryProducts 𝒞 using (BinaryProducts; module BinaryProducts)", "open import Categories.Object.Terminal 𝒞 using (Terminal)" ]
src/Categories/Category/Cartesian.agda
Cartesian
CartesianClosed : Set (levelOfTerm 𝒞) where infixr 9 _^_ -- an alternative notation for exponential, which emphasizes its internal hom natural infixr 5 _⇨_ field cartesian : Cartesian exp : Exponential A B module exp {A B} = Exponential (exp {A} {B}) _^_ : Obj → Obj → Obj B ^ A = exp.B^A {A} {B} _⇨_ : Obj → Obj → Obj _⇨_ = flip _^_ private module cartesian = Cartesian cartesian open CartesianMonoidal cartesian using (A×⊤≅A) open BinaryProducts cartesian.products using (_×_; product; π₁; π₂; ⟨_,_⟩; project₁; project₂; η; ⟨⟩-cong₂; ⟨⟩∘; _⁂_; ⟨⟩-congˡ; ⟨⟩-congʳ; first∘first; firstid; first; second; first↔second; second∘second; ⁂-cong₂; -×_) open Terminal cartesian.terminal using (⊤; !; !-unique₂; ⊤-id) B^A×A : ∀ B A → Product (B ^ A) A B^A×A B A = exp.product {A} {B} eval : Product.A×B (B^A×A B A) ⇒ B eval = exp.eval λg : C × A ⇒ B → C ⇒ B ^ A λg f = exp.λg product f λ-cong : f ≈ g → λg f ≈ λg g λ-cong eq = exp.λ-cong product eq λ-inj : λg f ≈ λg g → f ≈ g λ-inj = exp.λ-inj product _×id : (f : C ⇒ B ^ A) → C × A ⇒ [[ B^A×A B A ]] f ×id = [ product ⇒ exp.product ] f ×id β : eval ∘ λg f ×id ≈ f β = exp.β product subst : λg f ∘ g ≈ λg (f ∘ (g ⁂ id)) subst = exp.subst product product η-exp : λg (eval ∘ f ×id) ≈ f η-exp = exp.η product λ-unique : eval ∘ f ×id ≈ g → f ≈ λg g λ-unique = exp.λ-unique product λ-unique₂ : eval ∘ f ×id ≈ eval ∘ g ×id → f ≈ g λ-unique₂ = exp.λ-unique′ product -- the annoying detail is that B^A×A is NOT the same as B ^ A × A, but they are isomorphic. -- make some infra so that the latter (which is more intuitive) can be used. B^A×A-iso : Product.A×B (B^A×A B A) ≅ B ^ A × A B^A×A-iso {B = B} {A = A} = record { from = repack exp.product product ; to = repack product exp.product ; iso = record { isoˡ = begin repack product exp.product ∘ repack exp.product product ≈⟨ [ exp.product ]⟨⟩∘ ⟩ [ exp.product ]⟨ π₁ ∘ repack exp.product product , π₂ ∘ repack exp.product product ⟩ ≈⟨ Product.⟨⟩-cong₂ exp.product project₁ project₂ ⟩ [ exp.product ]⟨ [ exp.product ]π₁ , [ exp.product ]π₂ ⟩ ≈⟨ Product.η exp.product ⟩ id ∎ ; isoʳ = begin repack exp.product product ∘ repack product exp.product ≈⟨ ⟨⟩∘ ⟩ ⟨ [ exp.product ]π₁ ∘ repack product exp.product , [ exp.product ]π₂ ∘ repack product exp.product ⟩ ≈⟨ ⟨⟩-cong₂ (Product.project₁ exp.product) (Product.project₂ exp.product) ⟩ ⟨ π₁ , π₂ ⟩ ≈⟨ η ⟩ id ∎ } } eval′ : B ^ A × A ⇒ B eval′ = eval ∘ to where open _≅_ B^A×A-iso λ-unique′ : eval′ ∘ (f ⁂ id) ≈ g → f ≈ λg g λ-unique′ eq = exp.λ-unique product (⟺ (pullʳ [ product ⇒ product ⇒ exp.product ]repack∘×) ○ eq) λ-unique₂′ : eval′ ∘ (f ⁂ id) ≈ eval′ ∘ (g ⁂ id) → f ≈ g λ-unique₂′ eq = (λ-unique′ eq) ○ ⟺ (λ-unique′ refl) β′ : eval′ ∘ (λg f ⁂ id) ≈ f β′ {f = f} = begin eval′ ∘ (λg f ⁂ id) ≈⟨ pullʳ [ product ⇒ product ⇒ exp.product ]repack∘× ⟩ eval ∘ λg f ×id ≈⟨ β ⟩ f ∎ η-exp′ : λg (eval′ ∘ (f ⁂ id)) ≈ f η-exp′ = sym (λ-unique′ refl) η-id′ : λg (eval′ {B = B} {A = A}) ≈ id η-id′ = sym (λ-unique′ (elimʳ (id×id product))) ⊤^A≅⊤ : ⊤ ^ A ≅ ⊤ ⊤^A≅⊤ = record { from = ! ; to = λg ! ; iso = record { isoˡ = λ-unique₂ !-unique₂ ; isoʳ = ⊤-id _ } } A^⊤≅A : A ^ ⊤ ≅ A A^⊤≅A = record { from = let open _≅_ A×⊤≅A in eval′ ∘ to ; to = let open _≅_ A×⊤≅A in λg from ; iso = record { isoˡ = λ-unique₂′ $ begin eval′ ∘ ((λg π₁ ∘ eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈˘⟨ refl⟩∘⟨ first∘first ⟩ eval′ ∘ ((λg π₁ ⁂ id) ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id)) ≈⟨ pullˡ β′ ⟩ π₁ ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈⟨ helper ⟩ eval′ ∘ (id ⁂ id) ∎ ; isoʳ = firstid ! $ begin ((eval′ ∘ ⟨ id , ! ⟩) ∘ λg π₁) ⁂ id ≈˘⟨ first∘first ⟩ (eval′ ∘ ⟨ id , ! ⟩ ⁂ id) ∘ (λg π₁ ⁂ id) ≈⟨ helper′ ⟩∘⟨refl ⟩ (⟨ id , ! ⟩ ∘ eval′) ∘ (λg π₁ ⁂ id) ≈⟨ pullʳ β′ ⟩ ⟨ id , ! ⟩ ∘ π₁ ≈⟨ ⟨⟩∘ ⟩ ⟨ id ∘ π₁ , ! ∘ π₁ ⟩ ≈⟨ ⟨⟩-cong₂ identityˡ !-unique₂ ⟩ ⟨ π₁ , π₂ ⟩ ≈⟨ η ⟩ id ∎ } } where helper = begin π₁ ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈⟨ project₁ ⟩ (eval′ ∘ ⟨ id , ! ⟩) ∘ π₁ ≈⟨ pullʳ ⟨⟩∘ ⟩ eval′ ∘ ⟨ id ∘ π₁ , ! ∘ π₁ ⟩ ≈⟨ refl⟩∘⟨ ⟨⟩-congˡ !-unique₂ ⟩ eval′ ∘ (id ⁂ id) ∎ helper′ = let open _≅_ A×⊤≅A in begin (eval′ ∘ ⟨ id , ! ⟩) ⁂ id ≈⟨ introˡ isoˡ ⟩ (⟨ id , ! ⟩ ∘ π₁) ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈⟨ pullʳ helper ⟩ ⟨ id , ! ⟩ ∘ (eval′ ∘ (id ⁂ id)) ≈⟨ refl⟩∘⟨ elimʳ (id×id product) ⟩ ⟨ id , ! ⟩ ∘ eval′ ∎ -- we use -⇨- to represent the bifunctor. -- -^- would generate a bifunctor of type Bifunctor 𝒞 𝒞.op 𝒞 which is not very typical. -⇨- : Bifunctor 𝒞.op 𝒞 𝒞 -⇨- = record { F₀ = uncurry _⇨_ ; F₁ = λ where (f , g) → λg (g ∘ eval′ ∘ second f) ; identity = λ-cong (identityˡ ○ (elimʳ (id×id product))) ○ η-id′ ; homomorphism = λ-unique₂′ helper ; F-resp-≈ = λ where (eq₁ , eq₂) → λ-cong (∘-resp-≈ eq₂ (∘-resp-≈ʳ (⁂-cong₂ refl eq₁))) } where helper : eval′ ∘ first (λg ((g ∘ f) ∘ eval′ ∘ second (h ∘ i))) ≈ eval′ ∘ first (λg (g ∘ eval′ ∘ second i) ∘ λg (f ∘ eval′ ∘ second h)) helper {g = g} {f = f} {h = h} {i = i} = begin eval′ ∘ first (λg ((g ∘ f) ∘ eval′ ∘ second (h ∘ i))) ≈⟨ β′ ⟩ (g ∘ f) ∘ eval′ ∘ second (h ∘ i) ≈˘⟨ refl⟩∘⟨ pullʳ second∘second ⟩ (g ∘ f) ∘ (eval′ ∘ second h) ∘ second i ≈⟨ center refl ⟩ g ∘ (f ∘ eval′ ∘ second h) ∘ second i ≈˘⟨ refl⟩∘⟨ pullˡ β′ ⟩ g ∘ eval′ ∘ first (λg (f ∘ eval′ ∘ second h)) ∘ second i ≈⟨ refl⟩∘⟨ pushʳ first↔second ⟩ g ∘ (eval′ ∘ second i) ∘ first (λg (f ∘ eval′ ∘ second h)) ≈⟨ sym-assoc ⟩ (g ∘ eval′ ∘ second i) ∘ first (λg (f ∘ eval′ ∘ second h)) ≈˘⟨ pullˡ β′ ⟩ eval′ ∘ first (λg (g ∘ eval′ ∘ second i)) ∘ first (λg (f ∘ eval′ ∘ second h)) ≈⟨ refl⟩∘⟨ first∘first ⟩ eval′ ∘ first (λg (g ∘ eval′ ∘ second i) ∘ λg (f ∘ eval′ ∘ second h)) ∎ _⇨- : Obj → Endofunctor 𝒞 _⇨- = appˡ -⇨- -⇨_ : Obj → Functor 𝒞.op 𝒞 -⇨_ = appʳ -⇨- -- The cartesian closed structure induces a monoidal closed one: -- 𝒞 is cartesian monoidal closed.
record
src
[ "open import Categories.Category", "open import Level", "open import Function using (_$_; flip)", "open import Data.Product using (Σ; _,_; uncurry)", "open import Categories.Category.BinaryProducts 𝒞", "open import Categories.Category.Cartesian 𝒞", "open import Categories.Category.Cartesian.Monoidal using (module CartesianMonoidal)", "open import Categories.Category.Monoidal.Closed using (Closed)", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Bifunctor", "open import Categories.NaturalTransformation hiding (id)", "open import Categories.NaturalTransformation.Properties", "open import Categories.Object.Product 𝒞", "open import Categories.Object.Exponential 𝒞 hiding (repack)", "open import Categories.Object.Terminal using (Terminal)", "open import Categories.Morphism 𝒞", "open import Categories.Morphism.Reasoning 𝒞" ]
src/Categories/Category/CartesianClosed.agda
CartesianClosed
Closed : Set (levelOfTerm C) where field -- internal hom [-,-] : Bifunctor C.op C C unit : Obj [_,-] : Obj → Functor C C [_,-] = appˡ [-,-] [-,_] : Obj → Functor C.op C [-,_] = appʳ [-,-] module [-,-] = Functor [-,-] [_,_]₀ : Obj → Obj → Obj [ X , Y ]₀ = [-,-].F₀ (X , Y) [_,_]₁ : A ⇒ B → X ⇒ Y → [ B , X ]₀ ⇒ [ A , Y ]₀ [ f , g ]₁ = [-,-].F₁ (f , g) field -- i identity : NaturalIsomorphism idF [ unit ,-] -- j diagonal : Extranaturalʳ unit [-,-] module identity = NaturalIsomorphism identity module diagonal = DinaturalTransformation diagonal [[X,-],[X,-]] : Obj → Bifunctor C.op C C [[X,-],[X,-]] X = [-,-] ∘F (Functor.op [ X ,-] ⁂ [ X ,-]) [[-,Y],[-,Z]] : Obj → Obj → Bifunctor C C.op C [[-,Y],[-,Z]] Y Z = [-,-] ∘F ((Functor.op [-, Y ]) ⁂ [-, Z ]) -- L needs to be natural in Y and Z while extranatural in Z. -- it is better to spell out the conditions and then prove that indeed -- the naturality conditions hold. field L : ∀ X Y Z → [ Y , Z ]₀ ⇒ [ [ X , Y ]₀ , [ X , Z ]₀ ]₀ L-natural-comm : [ [ Y , Z ]₀ ⇒ [ [ X , Y′ ]₀ , [ X , Z′ ]₀ ]₀ ]⟨ [ f , g ]₁ ⇒⟨ [ Y′ , Z′ ]₀ ⟩ L X Y′ Z′ ≈ L X Y Z ⇒⟨ [ [ X , Y ]₀ , [ X , Z ]₀ ]₀ ⟩ [ [ C.id , f ]₁ , [ C.id , g ]₁ ]₁ ⟩ L-dinatural-comm : [ [ Y , Z ]₀ ⇒ [ [ X , Y ]₀ , [ X′ , Z ]₀ ]₀ ]⟨ L X′ Y Z ⇒⟨ [ [ X′ , Y ]₀ , [ X′ , Z ]₀ ]₀ ⟩ [ [ f , C.id ]₁ , [ C.id , C.id ]₁ ]₁ ≈ L X Y Z ⇒⟨ [ [ X , Y ]₀ , [ X , Z ]₀ ]₀ ⟩ [ [ C.id , C.id ]₁ , [ f , C.id ]₁ ]₁ ⟩ L-natural : NaturalTransformation [-,-] ([[X,-],[X,-]] X) L-natural {X} = ntHelper record { η = λ where (Y , Z) → L X Y Z ; commute = λ _ → L-natural-comm } L-dinatural : Extranaturalʳ [ Y , Z ]₀ (flip-bifunctor ([[-,Y],[-,Z]] Y Z)) L-dinatural {Y} {Z} = extranaturalʳ (λ X → L X Y Z) L-dinatural-comm module L-natural {X} = NaturalTransformation (L-natural {X}) module L-dinatural {Y Z} = DinaturalTransformation (L-dinatural {Y} {Z}) -- other required diagrams field Lj≈j : [ unit ⇒ [ [ X , Y ]₀ , [ X , Y ]₀ ]₀ ]⟨ diagonal.α Y ⇒⟨ [ Y , Y ]₀ ⟩ L X Y Y ≈ diagonal.α [ X , Y ]₀ ⟩ jL≈i : [ [ X , Y ]₀ ⇒ [ unit , [ X , Y ]₀ ]₀ ]⟨ L X X Y ⇒⟨ [ [ X , X ]₀ , [ X , Y ]₀ ]₀ ⟩ [ diagonal.α X , C.id ]₁ ≈ identity.⇒.η [ X , Y ]₀ ⟩ iL≈i : [ [ Y , Z ]₀ ⇒ [ Y , [ unit , Z ]₀ ]₀ ]⟨ L unit Y Z ⇒⟨ [ [ unit , Y ]₀ , [ unit , Z ]₀ ]₀ ⟩ [ identity.⇒.η Y , C.id ]₁ ≈ [ C.id , identity.⇒.η Z ]₁ ⟩ pentagon : [ [ U , V ]₀ ⇒ [ [ Y , U ]₀ , [ [ X , Y ]₀ , [ X , V ]₀ ]₀ ]₀ ]⟨ L X U V ⇒⟨ [ [ X , U ]₀ , [ X , V ]₀ ]₀ ⟩ L [ X , Y ]₀ [ X , U ]₀ [ X , V ]₀ ⇒⟨ [ [ [ X , Y ]₀ , [ X , U ]₀ ]₀ , [ [ X , Y ]₀ , [ X , V ]₀ ]₀ ]₀ ⟩ [ L X Y U , C.id ]₁ ≈ L Y U V ⇒⟨ [ [ Y , U ]₀ , [ Y , V ]₀ ]₀ ⟩ [ C.id , L X Y V ]₁ ⟩ open Functor open Func γ : Func (hom-setoid {X} {Y}) (hom-setoid {unit} {[ X , Y ]₀}) γ {X} = record { to = λ f → [ C.id , f ]₁ ∘ diagonal.α _ ; cong = λ eq → ∘-resp-≈ˡ (F-resp-≈ [ X ,-] eq) } field γ⁻¹ : Func (hom-setoid {unit} {[ X , Y ]₀}) (hom-setoid {X} {Y}) γ-γ⁻¹-inverseᵇ : Inverseᵇ _≈_ _≈_ (to γ⁻¹) (to (γ {X} {Y})) γ-inverse : Inverse (hom-setoid {unit} {[ X , Y ]₀}) (hom-setoid {X} {Y}) γ-inverse = record { to = to γ⁻¹ ; to-cong = cong γ⁻¹ ; from = to γ ; from-cong = cong γ ; inverse = γ-γ⁻¹-inverseᵇ }
record
src
[ "open import Categories.Category using (Category; module Commutation)", "open import Level using (Level; levelOfTerm)", "open import Data.Product using (Σ; _,_)", "open import Function.Bundles using (Func; Inverse)", "open import Function.Definitions using (Inverseᵇ)", "open import Categories.Category.Product using (_⁂_)", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Bifunctor using (Bifunctor; appˡ; appʳ; flip-bifunctor)", "open import Categories.Functor.Construction.Constant using (const)", "open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper)", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "open import Categories.NaturalTransformation.Dinatural" ]
src/Categories/Category/Closed.agda
Closed
CM-Category (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where infix 4 _≈_ _⇒_ infixr 9 _∘_ infixl 7 _+_ open CommutativeMonoid using (_∙_; ε) renaming (Carrier to ∣_∣) field Obj : Set o Hom : (A B : Obj) → CommutativeMonoid ℓ e _⇒_ : (A B : Obj) → Set ℓ A ⇒ B = ∣ Hom A B ∣ _+_ : {A B : Obj} → A ⇒ B → A ⇒ B → A ⇒ B _+_ {A} {B} f g = _∙_ (Hom A B) f g 0M : {A B : Obj} → A ⇒ B 0M {A} {B} = ε (Hom A B) field _≈_ : ∀ {A B : Obj} → Rel (A ⇒ B) e id : ∀ {A} → A ⇒ A _∘_ : ∀ {A B C} → B ⇒ C → A ⇒ B → A ⇒ C -- The usual categorical structure field assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f) -- We add a symmetric proof of associativity so that the opposite category of the -- opposite category is definitionally equal to the original category. See how -- `op` is implemented. sym-assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → h ∘ (g ∘ f) ≈ (h ∘ g) ∘ f identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f -- We add a proof of "neutral" identity proof, in order to ensure the opposite of -- constant functor is definitionally equal to itself. identity² : ∀ {A} → id ∘ id {A} ≈ id {A} equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B}) ∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i -- preservation of additive structure +-resp-∘ : ∀ {A B C D} {f g : B ⇒ C} {h : A ⇒ B} {k : C ⇒ D} → k ∘ (f + g) ∘ h ≈ k ∘ f ∘ h + k ∘ g ∘ h 0-resp-∘ : ∀ {A C D} {h : A ⇒ C} {k : C ⇒ D} → k ∘ 0M ∘ h ≈ 0M Underlying : {o ℓ e : Level} → CM-Category o ℓ e → Category o ℓ e Underlying C = record { CM-Category C }
record
src
[ "open import Level", "open import Algebra.Bundles using (CommutativeMonoid)", "open import Function.Base using (flip)", "open import Relation.Binary using (Rel; IsEquivalence)", "open import Categories.Category.Core using (Category)" ]
src/Categories/Category/CMonoidEnriched.agda
CM-Category
Underlying : {o ℓ e : Level} → CM-Category o ℓ e → Category o ℓ e
function
src
[ "open import Level", "open import Algebra.Bundles using (CommutativeMonoid)", "open import Function.Base using (flip)", "open import Relation.Binary using (Rel; IsEquivalence)", "open import Categories.Category.Core using (Category)" ]
src/Categories/Category/CMonoidEnriched.agda
Underlying
BinaryCoproducts : Set (levelOfTerm 𝒞) where infixr 6 _+_ infixr 7 _+₁_ field coproduct : ∀ {A B} → Coproduct A B module coproduct {A} {B} = Coproduct (coproduct {A} {B}) _+_ : Obj → Obj → Obj A + B = coproduct.A+B {A} {B} open coproduct using (i₁; i₂; [_,_]; inject₁; inject₂; []-cong₂; ∘-distribˡ-[]) renaming (unique to +-unique; η to +-η; g-η to +-g-η) public module Dual where op-binaryProducts : BinaryProducts op op-binaryProducts = record { product = Coproduct⇒coProduct coproduct } module op-binaryProducts = BinaryProducts op-binaryProducts open Dual +-comm : A + B ≅ B + A +-comm = op-≅⇒≅ (op-binaryProducts.×-comm) +-assoc : A + B + C ≅ (A + B) + C +-assoc = op-≅⇒≅ (op-binaryProducts.×-assoc) _+₁_ : A ⇒ B → C ⇒ D → A + C ⇒ B + D _+₁_ = op-binaryProducts._⁂_ open op-binaryProducts using () renaming ( ⟨⟩-congʳ to []-congʳ ; ⟨⟩-congˡ to []-congˡ ; assocˡ to +-assocʳ ; assocʳ to +-assocˡ ; swap to +-swap ; first to +-first ; second to +-second ; π₁∘⁂ to +₁∘i₁ ; π₂∘⁂ to +₁∘i₂ ; ⁂-cong₂ to +₁-cong₂ ; ⁂∘⟨⟩ to []∘+₁ ; ⁂∘⁂ to +₁∘+₁ ; ⟨⟩∘ to ∘[] ; first↔second to +-second↔first ; swap∘⁂ to +₁∘+-swap ; swap∘swap to +-swap∘swap ) public -- since op-×- has type Bifunctor 𝒞.op 𝒞.op 𝒞.op, -- need to rewrap in order to type check -+- : Bifunctor 𝒞 𝒞 𝒞 -+- = record { F₀ = op-×-.F₀ ; F₁ = op-×-.F₁ ; identity = op-×-.identity ; homomorphism = op-×-.homomorphism ; F-resp-≈ = op-×-.F-resp-≈ } where op-×- = op-binaryProducts.-×- module op-×- = Functor op-×- -+_ : Obj → Functor 𝒞 𝒞 -+_ = appʳ -+- _+- : Obj → Functor 𝒞 𝒞 _+- = appˡ -+-
record
src
[ "open import Categories.Category.Core using (Category)", "open import Level", "open import Categories.Category.BinaryProducts using (BinaryProducts)", "open import Categories.Category.Cartesian 𝒞.op", "open import Categories.Category.Cartesian.Monoidal using (module CartesianMonoidal)", "import Categories.Category.Cartesian.SymmetricMonoidal as CSM", "open import Categories.Category.Monoidal using (Monoidal)", "open import Categories.Category.Monoidal.Symmetric", "open import Categories.Morphism 𝒞", "open import Categories.Morphism.Properties 𝒞", "open import Categories.Morphism.Duality 𝒞", "open import Categories.Morphism.Reasoning 𝒞", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "open import Categories.Object.Initial 𝒞 using (Initial)", "open import Categories.Object.Coproduct 𝒞", "open import Categories.Object.Duality 𝒞", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Properties", "open import Categories.Functor.Bifunctor" ]
src/Categories/Category/Cocartesian.agda
BinaryCoproducts
Cocartesian : Set (levelOfTerm 𝒞) where field initial : Initial coproducts : BinaryCoproducts module initial = Initial initial module coproducts = BinaryCoproducts coproducts open initial renaming (! to ¡; !-unique to ¡-unique; !-unique₂ to ¡-unique₂) public open coproducts hiding (module Dual) public module Dual where open coproducts.Dual public op-cartesian : Cartesian op-cartesian = record { terminal = ⊥⇒op⊤ initial ; products = op-binaryProducts } module op-cartesian = Cartesian op-cartesian -- The op-cartesian structure induces a monoidal one.
record
src
[ "open import Categories.Category.Core using (Category)", "open import Level", "open import Categories.Category.BinaryProducts using (BinaryProducts)", "open import Categories.Category.Cartesian 𝒞.op", "open import Categories.Category.Cartesian.Monoidal using (module CartesianMonoidal)", "import Categories.Category.Cartesian.SymmetricMonoidal as CSM", "open import Categories.Category.Monoidal using (Monoidal)", "open import Categories.Category.Monoidal.Symmetric", "open import Categories.Morphism 𝒞", "open import Categories.Morphism.Properties 𝒞", "open import Categories.Morphism.Duality 𝒞", "open import Categories.Morphism.Reasoning 𝒞", "open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)", "open import Categories.Object.Initial 𝒞 using (Initial)", "open import Categories.Object.Coproduct 𝒞", "open import Categories.Object.Duality 𝒞", "open import Categories.Functor renaming (id to idF)", "open import Categories.Functor.Properties", "open import Categories.Functor.Bifunctor" ]
src/Categories/Category/Cocartesian.agda
Cocartesian
Cocomplete : (o ℓ e : Level) {o′ ℓ′ e′ : Level} (C : Category o′ ℓ′ e′) → Set _
function
src
[ "open import Level", "open import Categories.Category using (Category)", "open import Categories.Functor using (Functor)", "open import Categories.Diagram.Colimit using (Colimit)" ]
src/Categories/Category/Cocomplete.agda
Cocomplete
Complete : (o ℓ e : Level) {o′ ℓ′ e′ : Level} (C : Category o′ ℓ′ e′) → Set _
function
src
[ "open import Level", "open import Categories.Category", "open import Categories.Category.Construction.Cones", "open import Categories.Functor", "open import Categories.Diagram.Cone.Properties", "open import Categories.Diagram.Limit using (Limit)" ]
src/Categories/Category/Complete.agda
Complete
Concrete (C : Category o ℓ e) (ℓ′ e′ : Level) : Set (o ⊔ ℓ ⊔ e ⊔ suc (ℓ′ ⊔ e′)) where field concretize : Functor C (Setoids ℓ′ e′) conc-faithful : Faithful concretize -- Because of the use of the Hom functor, some levels collapse
record
src
[ "open import Level", "open import Categories.Category.Core using (Category)", "open import Categories.Category.Instance.Setoids using (Setoids)", "open import Categories.Functor.Core using (Functor)", "open import Categories.Functor.Representable using (Representable)", "open import Categories.Functor.Properties using (Faithful)" ]
src/Categories/Category/Concrete.agda
Concrete
RepresentablyConcrete (C : Category o ℓ e) : Set (o ⊔ suc (e ⊔ ℓ)) where open Concrete field conc : Concrete C ℓ e representable : Representable (concretize conc)
record
src
[ "open import Level", "open import Categories.Category.Core using (Category)", "open import Categories.Category.Instance.Setoids using (Setoids)", "open import Categories.Functor.Core using (Functor)", "open import Categories.Functor.Representable using (Representable)", "open import Categories.Functor.Properties using (Faithful)" ]
src/Categories/Category/Concrete.agda
RepresentablyConcrete
Category (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where eta-equality infix 4 _≈_ _⇒_ infixr 9 _∘_ field Obj : Set o _⇒_ : Rel Obj ℓ _≈_ : ∀ {A B} → Rel (A ⇒ B) e id : ∀ {A} → (A ⇒ A) _∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C) field assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f) -- We add a symmetric proof of associativity so that the opposite category of the -- opposite category is definitionally equal to the original category. See how -- `op` is implemented. sym-assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → h ∘ (g ∘ f) ≈ (h ∘ g) ∘ f identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f -- We add a proof of "neutral" identity proof, in order to ensure the opposite of -- constant functor is definitionally equal to itself. identity² : ∀ {A} → id ∘ id {A} ≈ id {A} equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B}) ∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i module Equiv {A B : Obj} = IsEquivalence (equiv {A} {B}) open Equiv ∘-resp-≈ˡ : ∀ {A B C} {f h : B ⇒ C} {g : A ⇒ B} → f ≈ h → f ∘ g ≈ h ∘ g ∘-resp-≈ˡ pf = ∘-resp-≈ pf refl ∘-resp-≈ʳ : ∀ {A B C} {f h : A ⇒ B} {g : B ⇒ C} → f ≈ h → g ∘ f ≈ g ∘ h ∘-resp-≈ʳ pf = ∘-resp-≈ refl pf hom-setoid : ∀ {A B} → Setoid _ _ hom-setoid {A} {B} = record { Carrier = A ⇒ B ; _≈_ = _≈_ ; isEquivalence = equiv } -- When a category is quantified, it is convenient to refer to the levels from a module, -- so we do not have to explicitly quantify over a category when universe levels do not -- play a big part in a proof (which is the case probably all the time). o-level : Level o-level = o ℓ-level : Level ℓ-level = ℓ e-level : Level e-level = e -- Reasoning combinators. _≈⟨_⟩_ and _≈˘⟨_⟩_ from SetoidR. -- Also some useful combinators for doing reasoning on _∘_ chains module HomReasoning {A B : Obj} where open SetoidR (hom-setoid {A} {B}) public -- open Equiv {A = A} {B = B} public infixr 4 _⟩∘⟨_ refl⟩∘⟨_ infixl 5 _⟩∘⟨refl _⟩∘⟨_ : ∀ {M} {f h : M ⇒ B} {g i : A ⇒ M} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i _⟩∘⟨_ = ∘-resp-≈ refl⟩∘⟨_ : ∀ {M} {f : M ⇒ B} {g i : A ⇒ M} → g ≈ i → f ∘ g ≈ f ∘ i refl⟩∘⟨_ = Equiv.refl ⟩∘⟨_ _⟩∘⟨refl : ∀ {M} {f h : M ⇒ B} {g : A ⇒ M} → f ≈ h → f ∘ g ≈ h ∘ g _⟩∘⟨refl = _⟩∘⟨ Equiv.refl -- convenient inline versions infix 2 ⟺ infixr 3 _○_ ⟺ : {f g : A ⇒ B} → f ≈ g → g ≈ f ⟺ = Equiv.sym _○_ : {f g h : A ⇒ B} → f ≈ g → g ≈ h → f ≈ h _○_ = Equiv.trans op : Category o ℓ e op = record { Obj = Obj ; _⇒_ = flip _⇒_ ; _≈_ = _≈_ ; _∘_ = flip _∘_ ; id = id ; assoc = sym-assoc ; sym-assoc = assoc ; identityˡ = identityʳ ; identityʳ = identityˡ ; identity² = identity² ; equiv = equiv ; ∘-resp-≈ = flip ∘-resp-≈ }
record
src
[ "open import Level", "open import Function.Base using (flip)", "open import Relation.Binary using (Rel; IsEquivalence; Setoid)", "open import Relation.Binary.PropositionalEquality as ≡ using (_≡_)", "import Relation.Binary.Reasoning.Setoid as SetoidR" ]
src/Categories/Category/Core.agda
Category
HasDagger {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C infix 10 _† field _† : ∀ {A B} → A ⇒ B → B ⇒ A †-identity : ∀ {A} → id {A} † ≈ id †-homomorphism : ∀ {A B C} {f : A ⇒ B} {g : B ⇒ C} → (g ∘ f) † ≈ f † ∘ g † †-resp-≈ : ∀ {A B} {f g : A ⇒ B} → f ≈ g → f † ≈ g † †-involutive : ∀ {A B} (f : A ⇒ B) → f † † ≈ f †-Functor : Functor op C †-Functor = record { F₀ = λ A → A ; F₁ = _† ; identity = †-identity ; homomorphism = †-homomorphism ; F-resp-≈ = †-resp-≈ } isUnitary : ∀ {A B} → Pred (A ⇒ B) e isUnitary f = Iso C f (f †) isSelfAdjoint : ∀ {A} → Pred (A ⇒ A) e isSelfAdjoint f = f † ≈ f
record
src
[ "open import Level using (_⊔_; suc)", "open import Relation.Unary using (Pred)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor.Core using (Functor)", "open import Categories.Morphism using (Iso)" ]
src/Categories/Category/Dagger.agda
HasDagger
DaggerCategory o ℓ e : Set (suc (o ⊔ ℓ ⊔ e)) where field C : Category o ℓ e hasDagger : HasDagger C open Category C public open HasDagger hasDagger public
record
src
[ "open import Level using (_⊔_; suc)", "open import Relation.Unary using (Pred)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor.Core using (Functor)", "open import Categories.Morphism using (Iso)" ]
src/Categories/Category/Dagger.agda
DaggerCategory
IsDiscrete {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C using (Obj; _⇒_; _≈_) field isGroupoid : IsGroupoid C preorder : {A B : Obj} → (f g : A ⇒ B) → f ≈ g
record
src
[ "open import Level using (Level; suc; _⊔_)", "open import Categories.Category using (Category)", "open import Categories.Category.Groupoid using (IsGroupoid)" ]
src/Categories/Category/Discrete.agda
IsDiscrete
DiscreteCategory (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where field category : Category o ℓ e isDiscrete : IsDiscrete category open IsDiscrete isDiscrete public
record
src
[ "open import Level using (Level; suc; _⊔_)", "open import Categories.Category using (Category)", "open import Categories.Category.Groupoid using (IsGroupoid)" ]
src/Categories/Category/Discrete.agda
DiscreteCategory
Distributive : Set (levelOfTerm 𝒞) where field cartesian : Cartesian 𝒞 cocartesian : Cocartesian 𝒞 open Cartesian cartesian using (products) open BinaryProducts products open Cocartesian cocartesian distributeˡ : ∀ {A B C : Obj} → A × B + A × C ⇒ A × (B + C) distributeˡ = [ id ⁂ i₁ , id ⁂ i₂ ] field isIsoˡ : ∀ {A B C : Obj} → IsIso (distributeˡ {A} {B} {C}) -- The following is then also an iso distributeʳ : ∀ {A B C : Obj} → B × A + C × A ⇒ (B + C) × A distributeʳ = [ i₁ ⁂ id , i₂ ⁂ id ] isIsoʳ : ∀ {A B C : Obj} → IsIso (distributeʳ {A} {B} {C}) isIsoʳ {A} {B} {C} = record { inv = ((swap +₁ swap) ∘ inv) ∘ swap ; iso = record { isoˡ = begin (((swap +₁ swap) ∘ inv) ∘ swap) ∘ [ i₁ ⁂ id , i₂ ⁂ id ] ≈⟨ ∘[] ⟩ [ (((swap +₁ swap) ∘ inv) ∘ swap) ∘ (i₁ ⁂ id) , (((swap +₁ swap) ∘ inv) ∘ swap) ∘ (i₂ ⁂ id) ] ≈⟨ []-cong₂ (pullʳ swap∘⁂) (pullʳ swap∘⁂) ⟩ [ ((swap +₁ swap) ∘ inv) ∘ (id ⁂ i₁) ∘ swap , ((swap +₁ swap) ∘ inv) ∘ (id ⁂ i₂) ∘ swap ] ≈˘⟨ ∘[] ⟩ ((swap +₁ swap) ∘ inv) ∘ [ (id ⁂ i₁) ∘ swap , (id ⁂ i₂) ∘ swap ] ≈˘⟨ refl⟩∘⟨ []∘+₁ ⟩ ((swap +₁ swap) ∘ inv) ∘ [ (id ⁂ i₁) , (id ⁂ i₂) ] ∘ (swap +₁ swap) ≈⟨ cancelInner isoˡ ⟩ (swap +₁ swap) ∘ (swap +₁ swap) ≈⟨ +₁∘+₁ ⟩ (swap ∘ swap) +₁ (swap ∘ swap) ≈⟨ +₁-cong₂ swap∘swap swap∘swap ⟩ (id +₁ id) ≈⟨ +-unique id-comm-sym id-comm-sym ⟩ id ∎ ; isoʳ = begin [ i₁ ⁂ id , i₂ ⁂ id ] ∘ ((swap +₁ swap) ∘ inv) ∘ swap ≈⟨ pull-first []∘+₁ ⟩ [ (i₁ ⁂ id) ∘ swap , (i₂ ⁂ id) ∘ swap ] ∘ inv ∘ swap ≈˘⟨ []-cong₂ swap∘⁂ swap∘⁂ ⟩∘⟨refl ⟩ [ swap ∘ (id ⁂ i₁) , swap ∘ (id ⁂ i₂) ] ∘ inv ∘ swap ≈˘⟨ ∘[] ⟩∘⟨refl ⟩ (swap ∘ [ (id ⁂ i₁) , (id ⁂ i₂) ]) ∘ inv ∘ swap ≈⟨ cancelInner isoʳ ⟩ swap ∘ swap ≈⟨ swap∘swap ⟩ id ∎ } } where open IsIso (isIsoˡ {A} {B} {C}) -- The inverse is what one is usually interested in distributeˡ⁻¹ : ∀ {A B C : Obj} → A × (B + C) ⇒ A × B + A × C distributeˡ⁻¹ = IsIso.inv isIsoˡ distributeʳ⁻¹ : ∀ {A B C : Obj} → (B + C) × A ⇒ B × A + C × A distributeʳ⁻¹ = IsIso.inv isIsoʳ
record
src
[ "open import Level using (levelOfTerm)", "open import Categories.Category.Core using (Category)", "open import Categories.Category.Cartesian using (Cartesian)", "open import Categories.Category.BinaryProducts using (BinaryProducts)", "open import Categories.Category.Cocartesian using (Cocartesian)", "import Categories.Morphism as M", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Category/Distributive.agda
Distributive
WeakInverse (F : Functor C D) (G : Functor D C) : Set (levelOfTerm F ⊔ levelOfTerm G) where field F∘G≈id : NaturalIsomorphism (F ∘F G) idF G∘F≈id : NaturalIsomorphism (G ∘F F) idF module F∘G≈id = NaturalIsomorphism F∘G≈id module G∘F≈id = NaturalIsomorphism G∘F≈id
record
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
WeakInverse
StrongEquivalence {o ℓ e o′ ℓ′ e′} (C : Category o ℓ e) (D : Category o′ ℓ′ e′) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where field F : Functor C D G : Functor D C weak-inverse : WeakInverse F G open WeakInverse weak-inverse public op : StrongEquivalence (Category.op C) (Category.op D) op = record { F = Functor.op F ; G = Functor.op G ; weak-inverse = record { F∘G≈id = NaturalIsomorphism.op′ F∘G≈id ; G∘F≈id = NaturalIsomorphism.op′ G∘F≈id } } refl : StrongEquivalence C C refl = record { F = idF ; G = idF ; weak-inverse = record { F∘G≈id = unitorˡ ; G∘F≈id = unitorˡ } } sym : StrongEquivalence C D → StrongEquivalence D C sym e = record { F = G ; G = F ; weak-inverse = record { F∘G≈id = G∘F≈id ; G∘F≈id = F∘G≈id } } where open StrongEquivalence e trans : StrongEquivalence C D → StrongEquivalence D E → StrongEquivalence C E trans {C = C} {D = D} {E = E} e e′ = record { F = e′.F ∘F e.F ; G = e.G ∘F e′.G ; weak-inverse = record { F∘G≈id = let module S = Setoid (≃.Functor-NI-setoid E E) in S.trans (S.trans (associator (e.G ∘F e′.G) e.F e′.F) (e′.F ⓘˡ (unitorˡ ⓘᵥ (e.F∘G≈id ⓘʳ e′.G) ⓘᵥ ≃.sym (associator e′.G e.G e.F)))) e′.F∘G≈id ; G∘F≈id = let module S = Setoid (≃.Functor-NI-setoid C C) in S.trans (S.trans (associator (e′.F ∘F e.F) e′.G e.G) (e.G ⓘˡ (unitorˡ ⓘᵥ (e′.G∘F≈id ⓘʳ e.F) ⓘᵥ ≃.sym (associator e.F e′.F e′.G)))) e.G∘F≈id } } where module e = StrongEquivalence e module e′ = StrongEquivalence e′ isEquivalence : ∀ {o ℓ e} → IsEquivalence (StrongEquivalence {o} {ℓ} {e}) isEquivalence = record { refl = refl ; sym = sym ; trans = trans } setoid : ∀ o ℓ e → Setoid _ _ setoid o ℓ e = record { Carrier = Category o ℓ e ; _≈_ = StrongEquivalence ; isEquivalence = isEquivalence }
record
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
StrongEquivalence
refl : StrongEquivalence C C
function
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
refl
sym : StrongEquivalence C D → StrongEquivalence D C
function
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
sym
trans : StrongEquivalence C D → StrongEquivalence D E → StrongEquivalence C E
function
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
trans
isEquivalence : ∀ {o ℓ e} → IsEquivalence (StrongEquivalence {o} {ℓ} {e})
function
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
isEquivalence
setoid : ∀ o ℓ e → Setoid _ _
function
src
[ "open import Level", "open import Relation.Binary using (IsEquivalence; Setoid)", "open import Categories.Category.Core using (Category)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.NaturalIsomorphism as ≃" ]
src/Categories/Category/Equivalence.agda
setoid
Exact {o ℓ e : Level} (𝒞 : Category o ℓ e) : Set (suc (o ⊔ ℓ ⊔ e)) where open Category 𝒞 open Pullback open Coequalizer open Equivalence field regular : Regular 𝒞 quotient : ∀ {X : Obj} (E : Equivalence 𝒞 X) → Coequalizer 𝒞 (R.p₁ E) (R.p₂ E) effective : ∀ {X : Obj} (E : Equivalence 𝒞 X) → IsPullback 𝒞 (R.p₁ E) (R.p₂ E) (arr (quotient E)) (arr (quotient E))
record
src
[ "open import Level", "open import Categories.Category.Core", "open import Categories.Diagram.Pullback", "open import Categories.Category.Cocartesian", "open import Categories.Object.Coproduct", "open import Categories.Morphism", "open import Categories.Diagram.Coequalizer", "open import Categories.Diagram.KernelPair", "open import Categories.Category.Regular", "open import Categories.Morphism.Regular", "open import Categories.Object.InternalRelation" ]
src/Categories/Category/Exact.agda
Exact
Extensive {o ℓ e : Level} (𝒞 : Category o ℓ e) : Set (suc (o ⊔ ℓ ⊔ e)) where open Category 𝒞 open Pullback using (p₁) field cocartesian : Cocartesian 𝒞 module CC = Cocartesian cocartesian open CC using (_+_; i₁; i₂; ¡) field pullback₁ : {A B C : Obj} (f : A ⇒ B + C) → Pullback 𝒞 f i₁ pullback₂ : {A B C : Obj} (f : A ⇒ B + C) → Pullback 𝒞 f i₂ pullback-of-cp-is-cp : {A B C : Obj} (f : A ⇒ B + C) → IsCoproduct 𝒞 (p₁ (pullback₁ f)) (p₁ (pullback₂ f)) pullback₁-is-mono : ∀ {A B : Obj} → Mono 𝒞 (i₁ {A = A}{B = B}) pullback₂-is-mono : ∀ {A B : Obj} → Mono 𝒞 (i₂ {A = A}{B = B}) disjoint : ∀ {A B : Obj} → IsPullback 𝒞 ¡ ¡ (i₁ {A = A}{B = B}) i₂ -- a version with non-canonical pullbacks module _ {A B C : Obj} {f : A ⇒ B + C} (pb₁ : Pullback 𝒞 f i₁) (pb₂ : Pullback 𝒞 f i₂) where private open IsCoproduct (pullback-of-cp-is-cp f) open HomReasoning; open MR 𝒞 open IsoPb 𝒞 (pullback₁ f) pb₁ renaming (P₀⇒P₁ to pb₁-to-can; p₁-≈ to p₁-≈₁) open IsoPb 𝒞 (pullback₂ f) pb₂ renaming (P₀⇒P₁ to pb₂-to-can; p₁-≈ to p₁-≈₂) can-to-pb₁ = _≅_.from $ up-to-iso 𝒞 pb₁ (pullback₁ f) can-to-pb₂ = _≅_.from $ up-to-iso 𝒞 pb₂ (pullback₂ f) pullback-of-cp-is-cp' : IsCoproduct 𝒞 (p₁ pb₁) (p₁ pb₂) IsCoproduct.[_,_] pullback-of-cp-is-cp' g h = [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] IsCoproduct.inject₁ pullback-of-cp-is-cp' {_}{g}{h} = begin [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] ∘ p₁ pb₁ ≈˘⟨ refl⟩∘⟨ cancelʳ (Iso.isoˡ $ _≅_.iso $ up-to-iso 𝒞 pb₁ (pullback₁ f)) ⟩ [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] ∘ (p₁ pb₁ ∘ pb₁-to-can) ∘ can-to-pb₁ ≈⟨ refl⟩∘⟨ p₁-≈₁ ⟩∘⟨refl ⟩ [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] ∘ p₁ (pullback₁ f) ∘ can-to-pb₁ ≈⟨ pullˡ inject₁ ⟩ (g ∘ pb₁-to-can) ∘ can-to-pb₁ ≈⟨ cancelʳ (Iso.isoˡ $ _≅_.iso $ up-to-iso 𝒞 pb₁ (pullback₁ f)) ⟩ g ∎ IsCoproduct.inject₂ pullback-of-cp-is-cp' {_}{g}{h} = begin [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] ∘ p₁ pb₂ ≈˘⟨ refl⟩∘⟨ cancelʳ (Iso.isoˡ $ _≅_.iso $ up-to-iso 𝒞 pb₂ (pullback₂ f)) ⟩ [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] ∘ (p₁ pb₂ ∘ pb₂-to-can) ∘ can-to-pb₂ ≈⟨ refl⟩∘⟨ p₁-≈₂ ⟩∘⟨refl ⟩ [ g ∘ pb₁-to-can , h ∘ pb₂-to-can ] ∘ p₁ (pullback₂ f) ∘ can-to-pb₂ ≈⟨ pullˡ inject₂ ⟩ (h ∘ pb₂-to-can) ∘ can-to-pb₂ ≈⟨ cancelʳ (Iso.isoˡ $ _≅_.iso $ up-to-iso 𝒞 pb₂ (pullback₂ f)) ⟩ h ∎ IsCoproduct.unique pullback-of-cp-is-cp' {_}{u}{g}{h} u∘p₁pb₁≈g u∘p₁pb₂≈h = unique (begin u ∘ p₁ (pullback₁ f) ≈˘⟨ pullʳ p₁-≈₁ ⟩ (u ∘ p₁ pb₁) ∘ pb₁-to-can ≈⟨ u∘p₁pb₁≈g ⟩∘⟨refl ⟩ g ∘ pb₁-to-can ∎) (begin u ∘ p₁ (pullback₂ f) ≈˘⟨ pullʳ p₁-≈₂ ⟩ (u ∘ p₁ pb₂) ∘ pb₂-to-can ≈⟨ u∘p₁pb₂≈h ⟩∘⟨refl ⟩ h ∘ pb₂-to-can ∎)
record
src
[ "open import Level", "open import Function using (_$_)", "open import Categories.Category.Core using (Category)", "open import Categories.Diagram.Pullback using (Pullback; IsPullback; up-to-iso)", "open import Categories.Diagram.Pullback.Properties using (module IsoPb)", "open import Categories.Category.Cocartesian using (Cocartesian)", "open import Categories.Object.Coproduct using (IsCoproduct)", "open import Categories.Morphism", "import Categories.Morphism.Reasoning as MR" ]
src/Categories/Category/Extensive.agda
Extensive
Finite {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where field shape : FinCatShape open FinCatShape public renaming (size to ∣Obj∣) shapeCat : Category _ _ _ shapeCat = FinCategory shape -- -- /------------\ -- < - \ -- C | S -- \ - ^ -- \------------/ -- field ⊣equiv : ⊣Equivalence shapeCat C module ⊣equiv = ⊣Equivalence ⊣equiv open ⊣equiv public
record
src
[ "open import Level", "open import Categories.Adjoint.Equivalence", "open import Categories.Category.Core", "open import Categories.Category.Finite.Fin" ]
src/Categories/Category/Finite.agda
Finite
IsGroupoid {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C public open Definitions C public open Categories.Morphism C infix 10 _⁻¹ field _⁻¹ : ∀ {A B} → A ⇒ B → B ⇒ A iso : ∀ {A B} {f : A ⇒ B} → Iso f (f ⁻¹) module iso {A B f} = Iso (iso {A} {B} {f}) equiv-obj : ∀ {A B} → A ⇒ B → A ≅ B equiv-obj f = record { from = f ; to = _ ; iso = iso } -- this definition doesn't seem to 'carry its weight' equiv-obj-sym : ∀ {A B} → A ⇒ B → B ≅ A equiv-obj-sym f = ≅.sym (equiv-obj f) -- A groupoid is a category that has a groupoid structure
record
src
[ "open import Level using (Level; suc; _⊔_)", "open import Categories.Category", "import Categories.Morphism" ]
src/Categories/Category/Groupoid.agda
IsGroupoid
Groupoid (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where field category : Category o ℓ e isGroupoid : IsGroupoid category open IsGroupoid isGroupoid public
record
src
[ "open import Level using (Level; suc; _⊔_)", "open import Categories.Category", "import Categories.Morphism" ]
src/Categories/Category/Groupoid.agda
Groupoid
categoryHelper : ∀ {o ℓ e} → CategoryHelper o ℓ e → Category o ℓ e
function
src
[ "open import Level", "open import Relation.Binary using (Rel; IsEquivalence)", "open import Categories.Category.Core using (Category)" ]
src/Categories/Category/Helper.agda
categoryHelper
Indiscrete : ∀ {o ℓ} (A : Set o) → Category o ℓ ℓ
function
src
[ "open import Level", "open import Data.Unit", "open import Categories.Category", "open import Relation.Binary.PropositionalEquality as ≡" ]
src/Categories/Category/Indiscrete.agda
Indiscrete
pseudo-iso {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C open Definitions C open Categories.Morphism C infix 10 _⁻¹ field _⁻¹ : ∀ {A B} → (f : A ⇒ B) → B ⇒ A pseudo-iso₁ : ∀ {A B} {f : A ⇒ B} → f ∘ f ⁻¹ ∘ f ≈ f pseudo-iso₂ : ∀ {A B} {f : A ⇒ B} → f ⁻¹ ∘ f ∘ f ⁻¹ ≈ f ⁻¹
record
src
[ "open import Level using (Level; suc; _⊔_)", "open import Categories.Category", "open import Data.Product", "import Categories.Morphism" ]
src/Categories/Category/Inverse.agda
pseudo-iso
Inverse {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C open Definitions C open Categories.Morphism C open pseudo-iso field piso : pseudo-iso C unique : ∀ {p : pseudo-iso C} {A B} → (f : A ⇒ B) → _⁻¹ piso f ≈ _⁻¹ p f
record
src
[ "open import Level using (Level; suc; _⊔_)", "open import Categories.Category", "open import Data.Product", "import Categories.Morphism" ]
src/Categories/Category/Inverse.agda
Inverse
liftC : ∀ {o ℓ e} o′ ℓ′ e′ → Category o ℓ e → Category (o ⊔ o′) (ℓ ⊔ ℓ′) (e ⊔ e′)
function
src
[ "open import Level", "open import Categories.Category", "open import Categories.Functor using (Functor)" ]
src/Categories/Category/Lift.agda
liftC
liftF : ∀ {o ℓ e} o′ ℓ′ e′ (C : Category o ℓ e) → Functor C (liftC o′ ℓ′ e′ C)
function
src
[ "open import Level", "open import Categories.Category", "open import Categories.Functor using (Functor)" ]
src/Categories/Category/Lift.agda
liftF
unliftF : ∀ {o ℓ e} o′ ℓ′ e′ (C : Category o ℓ e) → Functor (liftC o′ ℓ′ e′ C) C
function
src
[ "open import Level", "open import Categories.Category", "open import Categories.Functor using (Functor)" ]
src/Categories/Category/Lift.agda
unliftF
Product : (C : Category o ℓ e) (D : Category o′ ℓ′ e′) → Category (o ⊔ o′) (ℓ ⊔ ℓ′) (e ⊔ e′)
function
src
[ "open import Level", "open import Function using () renaming (_∘_ to _∙_)", "open import Data.Product using (_×_; Σ; _,_; proj₁; proj₂; zip; map; <_,_>; swap)", "open import Categories.Utils.Product", "open import Categories.Category using (Category)", "open import Categories.Category.Groupoid using (IsGroupoid)", "open import Categories.Functor renaming (id to idF)", "open import Categories.NaturalTransformation.Core", "open import Categories.NaturalTransformation.NaturalIsomorphism hiding (refl)", "import Categories.Morphism as Morphism" ]
src/Categories/Category/Product.agda
Product
Regular {o ℓ e : Level} (𝒞 : Category o ℓ e) : Set (suc (o ⊔ ℓ ⊔ e)) where open Category 𝒞 open Pullback field finitely-complete : FinitelyComplete 𝒞 coeq-of-kernelpairs : {A B : Obj} (f : A ⇒ B) (kp : KernelPair 𝒞 f) → Coequalizer 𝒞 (p₁ kp) (p₂ kp) pullback-of-regularepi-is-regularepi : {A B C : Obj} (f : B ⇒ A) {g : C ⇒ A} → RegularEpi 𝒞 f → (p : Pullback 𝒞 f g) → RegularEpi 𝒞 (p₂ p)
record
src
[ "open import Level", "open import Categories.Category.Core", "open import Categories.Category.Complete.Finitely using (FinitelyComplete)", "open import Categories.Diagram.Coequalizer", "open import Categories.Diagram.KernelPair", "open import Categories.Diagram.Pullback", "open import Categories.Morphism.Regular" ]
src/Categories/Category/Regular.agda
Regular
Restriction (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C using (Obj; _⇒_; _∘_; _≈_; id) field _↓ : {A B : Obj} → A ⇒ B → A ⇒ A -- partial identity on the right pidʳ : {A B : Obj} {f : A ⇒ B} → f ∘ f ↓ ≈ f -- the domain-of-definition arrows commute ↓-comm : {A B C : Obj} {f : A ⇒ B} {g : A ⇒ C} → f ↓ ∘ g ↓ ≈ g ↓ ∘ f ↓ -- domain-of-definition denests (on the right) ↓-denestʳ : {A B C : Obj} {f : A ⇒ B} {g : A ⇒ C} → (g ∘ f ↓) ↓ ≈ g ↓ ∘ f ↓ -- domain-of-definition has a skew-commutative law ↓-skew-comm : {A B C : Obj} {g : A ⇒ B} {f : C ⇒ A} → g ↓ ∘ f ≈ f ∘ (g ∘ f) ↓ -- and the new axiom, ↓ is a congruence ↓-cong : {A B : Obj} {f g : A ⇒ B} → f ≈ g → f ↓ ≈ g ↓ -- it is convenient to define the total predicate in this context total : {A B : Obj} (f : A ⇒ B) → Set e total f = f ↓ ≈ id
record
src
[ "open import Level using (Level; _⊔_)", "open import Categories.Category.Core using (Category)" ]
src/Categories/Category/Restriction.agda
Restriction
RigCategory {M⊎ M× : Monoidal C} (S⊎ : Symmetric M⊎) (S× : Symmetric M×) : Set (o ⊔ ℓ ⊔ e) where open Commutation C open Definitions C module M⊎ = Monoidal M⊎ module M× = Monoidal M× module S⊎ = Symmetric S⊎ module S× = Symmetric S× open M⊎ renaming (_⊗₀_ to _⊕₀_; _⊗₁_ to _⊕₁_) open M× private 0C : C.Obj 0C = M⊎.unit 1C : C.Obj 1C = M×.unit private B⊗ : X ⊗₀ Y ⇒ Y ⊗₀ X B⊗ {X} {Y} = S×.braiding.⇒.η (X , Y) B⊕ : ∀ {X Y} → X ⊕₀ Y ⇒ Y ⊕₀ X B⊕ {X} {Y} = S⊎.braiding.⇒.η (X , Y) field annₗ : ∀ {X} → 0C ⊗₀ X ≅ 0C annᵣ : ∀ {X} → X ⊗₀ 0C ≅ 0C distribₗ : ∀ {X Y Z} → X ⊗₀ (Y ⊕₀ Z) ≅ (X ⊗₀ Y) ⊕₀ (X ⊗₀ Z) distribᵣ : ∀ {X Y Z} → (X ⊕₀ Y) ⊗₀ Z ≅ (X ⊗₀ Z) ⊕₀ (Y ⊗₀ Z) private λ* : ∀ {X} → 0C ⊗₀ X ⇒ 0C λ* {X} = _≅_.from (annₗ {X}) ρ* : ∀ {X} → X ⊗₀ 0C ⇒ 0C ρ* {X} = _≅_.from (annᵣ {X}) module dl {X} {Y} {Z} = _≅_ (distribₗ {X} {Y} {Z}) module dr {X} {Y} {Z} = _≅_ (distribᵣ {X} {Y} {Z}) ⊗λ⇒ = M×.unitorˡ.from ⊗λ⇐ = M×.unitorˡ.to ⊗ρ⇒ = M×.unitorʳ.from ⊗ρ⇐ = M×.unitorʳ.to ⊗α⇒ = M×.associator.from ⊗α⇐ = M×.associator.to ⊕λ⇒ = M⊎.unitorˡ.from ⊕λ⇐ = M⊎.unitorˡ.to ⊕ρ⇒ = M⊎.unitorʳ.from ⊕ρ⇐ = M⊎.unitorʳ.to ⊕α⇒ = M⊎.associator.from ⊕α⇐ = M⊎.associator.to -- Naturality conditions for ann and distrib field annₗ-commute : CommutativeSquare (id ⊗₁ f) λ* λ* id annᵣ-commute : CommutativeSquare (f ⊗₁ id) ρ* ρ* id dl-commute : CommutativeSquare (f ⊗₁ (g ⊕₁ h)) dl.from dl.from ((f ⊗₁ g) ⊕₁ (f ⊗₁ h)) dr-commute : CommutativeSquare ((f ⊕₁ g) ⊗₁ h) dr.from dr.from ((f ⊗₁ h) ⊕₁ (g ⊗₁ h)) -- need II, IX, X, XV -- choose I, IV, VI, XI, XIII, XIX, XXIII and (XVI, XVII) field laplazaI : ∀ {A B C} → [ A ⊗₀ (B ⊕₀ C) ⇒ (A ⊗₀ C) ⊕₀ (A ⊗₀ B) ]⟨ dl.from ⇒⟨ (A ⊗₀ B) ⊕₀ (A ⊗₀ C) ⟩ B⊕ ≈ C.id ⊗₁ B⊕ ⇒⟨ A ⊗₀ (C ⊕₀ B) ⟩ dl.from ⟩ laplazaII : ∀ {A B C} → [ (A ⊕₀ B) ⊗₀ C ⇒ (C ⊗₀ A) ⊕₀ (C ⊗₀ B) ]⟨ B⊗ ⇒⟨ C ⊗₀ (A ⊕₀ B) ⟩ dl.from ≈ dr.from ⇒⟨ (A ⊗₀ C) ⊕₀ (B ⊗₀ C) ⟩ B⊗ ⊕₁ B⊗ ⟩ laplazaIV : {A B C D : Obj} → [ (A ⊕₀ B ⊕₀ C) ⊗₀ D ⇒ ((A ⊗₀ D) ⊕₀ (B ⊗₀ D)) ⊕₀ (C ⊗₀ D) ]⟨ dr.from ⇒⟨ (A ⊗₀ D) ⊕₀ ((B ⊕₀ C) ⊗₀ D) ⟩ C.id ⊕₁ dr.from ⇒⟨ (A ⊗₀ D) ⊕₀ ((B ⊗₀ D) ⊕₀ (C ⊗₀ D)) ⟩ ⊕α⇐ ≈ ⊕α⇐ ⊗₁ C.id ⇒⟨ ((A ⊕₀ B) ⊕₀ C) ⊗₀ D ⟩ dr.from ⇒⟨ ((A ⊕₀ B) ⊗₀ D) ⊕₀ (C ⊗₀ D) ⟩ dr.from ⊕₁ C.id ⟩ laplazaVI : {A B C D : Obj} → [ A ⊗₀ B ⊗₀ (C ⊕₀ D) ⇒ ((A ⊗₀ B) ⊗₀ C) ⊕₀ ((A ⊗₀ B) ⊗₀ D) ]⟨ C.id ⊗₁ dl.from ⇒⟨ A ⊗₀ ((B ⊗₀ C) ⊕₀ (B ⊗₀ D)) ⟩ dl.from ⇒⟨ (A ⊗₀ B ⊗₀ C) ⊕₀ (A ⊗₀ B ⊗₀ D) ⟩ ⊗α⇐ ⊕₁ ⊗α⇐ ≈ ⊗α⇐ ⇒⟨ (A ⊗₀ B) ⊗₀ (C ⊕₀ D) ⟩ dl.from ⟩ laplazaIX : ∀ {A B C D} → [ (A ⊕₀ B) ⊗₀ (C ⊕₀ D) ⇒ (((A ⊗₀ C) ⊕₀ (B ⊗₀ C)) ⊕₀ (A ⊗₀ D)) ⊕₀ (B ⊗₀ D) ]⟨ dr.from ⇒⟨ (A ⊗₀ (C ⊕₀ D)) ⊕₀ (B ⊗₀ (C ⊕₀ D)) ⟩ dl.from ⊕₁ dl.from ⇒⟨ ((A ⊗₀ C) ⊕₀ (A ⊗₀ D)) ⊕₀ ((B ⊗₀ C) ⊕₀ (B ⊗₀ D)) ⟩ ⊕α⇐ ⇒⟨ (((A ⊗₀ C) ⊕₀ (A ⊗₀ D)) ⊕₀ (B ⊗₀ C)) ⊕₀ (B ⊗₀ D) ⟩ ⊕α⇒ ⊕₁ C.id ⇒⟨ ((A ⊗₀ C) ⊕₀ ((A ⊗₀ D) ⊕₀ (B ⊗₀ C))) ⊕₀ (B ⊗₀ D) ⟩ (C.id ⊕₁ B⊕) ⊕₁ C.id ⇒⟨ ((A ⊗₀ C) ⊕₀ ((B ⊗₀ C) ⊕₀ (A ⊗₀ D))) ⊕₀ (B ⊗₀ D) ⟩ ⊕α⇐ ⊕₁ C.id ≈ dl.from ⇒⟨ ((A ⊕₀ B) ⊗₀ C) ⊕₀ ((A ⊕₀ B) ⊗₀ D) ⟩ dr.from ⊕₁ dr.from ⇒⟨ ((A ⊗₀ C) ⊕₀ (B ⊗₀ C)) ⊕₀ ((A ⊗₀ D) ⊕₀ (B ⊗₀ D)) ⟩ ⊕α⇐ ⟩ laplazaX : [ 0C ⊗₀ 0C ⇒ 0C ]⟨ λ* ≈ ρ* ⟩ laplazaXI : ∀ {A B} → [ 0C ⊗₀ (A ⊕₀ B) ⇒ 0C ]⟨ dl.from ⇒⟨ (0C ⊗₀ A) ⊕₀ (0C ⊗₀ B) ⟩ λ* ⊕₁ λ* ⇒⟨ 0C ⊕₀ 0C ⟩ ⊕λ⇒ ≈ λ* ⟩ laplazaXIII : [ 0C ⊗₀ 1C ⇒ 0C ]⟨ ⊗ρ⇒ ≈ λ* ⟩ laplazaXV : ∀ {A : Obj} → [ A ⊗₀ 0C ⇒ 0C ]⟨ ρ* ≈ B⊗ ⇒⟨ 0C ⊗₀ A ⟩ λ* ⟩ laplazaXVI : ∀ {A B} → [ 0C ⊗₀ (A ⊗₀ B) ⇒ 0C ]⟨ ⊗α⇐ ⇒⟨ (0C ⊗₀ A) ⊗₀ B ⟩ λ* ⊗₁ C.id ⇒⟨ 0C ⊗₀ B ⟩ λ* ≈ λ* ⟩ laplazaXVII : ∀ {A B} → [ A ⊗₀ (0C ⊗₀ B) ⇒ 0C ]⟨ ⊗α⇐ ⇒⟨ (A ⊗₀ 0C) ⊗₀ B ⟩ ρ* ⊗₁ C.id ⇒⟨ 0C ⊗₀ B ⟩ λ* ≈ C.id ⊗₁ λ* ⇒⟨ A ⊗₀ 0C ⟩ ρ* ⟩ laplazaXIX : ∀ {A B} → [ A ⊗₀ (0C ⊕₀ B) ⇒ A ⊗₀ B ]⟨ dl.from ⇒⟨ (A ⊗₀ 0C) ⊕₀ (A ⊗₀ B) ⟩ ρ* ⊕₁ C.id ⇒⟨ 0C ⊕₀ (A ⊗₀ B) ⟩ ⊕λ⇒ ≈ C.id ⊗₁ ⊕λ⇒ ⟩ laplazaXXIII : ∀ {A B} → [ 1C ⊗₀ (A ⊕₀ B) ⇒ (A ⊕₀ B) ]⟨ ⊗λ⇒ ≈ dl.from ⇒⟨ (1C ⊗₀ A) ⊕₀ (1C ⊗₀ B) ⟩ ⊗λ⇒ ⊕₁ ⊗λ⇒ ⟩
record
src
[ "open import Categories.Category", "open import Level", "open import Data.Fin.Base using () renaming (zero to 0F; suc to sucF)", "open import Data.Product using (_,_)", "open import Categories.Functor.Core", "open import Categories.Category.Monoidal", "open import Categories.Category.Monoidal.Braided", "open import Categories.Category.Monoidal.Symmetric", "open import Categories.NaturalTransformation.NaturalIsomorphism", "open import Categories.NaturalTransformation using (_∘ᵥ_; _∘ₕ_; _∘ˡ_; _∘ʳ_; NaturalTransformation)", "open import Categories.Morphism C" ]
src/Categories/Category/RigCategory.agda
RigCategory
Coverage {i} j {I : Obj → Set i} (covering₀ : ∀ {X} → I X → Obj) (covering₁ : ∀ {X} (i : I X) → covering₀ i ⇒ X) : Set (i ⊔ suc j ⊔ o ⊔ ℓ ⊔ e) where field J : ∀ (g : Y ⇒ Z) → Set j universal₀ : ∀ {g : Y ⇒ Z} → J g → Obj universal₁ : ∀ {g : Y ⇒ Z} (j : J g) → universal₀ j ⇒ Y commute : ∀ {g : Y ⇒ Z} (j : J g) → ∃₂ (λ i k → g ∘ universal₁ j ≈ covering₁ i ∘ k)
record
src
[ "open import Categories.Category", "open import Level", "open import Data.Product using (Σ; _,_; ∃₂)" ]
src/Categories/Category/Site.agda
Coverage
Site i j : Set (suc i ⊔ suc j ⊔ o ⊔ ℓ ⊔ e) where field I : Obj → Set i covering₀ : ∀ {X} → I X → Obj covering₁ : ∀ {X} (i : I X) → covering₀ i ⇒ X coverage : Coverage j covering₀ covering₁ module coverage = Coverage coverage open coverage public
record
src
[ "open import Categories.Category", "open import Level", "open import Data.Product using (Σ; _,_; ∃₂)" ]
src/Categories/Category/Site.agda
Site
SliceObj (X : Obj) : Set (o ⊔ ℓ) where constructor sliceobj field {Y} : Obj arr : Y ⇒ X private variable A : Obj X Y Z : SliceObj A
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary.Core using (Rel)", "open import Categories.Morphism.Reasoning 𝒞" ]
src/Categories/Category/Slice.agda
SliceObj
Slice ⇒ {A : Obj} (X Y : SliceObj A) : Set (ℓ ⊔ e) where constructor slicearr private module X = SliceObj X module Y = SliceObj Y field {h} : X.Y ⇒ Y.Y △ : Y.arr ∘ h ≈ X.arr Slice : Obj → Category _ _ _ Slice A = record { Obj = SliceObj A ; _⇒_ = Slice⇒ ; _≈_ = λ where (slicearr {f} _) (slicearr {g} _) → f ≈ g ; id = slicearr identityʳ ; _∘_ = λ (slicearr △) (slicearr △′) → slicearr (glueTrianglesʳ △ △′) ; assoc = assoc ; sym-assoc = sym-assoc ; identityˡ = identityˡ ; identityʳ = identityʳ ; identity² = identity² ; equiv = record -- must be expanded to get levels to work out { refl = refl ; sym = sym ; trans = trans } ; ∘-resp-≈ = ∘-resp-≈ }
record
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary.Core using (Rel)", "open import Categories.Morphism.Reasoning 𝒞" ]
src/Categories/Category/Slice.agda
Slice
Slice : Obj → Category _ _ _
function
src
[ "open import Categories.Category.Core", "open import Level", "open import Relation.Binary.Core using (Rel)", "open import Categories.Morphism.Reasoning 𝒞" ]
src/Categories/Category/Slice.agda
Slice
Species : (o ℓ o′ ℓ′ : Level) → Category (suc (o ⊔ ℓ ⊔ o′ ⊔ ℓ′)) (suc (o ⊔ ℓ) ⊔ (o′ ⊔ ℓ′)) (suc (o ⊔ ℓ) ⊔ o′ ⊔ ℓ′)
function
src
[ "open import Level", "open import Categories.Category.Core using (Category)", "open import Categories.Category.Construction.Functors", "open import Categories.Category.Construction.Core using (Core)", "open import Categories.Category.Instance.FinSetoids using (FinSetoids)", "open import Categories.Category.Instance.Setoids using (Setoids)" ]
src/Categories/Category/Species.agda
Species
SubCat (I : Set i) : Set (o ⊔ ℓ ⊔ i ⊔ suc ℓ′) where field U : I → Obj R : {a b : I} → U a ⇒ U b → Set ℓ′ Rid : {a : I} → R (id {U a}) _∘R_ : {a b c : I} {f : U b ⇒ U c} {g : U a ⇒ U b} → R f → R g → R (f ∘ g) SubCategory : SubCat {ℓ′ = ℓ′} I → Category _ _ _ SubCategory {I = I} sc = let open SubCat sc in record { Obj = I ; _⇒_ = λ a b → Σ (U a ⇒ U b) R ; _≈_ = λ f g → proj₁ f ≈ proj₁ g ; id = id , Rid ; _∘_ = zip _∘_ _∘R_ ; assoc = assoc ; sym-assoc = sym-assoc ; identityˡ = identityˡ ; identityʳ = identityʳ ; identity² = identity² ; equiv = record -- need to expand this out, else the levels don't work out { refl = refl ; sym = sym ; trans = trans } ; ∘-resp-≈ = ∘-resp-≈ } FullSubCategory : (U : I → Obj) → Category _ _ _ FullSubCategory {I = I} U = record { Obj = I ; _⇒_ = λ x y → U x ⇒ U y ; _≈_ = _≈_ ; id = id ; _∘_ = _∘_ ; assoc = assoc ; sym-assoc = sym-assoc ; identityˡ = identityˡ ; identityʳ = identityʳ ; identity² = identity² ; equiv = equiv ; ∘-resp-≈ = ∘-resp-≈ }
record
src
[ "open import Categories.Category", "open import Level", "open import Data.Product" ]
src/Categories/Category/SubCategory.agda
SubCat
SubCategory : SubCat {ℓ′ = ℓ′} I → Category _ _ _
function
src
[ "open import Categories.Category", "open import Level", "open import Data.Product" ]
src/Categories/Category/SubCategory.agda
SubCategory
End of preview. Expand in Data Studio

Agda-Categories

Structured dataset from agda-categories — Category theory.

730 declarations extracted from Agda source files.

Applications

  • Training language models on formal proofs
  • Fine-tuning theorem provers
  • Retrieval-augmented generation for proof assistants
  • Learning proof embeddings and representations

Source

Schema

Column Type Description
fact string Declaration body
type string data, record, function
library string Source module
imports list Required imports
filename string Source file path
symbolic_name string Identifier
Downloads last month
37

Collection including phanerozoic/Agda-Categories