#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Options

# Question 2.3 - The naturality of the diagonal

edited January 19


Let $$C$$ and $$D$$ be categories, and let $$F,G: C \rightarrow D$$ be functors. Recall that a natural transformation $$\alpha: F \implies G$$ consists of a morphism $$\alpha_c: F(c) \rightarrow G(c)$$ for each $$c \in Ob(C)$$, such that for each $$f: c_1 \rightarrow c_2$$ in $$C$$ the square:

\begin{CD} F(c_1) @>F(f)>> F(c_2) \\@V{\alpha_{c_1}}VV {}@VV{\alpha_{c_2}}V \\ G(c_1) @>>G(f)> G(c_2) \end{CD}

commutes in $$D$$.

Write $$id_{Set}: Set \rightarrow Set$$ for the identity functor on $$Set$$, and Double: $$Set \rightarrow Set$$ for the functor that sends a set $$X$$ to the set $$X \times X$$, and a function $$f: X \rightarrow Y$$ to the function Double($$f$$): $$X \times X \rightarrow Y \times Y$$ that maps $$(x_1,x_2)$$ to $$(f(x_1),f(x_2))$$.

Part A. For each set $$X$$, define the diagonal function $$\delta_x: X \rightarrow X \times X$$ to map $$x$$ to the pair $$(x,x)$$. Prove that $$\delta: id_{Set} \implies$$ Double defines a natural transformation.

Part B. Using the universal property of the product, write a polymorphic Haskell function

diag :: a -> (a,a)

implementing this natural transformation.