Let $X$ be any compact Housdorff space. Prove that there is a surjective group homomorphism $\text{dim}: K_0(C(X)) \to C(X, \mathbb{Z})$ such that $\text{dim}([p]_0)(x)=\text{Tr}(p(x))$.
My attempt: I want to construct a map $v:P_{\infty}C(X)\to C(X,Z)$ such that
(1) $v(p\oplus q)=v(p)+v(q)$,
(2) $v(0)=0$,
(3) if $p,q\in P_n(C(X))$,and $p\sim_{h}q$,then $v(p)=v(q)$,
then there exists a unique group homomorphism $\alpha: K_0(C(X))\to C(X,\Bbb Z)$ such that $\alpha([p]_0)=v(p)$.
How to find $v$ such that the above conditions hold?
Define $v:P_\infty(C(X))\to C(X,\mathbb Z)$ by $$v(p)(x)=\operatorname{Tr}(p(x)).$$ That the first and second properties hold follow directly from the definition of the trace. For the third property, if $t\mapsto p_t$ is a continuous map from $[0,1]$ to $P_n(C(X))$, then for each $x\in X$, the map $t\mapsto\operatorname{Tr}(p_t(x))$ is a continuous map from $[0,1]$ to $\mathbb Z$, hence is constant. Thus $\operatorname{Tr}(p_0(x))=\operatorname{Tr}(p_1(x))$ for all $x\in X$, and thus $v(p_0)=v(p_1)$. Thus $v$ satisfies all three properties, hence induces the map $\alpha:K_0(C(X))\to C(X,\mathbb Z)$ with the desired property.
To show that $\alpha$ is surjective, fix $f\in C(X,\mathbb Z)$. For each $n\in\mathbb Z$ put $V_n=f^{-1}(\{n\})$, and let $p_n\in C(X)$ be given by $p_n(x)=1$ if $x\in V_n$ and $p_n(x)=0$ otherwise. Then $g=\sum_{n\in\mathbb Z}n[p_n]_0\in K_0(C(X))$ and $\alpha(g)=f$.