How to tell when mathematical objects are of different types, e.g. $1$ and $0.5$, or $1$ and $+\infty$. I heard that for the purposes of doing set theory, we adopt the convention that the statement x=y is automatically false if $x, y$ are of different types; for instance, if one is treating sets and numbers as objects of different types, then a set would not be equal to a number.
But what does "type" really mean in mathematics? I am confused about the question of whether $1$ and $+\infty$ are objects of the same type(since they are both extended real numbers) or objects of different types(since $1$ is a real number and $+\infty$ is not). A similar question is, are $1$ and $1/2$ objects of the same type (since they are both real numbers) or objects of different types ($1$ is a natural number but $1/2$ is not)?
I apologize for the language barrier.
 A: Let's first look at how formal set theory without any notion of types handles this.
Here, everything is built up starting from the notion of sets, so everything is "really" a set. For example, we typically define $0$ to be the empty set $\emptyset$, $1$ to be $\{0\}$, or $\{\emptyset\}$, and more like this.
We define integers out of the natural numbers, rational numbers out of the integers, and real numbers out of the rationals. There are various ways to do this, usually involving equivalence classes of various equivalence relations.
For example, here is a common way to define the rationals, which I only mention for illustrative purposes. We start with the set $\mathbb Z \times (\mathbb Z \setminus \{0\})$: ordered pairs $(a,b)$ of integers with $b\ne 0$. We define an equivalence relation $\sim$ on this set by $(a,b) \sim (c,d)$ when $ad = bc$. The equivalence classes of this relation are the rationals: $a/b$ is shorthand for "the equivalence class of $(a,b)$ under $\sim$".
Anyway, once we've done this, there are actually several things all called "$1$". There's $1$ the natural number, constructed as $\{0\}$. There's $1$ the integer. There's $1$ the rational number: as an equivalence class, it consists of all pairs $\{(a,a) : a \in \mathbb Z \setminus \{0\}\}$. There's $1$ the real number, defined using Cauchy sequences or Dedekind cuts or decimal expansions or sometimes other, weirder things.
When we ask "Is $1 = 1/2$" it is probably clear from context that we are dealing with, say, $1$-the-real-number and $1/2$-the-real-number, and then $1 \ne 1/2$. This happens no matter how we define the real numbers, and so when we're not working with foundational things, we don't really care how we define the real numbers.
In practice, we would never ask whether $1$-the-natural number is equal to $1/2$-the-rational number. The answer:

*

*would depend on the specific way we defined the rational numbers;

*would almost certainly be "no" in this specific case no matter how we did it.

But sometimes we get nonsense "yes" answers if we think about how things look under the hood. The earlier $1 = \{0\}$ is such a nonsense "yes" answer. My favorite nonsense along these lines is "$7$ is a topology on $6$".

We might want some notion of types to avoid the nonsense "yes" answers. Formal type theory gets pretty crazy, but somewhat informally you can start by thinking of this as a tag attached to objects to say which thing we mean by them. For example, $1 : \text{real}$ for $1$-the-real-number or $1 : \text{natural}$ for $1$-the-natural-number.
Then, we say that two of these things (called terms) can only be equal if they have the same tag (called a type). For example, $1 : \text{natural}$ and $\{0\} : \text{set-of-naturals}$ are not equal, even though $1$ and $\{0\}$ are equal in set theory without types.
So when we ask if $1 = 1/2$, our first step is, again, to ask: which "$1$" and which "$1/2$" do we mean? (This is usually clear from context.) Then, for example

*

*$1 : \text{natural}$ and $1/2 : \text{rational}$ are not equal, because they have different types. (This was already almost certainly true without types, but not quite clear because we can construct the rationals in different ways.)

*$1 : \text{real}$ and $1/2 : \text{real}$ are not equal, but they could be because they have the same type. We actually have to go and check.

The important thing to remember is that, just as before, we have different terms, $1 : \text{natural}$ and $1 : \text{integer}$ and $1: \text{rational}$ and $1 : \text{real}$, all representing the same concept ("concept" is not a formal notion), but with different types.
A: When I read this question my initial thought was categorical vs. quantitative. the function, y=x represents a quantitative relationship between two items or variables. Whereas categorically, two objects don't automatically equal each other. In some ways they do but mathematically you can not prove that two objects will always equal each other.
My suggestion to you is, when asking this question, to define whether the object you were thinking of is quantitative or categorical. These are two extremely different subtopics.
