Entanglement and Bell States
The same H + CNOT combination that builds a Bell state in Qiskit builds one in Cirq too, entanglement is a property of the physics, not of any particular SDK.
Building and inspecting a Bell state
import cirq
q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit([
cirq.H(q0),
cirq.CNOT(q0, q1),
])
simulator = cirq.Simulator()
result = simulator.simulate(circuit)
print(result.dirac_notation())
print(abs(result.final_state_vector) ** 2) # ~[0.5, 0, 0, 0.5] for |00>, |01>, |10>, |11>
The probability vector has 4 entries, one per possible 2-qubit outcome in order 00, 01, 10, 11. Just like Qiskit's Bell state, only 00 and 11 have non-zero probability, 01/10 are impossible: measure either qubit and you instantly know the other's outcome.
Verifying with repeated measurement
circuit_measured = cirq.Circuit([
cirq.H(q0),
cirq.CNOT(q0, q1),
cirq.measure(q0, q1, key='result'),
])
result = simulator.run(circuit_measured, repetitions=1000)
print(result.histogram(key='result'))
cirq.measure(q0, q1, key='result') measures both qubits under one shared key, and .run(circuit, repetitions=1000) (Cirq's equivalent of Qiskit's shots) executes the circuit 1000 times. result.histogram(key='result') tallies the outcomes, covered in full in the next lesson.
TIP
Whichever SDK you use, the pattern for verifying entanglement is identical: build H + CNOT, run it many times, and confirm the "impossible" outcomes (01/10) never (or almost never, on noisy real hardware) appear.