Open
Description
Description of the issue
When using line qubits and crossing gates in a single moment; the output on printing the moment is confusing and does not show the overlap correctly, unlike the output obtained on printing the whole circuit.
How to reproduce the issue
a, b, c, d = cirq.LineQubit.range(4)
c1 = cirq.Circuit([cirq.CNOT(a, d), cirq.CNOT(b, c)])
c2 = cirq.Circuit([cirq.CNOT(a, c), cirq.CNOT(b, d)])
In [22]: print(c1, '\n', c2)
┌──┐
0: ────@─────
│
1: ────┼@────
││
2: ────┼X────
│
3: ────X─────
└──┘
┌──┐
0: ────@─────
│
1: ────┼@────
││
2: ────X┼────
│
3: ─────X────
└──┘
In [23]: print(c1[0], '\n', c2[0]) # <-- Confusing: The output should be different similar to circuit diagram above.
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─X─X
│
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─X─X
│
Another Example:
In [18]: print(cirq.Circuit(cirq.ControlledGate(cirq.X, num_controls = 3).on(a, b, c, d))[0])
...: print(cirq.Circuit([cirq.CNOT(a, d), cirq.CZ(b, c)])[0])
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─@─X
│
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─@─X
│
Cirq version
0.11.0.dev