Improved versions of discontinuous functions Given a set X (such as the set of points in an interval), the space ℝX of all real-valued functions on X is not usually the function space we work with -- it is "too large" in some sense.  Thus, we typically deal with functions that "behave well" with respect to some other structure on X.
One familiar example of this is functional analysis using the Lp spaces: we begin with a measure space (X,μ) and consider two functions to be equivalent if they agree on a set of full μ-measure.  Strictly speaking, then, we do not deal with functions themselves, but with equivalence classes of functions.
If X carries a topological structure rather than a measure-theoretic one, then we often consider the space C(X) of all continuous functions on X.  In this case elements of the space are single functions, and we do not impose any equivalence relation.
Of course, there are many discontinuous functions from X to ℝ that may be of interest:  characteristic functions of subsets Y ⊂ X, for example, or more general piecewise continuous functions.  Thus it would be of interest (to me at least) to have some notion of when two arbitrary functions are "close enough to identical" from a topological point of view, just as agreeing μ-a.e. gives a notion of "close enough to identical" from a measure-theoretic point of view.
As an example, if f : [0,1] → ℝ has f(0)=1 and f(x)=0 for all other x, we may reasonably say that the constant function g ≡ 0 is the "continuous version" of f.  Similarly, if f : ℝ → ℝ is given by f(x)=1 for x ≥ 0 and f(x)=0 for x<0, while g : ℝ → ℝ is given by g(x)=1 for x>0 and g(x)=0 for x ≤ 0, then we may feel that f and g are "close" to being the same function, perhaps close enough to be identified; furthermore, neither one is "more continuous" than the other, in contrast to the previous example.  (They are both more continuous, however, than the function h defined by h(0)=2 and h(x)=f(x)=g(x) for all x ≠ 0.)
One possible way to formalise this intuition would be to put a directed graph structure on the space ℝX of real-valued functions on X by drawing an edge from f to g if and only if the graph of g is contained in the closure of the graph of f.  Thus in the first example above, there would be an edge from f to g, but not from g to f, while in the second example, there would be edges from h to both f and g, and an edge in both directions between f and g, but no edges from f or g to h.
With this digraph structure, continuous functions would have many incoming edges, but no outgoing ones, while "well-behaved" piecewise continuous functions would be partitioned into equivalence classes, each class containing various functions corresponding to the choice for the value of the function at the points of discontinuity.
All this is just my own rambling line of thought at this point, and my question is this:  Is there a systematic and well-developed theory into which such considerations fit?  If so, is there a good reference?  I suspect that people have thought about this enough to come up with such a theory, but I have no idea what keywords to look for or what things might be called.  (For a similar reason, I wasn't quite sure how to tag this question appropriately, so please feel free to re-tag if you can do better.)
 A: The strong topological notion of "almost nowhere" is "meagerness", but you might just be asking for "a nowhere dense set". The rationals are dense, but meager, so the answer depends on whether you consider the indicator function of the rationals to be almost zero.
You talk about two things:


*

*equivalence classes of functions which agree on comeager/co-nowhere-dense set.

*functions which are discontinuous on meager/nowhere-dense set.


You are further stipulating that a good representative of the second class is one where the value at a point x in the discontinuity set is one of the limits of the function near x. This is difficult, because if you have a function which is discontinuous on the rationals, representatives can take on any value on the rationals, and give any limit at any point. So define a "real limit" of f at x is a limit of all the representatives of f.
How could any of this have any possible application to thermodynamics? Perhaps you are thinking of patching up thermodynamic functions which are discontinuous at 1st order phase transitions, but I am guessing. If it is something like that, I think "nowhere dense" will be enough, even the much weaker "having no accumulation points", since phase transitions will not accumulate.
A: You might be interested in the notion of "strong liftings." See for instance
http://en.wikipedia.org/wiki/Lifting_theory.
