I've read:
For all $a$ and $b$, if $a$ is a natural number and $a = b$, then $b$ is also a natural number. That is, the natural numbers are closed under equality.
This is so clear to the extent that it seems silly to me.
My question is: I need an example about something in math that is not closed under equality. Just to feel that the above sentence is not useless.
Consider “$3$” and “$5-2$.” They are clearly equal as natural numbers, but they are two different ways to write the same number. They are different things that you write that mean the same thing. In mathematics (as well as in linguistics, for natural languages) we call this distinction a distinction of syntax vs semantics.
Syntax concerns the formal writing of expressions. “$5-2$” and “$3$” are syntactically different because they are written differently. However they are semantically the same because they mean the same thing. Whether or not two expressions syntactically different expressions are semantically the same can depend on the context. As vector spaces or as additive groups $\mathbb R^2$ and $\mathbb C$ are the same, but as rings they are not, because they have different multiplicative structures.
What this axiom tells you is that “$=$” is a relation that only has to do with the semantic content of an expression, not its syntactic content. For an example where this doesn’t hold, consider the set of monomials. $x^4=x^2(x^2+1)-x^2$ but that doesn’t mean that the second expression is a monomial. That’s because the definition of monomial depends on how the expression is written (its syntactic content) rather than just what the expression means (its semantic content). Being a natural number is solely a comment about your semantic content, and this axiom is needed to assert that it is so. Otherwise, $5-2$ might not be a natural number.