mathematics - a gentle introduction to category theory

Upload: ndewura-jakpa

Post on 14-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    1/80

    A G e n t l e I n t r o d u c t i o n t o C a t e g o r y

    T h e o r y

    | t h e c a l c u l a t i o n a l a p p r o a c h |

    M a a r t e n M . F o k k i n g a

    V e r s i o n o f J u n e 6 , 1 9 9 4

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    2/80

    c

    M . M . F o k k i n g a , 1 9 9 2

    M a a r t e n M . F o k k i n g a

    U n i v e r s i t y o f T w e n t e , d e p t . I N F

    P O B o x 2 1 7

    N L 7 5 0 0 A E E N S C H E D E

    T h e N e t h e r l a n d s

    e - m a i l : f o k k i n g a @ c s . u t w e n t e . n l

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    3/80

    C o n t e n t s

    0 I n t r o d u c t i o n 3

    1 T h e m a i n c o n c e p t s 7

    1 a C a t e g o r i e s : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 7

    1 b F u n c t o r s : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 3

    1 c N a t u r a l i t y : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 9

    1 d A d j u n c t i o n s : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2 6

    1 e D u a l i t y : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2 9

    2 C o n s t r u c t i o n s i n c a t e g o r i e s 3 1

    2 a I s o , e p i c , a n d m o n i c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 3 1

    2 b I n i t i a l i t y a n d n a l i t y : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 3 4

    2 c P r o d u c t s a n d S u m s : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 3 8

    2 d C o e q u a l i s e r s : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4 3

    2 e C o l i m i t s : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4 7

    A M o r e o n a d j o i n t n e s s 5 9

    C h a p t e r s 3 a n d 5 o f ` L a w a n d O r d e r i n A l g o r i t h m i c s ' 4 ]

    p r e s e n t a c a t e g o r i c a l a p p r o a c h t o a l g e b r a s . T h o s e c h a p -

    t e r s d o n ' t u s e t h e n o t i o n s o f a d j u n c t i o n a n d c o l i m i t . S o

    y o u m a y s k i p S e c t i o n s 1 d , a n d 2 e , a n d A p p e n d i x A w h e n

    y o u a r e p r i m a r i l y i n t e r e s t e d i n r e a d i n g t h o s e c h a p t e r s .

    1

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    4/80

    2 C O N T E N T S

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    5/80

    C h a p t e r 0

    I n t r o d u c t i o n

    0 . 1 A i m . I n t h e s e n o t e s w e p r e s e n t t h e i m p o r t a n t n o t i o n s f r o m c a t e g o r y t h e o r y . T h e

    i n t e n t i o n i s t o p r o v i d e a f a i r l y g o o d s k i l l i n m a n i p u l a t i n g w i t h t h o s e c o n c e p t s f o r m a l l y .

    W h a t y o u p r o b a b l y w i l l n o t a c q u i r e f r o m t h e s e n o t e s i s t h e a b i l i t y t o r e c o g n i s e t h e c o n c e p t s

    i n y o u r d a i l y w o r k w h e n t h a t d i e r s f r o m a l g o r i t h m i c s , s i n c e w e g i v e o n l y a f e w e x a m p l e s

    a n d t h o s e a r e t a k e n f r o m a l g o r i t h m i c s . F o r s u c h a n a b i l i t y y o u n e e d t o w o r k t h r o u g h m a n y ,

    v e r y m a n y e x a m p l e s , i n d i v e r s e e l d s o f a p p l i c a t i o n s .

    T h i s t e x t d i e r s f r o m m o s t o t h e r i n t r o d u c t i o n s t o c a t e g o r y t h e o r y i n t h e c a l c u l a t i o n a l

    s t y l e o f t h e p r o o f s ( e s p e c i a l l y i n C h a p t e r 2 a n d A p p e n d i x A ) , t h e r e s t r i c t i o n t o a p p l i c a t i o n s

    w i t h i n a l g o r i t h m i c s , a n d t h e o m i s s i o n o f m a n y a d d i t i o n a l c o n c e p t s a n d f a c t s t h a t I c o n s i d e r

    n o t h e l p f u l i n a r s t i n t r o d u c t i o n t o c a t e g o r y t h e o r y .

    0 . 2 A c k n o w l e d g e m e n t s . T h i s t e x t i s a c o m p i l a t i o n a n d e x t e n s i o n o f w o r k t h a t I ' v e

    d o n e f o r m y t h e s i s . T h a t p r o j e c t w o u l d h a v e b e e n a f a i l u r e w i t h o u t t h e h e l p o r s t i m u l a t i o n

    b y m a n y p e o p l e . R e g a r d i n g t h e t e c h n i c a l c o n t e n t s , R o l a n d B a c k h o u s e , G r a n t M a l c o l m ,

    L a m b e r t M e e r t e n s a n d J a a p v a n d e r W o u d e m a y r e c o g n i s e t h e i r i d e a s a n d m e t h o d o l o g i c a l

    a n d n o t a t i o n a l s u g g e s t i o n s .

    0 . 3 W h y c a t e g o r y t h e o r y ? T h e r e a r e v a r i o u s v i e w s o n w h a t c a t e g o r y t h e o r y i s a b o u t ,

    a n d w h a t i t i s g o o d f o r . H e r e a r e s o m e .

    C a t e g o r y t h e o r y i s a r e l a t i v e l y y o u n g b r a n c h o f m a t h e m a t i c s , s t e m m i n g f r o m a l g e -

    b r a i c t o p o l o g y , a n d d e s i g n e d t o d e s c r i b e v a r i o u s s t r u c t u r a l c o n c e p t s f r o m d i e r e n t

    m a t h e m a t i c a l e l d s i n a u n i f o r m w a y . I n d e e d , c a t e g o r y t h e o r y p r o v i d e s a b a g o f

    c o n c e p t s ( a n d t h e o r e m s a b o u t t h o s e c o n c e p t s ) t h a t f o r m a n a b s t r a c t i o n o f m a n y

    c o n c r e t e c o n c e p t s i n d i v e r s e b r a n c h e s o f m a t h e m a t i c s , i n c l u d i n g c o m p u t i n g s c i e n c e .

    H e n c e i t w i l l c o m e a s n o s u r p r i s e t h a t t h e c o n c e p t s o f c a t e g o r y t h e o r y f o r m a n

    a b s t r a c t i o n o f m a n y c o n c e p t s t h a t p l a y a r o l e i n a l g o r i t h m i c s .

    Q u o t i n g H o a r e 6 ] : \ C a t e g o r y t h e o r y i s q u i t e t h e m o s t g e n e r a l a n d a b s t r a c t b r a n c h o f

    p u r e m a t h e m a t i c s . ] T h e c o r o l l a r y o f a h i g h d e g r e e o f g e n e r a l i t y a n d a b s t r a c t i o n

    3

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    6/80

    4 C H A P T E R 0 . I N T R O D U C T I O N

    i s t h a t t h e t h e o r y g i v e s a l m o s t n o a s s i s t a n c e i n s o l v i n g t h e m o r e s p e c i c p r o b l e m s

    w i t h i n a n y o f t h e s u b d i s c i p l i n e s t o w h i c h i t a p p l i e s . I t i s a t o o l f o r t h e g e n e r a l i s t , o f

    l i t t l e b e n e t t o t h e p r a c t i t i o n e r "

    H e n c e i t w i l l c o m e a s n o s u r p r i s e t h a t , f o r a l g o r i t h m i c s t o o , c a t e g o r y i s m a i n l y u s e f u l

    f o r t h e o r y d e v e l o p m e n t h a r d l y f o r i n d i v i d u a l p r o g r a m d e r i v a t i o n .

    Q u o t i n g A s p e r t i a n d L o n g o 1 ] : \ C a t e g o r y t h e o r y i s a m a t h e m a t i c a l j a r g o n .

    M a n y d i e r e n t f o r m a l i s m s a n d s t r u c t u r e s m a y b e p r o p o s e d f o r w h a t i s e s s e n t i a l l y t h e

    s a m e c o n c e p t t h e c a t e g o r i c a l l a n g u a g e a n d a p p r o a c h m a y s i m p l i f y t h r o u g h a b s t r a c -

    t i o n , d i s p l a y t h e g e n e r a l i t y o f c o n c e p t s , a n d h e l p t o f o r m u l a t e u n i f o r m d e n i t i o n s . "

    Q u o t i n g S c o t t 7 ] : \ C a t e g o r y t h e o r y o e r s ] a p u r e t h e o r y o f f u n c t i o n s , n o t a t h e o r y

    o f f u n c t i o n s d e r i v e d f r o m s e t s . "

    T o t h i s I w a n t t o a d d t h a t t h e l a n g u a g e o f c a t e g o r y t h e o r y f a c i l i t a t e s a n e l e g a n t

    s t y l e o f e x p r e s s i o n a n d p r o o f ( e q u a t i o n a l r e a s o n i n g ) f o r t h e u s e i n a l g o r i t h m i c s t h i s

    h a p p e n s t o b e r e a s o n i n g a t t h e f u n c t i o n l e v e l , w i t h o u t t h e n e e d ( a n d t h e p o s s i b i l i t y )

    t o i n t r o d u c e a r g u m e n t s e x p l i c i t l y . A l s o , t h e f o r m u l a s o f t e n s u g g e s t a n d e a s e a f a r -

    r e a c h i n g g e n e r a l i s a t i o n , m u c h m o r e s o t h a n t h e u s u a l s e t - t h e o r e t i c f o r m u l a t i o n s .

    C a t e g o r y t h e o r y h a s i t s e l f g r o w n t o a b r a n c h i n m a t h e m a t i c s , l i k e a l g e b r a a n d a n a l y s i s ,

    t h a t i s s t u d i e d l i k e a n y o t h e r o n e . O n e s h o u l d n o t c o n f u s e t h e p o t e n t i a l b e n e t s t h a t

    c a t e g o r y t h e o r y m a y h a v e ( f o r t h e t h e o r y u n d e r l y i n g a l g o r i t h m i c s , s a y ) w i t h t h e d i c u l t y

    a n d c o m p l e x i t y , a n d f u n , o f d o i n g c a t e g o r y t h e o r y a s a s p e c i a l i s a t i o n i n i t s e l f .

    0 . 4 P r e l i m i n a r i e s : s e q u e n c e s . O u r e x a m p l e s f r e q u e n t l y i n v o l v e n i t e l i s t s , o r s e -

    q u e n c e s a s w e l i k e t o c a l l t h e m . H e r e i s o u r n o t a t i o n .

    A s e q u e n c e i s a n i t e l i s t o f e l e m e n t s o f a c e r t a i n t y p e , d e n o t e d a

    0

    : : : a

    n ; 1

    ] . T h e

    s e t o f s e q u e n c e s o v e r A i s d e n o t e d S e q A . F u r t h e r o p e r a t i o n s a r e :

    t i p = a ! a

    : A ! S e q A

    : = ( a a

    0

    : : : a

    n ; 1

    ) ! a a

    0

    : : : a

    n ; 1

    : A S e q A ! S e q A

    c o n s = p r e x w r i t t e n o p e r a t i o n :

    + + = ( a

    0

    : : : a

    m ; 1

    a

    m

    : : : a

    n ; 1

    ) ! a

    0

    : : : a

    n ; 1

    : S e q A S e q A ! S e q A

    j o i n = p r e x w r i t t e n o p e r a t i o n + +

    S e q f = a

    0

    : : : a

    n ; 1

    ! f a

    0

    : : : f a

    n ; 1

    : S e q A ! S e q B w h e n e v e r f : A ! B

    = = a

    0

    : : : a

    n ; 1

    ! a

    0

    a

    n ; 1

    : S e q A ! A w h e n e v e r : A A ! A a n d

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    7/80

    5

    i s a s s o c i a t i v e a n d h a s a n e u t r a l e l e m e n t

    F u n c t i o n S e q f i s o f t e n c a l l e d m a p f . F u n c t i o n = i s c a l l e d t h e r e d u c e - w i t h - o r

    t h e f o l d - w i t h - t h e n e u t r a l e l e m e n t o f i s t h e o u t c o m e o n t h e e m p t y s e q u e n c e ] .

    A s s o c i a t i v i t y o f i m p l i e s t h a t t h e s p e c i c a t i o n o f = i s u n a m b i g u o u s , n o t d e p e n d i n g o n

    t h e p a r e n t h e s i s a t i o n w i t h i n a

    0

    a

    n ; 1

    E x e r c i s e : n d a n o n - a s s o c i a t i v e o p e r a t i o n f o r w h i c h = i s w e l l d e n e d . C o n c l u d e t h a t

    a s s o c i a t i v i t y o f i s a s u c i e n t , b u t n o t n e c e s s a r y c o n d i t i o n f o r = t o b e a w e l l d e n e d

    f u n c t i o n o n s e q u e n c e s .

    Y o u m a y f a m i l i a r i s e y o u r s e l f w i t h t h e s e o p e r a t i o n s b y p r o v i n g t h e l a w s l i s t e d i n p a r a -

    g r a p h 1 . 4 9 o n a c c o u n t o f t h e a b o v e d e n i t i o n s ( n o t i n g t h a t f g = g

    f = t h e c o m p o s i t i o n

    ` f f o l l o w e d b y g ' )

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    8/80

    6 C H A P T E R 0 . I N T R O D U C T I O N

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    9/80

    C h a p t e r 1

    T h e m a i n c o n c e p t s

    T h i s i n t r o d u c t o r y c h a p t e r g i v e s a b r i e f o v e r v i e w o f t h e i m p o r t a n t c a t e g o r i c a l c o n c e p t s ,

    n a m e l y c a t e g o r y , f u n c t o r , n a t u r a l i t y , a d j u n c t i o n , d u a l i t y . I n t h e n e x t c h a p t e r w e w i l l s h o w

    h o w t o e x p r e s s f a m i l i a r s e t - t h e o r e t i c n o t i o n s i n c a t e g o r y t h e o r e t i c t e r m s .

    1 a C a t e g o r i e s

    A c a t e g o r y i s a c o l l e c t i o n o f d a t a t h a t s a t i s f y s o m e p a r t i c u l a r p r o p e r t i e s . S o , s a y i n g t h a t

    s u c h - a n d - s o f o r m s a c a t e g o r y i s m e r e l y s h o r t f o r a s s e r t i n g t h a t s u c h - a n d - s o s a t i s f y a l l t h e

    a x i o m s o f a c a t e g o r y . S i n c e a l a r g e b o d y o f c o n c e p t s a n d t h e o r e m s h a v e b e e n d e v e l o p e d

    t h a t a r e b a s e d o n t h e c a t e g o r i c a l a x i o m s o n l y , t h o s e c o n c e p t s a n d t h e o r e m s a r e i m m e d i a t e l y

    a v a i l a b l e f o r s u c h - a n d - s o i f t h a t f o r m s a c a t e g o r y .

    F o r a n i n t u i t i v e u n d e r s t a n d i n g i n t h e f o l l o w i n g d e n i t i o n , o n e m a y i n t e r p r e t o b j e c t s a s

    s e t s , a n d m o r p h i s m s a s t y p e d t o t a l f u n c t i o n s . W e s h a l l l a t e r p r o v i d e s o m e m o r e a n d q u i t e

    d i e r e n t e x a m p l e s o f a c a t e g o r y , i n w h i c h t h e o b j e c t s a r e n ' t s e t s a n d t h e m o r p h i s m s a r e n ' t

    f u n c t i o n s .

    1 . 1 D e n i t i o n . A c a t e g o r y i s : t h e f o l l o w i n g d a t a , s u b j e c t t o t h e a x i o m s l i s t e d i n

    p a r a g r a p h 1 . 2 .

    A c o l l e c t i o n o f t h i n g s c a l l e d o b j e c t s

    B y d e f a u l t , A B C : : : v a r y o v e r o b j e c t s .

    A c o l l e c t i o n o f t h i n g s c a l l e d m o r p h i s m s , s o m e t i m e s c a l l e d a r r o w s

    B y d e f a u l t , f g h : : : , a n d l a t e r o n a l s o ' : : : , v a r y o v e r m o r p h i s m s .

    A r e l a t i o n o n m o r p h i s m s a n d p a i r s o f o b j e c t s , c a l l e d t y p i n g o f t h e m o r p h i s m s .

    B y d e f a u l t , t h e r e l a t i o n i s d e n o t e d f : A ! B , f o r m o r p h i s m f a n d o b j e c t s A B

    I n t h i s c a s e w e a l s o s a y t h a t A ! B i s t h e t y p e o f f , a n d t h a t f i s a m o r p h i s m

    f r o m A t o B . I n v i e w o f t h e a x i o m s b e l o w w e m a y d e n e t h e s o u r c e a n d t a r g e t

    7

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    10/80

    8 C H A P T E R 1 . T H E M A I N C O N C E P T S

    b y

    s r c f = A a n d t g t f = B w h e n e v e r f : A ! B

    A b i n a r y p a r t i a l o p e r a t i o n o n m o r p h i s m s , c a l l e d c o m p o s i t i o n

    B y d e f a u l t , f g i s t h e n o t a t i o n o f t h e c o m p o s i t i o n o f m o r p h i s m s f a n d g A n

    a l t e r n a t i v e n o t a t i o n i s g

    f , a n d e v e n g f , w i t h t h e c o n v e n t i o n f g = g

    f = g f

    W i t h i n a t e r m d e n o t i n g a m o r p h i s m , s y m b o l h a s w e a k e s t b i n d i n g p o w e r , w h e r e a s

    j u x t a p o s i t i o n b i n d s s t r o n g e s t W e s h a l l h a r d l y u s e s y m b o l

    t o d e n o t e c o m p o s i t i o n .

    F o r e a c h o b j e c t A a d i s t i n g u i s h e d m o r p h i s m , c a l l e d i d e n t i t y o n A

    B y d e f a u l t , i d

    A

    , o r i d w h e n A i s c l e a r f r o m t h e c o n t e x t , d e n o t e s t h e i d e n t i t y o n

    o b j e c t A

    B y d e f a u l t , A B C : : : v a r y o v e r c a t e g o r i e s , a n d p a r t i c u l a r c a t e g o r i e s a r e n a m e d a f t e r

    t h e i r o b j e c t s ( r a t h e r t h a n t h e i r m o r p h i s m s ) . A c t u a l l y , t h e s e d a t a d e n e t h e b a s i c t e r m s

    o f t h e c a t e g o r i c a l l a n g u a g e i n w h i c h p r o p e r t i e s o f t h e c a t e g o r y c a n b e s t a t e d . A c a t e -

    g o r i c a l s t a t e m e n t i s a n e x p r e s s i o n b u i l t f r o m ( n o t a t i o n s f o r ) o b j e c t s , t y p i n g , m o r p h i s m s ,

    c o m p o s i t i o n a n d i d e n t i t i e s b y m e a n s o f t h e u s u a l l o g i c a l c o n n e c t i v e s a n d q u a n t i c a t i o n s

    a n d e q u a l i t y . I f y o u h a p p e n t o k n o w w h a t t h e o b j e c t s r e a l l y a r e , y o u m a y u s e t h o s e a s p e c t s

    i n y o u r s t a t e m e n t s , b u t t h e n y o u a r e n o t e x p r e s s i n g y o u r s e l f c a t e g o r i c a l l y .

    S o m e t i m e s t h e r e a r e s e v e r a l c a t e g o r i e s u n d e r d i s c u s s i o n . T h e n t h e n a m e o f t h e c a t e g o r y

    m a y a n d m u s t b e a d d e d t o t h e a b o v e n o t a t i o n s , a s a s u b s c r i p t o r o t h e r w i s e , i n o r d e r t o

    a v o i d a m b i g u i t y . S o , l e t A b e a c a t e g o r y . T h e n w e m a y w r i t e s p e c i c a l l y f : A !

    A

    B ,

    s r c

    A

    , t g t

    A

    , f

    A

    g , a n d i d

    A A

    . T h e r e i s n o r e q u i r e m e n t i n t h e d e n i t i o n o f a c a t e g o r y

    s t a t i n g t h a t t h e m o r p h i s m s o f o n e s h o u l d b e d i e r e n t f r o m t h o s e o f a n o t h e r a m o r p h i s m

    o f A m a y a l s o b e a m o r p h i s m o f B . I n s u c h a c a s e t h e i n d i c a t i o n o f A i n f : A !

    A

    B

    a n d s r c

    A

    f i s q u i t e i m p o r t a n t .

    1 . 2 A x i o m s . T h e r e a r e t h r e e ` t y p i n g ' a x i o m s , a n d t w o a x i o m s f o r e q u a l i t y . T h e t y p i n g

    a x i o m s a r e t h e s e :

    f : A ! B a n d f : A

    0

    ! B

    0

    ) A = A

    0

    a n d B = B

    0

    1 3 u n i q u e - T y p e

    f : A ! B a n d g : B ! C ) f g : A ! C1 4 c o m p o s i t i o n - T y p e

    i d

    A

    : A ! A1 5 i d e n t i t y - T y p e

    A m o r p h i s m t e r m f i s w e l l - t y p e d i f : a t y p i n g f : A ! B c a n b e d e r i v e d f o r s o m e o b j e c t s

    A B a c c o r d i n g t o t h e s e a x i o m s ( a n d t h e T y p e p r o p e r t i e s o f d e n e d n o t i o n s t h a t w i l l b e

    g i v e n i n t h e s e q u e l ) .

    C o n v e n t i o n . W h e n e v e r w e w r i t e a t e r m , w e a s s u m e t h a t t h e v a r i a b l e s a r e t y p e d ( a t

    t h e i r i n t r o d u c t i o n | m o s t l y a n i m p l i c i t u n i v e r s a l q u a n t i c a t i o n i n f r o n t o f t h e f o r m u l a )

    i n s u c h a w a y t h a t t h e t e r m i s w e l l - t y p e d . T h i s c o n v e n t i o n a l l o w s u s t o s i m p l i f y t h e

    f o r m u l a t i o n s c o n s i d e r a b l y , a s i l l u s t r a t e d i n t h e f o l l o w i n g a x i o m s .

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    11/80

    1 A . C A T E G O R I E S 9

    H e r e a r e t h e t w o a x i o m s f o r e q u a l i t y o f m o r p h i s m s .

    ( f g ) h = f ( g h )1 6 c o m p o s i t i o n - A s s o c

    i d f = f = f i d1 7 I d e n t i t y

    I n a c c o r d a n c e w i t h t h e c o n v e n t i o n e x p l a i n e d a f e w l i n e s u p , a x i o m c o m p o s i t i o n - A s s o c

    i s u n i v e r s a l l y q u a n t i e d w i t h \ f o r a l l o b j e c t s A B C D a n d a l l m o r p h i s m s f g h w i t h

    f : A ! B , g : B ! C , a n d h : C ! D " , o r s l i g h t l y s i m p l e r , \ f o r a l l f g h w i t h

    t g t f = s r c g a n d t g t g = s r c h " . I n a c c o r d a n c e w i t h t h a t s a m e c o n v e n t i o n , a x i o m I d e n t i t y

    a c t u a l l y r e a d s i d

    s r c f

    f = f = f i d

    t g t f

    , o r e v e n \ f o r a l l o b j e c t s A B a n d a l l m o r p h i s m s

    f w i t h f : A ! B , i d

    A

    f = f = f i d

    B

    "

    C o n v e n t i o n . T h e c a t e g o r y a x i o m s a r e s o b a s i c t h a t w e s h a l l m o s t l y u s e t h e m t a c i t l y .

    I n p a r t i c u l a r , w e s h a l l u s e c o m p o s i t i o n - A s s o c i m p l i c i t l y b y o m i t t i n g t h e p a r e n t h e s e s i n a

    c o m p o s i t i o n , t h u s w r i t i n g f g h i n s t e a d o f e i t h e r ( f g ) h o r f ( g h )

    1 . 8 P r e - c a t e g o r y . I f t h e r e q u i r e m e n t u n i q u e - T y p e i s d r o p p e d i n t h e d e n i t i o n o f a

    c a t e g o r y , t h e n o n e g e t s t h e d e n i t i o n o f a p r e - c a t e g o r y

    Q u i t e o f t e n w e s h a l l e n c o u n t e r d a t a t h a t f o r m a p r e - c a t e g o r y . B y a s i m p l e t r i c k , t h o s e

    d a t a a l s o d e t e r m i n e a c a t e g o r y : t a k e m u l t i p l e c o p i e s o f t h e m o r p h i s m s a n d m a k e t h e m

    d i s t i n c t b y i n c o r p o r a t i n g a \ s o u r c e " a n d \ t a r g e t " i n t o t h e m . F o r m a l l y , l e t A b e a p r e -

    c a t e g o r y , a n d d e n e B b y

    a n o b j e c t i n B i s : a n o b j e c t i n A

    a m o r p h i s m i n B i s : a t r i p l e ( A f B ) w i t h f : A !

    A

    B

    f : A !

    B

    B A = A

    0

    a n d B = B

    0

    w h e r e ( A

    0

    f

    0

    B

    0

    ) = f

    f

    B

    g = ( A f

    0

    A

    g

    0

    C )

    w h e r e ( A f

    0

    B ) = f a n d ( B g

    0

    C ) = g

    i d

    B A

    = ( A i d

    A A

    A )

    T h e n B i s a c a t e g o r y . ( E x e r c i s e : p r o v e t h i s . )

    I n t h e s e q u e l , w e s h a l l s o m e t i m e s p r e t e n d t h a t a p r e - c a t e g o r y i s a c a t e g o r y , t h a t i s , w e

    s h a l l d e n e a c a t e g o r y o u t o f i t b y t h e a b o v e c o n s t r u c t i o n , b u t k e e p w r i t i n g f i n s t e a d o f

    ( A f B ) f o r t h e m o r p h i s m s .

    A b i g t e c h n i c a l a d v a n t a g e o f c a t e g o r i e s o v e r p r e - c a t e g o r i e s i s t h a t t h e r e i s n o n e e d t o

    s p e c i f y t h e s o u r c e a n d t a r g e t o f a m o r p h i s m t h e y a r e d e t e r m i n e d b y m o r p h i s m f a s s r c f

    a n d t g t f , r e s p e c t i v e l y . ( N e v e r t h e l e s s w e s h a l l o f t e n e x p l i c i t l y n a m e t h e s o u r c e a n d t a r g e t

    o f a m o r p h i s m , f o r c l a r i t y . ) A b i g c o n c e p t u a l a d v a n t a g e o f p r e - c a t e g o r i e s o v e r c a t e g o r i e s

    i s t h a t t h e m o r p h i s m s m o r e c l o s e l y c o r r e s p o n d t o t h e s t r u c t u r e p r e s e r v i n g t r a n s f o r m a t i o n s

    o f i n t e r e s t . I t s e e m s t h a t m o s t c o n c e p t s a n d t h e o r e m s f o r c a t e g o r i e s c a n b e g e n e r a l i s e d t o

    p r e - c a t e g o r i e s .

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    12/80

    1 0 C H A P T E R 1 . T H E M A I N C O N C E P T S

    1 . 9 E x a m p l e : S e t S e t

    0

    i s : t h e p r e - c a t e g o r y w h o s e o b j e c t s a r e s e t s , w h o s e m o r p h i s m s

    a r e t o t a l f u n c t i o n s , a n d w h o s e c o m p o s i t i o n a n d i d e n t i t i e s a r e f u n c t i o n c o m p o s i t i o n a n d

    i d e n t i t y f u n c t i o n s r e s p e c t i v e l y . F u r t h e r , d e n e f : A ! B t o m e a n t h a t , f o r e a c h a 2

    A , f a i s w e l l - d e n e d a n d f a 2 B . T h u s , f o r t h e s q u a r i n g f u n c t i o n s q u a r e w e h a v e

    s q u a r e : n a t ! n a t a s w e l l a s s q u a r e : r e a l ! r e a l , a n d s o o n . W i t h t h i s d e n i t i o n t h e

    a x i o m s l i s t e d i n p a r a g r a p h 1 . 2 , e x c e p t f o r u n i q u e - T y p e , a r e f u l l l e d . ( E x e r c i s e : v e r i f y t h e

    a x i o m s . )

    N o w d e n e c a t e g o r y S e t o u t o f p r e - c a t e g o r y S e t

    0

    b y t h e c o n s t r u c t i o n g i v e n i n p a r a -

    g r a p h 1 . 8 . W e k e e p s a y i n g t h a t t h e m o r p h i s m s i n S e t a r e t o t a l f u n c t i o n s i t m a y b e m o r e

    a c c u r a t e t o s a y t h a t t h e y a r e ` t y p e d ' t o t a l f u n c t i o n s , s i n c e t h e y c a r r y t h e i r t y p e ( s o u r c e

    a n d t a r g e t ) w i t h t h e m . W e a l s o k e e p t h e n o t a t i o n f a f o r t h e a p p l i c a t i o n o f f o n a ,

    w h e n e v e r f : A !

    S e t

    B a n d a 2 A

    D o i n g s e t t h e o r y i n t h e c a t e g o r i c a l l a n g u a g e e n f o r c e s t h e s t r a i t j a c k e t o f e x p r e s s i n g e v e r y -

    t h i n g w i t h f u n c t i o n c o m p o s i t i o n o n l y , w i t h o u t u s i n g e x p l i c i t a r g u m e n t s , m e m b e r s h i p a n d

    f u n c t i o n a p p l i c a t i o n . O n c e m a s t e r e d i t i s o f t e n , n o t a l w a y s , a n e l e g a n t w a y o f e x p r e s s i n g .

    W e s h a l l m o s t l y i l l u s t r a t e t h e n o t i o n s o f c a t e g o r y t h e o r y i n t e r m s o f c a t e g o r i e s w h e r e

    t h e m o r p h i s m s a r e f u n c t i o n s a n d c o m p o s i t i o n i s f u n c t i o n c o m p o s i t i o n , l i k e i n S e t . B u t

    b e w a r e , e v e n i f t h e m o r p h i s m s a r e f u n c t i o n s , t h e o b j e c t s n e e d n o t a t a l l b e s e t s : s o m e t i m e s

    t h e o b j e c t s a r e o p e r a t i o n s ( w i t h a n a p p r o p r i a t e d e n i t i o n f o r t h e t y p i n g o f t h e f u n c t i o n s ) .

    T h e c a t e g o r i e s o f F - a l g e b r a s a r e a n e x a m p l e o f t h i s a s p e c i a l c a s e i s A l g ( I I ) d i s c u s s e d

    i n p a r a g r a p h 1 . 2 2 , a n d M o n i n p a r a g r a p h 1 . 2 3 . O t h e r t i m e s w e ' l l t a k e \ s t r u c t u r e s " ( o f

    s t r u c t u r e d d a t a ) a s o b j e c t s , a g a i n w i t h a n a p p r o p r i a t e i n t e r p r e t a t i o n f o r t h e t y p i n g o f t h e

    m o r p h i s m s t h i s o c c u r s i n c a t e g o r y F t r ( A B ) d e n e d i n p a r a g r a p h 1 . 3 7 .

    1 . 1 0 E x a m p l e : g r a p h s a n d p r e - o r d e r s . O n e s h o u l d n o t b e m i s l e a d b y o u r i l l u s -

    t r a t i o n s , w h e r e m o r p h i s m s a r e f u n c t i o n s . T h e r e a r e m a n y m o r e m a t h e m a t i c a l d a t a t h a t

    c a n b e v i e w e d a s a c a t e g o r y . T o m e n t i o n j u s t o n e g e n e r i c e x a m p l e , e a c h d i r e c t e d g r a p h

    d e t e r m i n e s a c a t e g o r y a s f o l l o w s . T a k e t h e n o d e s a s o b j e c t s , a n d a l l p a t h s a s m o r p h i s m s

    t y p e d w i t h t h e i r s t a r t a n d e n d n o d e s . C o m p o s i t i o n i s c o n c a t e n a t i o n o f p a t h s , a n d t h e

    i d e n t i t i e s a r e t h e e m p t y p a t h s . T h u s d e n e d , t h e s e d a t a d o s a t i s f y t h e a x i o m s l i s t e d i n

    p a r a g r a p h 1 . 2 , h e n c e f o r m a c a t e g o r y . ( E x e r c i s e : v e r i f y t h i s . )

    H e r e i s y e t a n o t h e r i m p o r t a n t e x a m p l e o f a c l a s s o f c a t e g o r i e s . W e d o n ' t n e e d i t

    i n o u r d i s c u s s i o n o f a l g o r i t h m i c s , b u t i t p r o v i d e s s o m e t i m e s i n s t r u c t i v e e x a m p l e s . E a c h

    p r e - o r d e r e d s e t ( A ) c a n b e c o n s i d e r e d a c a t e g o r y , i n t h e f o l l o w i n g w a y . T h e e l e m e n t s

    a b : : : o f A a r e t h e o b j e c t s o f t h e c a t e g o r y a n d t h e r e i s a m o r p h i s m f r o m a t o b p r e c i s e l y

    w h e n a b . F o r m a l l y , t h e c a t e g o r y i s d e n e d a s f o l l o w s .

    a n o b j e c t i s : a n e l e m e n t i n A

    a m o r p h i s m i s : a p a i r ( a b ) w i t h a b i n A

    ( a b ) : c ! d a = c b = d

    ( a b ) ( b c ) = ( a c )

    i d

    a

    = ( a a )

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    13/80

    1 A . C A T E G O R I E S 1 1

    T h u s d e n e d , t h e s e d a t a d o s a t i s f y t h e a x i o m s o f a c a t e g o r y .

    E x e r c i s e : c h e c k t h a t l a w s c o m p o s i t i o n - A s s o c a n d - I d e n t i t y a r e s a t i s e d , a n d t h a t t h e t y p i n g

    a x i o m s f o l l o w f r o m t h e d e n i t i o n o f t h e t y p i n g r e l a t i o n , a n d t h a t t h e w e l l - d e n e d n e s s o f

    a n d i d f o l l o w f r o m t h e t r a n s i t i v i t y a n d r e e x i v i t y o f t h e p r e o r d e r , r e s p e c t i v e l y .

    E x e r c i s e : d e n e a c a t e g o r y w h e r e t h e m o r p h i s m s a r e n u m b e r s , a n d t h e c o m p o s i t i o n i s

    a d d i t i o n .

    1 . 1 1 C a r t e s i a n c l o s e d c a t e g o r i e s , a n d T o p o i . T h e a x i o m s o n t h e m o r p h i s m s a n d

    c o m p o s i t i o n a r e v e r y w e a k , s o t h a t m a n y m a t h e m a t i c a l s t r u c t u r e s c a n b e r e n d e r e d a s a

    c a t e g o r y . B y i m p o s i n g e x t r a a x i o m s , s t i l l i n t h e c a t e g o r i c a l l a n g u a g e , t h e c a t e g o r i e s m a y

    h a v e m o r e o f t h e p r o p e r t i e s y o u a r e a c t u a l l y i n t e r e s t e d i n .

    F o r e x a m p l e , a c a r t e s i a n c l o s e d c a t e g o r y i s a c a t e g o r y i n w h i c h t h e e x t r a p r o p e r t i e s

    m a k e t h e m o r p h i s m s b e h a v e m o r e l i k e r e a l f u n c t i o n s : i n p a r t i c u l a r , t h e r e i s a n o t i o n o f

    c u r r y i n g a n d o f a p p l y i n g a c u r r i e d m o r p h i s m . T h e r e i s a c l o s e r e l a t i o n s h i p b e t w e e n t h i s

    t y p e o f c a t e g o r i e s a n d t y p e d - c a l c u l i

    A s a n o t h e r e x a m p l e , a t o p o s ( p l u r a l : t o p o i o r t o p o s e s ) i s a c a r t e s i a n c l o s e d c a t e g o r y

    i n w h i c h t h e e x t r a p r o p e r t i e s m a k e t h e o b j e c t s h a v e m o r e o f t h e p r o p e r t i e s o f r e a l s e t s : i n

    p a r t i c u l a r , f o r e a c h o b j e c t t h e r e e x i s t s a n o b j e c t o f i t s ` s u b o b j e c t s ' .

    I n t h e s e n o t e s , w e s h a l l n o w h e r e n e e d t h e e x t r a p r o p e r t i e s . A s a r e s u l t , t h e n o t i o n s

    d e n e d h e r e , a n d t h e t h e o r e m s p r o v e d , a r e v e r y g e n e r a l a n d v e r y w e a k a t t h e s a m e t i m e .

    1 . 1 2 D i s c u s s i o n . Q u o t i n g A s p e r t i a n d L o n g o 1 ] : \ T h e b a s i c p r e m i s e o f c a t e g o r y t h e o r y

    i s t h a t e v e r y k i n d o f m a t h e m a t i c a l l y s t r u c t u r e d o b j e c t c o m e s e q u i p p e d w i t h a n o t i o n o f

    ] t r a n s f o r m a t i o n , c a l l e d ` m o r p h i s m ' , t h a t p r e s e r v e s t h e s t r u c t u r e o f t h e o b j e c t . " B y

    m e a n s o f t h e c a t e g o r i c a l l a n g u a g e o n e c a n n o t e x p r e s s p r o p e r t i e s o f t h e i n t e r n a l s t r u c t u r e

    o f o b j e c t s . T h e i n t e r n a l s t r u c t u r e o f o b j e c t s i s a c c e s s i b l e o n l y e x t e r n a l l y t h r o u g h t h e

    m o r p h i s m s b e t w e e n t h e o b j e c t s . T h e m o r p h i s m s m a y s e e m ( a n d s o m e t i m e s a r e ) f u n c t i o n s ,

    b u t t h e c a t e g o r i c a l l a n g u a g e d o e s n ' t e x p r e s s t h a t i t o n l y p r o v i d e s a w a y t o e x p r e s s t h e

    c o m p o s i t i o n o f m o r p h i s m s . T h e d i s c i p l i n e o f e x p r e s s i n g i n t e r n a l s t r u c t u r e o n l y e x t e r n a l l y i s

    t h e k e y t o t h e u n i f o r m i t y o f d e s c r i b i n g s t r u c t u r a l c o n c e p t s i n v a r i o u s d i e r e n t a p p l i c a t i o n

    e l d s .

    S i n c e e a c h g r a p h i s a c a t e g o r y , t h e a b o v e i n t e r p r e t a t i o n o f \ i n t e r n a l s t r u c t u r e " o f o b j e c t s

    d o e s n ' t a l w a y s m a k e s e n s e .

    E x e r c i s e . W h a t f u n c t i o n s a r e p r e c i s e l y t h e f u n c t i o n s t h a t p r e s e r v e a p a r t i a l o r d e r ?

    ( D e n e a c a t e g o r y i n w h i c h t h e s e f u n c t i o n s a r e t h e m o r p h i s m s . ) W h a t f u n c t i o n s a r e

    p r e c i s e l y t h e f u n c t i o n s t h a t p r e s e r v e a p a r t i a l o r d e r a n d t h e l i m i t s ? ( D e n e a c a t e g o r y i n

    w h i c h t h e s e f u n c t i o n s a r e t h e m o r p h i s m s . ) W h a t s t r u c t u r e o f s e t s i s p r e s e r v e d b y p r e c i s e l y

    a l l t o t a l f u n c t i o n s ? ( W h a t c a t e g o r y h a s t h e s e f u n c t i o n s a s m o r p h i s m s ? )

    1 . 1 3 E x p r e s s i n g c o n c e p t s c a t e g o r i c a l l y . I n t h e f o l l o w i n g c h a p t e r s w e s h a l l s h o w

    h o w a l l k i n d s o f f a m i l i a r c o n c e p t s c a n b e e x p r e s s e d c a t e g o r i c a l l y , t h a t i s , u s i n g o n l y t h e

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    14/80

    1 2 C H A P T E R 1 . T H E M A I N C O N C E P T S

    n o t i o n s o f o b j e c t , m o r p h i s m , t y p i n g , c o m p o s i t i o n , i d e n t i t y , a n d n o t i o n s t h a t c a n b e d e n e d

    i n t e r m s o f t h e s e , a n d f u r t h e r t h e u s u a l l o g i c a l c o n n e c t i v e s a n d q u a n t i c a t i o n s .

    T o a p p r e c i a t e t h e p r o b l e m s a n d d e l i g h t i n v o l v e d , t h e r e a d e r m a y s p e n d s o m e ( n o t

    t o o m u c h ) t i m e i n t r y i n g t o n d a c a t e g o r i c a l l y e x p r e s s e d p r o p e r t y P s u c h t h a t i n S e t

    p r o p e r t y P h o l d s p r e c i s e l y f o r t h e e m p t y s e t , t h a t i s , P ( A ) A = . S i m i l a r l y , y o u m a y

    t h i n k a b o u t c a t e g o r i c a l l y e x p r e s s e d p r o p e r t i e s P s u c h t h a t i n S e t t h e f o l l o w i n g h o l d s :

    P ( A ) A = f 1 7 g

    P ( A ) A i s a s i n g l e t o n s e t

    P ( A B ) A B

    P ( f ) f i s s u r j e c t i v e

    P ( f ) f i s i n j e c t i v e

    P ( A B C ) C = A B

    P ( A B C f g ) C i s t h e d i s j o i n t u n i o n o f A a n d B

    w i t h i n j e c t i o n s f : A ! C a n d g : B ! C

    A l s o , t h i n k a b o u t a w a y t o r e p r e s e n t a b i n a r y r e l a t i o n R o n A c a t e g o r i c a l l y w h a t c o l l e c -

    t i o n o f s e t s a n d f u n c t i o n s m a y c a r r y t h e s a m e i n f o r m a t i o n a s R ?

    J u s t f o r f u n y o u m a y a l s o t h i n k a b o u t c a t e g o r i c a l l y e x p r e s s e d p r o p e r t i e s P s u c h t h a t

    i n a p r e - o r d e r c o n s i d e r e d a s a c a t e g o r y ( s e e p a r a g r a p h 1 . 1 0 ) t h e f o l l o w i n g h o l d s :

    P ( a ) a i s a l e a s t e l e m e n t

    P ( a ) a i s a g r e a t e s t e l e m e n t

    P ( a b c ) c i s a g r e a t e s t l o w e r b o u n d o f a a n d b ,

    a n d w h a t i s t h e i n t e r p r e t a t i o n o f t h e s e p r o p e r t i e s i n S e t ?

    1 . 1 4 C o n s t r u c t i n g n e w c a t e g o r i e s . T h e r e a r e s e v e r a l w a y s i n w h i c h n e w c a t e g o r i e s

    c a n b e c o n s t r u c t e d o u t o f g i v e n o n e s . H e r e , w e g i v e j u s t t w o w a y s , a n d i n p a r a g r a p h 1 . 2 4

    w e ' l l s k e t c h s o m e o t h e r w a y s .

    A s u b c a t e g o r y o f A i s c o m p l e t e l y d e t e r m i n e d b y i t s o b j e c t s a n d m o r p h i s m s , a n d A

    F o r m a l l y , a s u b c a t e g o r y o f a c a t e g o r y A i s : a c a t e g o r y i n w h i c h e a c h o b j e c t , m o r p h i s m ,

    a n d i d e n t i t y i s a n o b j e c t , m o r p h i s m , a n d i d e n t i t y i n A , a n d i n w h i c h t h e t y p i n g a n d

    c o m p o s i t i o n i s t h e t y p i n g a n d c o m p o s i t i o n o f A r e s t r i c t e d t o t h e o b j e c t s a n d m o r p h i s m s

    o f t h e s u b c a t e g o r y .

    A f u l l s u b c a t e g o r y o f A i s c o m p l e t e l y d e t e r m i n e d b y i t s o b j e c t s , a n d A . F o r m a l l y , a

    s u b c a t e g o r y o f a c a t e g o r y A i s a f u l l s u b c a t e g o r y o f A i f : f o r e a c h A B i n t h e s u b c a t e g o r y ,

    a l l t h e m o r p h i s m s w i t h t y p e A ! B i n A a r e m o r p h i s m s i n t h e s u b c a t e g o r y .

    A c a t e g o r y i s b u i l t u p o n a c a t e g o r y A i f : i t s m o r p h i s m s a r e m o r p h i s m s i n A , a n d t h e

    c o m p o s i t i o n a n d i d e n t i t i e s a r e i n h e r i t e d f r o m A , a n d f u r t h e r , i t s o b j e c t s a r e c o l l e c t i o n s o f

    m o r p h i s m s o f A , a n d i t s t y p i n g f : A ! B i s d e n e d a s a c o l l e c t i o n o f e q u a t i o n s b e t w e e n

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    15/80

    1 B . F U N C T O R S 1 3

    t h e m o r p h i s m s f A B i n A . A n e x a m p l e i s s p e l l e d o u t i n d e t a i l i n p a r a g r a p h 1 . 2 2 : c a t e -

    g o r y A l g ( I I ) i s b u i l t u p o n S e t , a n d h a s b i n a r y o p e r a t i o n s a s o b j e c t s a n d h o m o m o r p h i s m s

    a s m o r p h i s m s . A l s o , i n p a r a g r a p h 1 . 2 3 c a t e g o r y M o n w i l l b e d e n e d a s a s u b c a t e g o r y o f

    A l g ( I I ) , a n d h e n c e M o n i s b u i l t u p o n S e t t o o .

    E x e r c i s e : p r o v e t h a t ` b e i n g a s u b c a t e g o r y o f ' i s a p a r t i a l o r d e r : r e e x i v e , a n t i s y m m e t r i c ,

    a n d t r a n s i t i v e . A l s o , p r o v e t h a t a s u b c a t e g o r y o f a c a t e g o r y b u i l t u p o n A i s i t s e l f b u i l t

    u p o n A

    1 b F u n c t o r s

    A f u n c t o r i s a m a p p i n g f r o m o n e c a t e g o r y t o a n o t h e r t h a t p r e s e r v e s t h e c a t e g o r i c a l s t r u c -

    t u r e , t h a t i s , i t p r e s e r v e s t h e p r o p e r t y o f b e i n g a n o b j e c t , t h e p r o p e r t y o f b e i n g a m o r p h i s m ,

    t h e t y p i n g , t h e c o m p o s i t i o n , a n d t h e i d e n t i t i e s . T h e s i g n i c a n c e o f f u n c t o r s i s m a n i f o l d :

    t h e y m a p o n e m a t h e m a t i c a l s t r u c t u r e ( c a t e g o r y , p i e c e o f m a t h e m a t i c s ) t o a n o t h e r , t h e y

    t u r n u p a s o b j e c t s o f i n t e r e s t i n g c a t e g o r i e s , t h e y a r e t h e m a t h e m a t i c a l l y o b v i o u s t y p e o f

    t r a n s f o r m a t i o n b e t w e e n c a t e g o r i e s , a n d , l a s t b u t n o t l e a s t , t h e y f o r m a c a t e g o r i c a l t o o l t o

    d e a l w i t h \ s t r u c t u r e d " o b j e c t s ( a s w e s h a l l e x p l a i n i n p a r a g r a p h 1 . 2 1 ) .

    1 . 1 5 D e n i t i o n . L e t A a n d B b e c a t e g o r i e s t h e n a f u n c t o r f r o m A t o B i s : a

    m a p p i n g F t h a t s e n d s o b j e c t s o f A t o o b j e c t s o f B , a n d m o r p h i s m s o f A t o m o r p h i s m s

    o f B i n s u c h a w a y t h a t

    F f : F A !

    B

    F B w h e n e v e r f : A !

    A

    B1 . 1 6 f t r - T y p e

    F i d

    A

    = i d

    F A

    f o r e a c h o b j e c t A i n A1 . 1 7 F u n c t o r

    F ( f g ) = F f F g w h e n e v e r f g i s w e l l - t y p e d 1 . 1 8 F u n c t o r

    F o r m u l a F : A ! B m e a n s t h a t F i s a f u n c t o r f r o m A t o B , a n d w e s a y t h a t A ! B i s

    a ( t h e ) t y p e o f F A n e n d o f u n c t o r i s : a f u n c t o r o f t y p e A ! A , f o r s o m e A i t s s o u r c e

    a n d t a r g e t a r e e q u a l . B y d e f a u l t , F G H J : : : v a r y o v e r f u n c t o r s .

    T h e t w o a x i o m s F u n c t o r a r e e q u i v a l e n t t o t h e s i n g l e s t a t e m e n t t h a t f u n c t o r s d i s t r i b u t e

    o v e r n i t e c o m p o s i t i o n s :

    F ( f g ) = F f F g ,

    w i t h i d b e i n g t h e e m p t y c o m p o s i t i o n .

    1 . 1 9 E x a m p l e : f u n c t o r I I C o n s i d e r c a t e g o r y S e t . D e n e m a p p i n g I I ( p r o n o u n c e d

    t w i n , o r b i n f r o m b i n a r y ) a s f o l l o w s .

    I I A = A A a s e t , h e n c e o b j e c t i n S e t

    I I f = ( a a

    0

    ) ! ( f a f a

    0

    )

    : I I A ! I I B w h e n e v e r f : A ! B

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    16/80

    1 4 C H A P T E R 1 . T H E M A I N C O N C E P T S

    F o r e x a m p l e , I I n a t i s t h e s e t o f p a i r s o f n a t u r a l n u m b e r s , a n d I I s u c c m a p s ( 1 9 4 8 ) o n t o

    ( 2 0 4 9 ) . M a p p i n g I I s a t i s e s t h e f u n c t o r p r o p e r t i e s i t i s a f u n c t o r I I : S e t ! S e t

    ( E x e r c i s e : v e r i f y t h e f u n c t o r a x i o m s . ) F u n c t o r I I c a n b e u s e d t o c h a r a c t e r i s e b i n a r y

    o p e r a t i o n s i n a n e a t w a y . F o r e x a m p l e ,

    + : I I n a t ! n a t

    n ! ( n d i v 1 0 n m o d 1 0 ) : n a t ! I I n a t

    W e s h a l l s a y t h a t t h e b i n a r y o p e r a t i o n s a r e I I - a r y o p e r a t i o n s .

    1 . 2 0 E x a m p l e : f u n c t o r S e q M a p p i n g S e q d i s c u s s e d i n p a r a g r a p h 0 . 4 i s a f u n c t o r

    w i t h t y p e S e t ! S e t . T o s e e t h i s , r e c a l l t h a t :

    S e q A = t h e s e t o f n i t e s e q u e n c e s o v e r A , a n o b j e c t i n S e t

    S e q f = a

    0

    : : : a

    n ; 1

    ! f a

    0

    : : : f a

    n ; 1

    : S e q A ! S e q B w h e n e v e r f : A ! B

    P r o p e r t y f t r - T y p e i s t h e s e c o n d l i n e o f t h e a b o v e e q u a t i o n f o r S e q f , a n d t h e e q u a t i o n s

    S e q i d

    A

    = i d

    S e q A

    a n d S e q ( f g ) = S e q f S e q g a r e e a s i l y v e r i e d . ( E x e r c i s e : d o t h i s . )

    F u n c t i o n s o n o r t o s e q u e n c e s h a v e S e q i n t h e i r s o u r c e o r t a r g e t t y p e , r e s p e c t i v e l y . F o r

    e x a m p l e , f u n c t i o n r e v

    A

    t h a t r e v e r s e s s e q u e n c e s o v e r A , h a s t y p e S e q A ! S e q A

    1 . 2 1 A u s e o f f u n c t o r s . I n t h e d e n i t i o n o f a c a t e g o r y , o b j e c t s a r e \ j u s t t h i n g s "

    f o r w h i c h n o i n t e r n a l s t r u c t u r e i s o b s e r v a b l e b y c a t e g o r i c a l m e a n s ( c o m p o s i t i o n , i d e n t i t i e s ,

    m o r p h i s m s , a n d t y p i n g ) . F u n c t o r s f o r m t h e t o o l t o d e a l w i t h \ s t r u c t u r e d " o b j e c t s . I n d e e d ,

    i n S e t a n ( t h e ? ) a s p e c t o f a s t r u c t u r e i s t h a t i t h a s \ c o n s t i t u e n t s " , a n d t h a t i t i s p o s s i b l e

    t o a p p l y a f u n c t i o n t o a l l t h e i n d i v i d u a l c o n s t i t u e n t s t h i s i s d o n e b y F f : F A ! F B

    S o I I i s o r r e p r e s e n t s t h e s t r u c t u r e o f p a i r s I I A i s t h e s e t o f p a i r s o f A , a n d I I f i s

    t h e f u n c t i o n s t h a t a p p l i e s f t o e a c h c o n s t i t u e n t o f a p a i r . A l s o , S e q i s o r r e p r e s e n t s

    t h e s t r u c t u r e o f s e q u e n c e s S e q A i s t h e s t r u c t u r e o f s e q u e n c e s o v e r A , a n d S e q f i s t h e

    f u n c t i o n t h a t a p p l i e s f t o e a c h c o n s t i t u e n t o f a s e q u e n c e .

    E v e n t h o u g h F A i s s t i l l j u s t a n o b j e c t , a t h i n g w i t h n o o b s e r v a b l e i n t e r n a l s t r u c t u r e ,

    t h e f u n c t o r p r o p e r t i e s e n a b l e t o e x p l o i t t h e \ s t r u c t u r e " o f F A . T h e f o l l o w i n g e x a m p l e

    m a y m a k e t h i s c l e a r i t i l l u s t r a t e s h o w f u n c t o r I I i s o r r e p r e s e n t s t h e s t r u c t u r e o f p a i r s I t

    i l l u s t r a t e s a t t h e s a m e t i m e w h e r e a n d h o w t h e f u n c t o r p r o p e r t i e s p l a y a r o l e .

    F o r t h i s , l e t : I I A ! A a n d : I I B ! B b e b i n a r y o p e r a t i o n s o n s e t s A a n d B

    r e s p e c t i v e l y , a n d l e t f : A ! B b e a f u n c t i o n . W e d e n e t h e n o t a t i o n

    f : !

    I I

    t o m e a n

    f = I I f

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    17/80

    1 B . F U N C T O R S 1 5

    E x p r e s s e d i n s e t - t h e o r e t i c t e r m s , p r o p e r t y f : !

    I I

    m e a n s t h a t f ( x y ) = f x f y

    f o r a l l x y i n t h e s o u r c e s e t o f . F o l l o w i n g m a t h e m a t i c a l t e r m i n o l o g y w e c a l l s u c h a

    f u n c t i o n f a h o m o m o r p h i s m f r o m t o

    N o w , p r o p e r t y f t r - T y p e i m p l i e s w e l l - t y p e d n e s s o f t h e d e n i n g e q u a t i o n o f !

    I I

    , i n d e p e n -

    d e n t l y o f t h e a c t u a l m e a n i n g o f I I . ( E x e r c i s e : v e r i f y t h i s c l a i m . ) T h e t w o o t h e r p r o p e r t i e s ,

    F u n c t o r , e n a b l e u s t o p r o v e t h e f o l l o w i n g t h e o r e m i n d e p e n d e n t l y o f t h e a c t u a l m e a n i n g o f

    I I . T h e t h e o r e m e x p r e s s e s t h a t f o r e a c h o p e r a t i o n t h e i d e n t i t y i s a h o m o m o r p h i s m f r o m

    t h a t o p e r a t i o n t o i t s e l f , a n d t h a t t h e c o m p o s i t i o n o f h o m o m o r p h i s m s i s a h o m o m o r p h i s m

    a g a i n .

    T h e o r e m

    i d : !

    I I

    f : !

    I I

    a n d g : !

    I I

    ) f g : !

    I I

    I n d e e d , f o r t h e f o r m e r w e a r g u e

    i d : !

    I I

    d e n i t i o n !

    I I

    i d = I I i d

    l h s : I d e n t i t y

    i d = I I i d

    ( L e i b n i z

    i d = I I i d

    F u n c t o r

    t r u e

    F o r t h e l a t t e r w e a r g u e

    f g : !

    I I

    d e n i t i o n !

    I I

    f g = I I ( f g )

    l h s : p r e m i s e f : !

    I I

    , a n d d e n i t i o n !

    I I

    I I f g = I I ( f g )

    l h s : p r e m i s e g : !

    I I

    , a n d d e n i t i o n !

    I I

    I I f I I g = I I ( f g )

    ( L e i b n i z

    I I f I I g = I I ( f g )

    F u n c t o r

    t r u e

    N o t o n l y i s t h e a c t u a l m e a n i n g o f I I n o w h e r e u s e d , b u t a l s o i t i s n o w h e r e u s e d t h a t A B

    a r e s e t s ( t h e r e i s n o w h e r e a m e m b e r s h i p 2 ) o r t h a t f g : : : a r e f u n c t i o n s o r o p e r a -

    t i o n s , r e s p e c t i v e l y . O n l y t h e c a t e g o r y a x i o m s ( a l l e x c e p t u n i q u e - T y p e ) a n d t h e f u n c t o r

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    18/80

    1 6 C H A P T E R 1 . T H E M A I N C O N C E P T S

    a x i o m s ( a l l o f t h e m ) h a v e b e e n u s e d . S o t h e a b o v e d e n i t i o n , t h e o r e m , a n d p r o o f a r e

    v a l i d f o r a n y f u n c t o r a n d a n y c a t e g o r y , n o t j u s t f o r f u n c t o r I I a n d c a t e g o r y S e t . H e r e

    w e s e e h o w a c a t e g o r i c a l f o r m u l a t i o n s u g g e s t s o r e a s e s a f a r - r e a c h i n g g e n e r a l i s a t i o n : r e -

    p l a c e I I b y a n a r b i t r a r y f u n c t o r F , a n d y o u h a v e a d e n i t i o n o f ` F - a r y o p e r a t i o n ' a n d

    ` F - h o m o m o r p h i s m ' , a n d a t h e o r e m t o g e t h e r w i t h i t s p r o o f a b o u t t h a t n o t i o n , a n d t h e s e

    a r e v a l i d f o r a n a r b i t r a r y c a t e g o r y .

    E x e r c i s e : g e n e r a l i s e t h e a b o v e t h e o r e m a n d p r o o f b y r e p l a c i n g I I e v e r y w h e r e b y a n a r b i -

    t r a r y f u n c t o r F c h e c k e a c h s t e p . A l s o , g e n e r a l i s e f r o m S e t t o a n a r b i t r a r y c a t e g o r y .

    T h i s c o n c l u d e s a n i l l u s t r a t i o n o f t h e u s e o f t h e f u n c t o r a x i o m s , a n d o f u s i n g f u n c t o r s t o

    d e a l w i t h \ s t r u c t u r e d o b j e c t s " .

    1 . 2 2 C a t e g o r y A l g ( I I ) T h e t h e o r e m i n p a r a g r a p h 1 . 2 1 g i v e s r i s e t o a n o t h e r c a t e g o r y ,

    t o b e c a l l e d A l g ( I I ) a n i m p o r t a n t o n e f o r a l g o r i t h m i c s , a s w i l l b e c o m e c l e a r i n t h e s e q u e l .

    I n w o r d s , A l g ( I I ) h a s t h e I I - a r y o p e r a t i o n s i n S e t a s o b j e c t s , t h e h o m o m o r p h i s m s f o r

    t h e s e o p e r a t i o n s a s m o r p h i s m s , a n d i t i n h e r i t s t h e c o m p o s i t i o n a n d i d e n t i t i e s f r o m S e t

    ( T h i s x e s e v e r y t h i n g e x c e p t t h e t y p i n g . ) F o r m a l l y , A l g ( I I ) i s d e n e d t h u s :

    a n A l g ( I I ) - o b j e c t i s : a I I - a r y o p e r a t i o n i n S e t

    a n A l g ( I I ) - m o r p h i s m i s : a h o m o m o r p h i s m f o r I I - a r y o p e r a t i o n s , i n S e t

    f : !

    A l g ( I I )

    f : !

    I I

    f = I I f

    f

    A l g ( I I )

    g = f

    S e t

    g

    i d

    A l g ( I I )

    = i d

    S e t A

    w h e r e A = t g t

    S e t

    ( )

    T h u s , A l g ( I I ) i s b u i l t u p o n S e t ( s e e p a r a g r a p h 1 . 1 4 f o r ` b u i l t u p o n ' ) . L e t u s s e e w h e t h e r

    t h e c a t e g o r y a x i o m s a r e f u l l l e d f o r A l g ( I I ) . T h e t h e o r e m i n p a r a g r a p h 1 . 2 1 a s s e r t s

    t h a t a x i o m s c o m p o s i t i o n - T y p e a n d i d e n t i t y - T y p e a r e f u l l l e d . T h e a x i o m s c o m p o s i t i o n -

    A s s o c a n d I d e n t i t y a r e f u l l l e d s i n c e t h e c o m p o s i t i o n a n d t h e i d e n t i t i e s a r e i n h e r i t e d f r o m

    c a t e g o r y S e t . S o , A l g ( I I ) i s a t l e a s t a p r e - c a t e g o r y . W i t h t h e d e n i t i o n a b o v e a x i o m

    u n i q u e - T y p e i s n o t f u l l l e d s o t h a t A l g ( I I ) i s n o t a c a t e g o r y . T h e r e a s o n i s t h a t a f u n c t i o n

    c a n b e a h o m o m o r p h i s m f o r s e v e r a l d i s t i n c t o p e r a t i o n s , t h a t i s , f : !

    I I

    a n d f :

    0

    !

    I I

    0

    c a n b o t h b e t r u e w h i l e t h e p a i r d i e r s f r o m t h e p a i r

    0

    0

    . ( E x e r c i s e : n d s u c h

    a f u n c t i o n a n d o p e r a t i o n s . )

    I n t h e s e q u e l w e s h a l l p r e t e n d t h a t A l g ( I I ) i s m a d e i n t o a c a t e g o r y ( r e - d e n i n g i t ) b y

    t h e t e c h n i q u e o f c o n s t r u c t i n g a c a t e g o r y o u t o f a p r e - c a t e g o r y , s e e p a r a g r a p h 1 . 8 . T h u s ,

    f : !

    A l g ( I I )

    d e n o t e s t h e t y p i n g i n A l g ( I I ) , a n d i m p l i e s t h a t t g t

    A l g ( I I )

    f = , w h e r e a s

    f o r m u l a f : !

    I I

    k e e p s t o m e a n o n l y t h a t f = I I f

    E x e r c i s e : g e n e r a l i s e t h e c o n s t r u c t i o n a b o v e t o a n a r b i t r a r y c a t e g o r y A i n s t e a d o f S e t

    T h a t i s , g i v e n a n a r b i t r a r y c a t e g o r y A , d e n e t h e ( p r e ) c a t e g o r y A l g

    A

    ( I I ) a n a l o g o u s t o

    A l g ( I I ) a b o v e . A l s o , g e n e r a l i s e I I t o a n a r b i t r a r y f u n c t o r F

    T h e n a m e ` A l g ' i s m n e m o n i c f o r ` a l g e b r a ' a n d d e r i v e s f r o m t h e f o l l o w i n g o b s e r v a t i o n . T h e

    I I - a r y o p e r a t i o n s a r e , i n f a c t , v e r y s i m p l e a l g e b r a s . C o n v e n t i o n a l l y , a n a l g e b r a w i t h a

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    19/80

    1 B . F U N C T O R S 1 7

    s i n g l e o p e r a t i o n : I I A ! A i s t h e p a i r ( A ) , a n d A i s c a l l e d t h e c a r r i e r . T h a n k s

    t o a x i o m u n i q u e - T y p e t h e c a r r i e r i s f u l l y d e t e r m i n e d b y t h e o p e r a t i o n i t s e l f , s o t h a t t h e

    o p e r a t i o n i t s e l f c a n b e c o n s i d e r e d t h e a l g e b r a .

    1 . 2 3 C a t e g o r y M o n N o w t h a t w e h a v e d e n e d c a t e g o r y A l g ( I I ) , w e t a k e t h e o p p o r -

    t u n i t y t o p r e s e n t a n o t h e r c a t e g o r y , t o b e c a l l e d M o n ( m n e m o n i c f o r ` m o n o i d ' ) . I t w i l l b e

    u s e d i n S e c t i o n 1 d b e l o w .

    F i r s t r e c a l l t h e n o t i o n o f m o n o i d . A m o n o i d o p e r a t i o n i s : a b i n a r y o p e r a t i o n t h a t i s

    a s s o c i a t i v e a n d h a s a n e u t r a l e l e m e n t ( s o m e t i m e s c a l l e d u n i t , o r e v e n i d e n t i t y ) . C o n v e n -

    t i o n a l l y , a m o n o i d i s : a t r i p l e ( A e ) , w h e r e : I I A ! A i s a m o n o i d o p e r a t i o n a n d

    e i s i t s n e u t r a l e l e m e n t . T h e c a r r i e r A i s u n i q u e l y d e t e r m i n e d b y ( t h a n k s t o a x i o m

    u n i q u e - T y p e , A = t g t ( ) ) . A l s o , t h e n e u t r a l e l e m e n t f o r i s u n i q u e , s i n c e e = e e

    0

    = e

    0

    f o r a n y t w o n e u t r a l e l e m e n t s e a n d e

    0

    . S o , w e m i g h t s a y t h a t a l o n e i s , o r r e p r e s e n t s ,

    t h e m o n o i d . A n y w a y , w e s h a l l t a l k o f m o n o i d o p e r a t i o n s , r a t h e r t h a n o f m o n o i d s .

    T h e s i g n i c a n c e o f m o n o i d o p e r a t i o n s f o r a l g o r i t h m i c s i s t h a t t h e r e d u c e - w i t h - i s a

    w e l l - d e n e d f u n c t i o n o f t y p e S e q A ! A w h e n i s a m o n o i d o p e r a t i o n s e e p a r a g r a p h 0 . 4 .

    C a t e g o r y M o n i s : t h e s u b c a t e g o r y o f A l g ( I I ) w h o s e o b j e c t s a r e t h e m o n o i d o p e r a t i o n s ,

    a n d w h o s e m o r p h i s m s a r e t h o s e f f o r w h i c h f : !

    I I

    a n d f ( e ) = e

    0

    w h e r e e e

    0

    a r e

    t h e n e u t r a l e l e m e n t s o f

    E x e r c i s e : g i v e a n e x p l i c i t d e n i t i o n o f t h e o b j e c t s , m o r p h i s m s , t y p i n g , c o m p o s i t i o n , a n d

    i d e n t i t i e s i n M o n , a n d p r o v e t h a t t h e c a t e g o r y a x i o m s a r e f u l l l e d .

    E x e r c i s e : p r o v e t h a t , i n S e t , M o n i s n o t a f u l l s u b c a t e g o r y o f A l g ( I I )

    1 . 2 4 M o r e f u n c t o r s , n e w c a t e g o r i e s . U p t o n o w w e h a v e s e e n o n l y e n d o f u n c t o r s ,

    n a m e l y I I a n d S e q t h a t i s , f u n c t o r s w h o s e s o u r c e a n d t a r g e t a r e e q u a l . T h e r e a r e s e v e r a l

    r e a s o n s w h y i t i s u s e f u l t o a l l o w t h e s o u r c e a n d t a r g e t c a t e g o r y o f a f u n c t o r t o d i e r f r o m

    e a c h o t h e r . W e b r i e y m e n t i o n t h r e e o f s u c h r e a s o n s h e r e . A t t h e s a m e t i m e , t h e s e r e a s o n s

    d e m o n s t r a t e t h e n e e d f o r b u i l d i n g n e w c a t e g o r i e s o u t o f g i v e n o n e s .

    F i r s t , t h e r e i s n o p r o b l e m i n d e n i n g a n o t i o n o f a 2 - p l a c e f u n c t o r , a l s o c a l l e d a b i f u n c -

    t o r . ( E x e r c i s e : t r y t o d e n e t h e n o t i o n o f b i f u n c t o r f o r m a l l y h o w w o u l d t h e b i f u n c t o r

    a x i o m s r e a d ? ) H o w e v e r , b y a s u i t a b l e d e n i t i o n o f t h e p r o d u c t o f t w o c a t e g o r i e s ( l i k e

    t h e c a r t e s i a n p r o d u c t o f s e t s ) , a 2 - p l a c e f u n c t o r o n c a t e g o r y A i s j u s t a n o r m a l f u n c t o r

    F : A A ! A . ( E x e r c i s e : t r y t o d e n e t h e n o t i o n o f t h e p r o d u c t c a t e g o r y A B o f

    t w o c a t e g o r i e s A a n d B . W h a t a r e t h e o b j e c t s , m o r p h i s m s , t y p i n g , c o m p o s i t i o n , a n d

    i d e n t i t i e s ? P r o v e t h a t t h e s e s a t i s f y t h e c a t e g o r y a x i o m s . )

    S e c o n d , l e t A b e a n a r b i t r a r y c a t e g o r y , a n d c o n s i d e r t h e f o l l o w i n g m a p p i n g F f r o m

    A t o S e t

    F A = f g g i s a m o r p h i s m i n A w i t h s r c g = A g a n o b j e c t i n S e t

    F f = g ! f

    A

    g

    : F A !

    S e t

    F B w h e n e v e r f : B !

    A

    A

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    20/80

    1 8 C H A P T E R 1 . T H E M A I N C O N C E P T S

    I n v i e w o f t h e e q u a t i o n f o r F f w e m i g h t c a l l F f : ` p r e c e d e w i t h f ' , a n d w e m i g h t w r i t e

    F f a l t e r n a t i v e l y a s ( f ) o r (

    f ) . M a p p i n g F i s l i k e a f u n c t o r i t h a s t h e p r o p e r t i e s t h a t

    f : B !

    A

    A ) F f : F A !

    S e t

    F B

    F i d = i d

    F ( g f ) = F f

    S e t

    F g

    N o t i c e t h a t i n t h e l e f t h a n d s i d e A a n d B , a n d a l s o f a n d g , a r e a t t h e w r o n g p l a c e f o r

    F t o b e a f u n c t o r . T h e r e i s n o p r o b l e m i n d e n i n g a n o t i o n o f a c o n t r a v a r i a n t f u n c t o r ,

    s o t h a t F i s a c o n t r a v a r i a n t f u n c t o r . ( E x e r c i s e : t r y t o d e n e t h e n o t i o n o f a c o n t r a v a r i a n t

    f u n c t o r h o w w o u l d t h e f u n c t o r a x i o m s r e a d ? ) H o w e v e r , b y a s u i t a b l e d e n i t i o n o f t h e

    o p p o s i t e A

    o p

    o f a c a t e g o r y A , m a p p i n g F i s j u s t a n o r m a l f u n c t o r F : A

    o p

    ! S e t

    C a t e g o r y A

    o p

    i s o b t a i n e d f r o m A b y t a k i n g t h e o b j e c t s , m o r p h i s m s a n d i d e n t i t i e s f r o m

    A , a n d d e n i n g t h e t y p i n g a n d c o m p o s i t i o n a s f o l l o w s :

    f : A !

    A

    o p

    B f : B !

    A

    A

    f

    A

    o p

    g = g

    A

    f

    O n e s a y s t h a t A

    o p

    i s o b t a i n e d f r o m A b y \ r e v e r s i n g a l l a r r o w s " . ( E x e r c i s e : v e r i f y t h a t

    A

    o p

    i s a c a t e g o r y i n d e e d . V e r i f y a l s o t h a t m a p p i n g F a b o v e i s a f u n c t o r F : A

    o p

    ! S e t )

    T h i r d , s o m e t i m e s w e n e e d t o s p e a k a b o u t , s a y , p a i r s o f m o r p h i s m s i n B w i t h a c o m m o n

    s o u r c e . ( F o r e x a m p l e , t h e t w o e x t r a c t i o n f u n c t i o n s f r o m a c a r t e s i a n p r o d u c t f o r m s u c h a

    p a i r . ) W e c a n d o t h i s c a t e g o r i c a l l y a s f o l l o w s . L e t A b e t h e c a t e g o r y d e t e r m i n e d b y t h e

    f o l l o w i n g g r a p h :

    f

    ;

    g

    ; !

    T h e n e a c h f u n c t o r F : A ! B d e t e r m i n e s a p a i r ( F f F g ) o f m o r p h i s m s i n B w i t h a

    c o m m o n s o u r c e a n d e a c h s u c h p a i r ( f

    0

    g

    0

    ) i n B c a n s o b e o b t a i n e d b y d e n i n g a s u i t a b l e

    f u n c t o r F

    0

    : A ! B . M o r e o v e r , s u c h p a i r s a n d s u c h f u n c t o r s d e t e r m i n e e a c h o t h e r u n i q u e l y .

    S o , t h o s e p a i r s i n B a r e i n a p r e c i s e s e n s e e q u i v a l e n t t o f u n c t o r s o f t y p e A ! B , w h e r e A

    i s a s a b o v e . ( E x e r c i s e : h o w c a n y o u s i m i l a r l y e x p r e s s t r i p l e s o f m o r p h i s m s w i t h a c o m m o n

    t a r g e t ? A n d w h a t a b o u t t r i p l e s ( f g h ) t h a t s a t i s f y f g = h ? )

    T h e s e t h r e e e x a m p l e s n o t o n l y i l l u s t r a t e t h e u s e f u l n e s s o f a l l o w i n g a f u n c t o r t o h a v e a

    d i e r e n t s o u r c e a n d t a r g e t , b u t a l s o d e m o n s t r a t e t h e u s e f u l n e s s o f d e n i n g n e w c a t e g o r i e s

    o u t o f g i v e n o n e s , s u c h a s t h e p r o d u c t o f c a t e g o r i e s , t h e o p p o s i t e o f a c a t e g o r y , a n d s e v e r a l

    n i t e c a t e g o r i e s .

    1 . 2 5 C o m p o s i t e f u n c t o r s . F o r f u n c t o r s F : A ! B a n d G : B ! C w e d e n e t h e

    m a p p i n g s I

    A

    a n d G F b y

    I

    A

    x = x

    ( G F ) x = G ( F x )

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    21/80

    1 C . N A T U R A L I T Y 1 9

    f o r a l l o b j e c t s a n d m o r p h i s m s x i n A . I n v i e w o f t h e d e n i n g e q u a t i o n w e c a n w r i t e G F x

    w i t h o u t s e m a n t i c a m b i g u i t y . W e a l s o w r i t e j u s t I i n s t e a d o f I

    A

    i f A i s i r r e l e v a n t o r c l e a r

    f r o m t h e c o n t e x t . T h u s d e n e d , I a n d G F a r e f u n c t o r s :

    I

    A

    : A ! A

    F : A ! B a n d G : B ! C ) G F : A ! C

    T h e p r o p e r t i e s f t r - T y p e a n d F u n c t o r a r e e a s i l y v e r i e d . ( E x e r c i s e : d o t h i s . ) O t h e r i m p o r -

    t a n t p r o p e r t i e s o f t h e s e f u n c t o r s a r e : a s s o c i a t i v i t y o f f u n c t o r c o m p o s i t i o n a n d n e u t r a l i t y

    o f I w i t h r e s p e c t t o f u n c t o r c o m p o s i t i o n :

    H ( G F ) = ( H G ) F

    F I

    A

    = F = I

    B

    F f o r F : A ! B

    T h e a s s o c i a t i v i t y i m p l i e s t h a t w r i t i n g H G F w i t h o u t p a r e n t h e s e s c a u s e s n o s e m a n t i c

    a m b i g u i t y .

    ( E x e r c i s e : a r e S e q I I a n d I I S e q w e l l d e n e d , a n d i f s o , w h a t s t r u c t u r e d o t h e y r e p r e s e n t ?

    A n d w h a t a b o u t S e q S e q ? )

    1 . 2 6 C a t e g o r y C a t T h e a b o v e p r o p e r t i e s o f f u n c t o r s s u g g e s t a ( p r e ) c a t e g o r y , c a l l e d

    C a t . T a k e a s o b j e c t s a l l c a t e g o r i e s , a s m o r p h i s m s a l l f u n c t o r s , a s t y p i n g t h e f u n c t o r t y p i n g ,

    a s i d e n t i t y o n A t h e i d e n t i t y f u n c t o r I

    A

    , a n d a s c o m p o s i t i o n t h e f u n c t o r c o m p o s i t i o n .

    A s u s u a l , w e c a n m a k e a c a t e g o r y o f C a t , s e e p a r a g r a p h 1 . 8 . T h u s o u r t a l k i n g o f ` t y p e ' o f

    f u n c t o r s i s j u s t i e d .

    H o w e v e r , t h e r e i s a f o u n d a t i o n a l p r o b l e m l u r k i n g h e r e . I s t h i s n e w c a t e g o r y C a t a n

    o b j e c t i n i t s e l f ? A n a n s w e r , b e i t y e s o r n o , w o u l d g i v e s i m i l a r p r o b l e m s a s t h e s u p p o s i t i o n

    t h a t t h e s e t o f a l l s e t s e x i s t s . W e w i l l n e i t h e r u s e t h e n e w c a t e g o r y i n a f o r m a l r e a s o n i n g ,

    n o r d i s c u s s w a y s o u t o f t h i s p a r a d o x .

    1 c N a t u r a l i t y

    A n a t u r a l t r a n s f o r m a t i o n i s n o t h i n g b u t a s t r u c t u r e p r e s e r v i n g m a p b e t w e e n f u n c t o r s .

    ` S t r u c t u r e p r e s e r v a t i o n ' m a k e s s e n s e , h e r e , s i n c e w e ' v e s e e n a l r e a d y t h a t a f u n c t o r i s , o r

    r e p r e s e n t s , a s t r u c t u r e t h a t o b j e c t s m i g h t h a v e . W e s h a l l r s t g i v e a n e x a m p l e , a n d t h e n

    p r e s e n t t h e f o r m a l d e n i t i o n .

    1 . 2 7 N a t u r a l i t y i n S e t L e t F G : A ! S e t b e f u n c t o r s . I n t h e t e r m i n o l o g y o f

    p a r a g r a p h 1 . 2 1 e a c h F A d e n o t e s a s t r u c t u r e d s e t a n d F d e n o t e s t h e s t r u c t u r e i t s e l f .

    F o r e x a m p l e , I I i s t h e s t r u c t u r e o f p a i r s , S e q t h e s t r u c t u r e o f s e q u e n c e s , I I S e q t h e

    s t r u c t u r e o f p a i r s o f s e q u e n c e s , S e q S e q t h e s t r u c t u r e o f s e q u e n c e s o f s e q u e n c e s , a n d s o

    o n . A ` t r a n s f o r m a t i o n ' f r o m s t r u c t u r e F t o s t r u c t u r e G i s : a f a m i l y t o f f u n c t i o n s

    t

    A

    : F A ! G A , m a p p i n g s e t F A t o s e t G A f o r e a c h A . A t r a n s f o r m a t i o n t i s ` n a t u r a l '

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    22/80

    2 0 C H A P T E R 1 . T H E M A I N C O N C E P T S

    i f : e a c h t

    A

    d o e s n ' t a e c t t h e c o n s t i t u e n t s o f t h e s t r u c t u r e d e l e m e n t s i n F A b u t o n l y

    r e s h a p e s t h e s t r u c t u r e o f t h e e l e m e n t s , f r o m a n F - s t r u c t u r e i n t o a G - s t r u c t u r e i n o t h e r

    w o r d s ,

    r e s h a p i n g t h e s t r u c t u r e b y m e a n s o f t

    c o m m u t e s w i t h

    s u b j e c t i n g t h e c o n s t i t u e n t s t o a n a r b i t r a r y m o r p h i s m :

    t h a t i s , F f t

    A

    = t

    A

    G f f o r a l l f : A !

    A

    A

    0

    A s a n e x a m p l e , c o n s i d e r t h e f u n c t i o n s j o i n

    A

    : I I S e q A ! S e q A i n S e t . F a m i l y j o i n

    i s a n a t u r a l t r a n s f o r m a t i o n f r o m I I S e q t o S e q , s i n c e

    I I S e q f j o i n

    A

    = j o i n

    A

    S e q f f o r e a c h f : A ! A

    0

    ,

    a s y o u c a n e a s i l y v e r i f y . T r a n s f o r m a t i o n j o i n r e s h a p e s e a c h I I S e q - s t r u c t u r e i n t o a S e q -

    s t r u c t u r e , a n d d o e s n ' t a e c t t h e c o n s t i t u e n t s o f t h e e l e m e n t s i n t h e s t r u c t u r e .

    I n t h e n e x t p a r a g r a p h , n a t u r a l i t y i n g e n e r a l i s d e n e d l i k e n a t u r a l i t y i n S e t w e a b s t r a c t

    f r o m S e t a n d r e p l a c e i t b y a n a r b i t r a r y c a t e g o r y B . T h e f o r m u l a s r e m a i n t h e s a m e , b u t

    t h e i n t e r p r e t a t i o n a b o v e ( i n t e r m s o f f u n c t i o n s , s e t s , a n d e l e m e n t s ) m a y c h a n g e .

    1 . 2 8 D e n i t i o n . L e t A B b e c a t e g o r i e s , a n d F G : A ! B b e f u n c t o r s . A t r a n s f o r -

    m a t i o n i n B f r o m F t o G i s : a f a m i l y " o f m o r p h i s m s

    "

    A

    : F A !

    B

    G A f o r e a c h A i n A1 . 2 9 n t r f - T y p e

    A t r a n s f o r m a t i o n " i n B f r o m F t o G i s n a t u r a l , d e n o t e d " : F ! G o r " : F !

    B

    G , i f :

    F f "

    B

    = "

    A

    G f f o r e a c h f : A !

    A

    B1 . 3 0 N t r f

    T h i s f o r m u l a i s ( s o n a t u r a l t h a t i t i s ) e a s y t o r e m e m b e r : m o r p h i s m "

    t a r g e t f

    h a s t y p e

    F ( t a r g e t f ) ! G ( t a r g e t f ) a n d t h e r e f o r e o c c u r s a t t h e t a r g e t s i d e o f a n o c c u r r e n c e o f f

    s i m i l a r l y "

    s o u r c e f

    o c c u r s a t t h e s o u r c e s i d e o f a n f . M o r e o v e r , s i n c e " i s a t r a n s f o r m a t i o n

    f r o m F t o G , f u n c t o r F o c c u r s a t t h e s o u r c e s i d e o f a n " a n d f u n c t o r G a t t h e t a r g e t

    s i d e .

    T h e n o t a t i o n " A i s a n a l t e r n a t i v e f o r "

    A

    , a n d u s e s " a s a f u n c t i o n . W e a l s o s a y t h a t

    " i s n a t u r a l i n i t s p a r a m e t e r . B y d e f a u l t , " r a n g e o v e r n a t u r a l t r a n s f o r m a t i o n s .

    E x e r c i s e : p r o v e t h a t 1 . 2 9 f o l l o w s f r o m t h e a s s u m p t i o n t h a t 1 . 3 0 i s w e l l - t y p e d . ( S o y o u

    n e e d o n l y r e m e m b e r 1 . 3 0 . )

    1 . 3 1 E x a m p l e . N a t u r a l t r a n s f o r m a t i o n s a r e a l l o v e r t h e p l a c e w e g i v e h e r e j u s t t w o

    s i m p l e e x a m p l e s , a n d i n p a r a g r a p h 1 . 3 8 o n e a p p l i c a t i o n . T h e c a t e g o r y u n d e r d i s c u s s i o n i s

    S e t

    F i r s t , c o n s i d e r t h e t r a n s f o r m a t i o n r e v t h a t y i e l d s t h e r e v e r s a l o f i t s a r g u m e n t :

    r e v

    A

    : S e q A ! S e q A

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    23/80

    1 C . N A T U R A L I T Y 2 1

    r e v

    A

    = a

    0

    : : : a

    n ; 1

    ! a

    n ; 1

    : : : a

    0

    T h u s , r e v r e s h a p e s a S e q - s t r u c t u r e i n t o a S e q - s t r u c t u r e , n o t a e c t i n g t h e c o n s t i t u e n t s

    o f i t s a r g u m e n t s . F a m i l y r e v i s a n a t u r a l t r a n s f o r m a t i o n t y p e d

    r e v : S e q ! S e q ,

    s i n c e f o r a l l f : A ! B

    S e q f r e v

    B

    = r e v

    A

    S e q f ,

    a s i s e a s i l y v e r i e d .

    S e c o n d , c o n s i d e r t h e t r a n s f o r m a t i o n i n i t s t h a t y i e l d s a l l i n i t i a l p a r t s o f i t s a r g u m e n t :

    i n i t s

    A

    : S e q A ! S e q S e q A

    i n i t s

    A

    = a

    0

    : : : a

    n ; 1

    ! a

    0

    : : : a

    0

    : : : a

    n ; 1

    T h u s , i n i t s r e s h a p e s a S e q - s t r u c t u r e i n t o a S e q S e q - s t r u c t u r e , n o t a e c t i n g t h e c o n -

    s t i t u e n t s o f i t s a r g u m e n t s . F a m i l y i n i t s i s a n a t u r a l t r a n s f o r m a t i o n t y p e d

    i n i t s : S e q ! S e q S e q ,

    s i n c e f o r a l l f : A ! B

    S e q f i n i t s

    B

    = i n i t s

    A

    S e q S e q f ,

    a s i s e a s i l y v e r i e d .

    E x e r c i s e : v e r i f y t h a t e a c h o f t h e f o l l o w i n g w e l l - k n o w n o p e r a t i o n s i s a n a t u r a l t r a n s f o r -

    m a t i o n o f t h e g i v e n t y p e :

    t i p : I ! S e q

    c o n c a t : S e q S e q ! S e q e q u a l s + + = a l s o c a l l e d a t t e n

    s e g s : S e q ! S e q S e q

    p a r t s : S e q ! S e q S e q S e q y i e l d s a l l p a r t i t i o n s o f i t s a r g u m e n t

    t a k e n : S e q ! S e q

    z i p : I I S e q ! S e q I I

    r o t a t e : S e q ! S e q

    s w a p : I I ! I I s w a p s t h e c o m p o n e n t s o f i t s a r g u m e n t

    e x l : I I ! I e x t r a c t s t h e l e f t c o m p o n e n t o f a p a i r .

    W e s h a l l l a t e r s e e h o w t o f o r m u l a t e t h e n a t u r a l i t y o f : a n d n i l , a n d o f t a k e ( n o t x i n g

    o n e o f i t s a r g u m e n t s ) , a n d h o w t o f o r m u l a t e a m o r e g e n e r a l n a t u r a l i t y o f s w a p a n d e x l

    ( n o t r e s t r i c t i n g t h e i r a r g u m e n t s t o t h e s a m e t y p e ) , a n d t h a t r e d u c e i t s e l f , o p e r a t i o n = , i s

    a n a t u r a l t r a n s f o r m a t i o n i n c a t e g o r y M o n

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    24/80

    2 2 C H A P T E R 1 . T H E M A I N C O N C E P T S

    1 . 3 2 C o m p o s i t i o n o f n a t u r a l t r a n s f o r m a t i o n s . F o r f u n c t o r s F G H J K a n d n a t -

    u r a l t r a n s f o r m a t i o n s " : F ! G a n d : G ! H w e d e n e t r a n s f o r m a t i o n s i d

    F

    " J "

    a n d "

    K

    b y

    ( i d

    F

    )

    A

    = i d

    ( F A )

    ( " )

    A

    = "

    A

    A

    ( J " )

    A

    = J ( "

    A

    )

    ( "

    K

    )

    A

    = "

    K A

    W e s h a l l w r i t e i d

    F A

    a n d J "

    A

    a n d "

    K A

    w i t h o u t p a r e n t h e s e s i n v i e w o f t h e e q u a t i o n s t h i s

    c a u s e s n o s e m a n t i c a m b i g u i t y . A n a l t e r n a t i v e n o t a t i o n f o r "

    K

    i s " K s o ( " K ) A = " ( K A )

    a n d w e t h e n w r i t e " K A w i t h o u t p a r e n t h e s e s t o o . S i m i l a r l y , ( J " ) K = J ( " K ) a n d w e

    w r i t e s i m p l y J " K . T h e s e t r a n s f o r m a t i o n s a r e n a t u r a l :

    i d

    F

    : F ! F1 . 3 3 n t r f - I d

    " : F ! G a n d : G ! H ) " : F ! H1 . 3 4 n t r f - C o m p o s e

    " : F ! G ) J " : J F ! J G1 . 3 5 n t r f - F t r

    " : F ! G ) "

    K

    : F K ! G K1 . 3 6 n t r f - P o l y

    N o t i c e t h a t f o r l a w s 1 . 3 5 a n d 1 . 3 6 t o m a k e s e n s e , F a n d G h a v e a c o m m o n s o u r c e a n d

    a c o m m o n t a r g e t , t h e s o u r c e o f J i s t h e t a r g e t o f F a n d G , a n d t h e t a r g e t o f K i s t h e

    s o u r c e o f F a n d G . T h e p r o o f s a r e q u i t e s i m p l e w e p r o v e o n l y l a w n t r f - C o m p o s e . A s

    r e g a r d s p r o p e r t y n t r f - T y p e f o r " w e a r g u e

    ( " )

    A

    : F A ! H A

    d e n i t i o n o f "

    "

    A

    A

    : F A ! H A

    ( c o m p o s i t i o n - T y p e

    "

    A

    : F A ! G A a n d

    A

    : G A ! H A

    ( d e n i t i o n !

    " : F ! G a n d : G ! H

    A n d t o s h o w t h e n a t u r a l i t y , p r o p e r t y N t r f , f o r " , w e a r g u e , f o r a r b i t r a r y f : A ! B ,

    F f ( " )

    B

    = ( " )

    A

    H f

    d e n i t i o n ( " )

    F f "

    B

    B

    = "

    A

    A

    H F

    p r e m i s e : n a t u r a l i t y " a n d

    "

    A

    G f

    B

    = "

    A

    G f

    B

    e q u a l i t y

    t r u e

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    25/80

    1 C . N A T U R A L I T Y 2 3

    ( E x e r c i s e : p r o v e l a w s 1 . 3 3 , 1 . 3 5 , a n d 1 . 3 6 . )

    F u r t h e r i m p o r t a n t p r o p e r t i e s o f n a t u r a l t r a n s f o r m a t i o n s a r e a s s o c i a t i v i t y o f c o m p o s i t i o n

    a n d n e u t r a l i t y o f i d

    F

    w i t h r e s p e c t t o c o m p o s i t i o n o f n a t u r a l t r a n s f o r m a t i o n s :

    " ( ) = ( " )

    i d

    F

    " = " = " i d

    G

    f o r " : F ! G . T h e p r o o f o f t h e s e p r o p e r t i e s i s s i m p l e t h e p r o p e r t i e s a r e i n h e r i t e d f r o m

    c o m p o s i t i o n a n d i d e n t i t i e s o f t h e c a t e g o r y . ( E x e r c i s e : p r o v e t h e s e c l a i m s . )

    1 . 3 7 C a t e g o r y F t r ( A B ) T h e p r o p e r t i e s o f c o m p o s i t e n a t u r a l t r a n s f o r m a t i o n s s u g -

    g e s t a c a t e g o r y . L e t A a n d B b e a c a t e g o r y . F o r m a n e w c a t e g o r y , c o m m o n l y d e n o t e d

    F t r ( A B ) , a s f o l l o w s . T a k e a s o b j e c t s a l l f u n c t o r s f r o m A t o B , a s m o r p h i s m s a l l n a t u r a l

    t r a n s f o r m a t i o n s ( f r o m f u n c t o r s w i t h t y p e A ! B t o f u n c t o r s w i t h t y p e A ! B ) , a s

    t y p i n g t h e t y p i n g o f n a t u r a l i t y ( a b o v e d e n o t e d ! ) , a s i d e n t i t i e s a l l i d e n t i t y n a t u r a l t r a n s -

    f o r m a t i o n s i d

    F

    , a n d a s c o m p o s i t i o n t h e c o m p o s i t i o n o f n a t u r a l t r a n s f o r m a t i o n s d e n e d

    a b o v e . T h u s d e n e d , F t r ( A B ) i s a p r e - c a t e g o r y a n d e v e n a c a t e g o r y . ( E x e r c i s e : v e r i f y

    t h i s . )

    1 . 3 8 A p p l i c a t i o n . C o n t i n u i n g t h e e x a m p l e o f p a r a g r a p h 1 . 3 1 , w e d e n e a f a m i l y t a i l s

    a s f o l l o w s . F u n c t i o n t a i l s

    A

    y i e l d s a l l t a i l p a r t s o f i t s a r g u m e n t s e q u e n c e a s i t s r e s u l t :

    t a i l s

    A

    : S e q A ! S e q S e q A

    t a i l s

    A

    = r e v

    A

    i n i t s

    A

    S e q r e v

    A

    O n e m a y n o w s u s p e c t t h a t , f o r a l l f : A ! B ,

    S e q f t a i l s

    B

    = t a i l s

    A

    S e q S e q f ,

    s o t h a t t a i l s : S e q ! S e q S e q . I n d e e d , t h i s i s a l m o s t i m m e d i a t e b y t h e l a w s g i v e n i n t h e

    p r e v i o u s p a r a g r a p h :

    t a i l s : S e q ! S e q S e q

    d e n i t i o n t a i l s

    r e v i n i t s S e q r e v : S e q ! S e q S e q

    ( n t r f - C o m p o s e

    r e v : S e q ! S e q i n i t s : S e q ! S e q S e q S e q r e v : S e q S e q ! S e q S e q

    ( n t r f - F t r , p r e m i s e s : n a t u r a l i t y r e v a n d i n i t s

    t r u e

    I n e e c t , t h e p r o o f o f t h i s s e m a n t i c p r o p e r t y i s n o t h i n g b u t t y p e c h e c k i n g ( v i e w i n g \ : ! "

    a s a t y p i n g , a n d n o w h e r e u s i n g t h e a c t u a l m e a n i n g o f i n i t s , r e v , a n d t a i l s ) . H a d n ' t w e

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    26/80

    2 4 C H A P T E R 1 . T H E M A I N C O N C E P T S

    h a d a v a i l a b l e t h e c o n c e p t a n d p r o p e r t i e s o f n a t u r a l i t y , t h e p r o o f w o u l d h a v e b e e n m u c h

    l o n g e r . I n d e e d , e x p l i c i t l y u s i n g t h e e q u a l i t i e s

    S e q f r e v

    B

    = r e v

    A

    S e q f

    S e q f i n i t s

    B

    = i n i t s

    A

    S e q S e q f

    f o r a l l f : A ! B , t h e p r o o f o f S e q f t a i l s

    B

    = t a i l s

    A

    S e q S e q f w o u l d r u n a s f o l l o w s .

    S e q f t a i l s

    B

    = d e n i t i o n t a i l s

    S e q f r e v

    B

    i n i t s

    B

    S e q r e v

    B

    = e q u a t i o n f o r r e v

    r e v

    A

    S e q f i n i t s

    B

    S e q r e v

    B

    = e q u a t i o n f o r i n i t s

    r e v

    A

    i n i t s

    A

    S e q S e q f S e q r e v

    B

    = F u n c t o r f o r S e q

    r e v

    A

    i n i t s

    A

    S e q ( S e q f r e v

    B

    )

    = e q u a t i o n f o r r e v

    r e v

    A

    i n i t s

    A

    S e q ( r e v

    A

    S e q f )

    = F u n c t o r f o r S e q

    r e v

    A

    i n i t s

    A

    S e q r e v

    A

    S e q S e q f

    = d e n i t i o n t a i l s

    t a i l s

    A

    S e q S e q f

    1 . 3 9 O m i t t i n g s u b s c r i p t s . F o r r e a d a b i l i t y w e s h a l l o f t e n o m i t t h e s u b s c r i p t s o r a r g u -

    m e n t s t o n a t u r a l t r a n s f o r m a t i o n s w h e n t h e y c a n b e r e t r i e v e d f r o m c o n t e x t u a l i n f o r m a t i o n .

    H e r e i s a n e x a m p l e y o u a r e n o t s u p p o s e d t o u n d e r s t a n d t h e ` m e a n i n g ' o f t h e f o r m u l a s .

    L e t t h e f o l l o w i n g b e g i v e n :

    F : A ! B

    G : B ! A

    : I

    A

    ! G F

    " : F G ! I

    B

    ,

    a n d c o n s i d e r f o r m u l a

    G " = i d

    T h e f o l l o w i n g p r o c e d u r e g i v e s t h e m o s t g e n e r a l s u b s c r i p t s t h a t m a k e t h e f o r m u l a w e l l t y p e d .

    U s e a b c : : : a s t y p e v a r i a b l e s ( t h e \ u n k n o w s " ) , u s e t h e s e a s t h e s u b s c r i p t s , a n d w r i t e

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    27/80

    1 C . N A T U R A L I T Y 2 5

    t h e s o u r c e a n d t a r g e t t y p e w i t h i n b r a c e s a t t h e s o u r c e a n d t a r g e t s i d e o f t h e m o r p h i s m s ,

    t h u s :

    f a g

    b

    f c g f d g

    G (

    f e g

    "

    f

    f g g

    )

    f h g

    =

    f j g

    i d

    k

    f l g

    T h e t y p i n g a x i o m s g e n e r a t e a c o l l e c t i o n o f e q u a t i o n s f o r t h e t y p e v a r i a b l e s :

    t y p i n g : a c = b G F b o n a c c o u n t o f n t r f - T y p e

    t y p i n g : c = d o n a c c o u n t o f c o m p o s i t i o n - T y p e

    t y p i n g G " : d h = G e G g o n a c c o u n t o f f t r - T y p e

    t y p i n g " : e g = F G f f o n a c c o u n t o f n t r f - T y p e

    t y p i n g i d : j = k = l o n a c c o u n t o f i d e n t i t y - T y p e

    t y p i n g = : a h = j l

    A m o s t g e n e r a l ( l e a s t c o n s t r a i n i n g ) s o l u t i o n f o r t h i s c o l l e c t i o n o f e q u a t i o n s c a n b e f o u n d

    b y t h e u n i c a t i o n a l g o r i t h m , a n d y i e l d s

    a = b = h = j = l = k = G f

    c = d = G F G f

    e = F G f

    g = f

    H e n c e , w r i t i n g B f o r t y p e v a r i a b l e f , a n d l l i n g i n t h e s u b s c r i p t s , t h e f o r m u l a r e a d s : f o r

    a r b i t r a r y o b j e c t B i n B ,

    G B

    G "

    B

    = i d

    G B

    : G B !

    A

    G B ,

    o r , w r i t i n g t h e s u b s c r i p t s a s a r g u m e n t s , a n d a b s t r a c t i n g f r o m B ,

    G G " = i d G : G ! G

    E x e r c i s e : i n f e r i n a s i m i l a r w a y t h e c a t e g o r i e s , a n d t h e t y p i n g o f t h e f u n c t o r s i n :

    : I ! G F

    " : F G ! I

    E x e r c i s e : a s s u m i n g

    " : F ! F F

    : F F ! F ,

    n d t h e m o s t g e n e r a l s u b s c r i p t s t h a t m a k e " F a w e l l - t y p e d t e r m d e n o t i n g a

    m o r p h i s m . ( W h a t f u n c t i o n d o e s t h e t e r m d e n o t e i f t h e c a t e g o r y i s S e t , F = S e q , a n d

    " = i n i t s t a i l s j o i n = ? )

  • 7/27/2019 Mathematics - A Gentle Introduction to Category Theory

    28/80

    2 6 C H A P T E R 1 . T H E M A I N C O N C E P T S

    1 d A d j u n c t i o n s

    A n a d j u n c t i o n i s a p a r t i c u l a r o n e - o n e c o r r e s p o n d e n c e b e t w e e n , o n t h e o n e h a n d , t h e m o r -

    p h i s m s o f a c e r t a i n t y p e i n o n e c a t e g o r y , a n d , o n t h e o t h e r h a n d , t h e m o r p h i s m s o f a c e r t a i n

    t y p e i n a n o t h e r c a t e g o r y . T h e c o r r e s p o n d e n c e c a n b e f o r m u l a t e d a s a n e q u i v a l e n c e b e t w e e n

    t w o e q u a t i o n s ( i n t h e t w o c a t e g o r i e s , r e s p e c t i v e l y ) . A n a d j u n c t i o n h a s m a n y p r o p e r t i e s ,

    a n d m a n y d i e r e n t b u t e q u i v a l e n t d e n i t i o n s .

    1 . 4 0 E x a m p l e . H e r e i s a l a w f o r s e q u e n c e s i t h a s a l o t o f w e l l - k n o w n c o n s e q u e n c e s , a s

    w e s h a l l s h o w i n a w h i l e .

    \ E a c h h o m o m o r p h i s m o n s e q u e n c e s i s u n i q u e l y d e t e r m i n e d ( a s a ` m a p ' f o l l o w e d b y

    a r e d u c e ) b y i t s r e s t r i c t i o n t o t h e s i n g l e t o n s e q u e n c e s . "

    T o b e p r e c i s e , t h e l a w r e a d s a s f o l l o w s .

    L e t A b e a n a r b i t r a r y s e t , a n d b e a n a r b i t r a r y m o n o i d o p e r a t i o n , s a y w i t h t a r g e t

    s e t B . T h e n , f o r a l l f : A ! B a n d a l l g : ( + +

    A

    ) !

    M o n

    ,

    f = t i p

    A

    g S e q f = = g . S e q A d j

    T h u s w e m a y c a l l f t h e ` r e s t r i c t i o n o f g t o t h e t i p e l e m e n t s ' a n d w r i t e f = b b g c c

    A

    =

    t i p

    A

    g . A l s o , w e m a y c a l l g t h e ` e x t e n s i o n o f f t o a h o m o m o r p h i s m f r o m ( + +

    A

    ) t o '

    a n d w r i t e g = d d f e e

    A

    = S e q f = . W i t h t h e s e d e n i t i o n s , a n d o m i t t i n g t h e s u b s c r i p t s ,

    t h e e q u i v a l e n c e r e a d s :

    f = b b g c c d d f e e = g

    T h i s e q u i v a l e n c e e x p r e s s e s t h a t b b c c a n d d d e e a r e e a c h o t h e r ' s i n v e r s e , a n d c o n s t i t u t e a o n e -

    o n e c o r r e s p o n d e n c e b e t w e e n f u n c t i o n s ( o f a c e r t a i n t y p e ) a n d h o m o m o r p h i s m s ( o f a c e r t a i n

    t y p e ) . M a p p i n g s b b c c a n d d d e e a r e c a l l e d l a d a n d r a d , r e s p e c t i v e l y , f r o m l e f t a d j u n g a t e

    a n d r i g h t a d j u n g a t e t h e s e n a m e s a n d n o t a t i o n s a r e n o t s t a n d a r d i n c a t e g o r y t h e o r y

    T h e a b o v e l a w i s a n ( a l m o s t f u l l - e d g e d ) i n s t a n c e o f a n a d j u n c t i o n . T h e s i g n i c a n c e f o r

    a l g o r i t h m i c s m a y b e e v i d e n t f r o m t h e c o n s e q u e n c e s o f S e q A d j l i s t e d i n p a r a g r a p h 1 . 4 9 .

    1 . 4 1 D e n i t i o n . A n a d j u n c t i o n i n v o l v e s s e v e r a l d a t a :

    T w o c a t e g o r i e s A a n d B

    I n t h e a b o v e e x a m p l e A = S e t a n d B = M o n

    T w o f u n c t o r s F : A ! B a n d G : B ! A

    A b o v e F f = S e q f a n d G g = g f o r m o r p h i s m s f a n d g . ( T h e f a c t t h a t a b o v e

    G i s t h e i d e n t i t y o n m o r p h i s m s a n d t h e r e f o r e i s i n v i s i b l e i n t h e l e f t - h a n d e q u a t i o n ,

    m a k e s t h e e x a m p l e a b i t s p e c i a l . ) F o r o b j e c t s t h e a b o v e f u n c t o r s a c t a s f o l l o w s :

    F A = ( + +

    A

    ) , a m o n o i d o p e r a t i o n , a n d G ( )