I saw some remark that any locally constant function $f:\mathbb Q\_p \to \mathbb C$ can be written as
$$
f(x)=\sum\_{i=1}^{\infty}c\_i1\_{U\_i}(x), c\_i\in\mathbb C
$$
for some open subsets $U\_i\in\mathbb Q\_p$.
Why is it possible?
And furthermore, if $f$ is also compactly supported, can it be finite linear combination?
If the answer is yes, why?



Why can a locally constant function on $\mathbb{Q}_p$ be expressed as a linear combination of characteristic functions?
Suppose that $f:\mathbb{Q}\_p\to\mathbb{C}$ is locally constant. For each $k\geq 0$ the set $p^{-k}\mathbb{Z}\_p\subset\mathbb{Q}\_p$ is compact, so it can be covered by finitely many open sets on which $f$ is constant, so $f(p^{-k}\mathbb{Z}\_p)$ is finite. By taking the union over $k$, we see that the image $C=f(\mathbb{Q}\_p)$ is countable. For notational simplicity I'll assume that $C$ is infinite, so it can be enumerated (without repetition) as $c\_1,c\_2,\dotsc$ say. Local constancy means that the sets $U\_i=f^{-1}\{c\_i\}$ are open, and they form a disjoint cover of $\mathbb{Q}\_p$. Now $f=\sum\_i c\_i\chi\_{U\_i}$.


