The following question is taken from Sipser:
Prove that $EQ_{\mathsf{DFA}}$ is decidable by testing the two DFAs on all strings up to a certain size. Calculate a size that works.
Here is the answer:
For any DFAs $A$ and $B$, $L(A) = L(B)$ if and only if $A$ and $B$ accept the same strings up to length $mn$, where $m$ and $n$ are the numbers of states of $A$ and $B$, respectively. Obviously, if $L(A) = L(B)$, $A$ and $B$ will accept the same strings. If $L(A) \neq L(B)$, we need to show that the languages differ on some string $s$ of length at most $mn.$ Let $t$ be a shortest string on which the languages differ. Let $l$ be the length of $t$. If $l \leq mn$ we are done. If not, consider the sequence of states $q_0,q_1,\dots,q_l$ that $A$ enters on input $t$, and the sequences of states $r_0,r_1,\dots,r_l$ that $B$ enters on input $t$. Because $A$ has $m$ states and $B$ has $n$ states, only $mn$ distinct pairs $(q,r)$ exist, where $q$ is a state of $A$ and $r$ is a state of $B$. By the pigeon hole principle, two pairs of states $(q_i,r_i)$ and $(q_j,r_j)$ must be identical. If we remove the portion of $t$ from $i$ to $j-1$, we obtain a shorter string on which $A$ and $B$ behave as they would on $t$. Hence we have found a shorter string on which the two languages differ, even though $t$ was supposed to be shortest. Hence $t$ must be no longer than $mn$.
Unfortunately, I do not understand the sequence of steps in the answer. Could anyone explain the answer for me in a simpler way?