Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions src/Categories/LocallyGraded.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{-# OPTIONS --without-K --safe #-}
module Categories.LocallyGraded where

open import Level
open import Data.Unit using (tt)
open import Data.Product using (_,_)

open import Categories.Bicategory
open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)

import Categories.Bicategory.Extras

-- Locally Graded categories, generalized to gradation via a bicategory.
--
-- Locally graded categories are a joint generalization of displayed categories
-- and enriched categories: display can be obtained by picking a discrete
-- bicategory as your gradition, and enrichment can be obtained by asking
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradition -> gradation

-- for representing objects of hom setoids.
record LocallyGraded
{o ℓ e t}
(B : Bicategory o ℓ e t)
(o' ℓ' e' : Level)
: Set (o ⊔ ℓ ⊔ e ⊔ t ⊔ suc o' ⊔ suc ℓ' ⊔ suc e') where
open Categories.Bicategory.Extras B
open Shorthands

infix 4 _⇒[_]_ _≈ᵥ_
infixr 11 _∘'_
infix 12 _⟨_⟩

field
-- Displayed objects and displayed morphisms over 1-cells.
Obj[_] : Obj → Set o'
_⇒[_]_ : ∀ {X Y} → Obj[ X ] → X ⇒₁ Y → Obj[ Y ] → Set ℓ'

-- We opt to only require fibrewise setoids, as opposed to a displayed setoid.
_≈ᵥ_ : ∀ {X Y X' Y'} {f : X ⇒₁ Y} → X' ⇒[ f ] Y' → X' ⇒[ f ] Y' → Set e'

-- Directed transport along 2-cells in the grading category.
_⟨_⟩ : ∀ {X Y X' Y'} {f g : X ⇒₁ Y} → X' ⇒[ g ] Y' → f ⇒₂ g → X' ⇒[ f ] Y'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this contravariant?

Copy link
Collaborator Author

@TOTBWF TOTBWF Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think of the transport as a sort of substitution operation, so it feels more natural to be contravariant. Also has the nice benefit of making the laws line up with the directions of the unitors/associators that you'd expect.
Ultimately doesn't matter too much though, as you can get the opposite variance by grading over co.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely see the laws lining up, which is nice. It just seems weird that f ⇒₂ g is used to transform a X' ⇒[ g ] Y' to a X' ⇒[ f ] Y'. That 2-cell might not be invertible. Calling it a "sort of substitution operation" only mildly helps.


field
-- Displayed identities and composites.
id' : ∀ {X} {X' : Obj[ X ]} → X' ⇒[ id₁ ] X'
_∘'_
: ∀ {X Y Z} {X' Y' Z'}
→ {f : Y ⇒₁ Z} {g : X ⇒₁ Y}
→ Y' ⇒[ f ] Z' → X' ⇒[ g ] Y' → X' ⇒[ f ∘₁ g ] Z'

-- Coherence for transports.
⟨⟩-idᵥ : ∀ {X Y X' Y'} {f : X ⇒₁ Y} {f' : X' ⇒[ f ] Y'} → f' ⟨ id₂ ⟩ ≈ᵥ f'
⟨⟩-∘ᵥ
: ∀ {X Y X' Y'} {f g h : X ⇒₁ Y} {h' : X' ⇒[ h ] Y'}
→ {α : g ⇒₂ h} {β : f ⇒₂ g}
→ h' ⟨ α ∘ᵥ β ⟩ ≈ᵥ h' ⟨ α ⟩ ⟨ β ⟩
-- We also need to ensure that identities and composites are stable under
-- transport.
⟨⟩-idₕ
: ∀ {X} {X' : Obj[ X ]} {α : id₁ ⇒₂ id₁}
→ id' {X' = X'} ⟨ α ⟩ ≈ᵥ id' {X' = X'}
⟨⟩-∘ₕ
: ∀ {X Y Z X' Y' Z'} {f h : Y ⇒₁ Z} {g k : X ⇒₁ Y}
→ {h' : Y' ⇒[ h ] Z'} {k' : X' ⇒[ k ] Y'}
→ {α : f ⇒₂ h} {β : g ⇒₂ k}
→ (h' ∘' k') ⟨ α ∘ₕ β ⟩ ≈ᵥ h' ⟨ α ⟩ ∘' k' ⟨ β ⟩

-- Left identities. Note that the second proof is actually redundant,
-- but we want op to be a definitional involution!
identityˡ'
: ∀ {X Y X' Y'} {f : X ⇒₁ Y} {f' : X' ⇒[ f ] Y'}
→ id' ∘' f' ≈ᵥ f' ⟨ λ⇒ ⟩
sym-identityˡ'
: ∀ {X Y X' Y'} {f : X ⇒₁ Y} {f' : X' ⇒[ f ] Y'}
→ f' ≈ᵥ (id' ∘' f') ⟨ λ⇐ ⟩

-- Right identities.
identityʳ'
: ∀ {X Y X' Y'} {f : X ⇒₁ Y} {f' : X' ⇒[ f ] Y'}
→ f' ∘' id' ≈ᵥ f' ⟨ ρ⇒ ⟩
sym-identityr'
: ∀ {X Y X' Y'} {f : X ⇒₁ Y} {f' : X' ⇒[ f ] Y'}
→ f' ≈ᵥ (f' ∘' id') ⟨ ρ⇐ ⟩

-- Associativity.
assoc'
: ∀ {W X Y Z W' X' Y' Z'}
→ {f : Y ⇒₁ Z} {g : X ⇒₁ Y} {h : W ⇒₁ X}
→ {f' : Y' ⇒[ f ] Z'} {g' : X' ⇒[ g ] Y'} {h' : W' ⇒[ h ] X'}
→ (f' ∘' g') ∘' h' ≈ᵥ (f' ∘' (g' ∘' h')) ⟨ α⇒ ⟩
sym-assoc'
: ∀ {W X Y Z W' X' Y' Z'}
→ {f : Y ⇒₁ Z} {g : X ⇒₁ Y} {h : W ⇒₁ X}
→ {f' : Y' ⇒[ f ] Z'} {g' : X' ⇒[ g ] Y'} {h' : W' ⇒[ h ] X'}
→ f' ∘' (g' ∘' h') ≈ᵥ ((f' ∘' g') ∘' h') ⟨ α⇐ ⟩