TITLE: Request for clarification of a point in the book Galois Theories by Borceux and Janelidze
QUESTION [6 upvotes]: In page 105 of the book Galois Theories, in Example 4.6.2, the authors state that a specific diagram is an internal groupoid, but I really cannot see why.

Let $\sigma \colon S \rightarrow R$ be a morphism in a category $\mathcal X$ with pullbacks. The diagram  is an internal groupoid, with $(p_0,p_1)$ the kernel pair of $\sigma$, $\Delta$ the diagonal of the pullback and $\tau$ the twisting isomorphism which interchanges factors. 

So, my main problem is, where does $p_4$ come from? Shouldn't it be $p_2$? And they also say $(p_0,p_1)$ is the kernel pair of $\sigma$. What is $p_0$? Shouldn't the kernel pair be $(p_1,p_2)$? In the beginning I thought it was just a typo, but in Section 5.1 they use the internal groupoid again, still with $p_4$ which makes me think that I must be doing something wrong. I have spent a lot of time trying to find out what happens, so please, if anyone could clarify this, I would appreciate it.

REPLY [10 votes]: They are thinking of the object $M=(S\times_RS)\times_S(S\times_RS)$ as a subobject of $S^4$, so there are four projections $p_1,p_2,p_3,p_4:M\to S$.  If $\mathcal{X}$ is some kind of category of sets with structure, then the composition map $(p_1,p_4)$ is just $((a_1,a_2),(a_3,a_4))\mapsto (a_1,a_4)$.  (Here $a_2$ is actually the same as $a_3$ because the middle pullback is over $S$.)  The other maps are $\tau(a_1,a_2)=(a_2,a_1)$ and $p_1(a_1,a_2)=a_1$ and $p_2(a_1,a_2)=a_2$ and $\Delta(a)=(a,a)$.  The kernel pair of $\sigma$ is indeed $(p_1,p_2)$ rather than $(p_0,p_1)$, which is just a typo.
If $\mathcal{X}$ is just the category of sets, you end up with the category whose object set is $S$, and there is a unique morphism from $a$ to $b$ if $\sigma(a)=\sigma(b)$, and no morphisms from $a$ to $b$ otherwise.