If $E$ is a finitely generated projective module over a local ring $A$, then $E$ is free: Theorem X.4.4 in Lang's *Algebra* I am studying from Lang's Algebra and in Chapter X Noetherian Rings and Modules, $\S$4 Nakayama's Lemma, he proves the following theorem using Nakayama's lemma (pages 425-426, third edition):

Theorem 4.4. Let $A$ be a local ring and $E$ a finite projective $A$-module. Then $E$ is free. In fact, if $x_1,\dotsc,x_n$ are elements of $E$ whose residue classes $\bar{x}_1,\dotsc,\bar{x}_n$ are a basis of $E/\mathfrak{m}E$ over $A/\mathfrak{m}$, then $x_1,\dotsc,x_n$ are a basis of $E$ over $A$. If $x_1,\dots,x_r$ are such that $\bar{x}_1,\dotsc,\bar{x}_r$ are linearly independent over $A/\mathfrak{m}$, then they can be completed to a basis of $E$ over $A$.

Here, $A$ is a commutative ring. The proof runs as follows:

Proof. We do this by induction on $r$. By one of the definitions of projective modules, there is a module $F$ such that $E \oplus F$ is free, say with basis $(e_j)$. Suppose first $r = 1$. If $a \in A$ is such that $ax_1 = 0$, then $a$ would be a divisor of $0$ in the free module $E \oplus F$, which implies that $a = 0$, thus concluding the proof in this case. Now let $a_1,\dotsc,a_r \in A$ be such that
  $$
a_1 x_1 + \dotsb + a_r x_r = 0.
$$
  There are elements $b_{ij} \in A$ such that
  $$
x_i = \sum_{j=1}^s b_{ij}e_j \quad \text{whence} \quad \sum_j\left( \sum_i a_i b_{ij}\right) e_j = 0.
$$
  Therefore
  $$
\sum_i a_i b_{ij} = 0 \quad \text{for all } j = 1,\dotsc,s.
$$
  Since $x_r \not\in \mathfrak{m}E$ it follows that $b_{rj} \notin \mathfrak{m}$ for some $j$, and this $b_{rj}$ is therefore a unit. Dividing by $b_{rj}$ we can then find elements $c_1,\dotsc,c_{r-1}$ such that
  $$
a_r = c_1 a_1 + \dotsb + c_{r-1} a_{r-1}.
$$
  We multiply this relation by $x_r$ on the right, and substitute in the original relation $\sum a_i x_i = 0$ to find
  $$
0 = \sum_{i=1}^r a_i x_i = a_1(x_1 + c_1 x_r) + \dotsb + a_{r-1}(x_{r-1} + c_{r-1}x_r).
$$
  But $x_1 + c_1 x_r,\dotsc,x_{r-1} + c_{r-1} x_r$ are linearly independent $\bmod{\mathfrak{m}E}$, and so by induction we conclude $a_i = 0$ for $i = 1,\dotsc,r-1$. Hence $a_r = 0$, thus concluding the proof of the theorem.

My trouble is I am not sure what Lang is inducting over: the $r$ that appears in the proof does not appear to be the same $r$ as the one in the statement of the theorem. If they were the same, then the base case would be to show that if $x_1$ is an element of $E$ such that $\bar{x}_1$ is linearly independent over $A/\mathfrak{m}$, then $x_1$ can be completed to a basis of $E$ over $A$. But this does not seem to be what Lang is proving in the base case.
My guess is that Lang is proving the following statement by induction: if $x_1,\dotsc,x_r$ are elements in $E$ such that $\bar{x}_1,\dotsc,\bar{x}_r$ are linearly independent over $A/\mathfrak{m}$, then $x_1,\dotsc,x_r$ are linearly independent over $A$. I am not fully sure that I am right, because 


*

*the proof of the base case does not appear to make use of the fact that $\bar{x}_1$ is linearly independent over $A/\mathfrak{m}$, and

*even after completing induction for all $r$ running from $1$ to the dimension of $E/\mathfrak{m}E$ over $A/\mathfrak{m}$, it is not clear to me how we have proved that $E$ is free. It seems to me that we still need to show that if $x_1,\dotsc,x_r$ is a set of elements of $E$ such that $\bar{x}_1,\dotsc,\bar{x}_r$ is a basis of $E/\mathfrak{m}E$ over $A/\mathfrak{m}$, then $x_1,\dotsc,x_r$ is a generating set of $E$ over $A$.


Can someone help clarify Lang's proof for me? Perhaps, I am only missing something small. I'd really appreciate any help in understanding this proof.
 A: You are correctly interpreting Lang's induction: he is arguing that if $\overline{x}_1,\dots,\overline{x}_r$ are linearly independent over $A/\mathfrak{m}$, then $x_1,\dots,x_r$ are linearly independent over $A$ in $E$. Karl Kronenfeld sketched an answer to the question in comments, but I'll write out the details.
Linear independence of $\overline{x}_1$ over $A/\mathfrak{m}$ is equivalent to the statement that $x_1\notin \mathfrak{m}E$. In particular, it is not zero. As Karl mentioned, Lang needs this in order to conclude that $ax_1=0$ implies $a=0$.
The other piece of the picture (as again Karl mentioned) is the implicit use of Nakayama's lemma. Nakayama's lemma states that for any finitely generated module $M$ over $A$, $\mathfrak{m}M=M$ cannot hold unless $M=0$. In the present situation, this will be applied with $M=E/E'$, where $E'$ is the submodule of $E$ generated by $x_1,\dots,x_n$, where $\overline{x}_1,\dots,\overline{x}_n$ are a basis for $E/\mathfrak{m}E$ over $A/\mathfrak{m}$, as follows:
Since $x_1,\dots,x_n$ span $E$ mod $\mathfrak{m}E$, we have $E = E' + \mathfrak{m}E$, and it follows that any element of $E$ differs from an element of $\mathfrak{m}E$ by an element of $E'$, i.e. that every element of $E$ is actually equal to an element of $\mathfrak{m}E$ mod $E'$, i.e. that $\mathfrak{m}(E/E') = E/E'$. Since $E$ is finitely generated, so is $E/E'$, and Nakayama's lemma then allows us to conclude that $E/E'=0$, i.e. that $E=E'$, i.e. that $x_1,\dots,x_n$ span $E$. (This argument uses only $E$'s finite generation and makes no use of the fact that it is projective.)
Now we can apply the proof you quote, to conclude that (now quite heavily using $E$'s projectivity), $\overline{x}_i$'s linearly independent over $A/\mathfrak{m}$ lift to $x_i$'s linearly independent over $A$. Thus a basis lifts to a basis, and we get to conclude that $E$ is free.
