FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

量子プログラミング言語Q#の勉強 (4. 量子テレポーテーション)

Microsoft Q# Programmingのガイドには、最初のサンプルプログラムとして量子テレポーテーションが登場している。

これは量子回路で表現すると、以下のようになっている。うん、訳が分からん。

色々と資料を読みながら、量子テレポーテーションについて勉強していこう。

  • Quantum Teleportation

https://www.appi.keio.ac.jp/Itoh_group/abe/pdf/qc2.pdf

https://www.youtube.com/watch?v=mose-W49uF8&index=2&list=PLB1324F2305C028F7

そもそも量子テレポーテーションとは

  • 量子アルゴリズムという程ではないけれども、最も重要な量子の操作の一つ。
  • 量子コンピュータにおいて、データを転送する (たとえその量子ビットが遠く離れていても)。
  • 量子ビットの状態を知ることなく、転送することができる!

  • Alice, Bob, Victorという3人がいる。

    • AliceとBobが量子の状態をエンコードしておき、AliceとVictorがデコードすることで、Bobの状態を知ることができる。
  • 2つの量子ビットがあり、AliceとBobがそれぞれ保持している。

  • VictorとAliceのベル状態のペアを作成する。
    • Aliceの測定により、Bell Pairは 1 つの状態に確定する。
    • → Bobの状態は、Victorのもともとの状態に近い状態になっている。
    • → Aliceはクラシカルな方法で、BobにAliceの状態を伝える。
    • → BobはXをかけることにより、Bobは自分の状態を知ることができる。
f:id:msyksphinz:20180218141408p:plain

Q#プログラミング言語による実装

こう考えてみると、Q#での実装は量子回路をそのまま実装してあるに過ぎない。

    operation Teleport(msg : Qubit, there : Qubit) : () {
        body {

            using (register = Qubit[1]) {
                // Ask for an auxillary qubit that we can use to prepare
                // for teleportation.
                let here = register[0];
            
                // Create some entanglement that we can use to send our message.
                H(here);
                CNOT(here, there);
            
                // Move our message into the entangled pair.
                CNOT(msg, here);
                H(msg);

                // Measure out the entanglement.
                if (M(msg) == One)  { Z(there); }
                if (M(here) == One) { X(there); }

                // Reset our "here" qubit before releasing it.
                Reset(here);
            }

        }
    }
f:id:msyksphinz:20180218141514p:plain
図. 量子テレポーテーションの回路とQ#の対応
f:id:msyksphinz:20180218145226p:plain
図. 量子テレポーテーションのQ#実行結果。送信元から送信先量子ビットの転送ができている。

補足. 量子テレポーテーションの理解にあたり必要な量子回路の変換

1. 量子状態のSWAP

2つの量子状態の交換は、SWAP操作と呼ばれる (参考資料 : https://www.appi.keio.ac.jp/Itoh_group/abe/pdf/qc1.pdf)

f:id:msyksphinz:20180218143357p:plain
2つの量子状態のSWAP

これは、量子ゲートのCNOTを3回組み合わせることで実現できる。

f:id:msyksphinz:20180218143504p:plain

証明

$$\left|a\right>\left|b\right>\rightarrow C_{12}\rightarrow \left|a\right>\left|b\oplus a\right>$$

$$\left|a\right>\left|b\oplus a\right> \rightarrow C_{21}\rightarrow \left|a\oplus(b\oplus a)\right>\left|b\oplus a\right> = \left|b\right>\left|b\oplus a\right>$$

$$\left|b\right>\left|b\oplus a\right> \rightarrow C_{12}\rightarrow \left|b\right>\left|(b\oplus a)\oplus b\right> = \left|b \right>\left|a \right>$$

\left| a\right>\left|b \right>\left| b \right>\left| a\right> に交換することができた。

2. 3量子ビットのCNOTを、4つのCNOTに変換する

f:id:msyksphinz:20180218144559p:plain
図. 3つの量子ビットのCNOTを変換する。

証明

$$\left|a\right>\left|b\right>\left|c\right>\rightarrow C_{12}\rightarrow \left|a\right>\left|(b\oplus a)\right>\left|c\right>$$

$$\left|a\right>\left|(b\oplus a)\right>\left|c\right>\rightarrow C_{23}\rightarrow \left|a\right>\left|(b\oplus a)\right>\left|c\oplus (b\oplus a)\right>$$

$$\left|a\right>\left|(b\oplus a)\right>\left|c\oplus (b\oplus a)\right>\rightarrow C_{12}\rightarrow \left|a\right>\left|(b\oplus a)\oplus a\right>\left|c\oplus (b\oplus a)\right> = \left|a\right>\left|b\right>\left|c\oplus (b\oplus a)\right> $$

$$\left|a\right>\left|b\right>\left|c\oplus (b\oplus a)\right> \rightarrow C_{23}\rightarrow \left|a\right>\left|b\right>\left|c\oplus (b\oplus a)\oplus b\right> = \left|a\right>\left|b\right>\left|c\oplus a\right>$$

これで、ac の状態のCNOTをとることができた。

関連記事