I'm new in this forum. I have a question about the proof of Lucas' theorem on Wikipedia (link).
The proof is completed by looking at the coefficients of $X^n$ on both sides, ${m \choose n}$ and $\prod{m_i \choose n_i}$ respectively. And it comes out that the coefficients are congruent $\bmod p$.
But how can we say this? As I know if two polynomials of the same degree are congruent $\bmod p$, that doesn't imply that corresponding coefficients are also congruent $\bmod p$. Then how is Lucas' theorem proved?

There are two polynomials under discussion, which I will name $f(X)$ and $g(X)$: $$f(X)=\sum_{n=0}^m\binom{m}{n}X^n\qquad \qquad g(X)=\sum_{n=0}^m\left(\prod_{i=0}^k \binom{m_i}{n_i}\right)X^n$$ Note that $f(X),g(X)\in\mathbb{Z}[X]$. That is, they have integer coefficients.
For any two polynomials $a(X),b(X)\in\mathbb{Z}[X]$, if we say that $$a(X)\equiv b(X)\bmod p$$ then that is intended to mean that $a(X)$ and $b(X)$ represent the same element of $(\mathbb{Z}/p\mathbb{Z})[X]$, which is equivalent to each of their coefficients being equivalent mod $p$. For example, if $$a(X)=4-3X+9X^2+4X^8,\quad b(X)=6+15X-X^2-10X^7\in\mathbb{Z}[X]$$ then $$a(X)\equiv b(X)\bmod 2$$ since they are both equivalent to the element $X+X^2\in(\mathbb{Z}/2\mathbb{Z})[X]$.
Thus, since the argument shows $f(X)\equiv g(X)\bmod p$, we can conclude $$\binom{m}{n}\equiv\prod_{i=0}^k \binom{m_i}{n_i}\bmod p$$ for each $0\leq n\leq m$.