Logical 0, binary 0, decimal 0: are they all the same in mathematics? A programming language might treat them differently, but is 0 just 0? No matter whether it is logical, binary, decimal, hexadecimal.
Logical 0, binary 0, decimal 0: are they the same?
215 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
Binary, decimal and hex are three different ways of representing numbers. The numbers are the same, so $11001000_2,202_{10}, \text { and } CA_{16}$ all represent the same number. In a computer language we may define that $0_2$ in memory represents logical false, but the concept is distinct from the natural numbers. In a computer we may also define that a certain bit pattern represents the real number $2.349595 \cdot 10^8$ (or something close to it). We could interpret that bit pattern as a binary representation of a natural number. There is no logical linkage between that natural number and $2.349595 \cdot 10^8$-it is an accident of the way we have defined the representation of floats. That representation becomes a requirement on the designer of computer hardware/software, to produce the proper binary string when operating on floats.
On
Disclaimer: I'm assuming that your "logical zero" refers to the way that some programming languages treat numbers as Boolean values.
On sameness:
There are (at least) two ways to interpret statement "$X$ and $Y$ are the same":
- definitions of $X$ and $Y$ make them equal,
- definitions of $X$ and $Y$ make them isomorphic.
For example, functions $f : \mathbb{N}\times\mathbb{N} \to \mathbb{N}$ and $g : \mathbb{N}\to \mathbb{N}^\mathbb{N}$ \begin{align} f(x,y) &= x + y \\ g(x)(y) &= x + y \end{align}
are not the same, e.g. they have different domains, but if the context doesn't care much about that, then these are essentially the same, i.e. describe the same concept.
Literal answer:
Different notations of natural numbers, e.g. binary or decimal or roman notation, all refer to the same object, $101_\text{bin} = 5_\text{dec} = \mathrm{V}_\text{rom}$. The strings of symbols, that is, the representation method may differ, but they all represent one object.
On the other hand, $0$ treated as a Boolean value has different properties. First, it is a member of structure called Boolean algebra
$$\Big\langle \{0,1\}, \min,\max, (x \mapsto 1-x), 0 , 1 \Big\rangle$$
which is isomorphic to the following Boolean algebra
$$\Big\langle \{\mathtt{false},\mathtt{true}\}, \land,\lor, \neg, \mathtt{false}, \mathtt{true} \Big\rangle.$$
Second, observe that the distinction between $0$ and $1$ is arbitrary: if you were to swap $0$ and $1$ and $\min$ with $\max$ (respectively $\land$ with $\lor$), then you would get the same (i.e. isomorphic) Boolean algebra.
Of course, there are many other ways in which $0_\mathbb{N}$ and $0_\text{Boolean}$ differ.
Finally, it's is worth to mention that in programming languages may use yet another approach, to mention two frequent:
- the zeros you enter are numbers, just the
if's are built so that they accept numbers (and perhaps strings, arrays and other stuff) and treat them in some predefined way. - the zeros you enter are numbers, just get automatically converted by the compiler into Boolean values.
In the above cases there is no "logical zero", because the zeros are just numbers.
Summing up: "logical zero" is not the same as "numeric zero", however, depending on how some programming language in question handles its symbols, all symbols 0 might represent the same concept.
Yet, this "swapping" property doesn't seem that important, if we were to disregard it (and perhaps some other things), could we call them the same?
On zeros:
There are multiple examples of concepts which could be regarded as "zero" in an appropriate context, for example
- the empty set $\varnothing$,
- the natural number $0$, i.e. the cardinality of the empty set,
- the real, complex, quaternion, etc. number $0$,
- zero vectors and matrices,
- identity matrices, identity functions,
- empty category,
- (addtive) neutral element in monoids, groups, rings, fields,
- sequences of zero length, empty arrays, the 0-tuple,
- function $\varnothing \to \varnothing$, empty relation.
Are these zeros the same? Let's take two groups, $G_1$ of order 2 and $G_2$ of order 3. Both contain the neutral element. However, those two are different structures and it's nonsensical to mix their elements; clearly the neutral elements are distinct entities. Yet we could consider $\mathbb{Z}_6$ which contains subgroup isomorphic to $G_1$ and another isomorphic to $G_2$, moreover, their identities coincide. In other words, there is a context in which we would consider them the same.
So, are these zeros the same or not? It depends on the details you pay attention to. For example, sequences, numbers and categories are distinct concepts having incomparable properties. Nevertheless, it so happens (and I didn't do it on purpose), there are monoid structures that would have all the above as their neutral elements (we could further generalize to non-associative operators, but I will stick with monoids here); consider the following binary operations:
- the empty set $\varnothing$: the union of sets,
- the natural number $0$: addition,
- the real, complex, quaternion, etc. number $0$: addition,
- zero vectors and matrices: point-wise addition,
- identity matrices, identity functions: composition,
- empty category: disjoint union of categories,
- (addtive) neutral element in monoids, groups, rings, fields: the respective operation in the structure,
- sequences of zero length, empty arrays, the 0-tuple: concatenation
- function $\varnothing \to \varnothing$, empty relation: the disjoint union of functions/relations, e.g. for $f : X_f \to Y_f$ and $g: X_g \to Y_g$ we would have $(f \uplus g) : X_f \uplus X_g \to Y_f \uplus Y_g$.
Summing up: even if the underlying concepts are different, when one blurs enough details (here we blur out everything but the monoid structure) a common pattern arises. For any two of the above monoids we could take their product and the identity element or the result would be actually common to both substructures. In other words, to answer if those zeros are the same, you need to decide first on the details you pay attention to.
I hope this helps $\ddot\smile$
The fact that you bring in "logical 0" makes this question tricky to answer. The other things you mentioned are all number systems. Ross's answer makes complete sense for those. But "logical 0" isn't a number at all. It's the smallest element in a complete boolean lattice.
And that's where things get tricky. In particular, the reason we call it zero is because it has two properties with respect to the lattice operations. It is the identity element for the join operation (so $0 \vee x = x$) and it is the absorbing element for the meet operation (so $0 \wedge x = 0$). Notice how this is similar to how the number zero works -- $\vee$ is like addition and $\wedge$ is like multiplication.
So, all of the zeroes, including logical zero, have these two properties. And it is on that basis that they all earn the symbol/name $0$. But it is not necessarily true that they are the same object. Having an apple is different than having an orange. So why should having no apples be the same as having no oranges?
There is room for both positions. But which you choose is purely a matter of philosophy or modeling.