Skip to content

Commit

Permalink
rec for free cat with terminal object, non-triviality example
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsnew committed Jun 4, 2024
1 parent 28991f7 commit b4969a1
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 110 deletions.
50 changes: 42 additions & 8 deletions Cubical/Categories/Constructions/Free/CategoryWithTerminal.agda
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{-# OPTIONS --safe #-}
-- Free category with a terminal object, over a Quiver
module Cubical.Categories.Constructions.Free.CategoryWithTerminal where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels

open import Cubical.Categories.Category.Base
open import Cubical.Categories.Functor
open import Cubical.Categories.Limits.Terminal.More
open import Cubical.Data.Quiver.Base
open import Cubical.Data.Sum.Base as Sum hiding (elim)
open import Cubical.Data.Sum.Base as Sum hiding (elim; rec)
open import Cubical.Data.Unit
open import Cubical.Categories.Displayed.Base
open import Cubical.Categories.Presheaf
Expand All @@ -15,10 +18,16 @@ open import Cubical.Categories.Displayed.Limits.Terminal
open import Cubical.Foundations.Equiv
open import Cubical.Data.Sigma.Properties
open import Cubical.Categories.Displayed.Section.Base
open import Cubical.Categories.Displayed.Constructions.Weaken as Wk
open import Cubical.Categories.Displayed.Reasoning

private
variable
ℓg ℓg' ℓC ℓC' ℓCᴰ ℓCᴰ' : Level
ℓg ℓg' ℓC ℓC' ℓCᴰ ℓCᴰ' ℓD ℓD' ℓDᴰ ℓDᴰ' : Level

open Section
open Functor
open UniversalElementᴰ

CategoryWithTerminal' : (ℓC ℓC' : Level) Type _
CategoryWithTerminal' ℓC ℓC' = Σ[ C ∈ Category ℓC ℓC' ] Terminal' C
Expand Down Expand Up @@ -73,10 +82,6 @@ module _ (Ob : Type ℓg) where
module _ (Cᴰ : Categoryᴰ (FreeCatw/Terminal' .fst) ℓCᴰ ℓCᴰ')
(term'ᴰ : LiftedTerminalᴰ Cᴰ (FreeCatw/Terminal' .snd)) where

open import Cubical.Foundations.HLevels
open import Cubical.Categories.Displayed.Reasoning
open Section
open UniversalElementᴰ
open LiftedTerminalᴰNotation Cᴰ term'ᴰ

private
Expand All @@ -86,8 +91,9 @@ module _ (Ob : Type ℓg) where
-- given an interpretation of atomic objects
module _: (v : Ob) Cᴰ.ob[ inl v ]) where
-- extend it to all objects
ϕ* : (v : Ob') Cᴰ.ob[ v ]
ϕ* = Sum.elim (λ a ϕ a) (λ b term'ᴰ .vertexᴰ)
private
ϕ* : (v : Ob') Cᴰ.ob[ v ]
ϕ* = Sum.elim (λ a ϕ a) (λ b term'ᴰ .vertexᴰ)

-- and given an interpretation of atomic morphisms
module _: (e : Q .mor)
Expand Down Expand Up @@ -126,3 +132,31 @@ module _ (Ob : Type ℓg) where
elim .F-homᴰ = elim-F-homᴰ
elim .F-idᴰ = refl
elim .F-seqᴰ _ _ = refl

-- module _
-- {D : Category ℓD ℓD'}
-- {term' : Terminal' D}
-- (F : Functor FC D)
-- (Dᴰ : Categoryᴰ D ℓDᴰ ℓDᴰ')
-- (term'ᴰ : Terminalᴰ Dᴰ term')
-- where
-- private
-- module Dᴰ = Categoryᴰ Dᴰ
-- open Terminal'Notation term'
-- module _ (ϕ : ∀ o → Dᴰ.ob[ F ⟅ o ⟆ ]) where
-- private
-- ϕ* : (o' : Ob') Dᴰ.ob[ F .F-ob o' ]
-- ϕ* = {!!}

module _ (D : Category ℓD ℓD')
(term' : Terminal' D)
: Ob D .ob)
where
private
open Terminal'Notation term'
ϕ* : Ob' D .ob
ϕ* = Sum.elim (λ a ϕ a) λ _ 𝟙

module _: e D [ ϕ* (Q .dom e) , ϕ* (Q .cod e) ]) where
rec : Functor FC D
rec = Wk.introS⁻ (elim (weaken FC D) (termWeaken _ term') ϕ ψ)
104 changes: 2 additions & 102 deletions Cubical/Categories/Displayed/Constructions/Weaken.agda
Original file line number Diff line number Diff line change
@@ -1,105 +1,5 @@
{-
Weaken a category to be a displayed category.
Later: weaken a displayed category to depend on fewer parameters?
-}

{-# OPTIONS --safe #-}
--
module Cubical.Categories.Displayed.Constructions.Weaken where

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

open import Cubical.Categories.Category.Base
open import Cubical.Categories.Functor

open import Cubical.Categories.Displayed.Base
open import Cubical.Categories.Displayed.Section.Base
open import Cubical.Categories.Displayed.Properties
open import Cubical.Categories.Displayed.Functor
open import Cubical.Categories.Constructions.TotalCategory as TC
hiding (intro)
open import Cubical.Categories.Constructions.TotalCategory.More as TC

private
variable
ℓB ℓB' ℓC ℓC' ℓCᴰ ℓCᴰ' ℓD ℓD' ℓDᴰ ℓDᴰ' ℓE ℓE' ℓEᴰ ℓEᴰ' : Level

open Categoryᴰ

module _ (C : Category ℓC ℓC') (D : Category ℓD ℓD') where
open Category
weaken : Categoryᴰ C ℓD ℓD'
weaken .ob[_] x = D .ob
weaken .Hom[_][_,_] f d d' = D [ d , d' ]
weaken .idᴰ = D .id
weaken ._⋆ᴰ_ = D ._⋆_
weaken .⋆IdLᴰ = D .⋆IdL
weaken .⋆IdRᴰ = D .⋆IdR
weaken .⋆Assocᴰ = D .⋆Assoc
weaken .isSetHomᴰ = D .isSetHom

open Functor
weakenΠ : Functor (∫C weaken) D
weakenΠ .F-ob = snd
weakenΠ .F-hom = snd
weakenΠ .F-id = refl
weakenΠ .F-seq _ _ = refl

module _ {C : Category ℓC ℓC'}
{D : Category ℓD ℓD'}
{E : Category ℓE ℓE'}
(F : Functor E C)
(G : Functor E D)
where
open Category
open Functor
open Section
introS : Section F (weaken C D)
introS .F-obᴰ x = G .F-ob x
introS .F-homᴰ f = G .F-hom f
introS .F-idᴰ = G .F-id
introS .F-seqᴰ _ _ = G .F-seq _ _

module _ {C : Category ℓC ℓC'}
{D : Category ℓD ℓD'}
{E : Category ℓE ℓE'}
{Eᴰ : Categoryᴰ E ℓEᴰ ℓEᴰ'}
(F : Functor E C)
(G : Functor E D)
where
open Category
open Functor
open Functorᴰ
introF : Functorᴰ F Eᴰ (weaken C D)
introF .F-obᴰ {x} _ = G .F-ob x
introF .F-homᴰ {x} {y} {f} {xᴰ} {yᴰ} _ = G .F-hom f
introF .F-idᴰ = G .F-id
introF .F-seqᴰ _ _ = G .F-seq _ _

introS⁻ : {C : Category ℓC ℓC'}
{D : Category ℓD ℓD'}
{E : Category ℓE ℓE'}
{F : Functor E C}
Section F (weaken C D)
Functor E D
introS⁻ {C = C}{D = D}{F = F} Fᴰ =
weakenΠ C D ∘F TC.intro' F Fᴰ

-- TODO: introS/introS⁻ is an Iso

module _ {B : Category ℓB ℓB'} {C : Category ℓC ℓC'} where
open Functor
open Functorᴰ

weakenF : {D : Category ℓD ℓD'} {E : Category ℓE ℓE'} {F : Functor B C}
(G : Functor D E)
Functorᴰ F (weaken B D) (weaken C E)
weakenF G .F-obᴰ = G .F-ob
weakenF G .F-homᴰ = G .F-hom
weakenF G .F-idᴰ = G .F-id
weakenF G .F-seqᴰ = G .F-seq
open import Cubical.Categories.Displayed.Constructions.Weaken.Base public
open import Cubical.Categories.Displayed.Constructions.Weaken.Properties public
100 changes: 100 additions & 0 deletions Cubical/Categories/Displayed/Constructions/Weaken/Base.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{-
Weaken a category to be a displayed category.
-}
{-# OPTIONS --safe #-}
--
module Cubical.Categories.Displayed.Constructions.Weaken.Base where

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

open import Cubical.Categories.Category.Base
open import Cubical.Categories.Functor

open import Cubical.Categories.Displayed.Base
open import Cubical.Categories.Displayed.Section.Base
open import Cubical.Categories.Displayed.Properties
open import Cubical.Categories.Displayed.Functor
open import Cubical.Categories.Constructions.TotalCategory as TC
hiding (intro)
open import Cubical.Categories.Constructions.TotalCategory.More as TC

private
variable
ℓB ℓB' ℓC ℓC' ℓCᴰ ℓCᴰ' ℓD ℓD' ℓDᴰ ℓDᴰ' ℓE ℓE' ℓEᴰ ℓEᴰ' : Level

open Categoryᴰ

module _ (C : Category ℓC ℓC') (D : Category ℓD ℓD') where
open Category
weaken : Categoryᴰ C ℓD ℓD'
weaken .ob[_] x = D .ob
weaken .Hom[_][_,_] f d d' = D [ d , d' ]
weaken .idᴰ = D .id
weaken ._⋆ᴰ_ = D ._⋆_
weaken .⋆IdLᴰ = D .⋆IdL
weaken .⋆IdRᴰ = D .⋆IdR
weaken .⋆Assocᴰ = D .⋆Assoc
weaken .isSetHomᴰ = D .isSetHom

open Functor
weakenΠ : Functor (∫C weaken) D
weakenΠ .F-ob = snd
weakenΠ .F-hom = snd
weakenΠ .F-id = refl
weakenΠ .F-seq _ _ = refl

module _ {C : Category ℓC ℓC'}
{D : Category ℓD ℓD'}
{E : Category ℓE ℓE'}
(F : Functor E C)
(G : Functor E D)
where
open Category
open Functor
open Section
introS : Section F (weaken C D)
introS .F-obᴰ x = G .F-ob x
introS .F-homᴰ f = G .F-hom f
introS .F-idᴰ = G .F-id
introS .F-seqᴰ _ _ = G .F-seq _ _

module _ {C : Category ℓC ℓC'}
{D : Category ℓD ℓD'}
{E : Category ℓE ℓE'}
{Eᴰ : Categoryᴰ E ℓEᴰ ℓEᴰ'}
(F : Functor E C)
(G : Functor E D)
where
open Category
open Functor
open Functorᴰ
introF : Functorᴰ F Eᴰ (weaken C D)
introF .F-obᴰ {x} _ = G .F-ob x
introF .F-homᴰ {x} {y} {f} {xᴰ} {yᴰ} _ = G .F-hom f
introF .F-idᴰ = G .F-id
introF .F-seqᴰ _ _ = G .F-seq _ _

introS⁻ : {C : Category ℓC ℓC'}
{D : Category ℓD ℓD'}
{E : Category ℓE ℓE'}
{F : Functor E C}
Section F (weaken C D)
Functor E D
introS⁻ {C = C}{D = D}{F = F} Fᴰ =
weakenΠ C D ∘F TC.intro' F Fᴰ

-- TODO: introS/introS⁻ is an Iso

module _ {B : Category ℓB ℓB'} {C : Category ℓC ℓC'} where
open Functor
open Functorᴰ

weakenF : {D : Category ℓD ℓD'} {E : Category ℓE ℓE'} {F : Functor B C}
(G : Functor D E)
Functorᴰ F (weaken B D) (weaken C E)
weakenF G .F-obᴰ = G .F-ob
weakenF G .F-homᴰ = G .F-hom
weakenF G .F-idᴰ = G .F-id
weakenF G .F-seqᴰ = G .F-seq
37 changes: 37 additions & 0 deletions Cubical/Categories/Displayed/Constructions/Weaken/Properties.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{-# OPTIONS --safe #-}
module Cubical.Categories.Displayed.Constructions.Weaken.Properties where

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

open import Cubical.Categories.Category.Base
open import Cubical.Categories.Functor
open import Cubical.Categories.Limits.Terminal.More
open import Cubical.Categories.Presheaf

open import Cubical.Categories.Displayed.Base
open import Cubical.Categories.Displayed.Section.Base
open import Cubical.Categories.Displayed.Properties
open import Cubical.Categories.Displayed.Functor
open import Cubical.Categories.Displayed.Limits.Terminal
open import Cubical.Categories.Constructions.TotalCategory as TC
hiding (intro)
open import Cubical.Categories.Constructions.TotalCategory.More as TC
open import Cubical.Categories.Displayed.Constructions.Weaken.Base as Wk
open import Cubical.Categories.Displayed.Presheaf

private
variable
ℓB ℓB' ℓC ℓC' ℓCᴰ ℓCᴰ' ℓD ℓD' ℓDᴰ ℓDᴰ' ℓE ℓE' ℓEᴰ ℓEᴰ' : Level

open Categoryᴰ
open UniversalElementᴰ
open UniversalElement
module _ {C : Category ℓC ℓC'} {D : Category ℓD ℓD'}
(termC : Terminal' C) (termD : Terminal' D)
where
termWeaken : LiftedTerminalᴰ (weaken C D) termC
termWeaken .vertexᴰ = termD .vertex
termWeaken .elementᴰ = termD .element
termWeaken .universalᴰ = termD .universal _
Loading

0 comments on commit b4969a1

Please sign in to comment.