Re: logic challenge for Mathematica (and others?)



G. A. Edgar wrote:
In[1] := 3+Infinity == 4+Infinity

Out[1] = True

Limit[3 + x, x -> Infinity] == Limit[4 + x, x -> Infinity]
--> True

In[2] := 3+{} == 4+{}

Out[2] = True

{1, 2, 3} is a list of three elements. Say we want to add 3 to each element of the list: 3 + {1, 2, 3} yields {4, 5, 6}. Now, {} is an empty list. Mathematica cannot add up a scalar to the empty list, so it returns an empty list. I do not know whether this answer is really intended by WRI -- usually Mathematica returns an expression unevaluated when it do not know what to do with it (that is it does not have any replacement rules or error/warning messages) -- or just some side effect of the overloaded addition operator.

Trace[3 + {} == 4 + {}]
--> {{3 + {}, {}}, {4 + {}, {}}, {} == {}, True}
.