I have a question regarding pairwise codeword error probability in coding theory. This coding theory class was opened for electrical engineering majors, and I'm self-studying it through the lecture notes, so some notations and even terminologies are not familiar to me. I want to find the "Pairwise Codeword Error probability" for a binary-symmetric channel. The lecture note claims the following equation: $$\Pr(\hat{\mathbf{c}}=\mathbf{c}'|\mathbf{c})=\Pr(\mathbf{c} \to \mathbf{c}')=\frac{1}{2}\Pr(d_H(\mathbf{c}, \mathbf{r})=d_H(\mathbf{c}',\mathbf{r}))+\Pr(d_H(\mathbf{c}, \mathbf{r})>d_H(\mathbf{c}',\mathbf{r})) $$ $\mathbf{c}$ is the vector we sent through the channel, $\mathbf{r}$ is the vector we received, and $\hat{\mathbf{c}}$ is the vector we decoded through some decoder. $d_H(\mathbf{a}, \mathbf{b})$ is the Hamming distance between two vectors $\mathbf{a}$ and $\mathbf{b}$, i.e, the number of coordinates that are not equal between these two vectors.
I do not get how the second equality holds(the first equality is just a definition). It seems that there is some sort of symmetry used here, but I can not figure it out. Any explanations will be helpful.
Basically we have $$\Pr(\hat{\mathbf{c}}=\mathbf{c}'|\mathbf{c})= \Pr(\mathbf{c} \to \mathbf{c}')=\Pr(E)+Pr(E') $$ where the error event considered is made up of two disjoint events $E,E'.$ The second event $E'$ is straightforward; it's the event that the received vector is nearer to the false codeword $\mathbf{c}'$ instead of the transmitted codeword and occurs with probability $$\Pr(d_H(\mathbf{c}, \mathbf{r})>d_H(\mathbf{c}',\mathbf{r})).$$
However, a decoding error also occurs for event $E,$ which is defined as the event that there are two equidistant nearest codewords from the received word, in which case one is chosen at random, i.e., with probability $$\frac{1}{2}\Pr(d_H(\mathbf{c}, \mathbf{r})=d_H(\mathbf{c}',\mathbf{r})).$$