I think the framework you are looking for may be found in thinking about the "logic" of mathematics in terms of a "formal language." See the articles on formal languages in the [Encyclopedia of Mathematics][1] and in MathWorld and Wikipedia. [1]: https://encyclopediaofmath.org/wiki/Formal_language