The most general version of the theorem (I have seen) states that a function from a compact metric space into reals can be approximated by an algebra of functions that maps in the same way, is continuous, separates points, is non-vanishing.
I wonder, apologies if the question is trivial (I am not a mathematician), what happens when the function of interest maps from a compact metric space into a finite set consisting of real numbers? I believe such functions are called simple functions (am not sure).
Is there a version of the theorem for such a case?
What worries me that such mappings look horribly non-continuous, and continuity seems to be a key requirement in all proofs of the theorem I’ve seen.
Note: I need to use the theorem in the way I presented (checkig for algebraic properties, separations property etc). Please try to suggest a similar formulation, if there is such.
An example: Imagine that I want to approximate a function f that takes a series of 100 numbers (each number from an interval [0,1]) and returns +1 if they are sorted, -1 if they are not. This is a complicated function though mathematically it is classified as a simple function (I think): it maps from a compact metric space (100-tuples or reals) into a finite set {-1,1}. At my disposal I have an algebra of functions I can use to carry out the approximation. What do I need to ask about that algebra in order to make sure I can find a good approximation for f? Should I proceede like usual as the SW instructs me to do (check separation property, etc) or do something else?
Best Zoran