I have a trouble understanding a certain proof from Roman's textbook "Advanced Linear Algebra" that
For subspaces $S$ and $T$ of a vector space $V$ we have
$\dim{S} + \dim{T} = \dim(S+T) + \dim(S \cap T)$
To provide some context I will have to give a full proof here:
Proof. Suppose that $B = \{ b_i | i \in I \}$ is a basis for $S \cap T$. Extend $B$ to a basis $A \cup B$ for $S$ where $A = \{ a_j | j \in J \}$ and $A \cap B = \varnothing$. Also, extend $B$ to a basis $B \cup C$ for $T$ where $C = \{ c_k | k \in K \}$ and $B \cap C = \varnothing$. We claim that $A \cup B \cup C$ is a basis for $S + T$. It is clear that $\langle A \cup B \cup C \rangle = S+T$.
Now we prove linear independence of $A \cup B \cup C$. Suppose $$ \sum_{i\in I}\beta_i b_i+ \sum_{j\in J}\alpha_j a_j+ \sum_{k\in K}\gamma_k c_k=0 $$ (with all but a finite number of nonzero coefficients). Then $$ v=\sum_{i\in I}\beta_i b_i+ \sum_{j\in J}\alpha_j a_j=-\sum_{k\in K}\gamma_k c_k\in S\cap T $$ so you can write $$ v=\sum_{i\in I}\delta_i b_i $$ Hence $$ \sum_{i\in I}\delta_i b_i+\sum_{k\in K}\gamma_k c_k=0 $$ Since $B \cup C$ is linearly independent, we have all $\delta_i$'s and all $\gamma_k$'s equal to zero. Hence, $$ \sum_{i\in I}\beta_i b_i+\sum_{j\in J}\alpha_j a_j = 0 $$ Since $A \cup B$ is also linearly independent, we also have all $a_j$'s and $b_i$'s equal to zero. Hence, $A \cup B \cup C$ is linearly independent, and so it is a basis for $S + T$.
Now, $\dim{S} + \dim{T} = |A \cup B| + |B \cup C| = |A| + |B| + |B| + |C| = |A| + |B| + |C| + \dim(S \cap T) = \dim(S + T) + \dim(S \cap T)$.
What I don't understand is why we have $|A| + |B| + |C| = \dim(S + T)$ in the last equality. Yes, $\dim(S + T) = |A \cup B \cup C|$, but $A$ and $C$ are not necessarily disjoint.
If $A$ and $C$ were not disjoint then $\alpha_j = c_k$ for some $j \in J$ and $k \in K$. Because $\alpha_j \in S$ and $\alpha_j = c_k \in T$ it follows that $\alpha_j \in S \cap T$. Because $B$ is a basis of $S \cap T$ it follows that $\alpha_j$ can be expressed as a linear combination of $B$, i.e. $\alpha_j = \sum_{i \in I} \beta_i b_i$ (with only finitely many coefficients being nonzero). Because $\alpha_j \notin B$ (as $A$ and $B$ are disjoint) it follows that $\{\alpha_j\} \cup B$ is linearly dependent. But $\{\alpha_j\} \cup B \subseteq A \cup B$, so this contradicts $A \cup B$ being linearly independent