Let x = number of live neighbors of a cell $$f(x)=\left\{\begin{matrix} live & \textrm{if}\ x = 3\\ live & \textrm{if}\ x = 4\\ dead & \textrm{otherwise}\\ \end{matrix}\right.$$
$$f(1) = dead$$ $$f(3) = live$$ $$f(4) = live$$ $$f(5) = dead$$
Given that the outputs aren't numbers, is this still mathematically sound?
Yes. Functions represent a relationship between 2 (not necessarily identical) sets.
You can talk about the function whose input in the name of a town, and whose output is the distance that you are from it.