量子コンピューティング向け言語Q#の問題集 QuantumKatas Teleportation Task 4.1〜4.2 Alice, Bob, Charlie

Task 4.1〜4.2はAlice, Bob, Charlieが登場する量子テレポーテーションの問題です。

Task 4.1は、Alice, Bob, Charlieの状態を|Ψ³⟩ = (|000⟩ + |011⟩ + |101⟩ + |110⟩) / 2 にするという問題です。
Task 4.2は、以下の設定です。

  1. Aliceがメッセージの量子ビットを持っている
  2. AliceがAlice自身の量子ビットとメッセージの量子ビットエンタングルさせる
  3. AliceがAliceの量子ビットとメッセージの量子ビットを測定し、測定結果を2bitの古典ビットとしてCharlieに送信する
  4. BobもBob自身の量子ビットを測定し、測定結果を1bitの古典ビットとしてCharlieに送信する
  5. Charlieは、受信した3bitを利用して、自身の状態をメッセージの状態にする

Task 4.2は上記1〜4は既に完了しているとして、5を行うという問題です。

この記事ではTask 4.2を説明します。

メッセージの量子ビットの状態を|m⟩ = a|0⟩ + b|1⟩ とすると、メッセージ, Alice, Bob, Charlieの状態は、 |m⟩|Ψ³⟩ = (a|0000⟩ + a|0011⟩ + a|0101⟩ + a|0110⟩ + b|1000⟩ + b|1011⟩ + b|1101⟩ + b|1110⟩) / 2 になります。

Aliceとメッセージをエンタングルさせる、すなわち、CNOT(メッセージ, Alice)を行った後、H(メッセージ)を行うと メッセージ, Alice, Bob, Charlieの状態は、 |m⟩|Ψ³⟩ = (a|0000⟩ + a|1000⟩ + a|0011⟩ + a|1011⟩ + a|0101⟩ + a|1101⟩ + a|0110⟩ + a|1110⟩ + b|0100⟩ - b|1100⟩ + b|0111⟩ - b|1111⟩ + b|0001⟩ - b|1001⟩ + b|0010⟩ - b|1010⟩) / (2*sqrt(2)) になります。ふぅ。

次にこの状態に対してメッセージとAliceの測定を行います。 測定結果と測定後の状態は次のようになります。

メッセージ量子ビットの測定結果 Alice量子ビットの測定結果 測定後の状態
0 0 (a|0000⟩ + a|0011⟩ + b|0001⟩ + b|0010⟩) / sqrt(2)
0 1 (a|0101⟩ + a|0110⟩ + b|0100⟩ + b|0111⟩) / sqrt(2)
1 0 (a|1000⟩ + a|1011⟩ - b|1001⟩ - b|1010⟩) / sqrt(2)
1 1 (a|1101⟩ + a|1110⟩ - b|1100⟩ - b|1111⟩) / sqrt(2)

この状態に対してBobの測定を行います。 ここで疑問があります。 問題文には以下のように書いてあります。

Bob has also measured his own qubit from |Ψ³⟩ 

これは不可能ではないでしょうか? なぜかというと、メッセージとAliceの測定を行った後にBobの測定を行うので、Aliceの状態が確定しているからです。
間違っていたらすみません。コメントで指摘してください。

測定結果の3bitと測定後状態は以下の表のようになります。

メッセージ量子ビットの測定結果 Alice量子ビットの測定結果 Bob量子ビットの測定結果 測定後の状態 Charlie量子ビットに行う操作
0 0 0 a|0000⟩ + b|0001⟩ なし
0 0 1 a|0011⟩ + b|0010⟩ X
0 1 0 a|0101⟩ + b|0100⟩ X
0 1 1 a|0110⟩ + b|0111⟩ なし
1 0 0 a|1000⟩ - b|1001⟩ Z
1 0 1 a|1011⟩ - b|1010⟩ X → Z
1 1 0 a|1101⟩ - b|1100⟩ X → Z
1 1 1 a|1110⟩ - b|1111⟩ Z

これをコードにするとTask 4.1を含めて次のようになります。

    // Quantum teleportation using entangled states other than Bell pairs is also feasible.
    // Here we look at just one of many possible schemes - in it a state is transferred from
    // Alice to a third participant Charlie, but this may only be accomplished if Charlie
    // has the trust of the second participant Bob.
    
    // Task 4.1*. Entangled trio
    // Input: three qubits qAlice, qBob, and qCharlie, each in |0⟩ state.
    // Goal: create an entangled state |Ψ³⟩ = (|000⟩ + |011⟩ + |101⟩ + |110⟩) / 2 on these qubits.
    //
    // In the context of the quantum teleportation protocol, this is the preparation step:
    // qubits qAlice, qBob, and qCharlie will be sent to Alice, Bob, and Charlie respectively.
    operation EntangleThreeQubits (qAlice : Qubit, qBob : Qubit, qCharlie : Qubit) : Unit {
      H(qAlice);
      H(qBob);
      (ControlledOnInt(1, X))([qAlice, qBob], qCharlie);
      (ControlledOnInt(2, X))([qAlice, qBob], qCharlie);
    }
    
    
    // Task 4.2*. Reconstruct the message (Charlie's task)
    // Alice has a message qubit in the state |ψ⟩ to be teleported, she has entangled it with
    // her own qubit from |Ψ³⟩ in the same manner as task 1.2 and extracted two classical bits
    // in order to send them to Charlie. Bob has also measured his own qubit from |Ψ³⟩ and sent
    // Charlie the result.
    //
    // Transform Charlie's qubit into the required state using the two classical bits
    // received from Alice, and the one classical bit received from Bob.
    // Inputs:
    //      1) Charlie's part of the entangled trio of qubits qCharlie.
    //      2) The tuple of classical bits received from Alice,
    //         in the format used in task 1.2.
    //      3) A classical bit resulting from the measurement of Bob's qubit.
    // Goal: transform Charlie's qubit qCharlie into the state in which the message qubit had been originally.
    operation ReconstructMessageWhenThreeEntangledQubits (qCharlie : Qubit, (b1 : Bool, b2 : Bool), b3 : Bool) : Unit {
      if ((not b2 && b3) || (b2 && not b3)) {
        X(qCharlie);
      }

      if (b1) {
        Z(qCharlie);
      }
    }