Академический Документы
Профессиональный Документы
Культура Документы
Baldur Bl ondal
Chalmers University of Technology
Categories, Denition
Categories, Denition
g f :AC
Identity arrow: For each object A we have idA : A A.
Laws of Categories
Such that:
Composition is Associative: h (g f ) = (h g ) f . id is Unit: Given f : A B , f idA = f = idB f .
Quick Comment!
Category Sets
First category is Sets of sets and functions. Another category of Sets n of nite sets and functions between them. Also categories of structured sets:
Groups (objects) and group homomorphisms (arrows). Real numbers R (objects) and continuous functions R R
(arrows).
Posets (objects) and monotone functions (arrows). ...
Partial Order
A set A has partial order if there is a binary relation a1 that for all a1 , a2 , a3 A:
a1 a1 a1
A A A A
a2 such
a2 (reexivity) a2 , a2 a2 , a2
A A
a3 a1
a1
a3 (transitivity)
a1 = a2 (anti-symmetry)
Example
The real numbers R form a poset with the usual n1 a total order which is partial order plus totality). n2 (actually
Category of partially ordered sets Pos where objects are posets and arrows are monotone functions m : A B such that: a1
A
a2 implies m a1
m a2
(1)
a2 = f a1
f a2 = g (f a1 ) (g f ) a2
g (f a2 )
a2 = idA a1
idA a2
Observation
Another example where the arrows are not functions: Objects Finite sets A, B , C , . . . Arrows Arrow F : A B is a a b matrix where a and b are the number of elements of the sets A and B . Composition Normal matrix multiplication. Identity Unit matrix.
Functors
A functor is a mapping between categories (remember that I said that mappings were important): F :CD
Denition: Functor
A mapping between categories C and D maps objects in C to objects in D and arrows in C to arrows in D: 1. For each object X in C we have F X in D. 2. For each f : A B in C we have F f : F A F B in D such that:
2.1 F idA = idFA 2.2 F (g f ) = F f F g
Category Cat
The functor F : C D gives a sort of picture of C in D but functors also compose and have an identity: idC : C C so guess what: we have a category Cat category of all categories where functors are arrows!
Preorders
A preorder is a set P with a binary relation that is reexive and transitive, any preorder is a category as such: Objects Elements of P . Arrows Relations on the elements of P . Typing f : a b if and only if a Composition Guess! Identity Since a a. is reexive we have idA : a a since b.
Category of Proofs
Objects are formul (, , . . . ) and arrows from to is a deduction of from assumption . There is also an important category that well consider quite a bit later on (we will call it Hask):
Monoids
Monoids are just categories with a single object and the arrows of the category are the elements of the monoid. Composition is the binary operation of the monoid.
Example
N, Q and Q with addition and 0 or multiplication and 1. For any set X the set of functions from X to X (HomSets (X , X )) is a monoid under composition. More generally: Any object C from any category C , arrows from C to C (HomC (C , C )) is a monoid under C . Lists under (++) and many other programming concepts (go through Data.Monoid and Control.Monoad.Writer).
Category Mon
1. Monoids are structured sets and there is a category Mon whose objects are monoids and whose arrows are functions that preserve the monoid structure. 2. A homomorphism from a monoid M to a monoid N is a function h : M N such that h (m M n) = h m N h n and h u M = uN . 3. NOTA BENE: A monoid homomorphism from M to N is the same thing as a functor from M to N (when regarded as categories). 4. In that sense: Categories generalize monoids, functors generalize homomorphisms.
Isomorphism
For a category C f : A B is an isomorphism if there exists an arrow g : B A in C such that: g f = idA and f g = idB i.e. we can go back and forth without losing any information. Isomorphisms are unique so we write g = f 1 and say that A is isomorphic to B (A = B ). This denition is our rst example of an abstract, category theoretic denition of an important notion: it doesnt consider additional information about the objects and arrows and is valid for any category!
Groups
Denition: Group
A group G is a monoid with an inverse g 1 for every element g . G is a category with a single object where every arrow is an isomorphism.
Example
The natural numbers dont form a group under either addition or multiplication but integers Z and positive rationals Q+ do.
Example
For any set X we have a group Aut (X ) of automorphisms/permutations of X (isomorphisms from an object to itself: f : X X while preserving all of its structure). automorphism = endomorphism + isomorphism
The opposite or dual category C op which has the same objects as category C and an arrow f : C D in C op for every f : D C in C. We will write arrow f : D C in C op to distinguish from f : C D in C and procede to dene composition and units in C op using the corresponding operations in C : idC = (idC ) f g = (g f )
def def
A slice category C /C of a category C over an object C C . Objects All arrows f C such that cod f = C . Arrows Arrow a : X X . Typing Arrow a is from f : X C to f : X C such that f a =f. Composition Same as C . Identity Same as C . Then there is a functor U : C /C C that forgets about base object C .
Title
Title