I just talked about characteristic functions as masks on other functions. Given a function and a subset , we can mask the function to the subset by multiplying it by the characteristic function . I want to talk a little more about these functions and how they relate to set theory.
First of all, it’s easy to recognize a characteristic function when we see one: they’re exactly the idempotent functions. That is, , and if then must be for some set . Indeed, given a real number , we can only have if or . That is, or for every . So we can define to be the set of for which , and then for every . Thus the idempotents in the algebra of real-valued functions on correspond exactly to the subsets of .
We can define two operations on such idempotent functions to make them into a lattice. The easier to define is the meet. Given idempotents and we define the meet to be their product:
This function will take the value at a point if and only if both and do, so this is the characteristic function of the intersection
We might hope that the join would be the sum of two idempotents, but in general this will not be another idempotent. Indeed, we can check:
We have a problem exactly when the corresponding sets have a nonempty intersection, which leads us to think that maybe this has something to do with the inclusion-exclusion principle. We’re “overcounting” the intersection by just adding, so let’s subtract it off to define
We can multiply this out to check its idempotence, or we could consider its values. If is not in , then , and we find — it takes the value if and otherwise. A similar calculation holds if , which leaves only the case when . But now and both take the value , and a quick calculation shows that does as well. This establishes that
We can push further and make this into an orthocomplemented lattice. We define the orthocomplement of an idempotent by
This function is wherever is , and vice-versa. That is, it’s the characteristic function of the complement
So we can take the lattice of subsets of and realize it in the nice, concrete algebra of real-valued functions on . The objects of the lattice are exactly the idempotents of this algebra, and we can build the meet and join from the algebraic operations of addition and multiplication. In fact, we could turn around and do this for any commutative algebra to create a lattice, which would mimic the “lattice of subsets” of some “set”, which emerges from the algebra. This sort of trick is a key insight to quite a lot of modern geometry.