Pull back of a finite measure I came across the following problem asked in a prelim exam. 
Let $X$ and $Y$ be compact metric spaces. Suppose, $\phi:X\to Y$ is a continuous surjective map. Let $D= \{f\in C(X): f(x)=f(x’)\ \text{whenever}\  \phi(x)=\phi(x’)\}.$
a) Show that $D$ is a closed subspace of $C(X)$ and that $D=\{g\circ \phi : g\in C(Y)\}.$
b) Let $\nu$ be a finite positive Borel measure on $Y$. Prove that there is a finite positive Borel measure $\mu$ on X such that $\mu(\phi^{-1}(F))=\nu(F)$ for all Borel subsets $F$ of Y. 
As far as part a) is concerned, it is easy to prove that $D$ is closed subspace and also that a function $f$ in D looks like $g\circ \phi$ for some g. But, I am not able to argue why $g$ should be continuous. 
My main problem is regarding the part b). While it is easy to show that $\{\phi^{-1}(F)\}$, where $F$ runs over Borel subsets of $Y$, is a sigma algebra. And we can define a finite measure $\mu$ on this sigma algebra by $\mu(\phi^{-1}(F))=\nu(F)$. I can show that this is well defined. My trouble is that this sigma algebra on $X$ can be much smaller than the Borel sigma algebra on $X$. So, do I need to extend this measure to whole Borel sigma algebra? If yes, how can I do that? Also, I do not see the use of surjectivity of $\phi$ in part b). Am I correct in my understanding?
 A: (a)
I believe you know that
\begin{align*} g(y)=f(x), \end{align*}
where $x$ is any point satisfying $\phi(x)=y$. 
(Note that you should write $g(y)=something$ instead of $g(\phi(x))=something$ to give a definition of a function on $Y$. This is very important. )
To show $g$ is continuous, we could show that $g^{-1}(A)$ is closed in $Y$ for every closed set $A$ in $\mathbb{R}$. Observe that
\begin{align*} g^{-1}(A)=\phi(f^{-1}(A)) \end{align*}
and use the compactness of $X$, we could conclude that $g^{-1}(A)$ is closed in $Y$. The verification of the above formula is left to you. 
(b)
As the remark in my first paragraph, $\mu(\phi^{-1}(F))=something$ is not a definition of a measure on the Borel algebra (in $X$). (you already pointed it out in the question) The correct definition should be
\begin{align*} \mu(A)=\nu(\phi(A)), \end{align*} 
where $A$ is $any$ Borel set in $X$.
To check this is well-defined, we have to show that $\phi(A)$ is a Borel set in $Y$ for any Borel set $A$ in $X$. This uses the surjectivity of $\phi$ and the fact that Borel algebra is the smallest $\sigma$-algebra containing all closed sets. 
Of course, checking $\mu(\phi^{-1}(F))=\nu(F)$ is required (and is left to you). During the verification, you would need $\phi(\phi^{-1}(F))=F$, which is true when $\phi$ is surjective. 
A: Mindlack has given a good answer for the second part. 
To show continuity of $g$ you use the closed map lemma. In particular $X$ is compact, $Y$ is Hausdorff and $\phi$ is continuous therefore $\phi$ is a closed map. Hence as a continuous, closed surjection, $\phi$ is a quotient map. 
Thus by the defining property of the quotient topology any $g: Y \to Z$ (where $Z$ is any topological space) is continuous if and only if $g \circ \phi$ is. $g \circ \phi$ is clearly continuous as it is equal to $f$.
