{-# OPTIONS --without-K --safe #-}
module Categories.Category.Construction.Elements where
open import Level
open import Data.Product using (Σ; _,_; Σ-syntax; proj₁; proj₂; map)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; sym; trans; cong)
open import Function hiding (_∘_) renaming (id to idf)
open import Categories.Category using (Category)
open import Categories.Functor hiding (id)
open import Categories.Category.Instance.Sets
open import Categories.Category.Instance.Cats
open import Categories.Category.Construction.Functors
open import Categories.NaturalTransformation.NaturalIsomorphism hiding (refl; sym; trans)
open import Categories.NaturalTransformation hiding (id)
import Categories.Morphism.Reasoning as MR
private
variable
o ℓ e o′ : Level
Elements : {C : Category o ℓ e} → Functor C (Sets o′) → Category (o ⊔ o′) (ℓ ⊔ o′) e
Elements {C = C} F = record
{ Obj = Σ Obj F₀
; _⇒_ = λ { (c , x) (c′ , x′) → Σ (c ⇒ c′) (λ f → F₁ f x ≡ x′) }
; _≈_ = λ p q → proj₁ p ≈ proj₁ q
; id = id , identity _
; _∘_ = λ { (f , Ff≡) (g , Fg≡) → f ∘ g , trans (homomorphism _) (trans (cong (F₁ f) Fg≡) Ff≡)}
; assoc = assoc
; sym-assoc = sym-assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identity²
; equiv = record { refl = Equiv.refl ; sym = Equiv.sym ; trans = Equiv.trans }
; ∘-resp-≈ = ∘-resp-≈
}
where
open Category C
open Functor F
El : {C : Category o ℓ e} → Functor (Functors C (Sets o′)) (Cats (o ⊔ o′) (ℓ ⊔ o′) e)
El {C = C} = record
{ F₀ = Elements
; F₁ = λ A⇒B → record
{ F₀ = map idf (η A⇒B _)
; F₁ = map idf λ {f} eq → trans (sym $ commute A⇒B f _) (cong (η A⇒B _) eq)
; identity = Equiv.refl
; homomorphism = Equiv.refl
; F-resp-≈ = idf
}
; identity = λ {P} → record
{ F⇒G = record
{ η = λ X → id , identity P _
; commute = λ _ → MR.id-comm-sym C
; sym-commute = λ _ → MR.id-comm C
}
; F⇐G = record
{ η = λ X → id , identity P _
; commute = λ _ → MR.id-comm-sym C
; sym-commute = λ _ → MR.id-comm C
}
; iso = λ X → record { isoˡ = identityˡ ; isoʳ = identityʳ } }
; homomorphism = λ {X₁} {Y₁} {Z₁} → record
{ F⇒G = record
{ η = λ X → id , identity Z₁ _
; commute = λ _ → MR.id-comm-sym C
; sym-commute = λ _ → MR.id-comm C
}
; F⇐G = record
{ η = λ X → id , identity Z₁ _
; commute = λ _ → MR.id-comm-sym C
; sym-commute = λ _ → MR.id-comm C
}
; iso = λ X → record { isoˡ = identityˡ ; isoʳ = identityʳ }
}
; F-resp-≈ = λ {_} {B₁} f≈g → record
{ F⇒G = record
{ η = λ _ → id , trans (identity B₁ _) (f≈g _)
; commute = λ _ → MR.id-comm-sym C
; sym-commute = λ _ → MR.id-comm C
}
; F⇐G = record
{ η = λ _ → id , trans (identity B₁ _) (sym (f≈g _ ))
; commute = λ _ → MR.id-comm-sym C
; sym-commute = λ _ → MR.id-comm C
}
; iso = λ X → record { isoˡ = identityˡ ; isoʳ = identityʳ } }
}
where
open Category C
open Functor
open NaturalTransformation