Proof of the composition of smooth functions is smooth. I have seen a couple questions involving the composition of smooth maps is smooth, but the proof I came up with does not look quite like the proofs given and I want to know if there is anything wrong with my proof.

Let $X \subset R^k$, $Y \subset R^l$, and $Z \subset R^m$. Claim: If $f : X \to Y$ and $g : Y \to Z$ are smooth, then their composition $g \circ f$ is smooth.

Proof:
We have that $f$ is smooth. Therefore, for any $x \in X$, $\exists U \subset R^k$ that contains $x$ and there exists $F : U \to R^l$ that coincides with $f$ in $U \cap X$. Notice that $f(x) \in Y$. As $f(x) \in Y$ and $g$ is smooth we know that for any $x \in X$, $\exists  W \subset R^l$ containing $f(x)$ and $\exists G : W \to R^m$ such that $G$ coincides with $g$ in $W \cap Y$. As a result, we can guarantee $G \circ F : U \to R^m$, therefore, $g \circ f$ must be smooth as there exists an appropriate open set $U$ and corresponding function $G \circ F$.
 A: Your alleged proof does nothing. You just have replaced the given open sets $X\subset{\mathbb R}^k$ and $Y\subset{\mathbb R}^l$ by smaller sets, with no apparent reason or purpose. 
You have not made clear what you mean by "smooth". If you just mean $C^1$ the proof is just a reference to the chain rule, see the answer in the linked question. If you mean $C^\infty$ you have to set up an induction proof showing that all partial derivatives of $g\circ f$ of all orders exist and are continuous if this is the case for $f$ and $g$.
A: I think the answer to your question is already given in the answers to the couple questions you mention, it just doesn't appear integrated into a single answer, so I think it's convenient to write it here.
It is convenient to say that this problem corresponds to Exercise 1.3 (with a star) of Guillemin and Pollack's book, Differential Topology.
Let us therefore remember the definitions that Guillemin and Pollack offer in that book:
First we write the definition of smoothness in the classical sense, i.e., on open sets of $ \mathbb R ^ n $​ (Guillemin and Pollack do not use the term "classical" but it suits us to handle it like this for our explanation):

A maping $f$ of an open set $U\subset\mathbb R^n$ into $\mathbb R^m$​
is called smooth if it has continuous partial derivatives of all
orders. (Page 1)

Then, we write the "extended" version (on arbitrary sets):

A map $f:X\to\mathbb R^m$ defined on an arbitrary subset $X$ in
$\mathbb R^n$ is called smooth if it may be locally extended to a
smooth map on open sets; that is, if around each point $x\in X$ there
is an open set $U\subset\mathbb R^n$ and a smooth map [in the
classical sense] $F:U\to\mathbb R^m$ such that $F$ equals $f$ on
$U\cap X$​​. (Pages 1 and 2)

Let then $ X \subset \mathbb R ^ n $, $ Y \subset \mathbb R ^ m $, $ Z \subset R ^ k $ be arbitrary subsets and let $ f: X \to Y $ y $ g: Y \to Z $ smooth maps (extended sense). We want to show that the composition $ h = g \circ f: X \to Z $ is smooth (extended sense).
In the case of $ X $​, $ Y $​ and $ Z $​ open this is a typical calculus result that is explained here.
In the general case we proceed as follows:
Let $ x \in X $. Since $ f $ is smooth (extended sense), there exists an open $ U \subset \mathbb R ^ m $ and a function $ F: U \to \ R ^ n $​ smooth (classical sense) such that
$$
x\in U \qquad \text y \qquad F|_{U\cap X}=f.
$$
Let $ y = f (x) \in Y $. Since $ g $ is smooth (extended sense), there is an open $ V \subset \mathbb R ^ n $ and a function $ G: V \to \mathbb R ^ k $ smooth (classical sense) such that
$$
y=f(x)\in V \qquad \text y \qquad G|_{V\cap Y}=g.
$$
Of course we would like to take the composition $ G \circ F $​ as the smooth function (classical sense) that smoothly extends the function $ h $​, but it is not possible to do this for the reasons explained here.
So if we set
$$
\widehat F=F|_{U\cap F^{-1}(V)}:U\cap F^{-1}(V)\to \mathbb R^n
$$
then $ \widehat F $ is smooth (classical sense) and since $ U \cap X \cap F ^ {- 1} (V) \subset U \cap X $, it follows that
$$
\widehat F|_{U\cap X}=F|_{U\cap X}=f.
$$
We set
$$
H=G\circ\widehat F:U\cap F^{-1}(V)\to\mathbb R^k.
$$
Then $ H $ is smooth (classical sense) and if $ \xi \in U \cap X $, $f(\xi)\in V\cap Y$, and therefore
$$
H(\xi)=G(\widehat F(\xi))=G(f(\xi))=g(f(\xi))=h(\xi).
$$
That is $H|_{U\cap X}=h$ and $h$​ is smooth (extended sense).
Many other solutions to starred exercises from Guillemin and Pollack's book can be found here.
