Why do we need to extend $\phi$? Here is the proof of a lemma appeared in a text book:

Lemma If $M\subset \mathbb R^k$ is a nonempty smooth m-manifold then $m\leq k$.
  Proof. Let $\phi:U\bigcap M\to \Omega$ be a coordinate chart of $M$ onto an open subset $\Omega\subset\mathbb R^m$, denote its inverse by $\psi:=\phi^{-1}:\Omega\to U\bigcap M$, and let $p\in U\bigcap M$. Shrinking $U$, if necessary, we may assume that $\phi$ extends to a smooth map $\Phi:U\to{\mathbb R}^m$. This extension satisfies $\Phi(\psi(x))=\phi(\psi(x))=x$ and, by the chain rule, we have $$d\Phi(\psi(x))=\phi(\psi(x))=x$$ and, by the chain rule, we have $$d\Phi (\psi (x))d\psi(x)=id:{\mathbb R}^m\to{\mathbb R}^m$$ for every $x\in\Omega$. Hence $d\psi(x):{\mathbb R}^m\to {\mathbb R}^k$ is injective for $x\in\Omega$ and, since $\Omega\neq \emptyset$, this implies $m\leq k$.

My question is: Is it necessary to extend $\phi$ into $\Phi$? What on earth is the point of doing that? By the way, why does the author say "Shrinking $U$ if necessary"? I don't see there will be any case where it's necessary to shrink $U$.
 A: The first part of the question has already received a satisfactory answer in the comments, so we shall refer to the second one.
Consider the following example: $k=1$, $M=(0,\infty),\;U=\mathbb{R}$. In this case, of course, $U\cap M=(0,\infty)$, and so we can define the coordinate chart by $$\phi(x)=\log x.$$This chart obviously cannot be extended to the whole of $U$.
Remark: It is not so trivial (in my opinion) that $\phi$ can be extended to a smooth function on some neighborhood in $\mathbb{R}^k$ (can you prove it?). The only way I know to show this is by the inverse function theorem, which assures the existence of ... only on some neighborhood. 
Another remark: I don't know which textbook you are referring to, and how the author defines a smooth manifold, but according to some definitions, it is not true at all that $\phi$ can be extended to a smooth function on a neighborhood in $\mathbb{R}^k$. When using the intrinsic definition of a manifold, in order for this claim to be true one needs to assume that $M\subset\mathbb{R}^k$ is a submanifold, rather than just a smooth manifold.
