Skip to content

Bell态制备 ​

使用 pyqpanda3 创建并验证 Bell(EPR)纠缠态。


问题 ​

什么是Bell态? ​

Bell态(也称为 EPR 对,以 Einstein、Podolsky 和 Rosen 命名)是一对最大纠缠的量子比特。四个Bell态构成了双量子比特希尔伯特空间的一组完备正交基:

|Φ+⟩=12(|00⟩+|11⟩)|Φ−⟩=12(|00⟩−|11⟩)|Ψ+⟩=12(|01⟩+|10⟩)|Ψ−⟩=12(|01⟩−|10⟩)

最常用的是 |Φ+⟩。当你测量该态的两个量子比特时,总是会得到相同的结果:两个量子比特都产生 0,或者都产生 1。每种结果出现的概率为 12,而 01 和 10 结果永远不会出现。这种完美关联性与量子比特之间的物理距离无关。

为什么Bell态很重要? ​

Bell态是量子计算和量子信息的基础,原因如下:

  • 纠缠验证。 Bell态是量子纠缠的最简单示例。它们用于 Bell不等式实验(CHSH 游戏)来证明自然界不能用局域隐变量理论描述。

  • 量子隐形传态。 共享的Bell对是量子信道,能够仅通过经典通信传态任意量子比特态。

  • 超密编码。 通过操控Bell对中的一个量子比特,发送方可以向持有两个量子比特的接收方传输两个经典比特。

  • 量子密钥分发(QKD)。 如 E91 等协议使用Bell对生成具有信息论安全性的共享密钥。

  • 纠错。 Bell态在容错协议中被消耗,例如基于传态的门操作和表面码的格点缝合。

  • 基准测试。 制备和测量Bell态是真实量子硬件上评估双量子比特门保真度的标准校准程序。

mermaid
graph TD
    A["Bell States"] --> B["Quantum Teleportation"]
    A --> C["Superdense Coding"]
    A --> D["Quantum Key Distribution"]
    A --> E["Error Correction"]
    A --> F["Hardware Benchmarking"]
    A --> G["CHSH / Bell Inequalities"]

    style A fill:#1565C0,color:#fff
    style B fill:#42A5F5,color:#fff
    style C fill:#42A5F5,color:#fff
    style D fill:#42A5F5,color:#fff
    style E fill:#42A5F5,color:#fff
    style F fill:#42A5F5,color:#fff
    style G fill:#42A5F5,color:#fff

方案 ​

基本 Bell 态的电路 ​

从初始态 |00⟩ 制备 |Φ+⟩ 的标准方法只需两个门:

  1. 对量子比特 0 施加 Hadamard 门。 这创建了均匀叠加态:
H|0⟩=12(|0⟩+|1⟩)
  1. 以量子比特 0 为控制、量子比特 1 为目标施加 CNOT 门。 这使两个量子比特纠缠:
CNOT0,1(H0⊗I1)∥00⟩=12(∥00⟩+∥11⟩)
  1. 测量两个量子比特以坍缩态并收集统计信息。
mermaid
flowchart LR
    subgraph Init["Initial State"]
        Q0a["|0>"]
        Q1a["|0>"]
    end
    subgraph AfterH["After H(0)"]
        Q0b["(|0>+|1>)/sqrt(2)"]
        Q1b["|0>"]
    end
    subgraph AfterCX["After CNOT(0,1)"]
        Q0c["(|00>+|11>)/sqrt(2)"]
    end
    subgraph Meas["Measurement"]
        M["00 or 11<br/>50% each"]
    end

    Q0a --> AfterH
    Q1a --> AfterH
    AfterH --> AfterCX
    AfterCX --> Meas

制备全部四个Bell态 ​

每个Bell态都可以通过在纠缠前对其中一个量子比特施加 Pauli 门从 |Φ+⟩ 得到:

目标态量子比特 1 上的额外门电路
|Φ+⟩(无)H(0) -- CNOT(0,1)
|Φ−⟩CNOT 前加 Z(1)Z(1) -- H(0) -- CNOT(0,1)
|Ψ+⟩CNOT 前加 X(1)X(1) -- H(0) -- CNOT(0,1)
|Ψ−⟩CNOT 前加 Y(1)Y(1) -- H(0) -- CNOT(0,1)

等效地,你可以在 CNOT 之后施加校正,这在组合电路时通常更方便:

目标态CNOT 后的校正
|Φ+⟩(无)
|Φ−⟩Z(0)
|Ψ+⟩X(0)
|Ψ−⟩Y(0)
mermaid
flowchart TD
    A["|00>"] --> B["H(0)"]
    B --> C["CNOT(0,1)"]
    C --> D{"Choose Bell state"}
    D -->|"None"| E["|Phi+> = (|00>+|11>)/sqrt(2)"]
    D -->|"Z(0)"| F["|Phi-> = (|00>-|11>)/sqrt(2)"]
    D -->|"X(0)"| G["|Psi+> = (|01>+|10>)/sqrt(2)"]
    D -->|"Y(0)"| H["|Psi-> = (|01>-|10>)/sqrt(2)"]

    style E fill:#C8E6C9
    style F fill:#BBDEFB
    style G fill:#FFF9C4
    style H fill:#FFE0B2

代码 ​

基本Bell态制备与测量 ​

这是最简示例:制备 |Φ+⟩,测量两个量子比特,并打印计数结果。

python
from pyqpanda3 import core

# Build the Bell state circuit.
# QProg is the top-level container for quantum operations.
prog = core.QProg()

# Step 1: Apply Hadamard to qubit 0.
# This puts qubit 0 into the equal superposition (|0> + |1>) / sqrt(2).
prog << core.H(0)

# Step 2: Apply CNOT with qubit 0 as control, qubit 1 as target.
# This correlates the two qubits, producing the Bell state |Phi+>.
prog << core.CNOT(0, 1)

# Step 3: Measure both qubits into classical bits 0 and 1.
prog << core.measure([0, 1], [0, 1])

# Create the CPU statevector simulator and run 10,000 shots.
machine = core.CPUQVM()
machine.run(prog, shots=10000)

# Retrieve measurement counts.
counts = machine.result().get_counts()
print("Bell state |Phi+> counts:", counts)
# Expected: {'00': ~5000, '11': ~5000}, no '01' or '10'

运行结果:

Bell state |Phi+> counts: {'00': 4980, '11': 5020}

预期输出:

Bell state |Phi+> counts: {'00': 4980, '11': 5020}

获取状态向量并验证振幅 ​

当你需要直接检查量子态(而非通过测量统计)时,运行不带测量的电路并获取状态向量。

python
from pyqpanda3 import core
import numpy as np

# Build the Bell state circuit WITHOUT measurement.
prog = core.QProg()
prog << core.H(0)
prog << core.CNOT(0, 1)

# Run on CPUQVM. Without measurement, we get the full state vector.
machine = core.CPUQVM()
machine.run(prog, shots=1)

# Retrieve the state vector.
sv = machine.result().get_state_vector()
print("State vector:", sv)

# The Bell state |Phi+> should have amplitudes:
#   |00>: 1/sqrt(2) ~ 0.7071
#   |01>: 0
#   |10>: 0
#   |11>: 1/sqrt(2) ~ 0.7071
expected = np.array([1, 0, 0, 1]) / np.sqrt(2)
assert np.allclose(np.abs(sv), np.abs(expected), atol=1e-10), \
    "State vector does not match expected Bell state amplitudes"

# Verify probabilities sum to 1.
probs = np.abs(sv) ** 2
print("Probabilities:", dict(zip(["00", "01", "10", "11"], probs)))
print("Sum of probabilities:", np.sum(probs))
# Expected: {'00': 0.5, '01': 0.0, '10': 0.0, '11': 0.5}, sum = 1.0

运行结果:

State vector: [(0.7071067811865476+0j), 0j, 0j, (0.7071067811865476+0j)]
Probabilities: {'00': np.float64(0.5000000000000001), '01': np.float64(0.0), '10': np.float64(0.0), '11': np.float64(0.5000000000000001)}
Sum of probabilities: 1.0000000000000002

预期输出:

State vector: [0.70710678+0.j 0.+0.j 0.+0.j 0.70710678+0.j]
Probabilities: {'00': 0.5, '01': 0.0, '10': 0.0, '11': 0.5}
Sum of probabilities: 1.0

全部四个Bell态 ​

本示例制备每个Bell态并打印测量分布,以便你看到它们之间的差异。

python
from pyqpanda3 import core

def make_bell_state(variant):
    """Prepare one of the four Bell states.

    Args:
        variant: One of 'phi+', 'phi-', 'psi+', 'psi-'.

    Returns:
        A QProg that prepares the requested Bell state and measures both qubits.
    """
    prog = core.QProg()
    prog << core.H(0)
    prog << core.CNOT(0, 1)

    # Apply the appropriate Pauli correction to select the Bell state variant.
    if variant == "phi+":
        pass  # No correction needed
    elif variant == "phi-":
        prog << core.Z(0)
    elif variant == "psi+":
        prog << core.X(0)
    elif variant == "psi-":
        # Y = iXZ, but in the computational basis Y = [[0,-i],[i,0]].
        # For measurement statistics, applying Z followed by X is equivalent
        # to applying Y up to an irrelevant global phase.
        prog << core.Z(0)
        prog << core.X(0)
    else:
        raise ValueError(f"Unknown Bell state variant: {variant}")

    prog << core.measure([0, 1], [0, 1])
    return prog

# Run all four variants and display the results.
machine = core.CPUQVM()
shots = 10000

for variant in ["phi+", "phi-", "psi+", "psi-"]:
    prog = make_bell_state(variant)
    machine.run(prog, shots=shots)
    counts = machine.result().get_counts()
    print(f"|{variant:>4s}> : {counts}")

运行结果:

|phi+> : {'00': 4884, '11': 5116}
|phi-> : {'00': 4986, '11': 5014}
|psi+> : {'01': 5023, '10': 4977}
|psi-> : {'01': 5023, '10': 4977}

预期输出:

|phi+> : {'00': 4884, '11': 5116}
|phi-> : {'00': 4986, '11': 5014}
|psi+> : {'01': 5023, '10': 4977}
|psi-> : {'01': 5023, '10': 4977}

关于区分 |Φ+⟩ 与 |Φ−⟩ 的说明: 这两个态在计算基中产生相同的测量统计。两者都以等概率产生 00 和 11。相对相位(|00⟩ 和 |11⟩ 之间的 +1 和 −1)只能通过在不同基中测量来检测(例如,在测量前对两个量子比特施加 Hadamard)。|Ψ+⟩ 与 |Ψ−⟩ 之间也是如此。

通过关联性验证纠缠 ​

通过确认两个量子比特完全关联来验证纠缠。本示例收集大量采样并检查是否没有非关联结果(01 或 10)出现。

python
from pyqpanda3 import core

# Prepare the Bell state |Phi+>.
prog = core.QProg()
prog << core.H(0)
prog << core.CNOT(0, 1)
prog << core.measure([0, 1], [0, 1])

machine = core.CPUQVM()
shots = 100000
machine.run(prog, shots=shots)
counts = machine.result().get_counts()

# The correlated outcomes.
correlated = counts.get("00", 0) + counts.get("11", 0)

# The uncorrelated outcomes (should be zero in a noiseless simulation).
uncorrelated = counts.get("01", 0) + counts.get("10", 0)

correlation_rate = correlated / shots
print(f"Correlated outcomes (00, 11): {correlated} / {shots} = {correlation_rate:.6f}")
print(f"Uncorrelated outcomes (01, 10): {uncorrelated}")

# In a noiseless simulation, the correlation should be exactly 1.0.
assert correlation_rate == 1.0, f"Unexpected uncorrelated outcomes: {uncorrelated}"
print("PASS: Perfect correlation confirmed (noiseless simulation).")

运行结果:

Correlated outcomes (00, 11): 100000 / 100000 = 1.000000
Uncorrelated outcomes (01, 10): 0
PASS: Perfect correlation confirmed (noiseless simulation).

预期输出:

Correlated outcomes (00, 11): 100000 / 100000 = 1.000000
Uncorrelated outcomes (01, 10): 0
PASS: Perfect correlation confirmed (noiseless simulation).

在 DensityMatrixSimulator 上运行 ​

DensityMatrixSimulator 可用于详细分析量子态——纯度、约化密度矩阵和精确概率——无需采样噪声。

python
from pyqpanda3 import core
import numpy as np

# Build the Bell state circuit without measurement.
prog = core.QProg()
prog << core.H(0)
prog << core.CNOT(0, 1)

# Run on the density matrix simulator.
dm_sim = core.DensityMatrixSimulator()
dm_sim.run(prog)

# Get exact probabilities for each basis state.
probs = dm_sim.state_probs()
print("Exact probabilities:")
for idx, p in enumerate(probs):
    label = format(idx, "02b")
    print(f"  |{label}>: {p:.6f}")

# Get the full density matrix (4x4 for 2 qubits).
dm = dm_sim.density_matrix()
print(f"\nDensity matrix shape: {dm.shape}")
print(f"Density matrix:\n{dm}")

# Verify purity. For a pure state, Tr(rho^2) = 1.0.
purity = np.trace(dm @ dm).real
print(f"\nPurity Tr(rho^2): {purity:.6f}")
assert abs(purity - 1.0) < 1e-10, "State is not pure!"

# Compute the reduced density matrix for qubit 0 by tracing out qubit 1.
# For a maximally entangled state, each subsystem is maximally mixed: I/2.
reduced_q0 = dm_sim.reduced_density_matrix([0])
print(f"\nReduced density matrix (qubit 0):\n{reduced_q0}")
reduced_purity = np.trace(reduced_q0 @ reduced_q0).real
print(f"Reduced purity: {reduced_purity:.6f} (maximally mixed = 0.5)")

运行结果:

Exact probabilities:
  |00>: 0.500000
  |01>: 0.000000
  |10>: 0.000000
  |11>: 0.500000

Density matrix shape: (4, 4)
Density matrix:
[[0.5+0.j 0. +0.j 0. +0.j 0.5+0.j]
 [0. +0.j 0. +0.j 0. +0.j 0. +0.j]
 [0. +0.j 0. +0.j 0. +0.j 0. +0.j]
 [0.5+0.j 0. +0.j 0. +0.j 0.5+0.j]]

Purity Tr(rho^2): 1.000000

Reduced density matrix (qubit 0):
[[0.5+0.j 0. +0.j]
 [0. +0.j 0.5+0.j]]
Reduced purity: 0.500000 (maximally mixed = 0.5)

预期输出:

Exact probabilities:
  |00>: 0.500000
  |01>: 0.000000
  |10>: 0.000000
  |11>: 0.500000

Density matrix shape: (4, 4)
Density matrix:
[[0.5+0.j 0. +0.j 0. +0.j 0.5+0.j]
 [0. +0.j 0. +0.j 0. +0.j 0. +0.j]
 [0. +0.j 0. +0.j 0. +0.j 0. +0.j]
 [0.5+0.j 0. +0.j 0. +0.j 0.5+0.j]]

Purity Tr(rho^2): 1.000000

Reduced density matrix (qubit 0):
[[0.5+0.j 0. +0.j]
 [0. +0.j 0.5+0.j]]
Reduced purity: 0.500000 (maximally mixed = 0.5)

单个量子比特是最大混合态(ρ0=I/2,纯度 =0.5),而联合态是纯态(纯度 =1.0),这是最大纠缠的标志。你对量子比特对拥有完整信息,但对任一单独量子比特的信息为零。

在 Stabilizer 模拟器上运行 ​

Bell 态电路仅使用 Clifford 门(H 和 CNOT),因此可以在 Stabilizer 后端上高效模拟。这对于快速测试或量子比特数量较多时(全状态向量模拟代价较高)非常有用。

python
from pyqpanda3 import core

# The same Bell state circuit -- all gates are Clifford.
prog = core.QProg()
prog << core.H(0)
prog << core.CNOT(0, 1)
prog << core.measure([0, 1], [0, 1])

# The Stabilizer simulator tracks Pauli stabilizer generators instead of
# the full state vector. It runs in O(n^2) time per gate rather than O(2^n).
stab = core.Stabilizer()
stab.run(prog, shots=10000)

result = stab.result()
counts = result.get_counts()
print("Stabilizer Bell state counts:", counts)

# The results should match CPUQVM: only '00' and '11', roughly 50/50.

运行结果:

Stabilizer Bell state counts: {'00': 5025, '11': 4975}

预期输出:

Stabilizer Bell state counts: {'00': 5025, '11': 4975}

带噪声模拟的Bell态 ​

真实量子硬件会引入误差。本示例展示去极化噪声模型如何使之前被禁止的结果(01、10)以小但非零的概率出现。

python
from pyqpanda3 import core

# Build the Bell state circuit.
prog = core.QProg()
prog << core.H(0)
prog << core.CNOT(0, 1)
prog << core.measure([0, 1], [0, 1])

# Create a noise model with 2% depolarizing error on CNOT gates.
noise = core.NoiseModel()
noise.add_quantum_error(
    core.depolarizing_error(0.02),
    core.GateType.CNOT,
    [0, 1]
)

# Add 1% depolarizing error on single-qubit gates.
noise.add_quantum_error(
    core.depolarizing_error(0.01),
    core.GateType.H,
    [0]
)
noise.add_quantum_error(
    core.depolarizing_error(0.01),
    core.GateType.H,
    [1]
)

# Run with noise on the CPUQVM.
machine = core.CPUQVM()
machine.run(prog, shots=10000, model=noise)
noisy_counts = machine.result().get_counts()
print("Noisy Bell state counts:", noisy_counts)

# Compute the Bell fidelity: fraction of outcomes that are correlated.
bell_fidelity = (noisy_counts.get("00", 0) + noisy_counts.get("11", 0)) / 10000
print(f"Bell fidelity: {bell_fidelity:.4f}")

# Also compare with the noiseless result.
machine.run(prog, shots=10000)
ideal_counts = machine.result().get_counts()
print(f"Ideal counts:  {ideal_counts}")

运行结果:

Noisy Bell state counts: {'00': 4890, '11': 4896, '10': 109, '01': 105}
Bell fidelity: 0.9786
Ideal counts:  {'00': 5013, '11': 4987}

预期输出:

Noisy Bell state counts: {'00': 4890, '11': 4896, '01': 105, '10': 109}
Bell fidelity: 0.9786
Ideal counts:  {'00': 5013, '11': 4987}

噪声将概率泄漏到 01 和 10 结果中,使Bell保真度低于 1.0。泄漏量取决于噪声强度。

比较不同噪声信道对Bell态的影响 ​

不同的物理噪声机制对Bell态的影响不同。本示例施加几种误差信道并测量每种如何降低Bell保真度。

python
from pyqpanda3 import core

def bell_fidelity(noise_model, shots=10000):
    """Run a Bell state circuit with the given noise model and return fidelity."""
    prog = core.QProg()
    prog << core.H(0)
    prog << core.CNOT(0, 1)
    prog << core.measure([0, 1], [0, 1])

    machine = core.CPUQVM()
    machine.run(prog, shots=shots, model=noise_model)
    counts = machine.result().get_counts()

    correlated = counts.get("00", 0) + counts.get("11", 0)
    return correlated / shots, counts

# Define noise models with different error channels at 3% strength.
error_rate = 0.03
channels = {
    "Bit Flip (X)":       core.pauli_x_error(error_rate),
    "Phase Flip (Z)":     core.pauli_z_error(error_rate),
    "Depolarizing":       core.depolarizing_error(error_rate),
    "Amplitude Damping":  core.amplitude_damping_error(error_rate),
    "Phase Damping":      core.phase_damping_error(error_rate),
}

print(f"{'Channel':<22s}  {'Fidelity':>8s}  {'Counts'}")
print("-" * 70)

for name, error in channels.items():
    noise = core.NoiseModel()
    noise.add_quantum_error(error, core.GateType.CNOT, [0, 1])
    noise.add_quantum_error(error, core.GateType.H, [0])
    noise.add_quantum_error(error, core.GateType.H, [1])

    fid, counts = bell_fidelity(noise)
    print(f"{name:<22s}  {fid:>8.4f}  {counts}")

运行结果:

Channel                 Fidelity  Counts
----------------------------------------------------------------------
Bit Flip (X)              0.9442  {'00': 4755, '11': 4687, '01': 282, '10': 276}
Phase Flip (Z)            1.0000  {'00': 4998, '11': 5002}
Depolarizing              0.9729  {'00': 4815, '11': 4914, '10': 134, '01': 137}
Amplitude Damping         0.9753  {'11': 4437, '00': 5316, '10': 246, '01': 1}
Phase Damping             1.0000  {'11': 4987, '00': 5013}

预期输出(近似):

Channel                  Fidelity  Counts
----------------------------------------------------------------------
Bit Flip (X)              0.9442  {'00': 4755, '11': 4687, '01': 282, '10': 276}
Phase Flip (Z)            1.0000  {'00': 4998, '11': 5002}
Depolarizing              0.9729  {'00': 4815, '11': 4914, '10': 134, '01': 137}
Amplitude Damping         0.9753  {'11': 4437, '00': 5316, '10': 246, '01': 1}
Phase Damping             1.0000  {'11': 4987, '00': 5013}

主要观察:

  • 去极化噪声最具破坏性,因为它同时施加了三种 Pauli 误差。
  • 振幅阻尼具有不对称性:|00⟩ 比 |11⟩ 获得更多计数,因为误差驱动 |1⟩→|0⟩。
  • 相位翻转(Z)和相位阻尼不会改变计算基下的测量结果:Bell 态 |Φ+⟩ 在相位翻转下仍然保持 |00⟩ 和 |11⟩ 的相关性。如需检测相位误差,需要在不同基下进行测量(例如对两个量子比特施加 Hadamard 门后再测量)。

使用 DensityMatrixSimulator 进行噪声分析 ​

DensityMatrixSimulator 可用于精确分析,但需要注意在 pyqpanda3 0.3.5 中带噪声模型的密度矩阵模拟存在稳定性问题。作为替代,可以将 CPUQVM 配合大量采样与密度矩阵的精确结果进行对比。

python
from pyqpanda3 import core
import numpy as np

# Build the Bell state circuit without measurement (for DensityMatrixSimulator).
prog = core.QProg()
prog << core.H(0)
prog << core.CNOT(0, 1)

# Build the Bell state circuit with measurement (for CPUQVM).
prog_meas = core.QProg()
prog_meas << core.H(0)
prog_meas << core.CNOT(0, 1)
prog_meas << core.measure([0, 1], [0, 1])

# Define a noise model with depolarizing error on CNOT.
noise = core.NoiseModel()
noise.add_quantum_error(
    core.depolarizing_error(0.02),
    core.GateType.CNOT,
    [0, 1]
)

# Ideal simulation (exact via DensityMatrixSimulator).
dm_ideal = core.DensityMatrixSimulator()
dm_ideal.run(prog)
ideal_probs = dm_ideal.state_probs()
ideal_dm = dm_ideal.density_matrix()

# Noisy simulation via CPUQVM with many shots.
machine = core.CPUQVM()
machine.run(prog_meas, shots=100000, model=noise)
noisy_counts = machine.result().get_counts()
noisy_probs = np.array([
    noisy_counts.get("00", 0),
    noisy_counts.get("01", 0),
    noisy_counts.get("10", 0),
    noisy_counts.get("11", 0)
]) / 100000

# Compare exact probabilities.
print("Basis   | Ideal     | Noisy (approx)")
print("--------|-----------|---------------")
for idx in range(4):
    label = format(idx, "02b")
    print(f"  |{label}>  | {ideal_probs[idx]:.6f} | {noisy_probs[idx]:.6f}")

# Compute ideal purity.
ideal_purity = np.trace(ideal_dm @ ideal_dm).real
print(f"\nIdeal purity (exact):     {ideal_purity:.6f}")

# Compute approximate Bell fidelity from measurement statistics.
bell_fidelity_approx = noisy_probs[0] + noisy_probs[3]
print(f"Bell fidelity (approx):  {bell_fidelity_approx:.6f}")

运行结果(近似值,因采样而异):

Basis   | Ideal     | Noisy (approx)
--------|-----------|---------------
  |00>  | 0.500000 | 0.489500
  |01>  | 0.000000 | 0.010390
  |10>  | 0.000000 | 0.010550
  |11>  | 0.500000 | 0.489560

Ideal purity (exact):     1.000000
Bell fidelity (approx):  0.979060

解析 ​

为什么 H 后跟 CNOT 能创建纠缠 ​

让我们从 |00⟩ 开始,逐步追踪电路。

步骤 1:初始态。

|ψ0⟩=|00⟩=|0⟩⊗|0⟩

步骤 2:对量子比特 0 施加 Hadamard。

Hadamard 矩阵为:

H=12(111−1)

作用于 |0⟩:

H|0⟩=12(|0⟩+|1⟩)

因此联合态变为:

∥ψ1⟩=(H⊗I)∥00⟩=12(∥0⟩+∥1⟩)⊗∥0⟩=12(∥00⟩+∥10⟩)

此时量子比特未纠缠。该态是直积态:每个量子比特有各自独立的描述。

步骤 3:施加控制=0、目标=1 的 CNOT。

CNOT 门在控制比特为 |1⟩ 时翻转目标比特:

CNOT|00⟩=|00⟩,CNOT|10⟩=|11⟩

因此:

∥ψ2⟩=CNOT0,1∥ψ1⟩=12(∥00⟩+∥11⟩)

该态不能写为两个单量子比特态的直积。量子比特已纠缠。

mermaid
sequenceDiagram
    participant State as Quantum State
    participant H as Hadamard(0)
    participant CX as CNOT(0,1)

    Note over State: |00> = [1, 0, 0, 0]
    State->>H: Apply H on qubit 0
    Note over H: H|0> = (|0>+|1>)/sqrt(2)
    H->>CX: Product state (not entangled)
    Note over CX: |00> stays |00>, |10> becomes |11>
    CX->>State: (|00>+|11>)/sqrt(2)
    Note over State: Entangled! Not a product state.

每个Bell态的数学推导 ​

全部四个Bell态通过将 Pauli 门作用于 |Φ+⟩ 得到。

|Φ+⟩(默认):

|Φ+⟩=12(|00⟩+|11⟩)

|Φ−⟩ -- 对 |Φ+⟩ 施加 Z0:

Z0∥Φ+⟩=Z0⋅12(∥00⟩+∥11⟩)=12(∥00⟩−∥11⟩)=∥Φ−⟩

因为 Z|0⟩=|0⟩ 且 Z|1⟩=−|1⟩。

|Ψ+⟩ -- 对 |Φ+⟩ 施加 X0:

X0∥Φ+⟩=X0⋅12(∥00⟩+∥11⟩)=12(∥10⟩+∥01⟩)=∥Ψ+⟩

因为 X|0⟩=|1⟩ 且 X|1⟩=|0⟩,所以 X0|00⟩=|10⟩ 且 X0|11⟩=|01⟩。

|Ψ−⟩ -- 对 |Φ+⟩ 施加 Y0(或等效地 Z0X0):

Y0∥Φ+⟩=i2(∥10⟩−∥01⟩)=i⋅∥Ψ−⟩

由于全局相位在物理上不可观测,Y0|Φ+⟩ 产生的 |Ψ−⟩ 仅差一个无关的因子 i。

测量统计的解释 ​

当你在计算基中测量 |Φ+⟩ 时,得到:

P(00)=|12|2=12P(11)=|12|2=12P(01)=P(10)=0

结果是完全关联的:测量量子比特 0 立即告诉你量子比特 1 的结果。这由条件概率量化:

P(q1=q0)=1

这种完美关联性无法被任何尊重局域性(没有超光速通信)的经典理论重现。这就是 Bell 定理的内容,由 Aspect、Clauser、Zeilinger 等人实验证实(2022 年诺贝尔物理学奖)。

Bell态作为最大纠缠态 ​

一个双量子比特态 |ψ⟩ 是最大纠缠的,当且仅当每个子系统的约化密度矩阵是最大混合态:

ρA=TrB(|ψ⟩⟨ψ|)=I2

对于 |Φ+⟩:

ρAB=∥Φ+⟩⟨Φ+∥=12(1001000000001001)

对量子比特 B 求偏迹:

ρA=TrB(ρAB)=12(1001)=I2

这意味着如果你只看任一量子比特,它看起来完全随机:50% 的概率为 |0⟩,50% 的概率为 |1⟩。信息完全在量子比特之间的关联中,而不在任一单独量子比特中。

共生度和纠缠熵在Bell态上均达到最大值:

度量公式Bell态值
共生度C(|ψ⟩)1
纠缠熵S(ρA)=−Tr(ρAlog2⁡ρA)1 比特
子系统纯度Tr(ρA2)0.5

与量子隐形传态的联系 ​

Bell态是使传态成为可能的量子资源。在标准传态协议中:

  1. Alice 和 Bob 共享一个Bell对 |Φ+⟩AB。Alice 持有量子比特 A;Bob 持有量子比特 B。
  2. Alice 纠缠她的未知态 |ψ⟩C 与她的Bell对份额,使用 CNOT 和 Hadamard。
  3. Alice 测量她的两个量子比特(C 和 A),并将 2 比特经典结果发送给 Bob。
  4. Bob 施加 Pauli 校正(I、X、Z 或 Y)到他的量子比特 B,基于他收到的 2 个比特。校正后,Bob 的量子比特处于态 |ψ⟩。
mermaid
flowchart LR
    subgraph Alice["Alice"]
        psi["|psi>_C"]
        A["Qubit A"]
        H2["H"]
        CX2["CNOT(C,A)"]
        M2["Measure"]
    end
    subgraph Bob["Bob"]
        B["Qubit B"]
        U["Pauli correction"]
    end

    psi --> CX2
    A --> CX2 --> H2 --> M2
    M2 -->|"2 classical bits"| U
    B --> U
    U --> psiB["|psi>_B"]

    style Alice fill:#E3F2FD
    style Bob fill:#FFF3E0

没有初始Bell对,传态是不可能的。Bell对提供了量子信道(纠缠),补偿了 Alice 仅发送经典信息的事实。

与超密编码的联系 ​

超密编码是传态的逆过程:不是发送一个量子比特来传输两个经典比特,而是操控共享Bell对中的一个量子比特来编码两个经典比特,然后发送那一个量子比特。

协议如下:

  1. Alice 和 Bob 共享 |Φ+⟩AB。
  2. Alice 施加四种 Pauli 操作之一到她的量子比特 A:
    • I:态保持 |Φ+⟩ -- 编码 00
    • X:态变为 |Ψ+⟩ -- 编码 01
    • Z:态变为 |Φ−⟩ -- 编码 10
    • Y:态变为 |Ψ−⟩ -- 编码 11
  3. Alice 发送她的量子比特 A 给 Bob。
  4. Bob 现在持有两个量子比特。他施加Bell测量(Bell态制备电路的逆操作:先 CNOT 再 Hadamard,然后测量)来区分他拥有四种Bell态中的哪一种,恢复两个经典比特。
mermaid
flowchart LR
    A["Shared |Phi+>"] --> B["Alice applies Pauli"]
    B --> C["Alice sends qubit to Bob"]
    C --> D["Bob performs Bell measurement"]
    D --> E["2 classical bits recovered"]

    style A fill:#C8E6C9
    style E fill:#C8E6C9

四种 Pauli 操作恰好映射到四种Bell态,这就是为什么制备和区分所有四种Bell态的能力对超密编码至关重要。

实用技巧 ​

1. 始终通过统计验证。 单次采样不能说明问题。运行至少 1,000 次采样来确认预期分布。对于定量保真度估计,使用 10,000 次或更多。

2. 使用 DensityMatrixSimulator 进行分析。 当你需要精确数值(纯度、约化密度矩阵、von Neumann 熵)时,使用 DensityMatrixSimulator 而非采样计数。

3. 使用 Stabilizer 进行大规模 Clifford 电路模拟。 如果你的Bell态是更大 Clifford 电路的一部分(例如,包含数百个量子比特的纠错码),Stabilizer 后端可以高效处理。

4. 真实地建模噪声。 当为硬件预测进行模拟时,使用逐门、逐量子比特的噪声模型,其误差率从目标设备校准。超导硬件的典型值为单量子比特门 0.1%,双量子比特门 1-2%。

5. Bell态电路是最简单的纠缠测试。 如果你的硬件或模拟器能正确产生 00 和 11 的 50/50 分布,且没有 01 或 10,你就验证了 Hadamard 和 CNOT 门工作正常。

Released under the MIT License.