view universal-mapping.agda @ 41:e9fa5c95eff7

isFunctor
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 22 Jul 2013 19:07:31 +0900
parents c34b1cfe9fdc
children 9694f93977ca
line wrap: on
line source

module universal-mapping where

open import Category -- https://github.com/konn/category-agda
open import Level
open import Category.HomReasoning

open Functor

record IsUniversalMapping  {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ') 
                 ( U : Functor B A )
                 ( F : Obj A -> Obj B )
                 ( η : (a : Obj A) -> Hom A a ( FObj U (F a) ) )
                 ( _* : { a : Obj A}{ b : Obj B} -> ( Hom A a (FObj U b) ) ->  Hom B (F a ) b )
                 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
   field
       universalMapping :   (a' : Obj A) ( b' : Obj B ) -> { f : Hom A a' (FObj U b') } -> 
                     A [ A [ FMap U ( f * ) o  η a' ]  ≈ f ]


record UniversalMapping  {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ') 
                 ( U : Functor B A )
                 ( F : Obj A -> Obj B )
                 ( η : (a : Obj A) -> Hom A a ( FObj U (F a) ) )
                 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
    infixr 11 _*
    field
       _* :  { a : Obj A}{ b : Obj B} -> ( Hom A a (FObj U b) ) ->  Hom B (F a ) b 
       isUniversalMapping : IsUniversalMapping A B U F η _*

open NTrans
open import Category.Cat
record IsAdjunction  {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ') 
                 ( U : Functor B A )
                 ( F : Functor A B )
                 ( η : NTrans A A identityFunctor ( U ○  F ) )
                 ( ε : NTrans B B  ( F ○  U ) identityFunctor )
                 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
   field
       adjoint1 :   { b' : Obj B } ->
                     A [ A [ ( FMap U ( TMap ε b' ))  o ( TMap η ( FObj U b' )) ]  ≈ Id {_} {_} {_} {A} (FObj U b') ]
       adjoint2 :   {a' : Obj A} ->
                     B [ B [ ( TMap ε ( FObj F a' ))  o ( FMap F ( TMap η a' )) ]  ≈ Id {_} {_} {_} {B} (FObj F a') ]

record Adjunction {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ') 
                 ( U : Functor B A )
                 ( F : Functor A B )
                 ( η : NTrans A A identityFunctor ( U ○  F ) )
                 ( ε : NTrans B B  ( F ○  U ) identityFunctor )
                 : Set (suc (c₁ ⊔ c₂ ⊔ ℓ ⊔ c₁' ⊔ c₂' ⊔ ℓ' )) where
    field
       isAdjunction : IsAdjunction A B U F η ε

open Adjunction
open UniversalMapping

Solution : {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ')
                 ( U : Functor B A )
                 ( F : Functor A B )
                 ( ε : NTrans B B  ( F ○  U ) identityFunctor ) ->
     { a : Obj A} { b : Obj B} -> ( f : Hom A a (FObj U b) ) ->  Hom B (FObj F a ) b 
Solution  A B U F ε {a} {b} f = B [ TMap ε b o FMap F f ]

Lemma1 : {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ')
                 ( U : Functor B A )
                 ( F : Functor A B )
                 ( η : NTrans A A identityFunctor ( U ○  F ) )
                 ( ε : NTrans B B  ( F ○  U ) identityFunctor ) ->
      Adjunction A B U F η ε  -> UniversalMapping A B U (FObj F) (TMap η) 
Lemma1 A B U F η ε adj = record {
         _* = Solution A B U F ε ;
         isUniversalMapping = record {
                    universalMapping  = universalMapping
              }
      } where
         universalMapping :   (a' : Obj A) ( b' : Obj B ) -> { f : Hom A a' (FObj U b') } -> 
                     A [ A [ FMap U ( Solution A B U F ε f  ) o TMap η a' ]  ≈ f ]
         universalMapping a b {f} = 
           let open ≈-Reasoning (A) in
              begin 
                  FMap U ( Solution A B U F ε f  ) o TMap η a 
              ≈⟨⟩
                  FMap U (  B [ TMap ε b o FMap F f ] ) o TMap η a 
              ≈⟨ car (IsFunctor.distr ( isFunctor U )) ⟩
                 ( (FMap U (TMap ε b))  o (FMap U ( FMap F f )) ) o TMap η a 
              ≈⟨ sym assoc ⟩
                  (FMap U (TMap ε b))  o ((FMap U ( FMap F f ))  o TMap η a )
              ≈⟨ cdr (nat A η) ⟩
                  (FMap U (TMap ε b))  o ((TMap η (FObj U b )) o f )
              ≈⟨ assoc ⟩
                  ((FMap U (TMap ε b))  o (TMap η (FObj U b)))  o f 
              ≈⟨ car ( IsAdjunction.adjoint1 ( isAdjunction adj))  ⟩
                  id (FObj U b) o f
              ≈⟨  idL  ⟩
                  f



FunctorF : {c₁ c₂ ℓ c₁' c₂' ℓ' : Level} (A : Category c₁ c₂ ℓ) (B : Category c₁' c₂' ℓ') 
                 ( U : Functor B A )
                 ( F : Obj A -> Obj B )
                 ( η : (a : Obj A) -> Hom A a ( FObj U (F a) ) ) ->
       UniversalMapping A B U F η   -> Functor A B
FunctorF A B U F η um = record {
              FObj = F;
              FMap = \f ->  (_* um)  (A [  η (Category.cod A f )   o f ])   ;
              isFunctor = isFunctor1
       } where
         isFunctor1 : ?
         isFunctor1 = ?