example diagram of pullbacks and fiber products

I am going through Category Theory for Scientists. I am on section 2.5.1 Pullbacks.

I am having trouble visualizing a pullback.

Earlier in the book the author gives a nice diagram of an example of products of sets.

enter image description here

There is a similar diagram for coproducts of sets.

enter image description here

Is there some way to draw an example of a pullback or a fiber product? Or is there some sort of example that would make pullbacks and fiber products easier to understand for someone coming from a programming background as opposed to a math background? Or am I just thinking about this completely wrong?


Solution 1:

A pullback as just a certain subset of the product: those pairs $(a,b)$ on which the two given maps on coordinates agree, i.e. $f(a)=g(b)$.

This needs an explicit example, which I'll build on the lovely product diagram we already have available. So map $X=\{1,2,3,4,5,6\}\to \{\text{even},\text{odd}\}$ in the obvious way, and $Y=\{\clubsuit,\diamondsuit,\heartsuit,\spadesuit\}$ by saying, for instance, the black suits $\clubsuit,\spadesuit$ are "even" and the others are "odd." Then the pullback becomes a subset of $X\times Y$ given by pairs $(n,s)$ where $n$ and $s$ have the same image in $\{\text{even},\text{odd}\}$. That is, the pullback has the twelve elements $\{(1,\heartsuit),(1,\diamondsuit),(3,\heartsuit),...,(5,\diamondsuit),(2,\spadesuit),(2,\clubsuit),...,(6,\clubsuit)\}$. If this begins to make some sense, see if you can compute

  • the pullback of $X$ and $Y$ over the unique maps sending $X$ and $Y$ to a one-element set
  • the pullback over the identity map $i:Y\to Y$ and any map $f:X\to Y$.