gate1 == gate2 should imply f(gate1) == f(gate2)
See original GitHub issueExample where it doesn’t:
In [2]: z1 = cirq.Z
In [3]: z3 = cirq.Z**3
In [4]: z1 == z3
Out[4]: True
In [5]: z1**(1/3) == z3**(1/3)
Out[5]: False
This is a consequence of our attempt to preserve the identity
(1) (G**a)**b == G**(a*b)
The identity is true for real numbers. It fails when we move on to complex numbers. From then on it continues to fail for unitary operators.
I understand the desire for intuitive behavior, but I fear that an attempt to preserve a false identity will just lead to a surprising behavior elsewhere: since the identity is false, something has to give. In this case, we are giving up a very fundamental and intuitive property of equality: if two gates are equal then transforming each in a given way yields another pair of equal gates.
If we must surprise some users, perhaps it is best to do so in a context that is at least consistent with the rest of the world, which recognizes the failure of identity (1).
Filed from review of #1155.
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (7 by maintainers)
Off the top of my head, I remember that sphere eversion is possible because of conservation of a 3d analogue to the 2d winding number https://www.youtube.com/watch?v=sKqt6e7EcCs
A better example of a common place this doesn’t hold. Dictionaries in Python are ordered (now), so: