Derivatives and the cotangent space

In Differentiable Manifolds, the derivative of a function $f: M \rightarrow \mathbb{R}$ at $a$ denoted by $(df)_a$ is defined as its image in the cotangent space: $T_a^* = C^\infty(M)/Z_a$, where $Z_a$ is the subspace of functions whose derivatives vanishes a $a$.

I'm having trouble understanding the following proposition:

Proposition 3.1 Let $M$ be an $n$-dimensional manifold, then

• the cotangent space $T_a^*$ at $a \in M$ is an n-dimensional vector space

• if $(U, \varphi)$ is a coordinate chart around $x$ with coordinates $x_1, \dots, x_n$, then the elements $(dx_1)_a, \dots, (dx_n)_a$ form a basis for $T_a^*$

• if $f \in C^\infty(M)$ and in the coordinate chart, $f \varphi^{-1} = \phi(x_1, \dots, x_n)$ then $$(df)_a = \sum_i \frac{\partial \phi}{\partial x_i} (\varphi(a))(dx_i)_a$$

Proof: If $f \in C^\infty(M)$, with $f \varphi^{-1} = \phi(x_1, \dots, x_n)$ then $$f - \sum \frac{\partial \phi}{\partial x_i} (\varphi(a))x_i$$ is a (locally defined) smooth function whose derivative vanishes at $a$, so $$(df)_a = \sum \frac{\partial f}{\partial x_i} (\varphi(a))(dx_i)_a$$ and $(dx_1)_a, \dots, (dx_n)_a$ span $T_a^*$.

More specifically, I wonder what is meant by $f - \sum \frac{\partial \phi}{\partial x_i} (\varphi(a))x_i$ since $f$ is a function on $M$ and the sum is a function on $\mathbb{R}^n$. I also wonder what is meant by $(dx_i)_a$ in this context since $x_i$ is not a function on $M$.

Let $\phi:U\to\mathbb{R}^n$. Then $x_i:U\to\mathbb{R}^n$ is defined to be the $i$th component function of $\phi$. In other words, $$\phi(p)=(x_1(p),\ldots,x_n(p))$$ for each $p\in U$.
So $x_i$ is in fact a function whose domain is the open set $U\subset M$.