There is a version of the theorem for continuous mappings $f$ from a compact metric space $X$ to real numbers $R$. Namely, if an algebra $A$ of continuous functions separates points and is non-vanishing, then any $f$ can be approximated arbitrarily well by an element $a$ in $A$.
I wonder whether the same exists for functions that map from a compact metric space $X$ to real numbers but are only piecewise continuous.
An example of $f$: Take a series of 100 numbers $\vec x=(x_1,x_2,\cdots,x_{100})$, each number in the interval $[0,1]$, and return $+1$ if they are sorted and $-1$ if they are not.
An example of $A$: an element $a\in A$ is defined by a tuple $a\equiv (i,j,v)$ where $i$ and $j$ are indexing elements of the sequence of 100, $v$ is any two-argument piecewise continuous function that takes $x_i$ and $x_j$, and returns a number. Thus the element $a$ would operate on $\vec x$ as follows: $a\circ\vec x \equiv (i,j,v)\circ\vec x=v(x_i,x_j)$.
Can I use $A$ to approximate $f$? I would like to use the Stone-W theorem to figure it out. However, the theorem only works for continuous functions. So unless there is a version for piecewise continuous functions such a problem cannot be solved.
Best
Zoran
p.s. This is an improved version of a similar question posted elsewhere. Based on the comments I’ve got there I realized that the present post is really the question I am interested in.