# Categories and Computer Science by R. F. C. Walters

Y2, there is an arrow f + g : X1 +X2 -f Y1 +Y2, defined to be the unique arrow making the following diagram 44 2. PRODUCTS AND SUMS commute: 2 X1 X1 + X2 X2 Y1 - 1'1 + Y2 - Y2. ii j2 You may think of f + g as the function `in the first case do f, in the second case do g'. Example 19. Given two objects X, Y there is an arrow twistx,y : X + Y Y+X (which in Sets takes (x, 0) to (x,1) and (y, 1) to (y, 0)) defined as follows. Suppose i1i i2 are the injections of X + Y and 11, j2 the injections of Y + X.

Here is one more way of making new categories out of old. Definition. If A, B are categories then A x B, the product of A and B, is defined by the following: the objects of A x B are pairs (A, B) of objects, A from A and B from B; the arrows from (Al, B1) to (A2, B2) are pairs (fl, gl) of arrows (ft A2, B2) Composition is performed component by component. Example 28. Suppose that A has two objects A1, A2 and three arrows 1A1, 1A2 and f : Al -* A2 and B has two objects B1, B2 and three arrows 181, 1B2 20 1.

8. If object P in the category A°P, together with projections Pl A, P2 : P -> B, satisfies the property of a product in A°P, write down what property P, together with pi, p2, satisfies in A; that is the dual property. 9. Show that if the sum X + Y of two objects X, Y is initial (X + Y = 0), then X and Y are both initial (X = 0 = Y). 10. IR, ... , and arrows all functions. Show how to construct out of the continuous functions from IR to IR and the test function test,,>o : IR -> IR + IR, using composition and sums, the following functions: (i) test=o : IR -+ IR + IR (x, 0) (X'1) if x#0 ifx=0 f: IR -f IR x f sin x ifx < 0 cos x if x > 0 f : IR -p IR XH f cosx if cosx > 0 to otherwise.