qr = QuantumRegister(2)
cr = ClassicalRegister(2)
# Creating a Bell circuit
qc_if_else = QuantumCircuit(qr, cr)
qc_if_else.h(0)
qc_if_else.measure(0, 1)
with qc_if_else.if_test((cr[0], True)) as else_:
qc_if_else.x(0)
with else_:
qc_if_else.x(1)
qc_if_else.measure(0, 1)
qc_if_else.draw(output="mpl", idle_wires=False)
I am following this Tutorial on dynamic circuits, what I understood from the above piece of code is that we measure the qubit zero and store the value in the register with index 1 (that is the second register) , and then we test if cr[0] is True which will be False as its zero because we didnt measure anything and store it in cr[0] so it will go to the else block which applies X gate on the qubit with index 1 (the second qubit). and then measure the qubit zero and again store it in the classical register with index[1] (the second register).
Is my understanding of the above circuit correct? I dont understand how the above circuit creates a bell circuit? It would be very helpful if someone can break the circuit and explain.