import numpy as np
from common import H, basis, cnot, counts, describe, single

# H sur le qubit 0, puis CNOT(0 → 1), puis CNOT(1 → 2)
ghz = cnot(1, 2, 3) @ cnot(0, 1, 3) @ single(H, 0, 3) @ basis("000")
print("amplitudes :", describe(ghz))

rng = np.random.default_rng(42)
print("1 000 lectures :", counts(ghz, 1000, rng))
