question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gate1 == gate2 should imply f(gate1) == f(gate2)

See original GitHub issue

Example 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:closed
  • Created 5 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Strilanccommented, Nov 23, 2018

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

0reactions
daxfohlcommented, Mar 22, 2022

A better example of a common place this doesn’t hold. Dictionaries in Python are ordered (now), so:

>>> x = {'a':1, 'b':2}
>>> y = {'b':2, 'a':1}
>>> x == y
True
>>> list(x)
['a', 'b']
>>> list(y)
['b', 'a']
>>> list(x) == list(y)
False
Read more comments on GitHub >

github_iconTop Results From Across the Web

Gate 1 Travel
Gate 1 Travel offers escorted tours, European river cruises, independent vacations and customized international vacation packages for less.
Read more >
Contact Us | Gate 1 Travel - More of the World For Less!
Contacting us by Email. Please fill out the form below with your questions or comments. Requests are answered in the order they are...
Read more >
Spain & Portugal | Gate 1 Travel - More of the World For Less!
Spain travel packages at great prices allow you to explore your favorite destinations customized to your time and budget. Gate 1 Travel has...
Read more >
Turkey | Gate 1 Travel - More of the World For Less!
Looking to travel Greek Islands? Gate 1 Travel has fantastic Greece vacation packages including escorted tours and multi-city journeys.
Read more >
Ireland | Gate 1 Travel - More of the World For Less!
Ireland vacation packages at fantastic prices through Gate 1 Travel allow you to customize your vacation according to your time and budget.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found