Speakpigeon wrote: ↑Thu Feb 28, 2019 10:31 am
So, if A = A is not necessarily true, how do you prove that 2 = 2 for example?
Well the two is an object of type integer. In the context of integers the meaning of = is pretty unambiguous. It means "Distance from 0 on the number line". Unless my imagination is lacking - I can't think of another meaning.
But observe that in order to be explicit about the law of identity we need to state it like this:
for all x: id(x) = id(x).
So then 2 = 2 means "are the two integers the same distance from 0?"
But id(2) = id(2) means "do the two objects have the same IDENTITY?"
In Python the value and identities of "2" are different things.
Code: Select all
In [2]: 2 == 2
Out[2]: True
In [3]: id(2)
Out[3]: 96222208947104
In [4]: id(2) == id(2)
Out[4]: True
So then to the question "Are the two integers the same distance from 0?" the answer is True.
And to the question "Do the two objects have the same identity?" the answer is also True.
They answer different questions.
Speakpigeon wrote: ↑Thu Feb 28, 2019 10:31 am
Or do you just never need to prove that x = x, for any x whatever?
EB
It depends on what you mean by "=".
For all numeric types the meaning is clear.
What does "=" mean for sets?
Equivalent contents?
Equivalent size?
If the set of Apples and the set of Oranges are both empty are they the same set?
Code: Select all
In [7]: Apples = []
In [8]: Oranges = []
In [9]: Apples == Oranges
Out[9]: True
So apples and oranges are the same thing? Right