How to prove that minimal DFA is unique? My idea is that the number of states in the minimum DFA is equal to the number of equivalent states. So, if there exists another minimum DFA, then it must have different equivalent states than the previous DFA which is not possible.

How do I formally prove this?

EDIT: Maybe something like "since two states are equivalent, they are semantically equivalent and hence, they can't be equivalent and different at the same time" might do if written formally?
Suppose that we are given a regular language $L$ and a DFA ${\cal A} = (Q,q_0,F,\delta)$. Denote the equivalence classes of the Myhill–Nerode relation of $L$ by $S_1,\ldots,S_m$. For each state $q \in Q$, define $L_q = \{w \in \Sigma^* : \delta(q_0,w) = q\}$. From the definition of the Myhill–Nerode relation it follows that each $L_q$ is a subset of some $S_i$.

The Myhill–Nerode theorem shows that there is a DFA with $m$ states, so suppose that ${\cal A}$ has $m$ states. From our comment above it follows that each $L_q$ equals some $S_i$. Rename the states so that $S_i = L_i$ (so now $Q = \{1,\ldots,m\}$). We now read off all the other data of ${\cal A}$:


The starting state $q_0$ is the one whose language contains the empty word $\epsilon$, that is, it is determined by the condition $\epsilon \in S_{q_0}$.
A state $i$ is accepting if $S_i \subseteq L$, and rejecting if $S_i \subseteq \overline{L}$ (it follows from the definition of the Myhill–Nerode relation that these are the only two possibilities).
Let $w_i$ be an arbitrary word in $S_i$, and let $\sigma \in \Sigma$. Then $\delta(i,\sigma) = j$ if $w_i\sigma \in S_j$. Again, the definition of the Myhill–Nerode relation shows that the choice of $w_i$ doesn't matter.


After renaming the states of ${\cal A}$ in a canonical way, we read off ${\cal A}$ from the Myhill–Nerode relation of $L$. It follows that all minimial DFAs for $L$ are equivalent.