Skip to content

Commit

Permalink
Right Kan extension with an application to presheaves on DistLattices (
Browse files Browse the repository at this point in the history
…#735)

* use improved ringsolver

* delete one more line

* get started

* small lemmas

* functoriality of identity

* finish functoriality

* start experimenting

* general MacLane

* cleanup

* delete misleading comment

* natural trans

* only small progress

* finish nat trans
  • Loading branch information
mzeuner committed Apr 5, 2022
1 parent c0b7971 commit 604b43b
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Cubical/Categories/DistLatticeSheaf.agda
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Cubical.Categories.DistLatticeSheaf where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Structure
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Powerset
open import Cubical.Data.Sigma

Expand All @@ -20,6 +21,8 @@ open import Cubical.Categories.Functor
open import Cubical.Categories.NaturalTransformation
open import Cubical.Categories.Limits.Pullback
open import Cubical.Categories.Limits.Terminal
open import Cubical.Categories.Limits.Limits
open import Cubical.Categories.Limits.RightKan
open import Cubical.Categories.Instances.Functors
open import Cubical.Categories.Instances.CommRings
open import Cubical.Categories.Instances.Poset
Expand All @@ -31,6 +34,29 @@ private
variable
ℓ ℓ' ℓ'' : Level


module PreSheafExtension (L : DistLattice ℓ) (C : Category ℓ' ℓ'')
(limitC : Limits {ℓ} {ℓ} C) (L' : ℙ (fst L)) where

open Functor

private
DLCat = DistLatticeCategory L
DLSubCat = ΣPropCat DLCat L'
DLPreSheaf = Functor (DLCat ^op) C
DLSubPreSheaf = Functor (DLSubCat ^op) C

i : Functor DLSubCat DLCat
F-ob i = fst
F-hom i f = f
F-id i = refl
F-seq i _ _ = refl

DLRan : DLSubPreSheaf DLPreSheaf
DLRan = Ran limitC (i ^opF)



module _ (L : DistLattice ℓ) (C : Category ℓ' ℓ'') (T : Terminal C) where
open Category hiding (_⋆_)
open Functor
Expand Down Expand Up @@ -99,6 +125,7 @@ module _ (L : DistLattice ℓ) (C : Category ℓ' ℓ'') (T : Terminal C) where
DLSheaf = Σ[ F ∈ DLPreSheaf ] isDLSheaf F



module SheafOnBasis (L : DistLattice ℓ) (C : Category ℓ' ℓ'') (T : Terminal C)
(L' : ℙ (fst L)) (hB : IsBasis L L') where

Expand Down
14 changes: 14 additions & 0 deletions Cubical/Categories/Functor/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ record Functor (C : Category ℓC ℓC') (D : Category ℓD ℓD') :
(F-hom f) ⋆⟨ D ⟩ (F-hom k) ≡ (F-hom g) ⋆⟨ D ⟩ (F-hom h)
F-square Csquare = sym (F-seq _ _) ∙∙ cong F-hom Csquare ∙∙ F-seq _ _


private
variable
ℓ ℓ' : Level
Expand All @@ -43,6 +44,19 @@ private
open Category
open Functor

Functor≡ : {F G : Functor C D}
(h : (c : ob C) F-ob F c ≡ F-ob G c)
( {c c' : ob C} (f : C [ c , c' ]) PathP (λ i D [ h c i , h c' i ]) (F-hom F f) (F-hom G f))
F ≡ G
F-ob (Functor≡ hOb hHom i) c = hOb c i
F-hom (Functor≡ hOb hHom i) f = hHom f i
F-id (Functor≡ {C = C} {D = D} {F = F} {G = G} hOb hHom i) =
isProp→PathP (λ j isSetHom D (hHom (C .id) j) (D .id)) (F-id F) (F-id G) i
F-seq (Functor≡ {C = C} {D = D} {F = F} {G = G} hOb hHom i) f g =
isProp→PathP (λ j isSetHom D (hHom (f ⋆⟨ C ⟩ g) j) ((hHom f j) ⋆⟨ D ⟩ (hHom g j))) (F-seq F f g) (F-seq G f g) i



-- Helpful notation

-- action on objects
Expand Down
18 changes: 17 additions & 1 deletion Cubical/Categories/Limits/Limits.agda
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,23 @@ module _ {ℓJ ℓJ' ℓC ℓC' : Level} {J : Category ℓJ ℓJ'} {C : Category
isConeMor cc limCone k limArrow c cc ≡ k
limArrowUnique c cc k hk = cong fst (univProp c cc .snd (k , hk))

-- TODO: define limOfArrows
open LimCone
limOfArrows : (D₁ D₂ : Functor J C)
(CC₁ : LimCone D₁) (CC₂ : LimCone D₂)
(f : (u : ob J) C [ D₁ .F-ob u , D₂ .F-ob u ])
(fNat : {u v : ob J} (e : J [ u , v ])
f u ⋆⟨ C ⟩ D₂ .F-hom e ≡ D₁ .F-hom e ⋆⟨ C ⟩ f v)
C [ CC₁ .lim , CC₂ .lim ]
limOfArrows D₁ D₂ CC₁ CC₂ f fNat = limArrow CC₂ (CC₁ .lim) coneD₂Lim₁
where
coneD₂Lim₁ : Cone D₂ (CC₁ .lim)
coneOut coneD₂Lim₁ v = limOut CC₁ v ⋆⟨ C ⟩ f v
coneOutCommutes coneD₂Lim₁ {u = u} {v = v} e =
limOut CC₁ u ⋆⟨ C ⟩ f u ⋆⟨ C ⟩ D₂ .F-hom e ≡⟨ ⋆Assoc C _ _ _ ⟩
limOut CC₁ u ⋆⟨ C ⟩ (f u ⋆⟨ C ⟩ D₂ .F-hom e) ≡⟨ cong (λ x seq' C (limOut CC₁ u) x) (fNat e) ⟩
limOut CC₁ u ⋆⟨ C ⟩ (D₁ .F-hom e ⋆⟨ C ⟩ f v) ≡⟨ sym (⋆Assoc C _ _ _) ⟩
limOut CC₁ u ⋆⟨ C ⟩ D₁ .F-hom e ⋆⟨ C ⟩ f v ≡⟨ cong (λ x x ⋆⟨ C ⟩ f v) (limOutCommutes CC₁ e) ⟩
limOut CC₁ v ⋆⟨ C ⟩ f v ∎

-- A category is complete if it has all limits
Limits : {ℓJ ℓJ' ℓC ℓC' : Level} Category ℓC ℓC' Type _
Expand Down
126 changes: 126 additions & 0 deletions Cubical/Categories/Limits/RightKan.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Categories.Limits.RightKan where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Structure
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Powerset
open import Cubical.Data.Sigma

open import Cubical.Categories.Category
open import Cubical.Categories.Morphism renaming (isIso to isIsoC)
open import Cubical.Categories.Functor
open import Cubical.Categories.NaturalTransformation
open import Cubical.Categories.Limits.Limits



module _ {ℓC ℓC' ℓM ℓM' ℓA ℓA' : Level}
{C : Category ℓC ℓC'}
{M : Category ℓM ℓM'}
{A : Category ℓA ℓA'}
(limitA : Limits {ℓ-max ℓC' ℓM} {ℓ-max ℓC' ℓM'} A)
(K : Functor M C)
(T : Functor M A)
where

open Category
open Functor
open Cone
open LimCone


_↓Diag : ob C Category (ℓ-max ℓC' ℓM) (ℓ-max ℓC' ℓM')
ob (x ↓Diag) = Σ[ u ∈ ob M ] C [ x , K .F-ob u ]
Hom[_,_] (x ↓Diag) (u , f) (v , g) = Σ[ h ∈ M [ u , v ] ] f ⋆⟨ C ⟩ K .F-hom h ≡ g
id (x ↓Diag) {x = (u , f)} = id M , cong (seq' C f) (F-id K) ∙ ⋆IdR C f
_⋆_ (x ↓Diag) {x = (u , f)} (h , hComm) (k , kComm) = (h ⋆⟨ M ⟩ k)
, cong (seq' C f) (F-seq K h k)
∙ sym (⋆Assoc C _ _ _)
∙ cong (λ l seq' C l (F-hom K k)) hComm
∙ kComm
⋆IdL (x ↓Diag) _ = Σ≡Prop (λ _ isSetHom C _ _) (⋆IdL M _)
⋆IdR (x ↓Diag) _ = Σ≡Prop (λ _ isSetHom C _ _) (⋆IdR M _)
⋆Assoc (x ↓Diag) _ _ _ = Σ≡Prop (λ _ isSetHom C _ _) (⋆Assoc M _ _ _)
isSetHom (x ↓Diag) = isSetΣSndProp (isSetHom M) λ _ isSetHom C _ _

private
i : (x : ob C) Functor (x ↓Diag) M
F-ob (i x) = fst
F-hom (i x) = fst
F-id (i x) = refl
F-seq (i x) _ _ = refl

j : {x y : ob C} (f : C [ x , y ]) Functor (y ↓Diag) (x ↓Diag)
F-ob (j f) (u , g) = u , f ⋆⟨ C ⟩ g
F-hom (j f) (h , hComm) = h , ⋆Assoc C _ _ _ ∙ cong (seq' C f) hComm
F-id (j f) = Σ≡Prop (λ _ isSetHom C _ _) refl
F-seq (j f) _ _ = Σ≡Prop (λ _ isSetHom C _ _) refl


T* : (x : ob C) Functor (x ↓Diag) A
T* x = funcComp T (i x)

RanOb : ob C ob A
RanOb x = limitA (x ↓Diag) (T* x) .lim


RanCone : {x y : ob C} C [ x , y ] Cone (T* y) (RanOb x)
coneOut (RanCone {x = x} f) v = limOut (limitA (x ↓Diag) (T* x)) (j f .F-ob v)
coneOutCommutes (RanCone {x = x} f) h = limOutCommutes (limitA (x ↓Diag) (T* x)) (j f .F-hom h)


-- technical lemmas for proving functoriality
RanConeRefl : {x} v
limOut (limitA (x ↓Diag) (T* x)) v
≡ limOut (limitA (x ↓Diag) (T* x)) (j (id C) .F-ob v)
RanConeRefl {x = x} (v , f) =
cong (λ p limOut (limitA (x ↓Diag) (T* x)) (v , p)) (sym (⋆IdL C f))

RanConeTrans : {x y z} (f : C [ x , y ]) (g : C [ y , z ]) v
limOut (limitA (x ↓Diag) (T* x)) (j f .F-ob (j g .F-ob v))
≡ limOut (limitA (x ↓Diag) (T* x)) (j (f ⋆⟨ C ⟩ g) .F-ob v)
RanConeTrans {x = x} {y = y} {z = z} f g (v , h) =
cong (λ p limOut (limitA (x ↓Diag) (T* x)) (v , p)) (sym (⋆Assoc C f g h))


-- the right Kan-extension
Ran : Functor C A
F-ob Ran = RanOb
F-hom Ran {y = y} f = limArrow (limitA (y ↓Diag) (T* y)) _ (RanCone f)
F-id Ran {x = x} =
limArrowUnique (limitA (x ↓Diag) (T* x)) _ _ _ (λ v (⋆IdL A _) ∙ RanConeRefl v)
F-seq Ran {x = x} {y = y} {z = z} f g =
limArrowUnique (limitA (z ↓Diag) (T* z)) _ _ _ path
where
path : v
(F-hom Ran f) ⋆⟨ A ⟩ (F-hom Ran g) ⋆⟨ A ⟩ (limOut (limitA (z ↓Diag) (T* z)) v)
≡ coneOut (RanCone (f ⋆⟨ C ⟩ g)) v
path v = (F-hom Ran f) ⋆⟨ A ⟩ (F-hom Ran g) ⋆⟨ A ⟩ (limOut (limitA (z ↓Diag) (T* z)) v)
≡⟨ ⋆Assoc A _ _ _ ⟩
(F-hom Ran f) ⋆⟨ A ⟩ ((F-hom Ran g) ⋆⟨ A ⟩ (limOut (limitA (z ↓Diag) (T* z)) v))
≡⟨ cong (seq' A (F-hom Ran f)) (limArrowCommutes _ _ _ _) ⟩
(F-hom Ran f) ⋆⟨ A ⟩ limOut (limitA (y ↓Diag) (T* y)) (j g .F-ob v)
≡⟨ limArrowCommutes _ _ _ _ ⟩
limOut (limitA (x ↓Diag) (T* x)) (j f .F-ob (j g .F-ob v))
≡⟨ RanConeTrans f g v ⟩
coneOut (RanCone (f ⋆⟨ C ⟩ g)) v ∎


open NatTrans
RanNatTrans : NatTrans (funcComp Ran K) T
N-ob RanNatTrans u = coneOut (RanCone (id C)) (u , id C)
N-hom RanNatTrans {x = u} {y = v} f =
Ran .F-hom (K .F-hom f) ⋆⟨ A ⟩ coneOut (RanCone (id C)) (v , id C)
≡⟨ cong (λ g Ran .F-hom (K .F-hom f) ⋆⟨ A ⟩ g) (sym (RanConeRefl (v , id C))) ⟩
Ran .F-hom (K .F-hom f) ⋆⟨ A ⟩ limOut (limitA ((K .F-ob v) ↓Diag) (T* (K .F-ob v))) (v , id C)
≡⟨ limArrowCommutes _ _ _ _ ⟩
coneOut (RanCone (K .F-hom f)) (v , id C)
≡⟨ cong (λ g limOut (limitA ((K .F-ob u) ↓Diag) (T* (K .F-ob u))) (v , g))
(⋆IdR C (K .F-hom f) ∙ sym (⋆IdL C (K .F-hom f))) ⟩
coneOut (RanCone (id C)) (v , K .F-hom f)
≡⟨ sym (coneOutCommutes (RanCone (id C)) (f , ⋆IdL C _)) ⟩
coneOut (RanCone (id C)) (u , id C) ⋆⟨ A ⟩ T .F-hom f ∎

-- TODO: show that this nat. trans. is a "universal arrow" and that is a nat. iso.
-- if K is full and faithful...

0 comments on commit 604b43b

Please sign in to comment.