From page 31 of The algebra of programming :

Next, consider the squaring functor $()^2: Fun \leftarrow Fun$ defined by

$$ A^2 = \{(a, b) | a \in A, b \in B\} \\ f^2(a, b) = (f a, f b) $$

Functors are required to preserve identities and composition:

$$ F(id_A) = id_{FA} \\ F(f \circ g) = Ff \circ Fg $$

The second property is easy:

$$ (f \circ g)^2 (a, b) = ((f\circ g) (a), (f\circ g) b) \\ (f^2 \circ g^2) (a, b) = f^2 (g (a), g (b)) = ((f\circ g) (a), (f\circ g) (b)) $$

But I can't figure out how the squaring functor preserve the identity property. Could anyone help?


Ok, I have worked it out:

$$ id^2 (a, b) = (id(a), id(b)) = (a, b) = id_{A^2} (a, b) $$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.