Any nonempty totally disconnected, perfect compact metric space is homeomorphic to Cantor set - proof explanation. I am reading the proof of the theorem 30.3 from General Topology by Stephen Willard:

Any two totally disconnected, perfect compact metric spaces are homeomorphic.

The corollary from this theorem is the sufficient condition for the space to be homeomorphic to the Cantor set. The proof is based on theorem 29.15 (I quote only the part a)):

Let $X$ be a totally disconnected compact metric space. Then
a) For each $n=0,1,2,\ldots$ there is a finite open cover $\mathcal{U}_n$ of $X$ by disjoint open sets of diameter $<1/2^n$ such that $\mathcal{U}_{n+1}<\mathcal{U}_n$ for each $n\geq 0$.

and lemma 30.2:

If $U$ is any nonempty open set in a compact, totally disconneced, perfect $T_2$-space and $n$ is any positive integer then $U=U_1\cup\ldots\cup U_n$ for some choice for nonempty disjoint open sets $U_1,\ldots,U_n$.

The proof of thm 30.3 starts as follows:

Let $X,Y$ be such spaces. Let $(\mathcal{U}_n),(\mathcal{V}_n)$ be sequences of finite covers of $X$ and $Y$, respectively, by disjoint open sets, the set of the nth cover having diameter $<1/2^n$. The existence of these is guaranteed by theorem 29.15. By using lemma 30.2 in order to split sets where necessary, we may assume $\mathcal{U}_n$ and $\mathcal{V}_n$ have the same number of elements for each $n$.

I can't figure out why we can assume that without loss of generality. From the rest of the proof which I didn't quote here I see that the property $\mathcal{U}_{n+1}<\mathcal{U}_n$ ($\mathcal{U}_{n+1}$ is a refinement of $\mathcal{U}_{n}$) is also important although it wasn't stated explicitly in the proof. My idea was to use induction but I don't even know how to define $\mathcal{U}_{0}'$ and $\mathcal{V}_{0}'$ so that they have the same number of elements and all required properties which $\mathcal{U}_{0}$ and $\mathcal{V}_{0}$ have (in particular $\mathcal{U}_{1}<\mathcal{U}_{0}$ and $\mathcal{V}_{1}<\mathcal{V}_{0}$). I tried this:
Let $\mathcal{U}_{0}=\{U_1,\ldots, U_k\}$ and $\mathcal{V}_{0}=\{V_1,\ldots, V_l\}$. We can assume $k<l$. Applying lemma 30.2 to the set $U_k$ and positive integer $l-k+1$ there exist nonempty disjoint open sets $U_k',\ldots,U_l'$ such that $U_k=U_k'\cup\ldots\cup U_l'$. Let $\mathcal{U}_{0}'=\{U_1,\ldots, U_{k-1},U_k',\ldots, U_l'\}$. Then $\mathcal{U}_{0}'$ is a finite cover of $X$ by disjoint open sets of diameter $<1$. However, when we replace $\mathcal{U}_0$ with $\mathcal{U}_0'$ in the sequence $(\mathcal{U}_n)$ the property $\mathcal{U}_1<\mathcal{U}_0'$ seems to fail.
Edit based on Henno Brandsma's answer
Please tell me if I understand correctly:
From lemma 30.2 we can get the following lemma:
Lemma 1. Let $X$ be totally disconnected, perfect compact metric space and $\mathcal{U}$ a finite open cover of $X$ by disjoint nonempty sets of diameter $<\varepsilon$. If $\mathcal{U}$ has $k$ elements and $k'>k$ is an arbitraty natural number, then there exist a finite open cover $\mathcal{U}'$ of $X$ by disjoint nonempty sets of diameter $<\varepsilon$, which has $k'$ elements and $\mathcal{U}'<\mathcal{U}$.
Lemma 2 is just a corollary from theorem 29.15:
Lemma 2. Let $X$ be a totally disconnected compact metric space. Then
for any $\varepsilon>0$ there is a finite open cover $\mathcal{U}$ of $X$ by nonempty disjoint sets of diameter $<\varepsilon$.
Now under all the assumptions about the space $X$ I want to prove the existence of the sequences $(\mathcal{U}_n),(\mathcal{V}_n)$ with all required properties and the same sizes for each $n$:
For $n=0$ we take covers of $X,Y$ respectively using lemma 2 with $\varepsilon=1$ and enlarge one of them using lemma 1 so they have the same size.
Fix $n\in\mathbb{N}$ and assume we have defined $\mathcal{U}_n, \mathcal{V}_n$. We may assume that they have the same size as long as we can prove that $\mathcal{U}_{n+1}, \mathcal{V}_{n+1}$ will have the same size. There is one-to-one correspondence $\alpha:\mathcal{U}_n\rightarrow \mathcal{V}_n$.
For any $U\in\mathcal{U}_n$, $U$ as a space satisfies the assumption of lemma 2, and so does $\alpha (U)\in\mathcal{V}_n$. There exist finite open covers $\mathcal{U}_U, \mathcal{V}_{U}$ of $U$ and $\alpha(U)$ respectively by disjoint nonempty sets of diameter $<1/2^{n+1}$, which have the same number of elements $m_U$ (using lemma 1).
We define $$\mathcal{U}_{n+1}:=\bigcup_{U\in \mathcal{U}_n}\mathcal{U}_U, \mathcal{V}_{n+1}:=\bigcup_{U\in \mathcal{U}_n}\mathcal{V}_U$$
Both $\mathcal{U}_{n+1}$ and $\mathcal{V}_{n+1}$ have $\sum_{U\in\mathcal{U_n}}m_U$ elements as desired. Moreover $\mathcal{U}_{n+1}<\mathcal{U}_{n}$ and $\mathcal{V}_{n+1}<\mathcal{V}_{n}$.
Should I post it as my own answer?
 A: To comment on the final paragraphs: at that stage $\mathcal{U}_1$ is not constructed yet!
The idea of the proof really is a recursion: we start with $\mathcal{U}_0$ and $\mathcal{V}_0$ and use the lemma in the way you described so that $|\mathcal{U}_0| = |\mathcal{V}_0|$. The diameter of the starting attempts' sets was $< \frac{1}{2^0}$ already and these only gets smaller when splitting in the initially larger cover so that's no issue.
Next we split each set in $\mathcal{U}_0$ into finitely many disjoint open pieces so that the diameters of its pieces are $< \frac{1}{2^1}$. Note that each such set is clopen (being from a finite disjoint open cover) and so again compact zero-dimensional and perfect so 29.51a applies for each of the elements of $\mathcal{U}_0$ too. The resulting total cover (the union of the splits of each element of $\mathcal{U}_0$) is trivially a refinement and we do the same for $\mathcal{V}_0$ to make our first attempt at $\mathcal{V}_1 < \mathcal{V}_0$. Then use the same trick to ensure these covers of $X$ resp. $Y$ have the same size again, if they are not already.
We continue by recursion in the same way, decreasing the diameters again etc. The end result will be as Willard describes. So you apply the splitting lemma along the construction for each new stage to keep the sizes of $\mathcal{U}_n$ and $\mathcal{V}_n$ equal after each stage.
