-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added teleportation tasks 2.1 to 2.3 (#1619)
Added teleportation tasks 2.1 to 2.3 --------- Co-authored-by: Mariia Mykhailova <[email protected]> Co-authored-by: Mariia Mykhailova <[email protected]>
- Loading branch information
1 parent
f57ccee
commit 3663b28
Showing
16 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
katas/content/teleportation/reconstruct_message_phi_minus/Placeholder.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Kata { | ||
operation ReconstructMessage_PhiMinus(qBob : Qubit, (b1 : Bool, b2 : Bool)) : Unit { | ||
// Implement your solution here... | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
katas/content/teleportation/reconstruct_message_phi_minus/Solution.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Kata { | ||
operation ReconstructMessage_PhiMinus(qBob : Qubit, (b1 : Bool, b2 : Bool)) : Unit { | ||
if not b1 { | ||
Z(qBob); | ||
} | ||
if b2 { | ||
X(qBob); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
katas/content/teleportation/reconstruct_message_phi_minus/Verification.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Kata.Verification { | ||
open Microsoft.Quantum.Diagnostics; | ||
open Microsoft.Quantum.Katas; | ||
|
||
@EntryPoint() | ||
operation CheckSolution() : Bool { | ||
let teleport = ComposeTeleportation(StatePrep_BellState(_, _, 1), SendMessage_Reference, Kata.ReconstructMessage_PhiMinus, _, _, _); | ||
return TeleportTestLoop(teleport); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
katas/content/teleportation/reconstruct_message_phi_minus/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**Goal:** | ||
Transform Bob's qubit `qBob` into the state in which the message qubit had been originally. It is given that `qAlice` and `qBob` were initially entangled in $\ket{\Phi ^{-}} = \frac{1}{\sqrt{2}}(\ket{00}-\ket{11})$ state. |
15 changes: 15 additions & 0 deletions
15
katas/content/teleportation/reconstruct_message_phi_minus/solution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Bob's side of this protocol can actually be represented as a sequence of two steps: | ||
|
||
1. Transform the Bell pair he shares with Alice back to $\ket{\Phi ^+}$. This can be done by applying the $Z$ gate to Bob's qubit. | ||
2. Apply the standard teleportation protocol. | ||
|
||
The final set of corrections we need is the $Z$ gate, followed by the standard teleportation corrections: | ||
- For 00, only Z correction is required. | ||
- For 01, no change is required. | ||
- For 10, both Z and X correction is required. | ||
- For 11, only X correction is requried. | ||
|
||
@[solution]({ | ||
"id": "teleportation__reconstruct_message_phi_minus_solution", | ||
"codePath": "./Solution.qs" | ||
}) |
5 changes: 5 additions & 0 deletions
5
katas/content/teleportation/reconstruct_message_psi_minus/Placeholder.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Kata { | ||
operation ReconstructMessage_PsiMinus(qBob : Qubit, (b1 : Bool, b2 : Bool)) : Unit { | ||
// Implement your solution here... | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
katas/content/teleportation/reconstruct_message_psi_minus/Solution.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Kata { | ||
operation ReconstructMessage_PsiMinus(qBob : Qubit, (b1 : Bool, b2 : Bool)) : Unit { | ||
if not b1 { | ||
Z(qBob); | ||
} | ||
if not b2 { | ||
X(qBob); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
katas/content/teleportation/reconstruct_message_psi_minus/Verification.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Kata.Verification { | ||
open Microsoft.Quantum.Diagnostics; | ||
open Microsoft.Quantum.Katas; | ||
|
||
@EntryPoint() | ||
operation CheckSolution() : Bool { | ||
let teleport = ComposeTeleportation(StatePrep_BellState(_, _, 3), SendMessage_Reference, Kata.ReconstructMessage_PsiMinus, _, _, _); | ||
return TeleportTestLoop(teleport); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
katas/content/teleportation/reconstruct_message_psi_minus/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**Goal:** | ||
Transform Bob's qubit `qBob` into the state in which the message qubit had been originally. It is given that `qAlice` and `qBob` were initially entangled in $\ket{\Psi ^{-}} = \frac{1}{\sqrt{2}}(\ket{01}-\ket{10})$ state. |
14 changes: 14 additions & 0 deletions
14
katas/content/teleportation/reconstruct_message_psi_minus/solution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Bob's side of this protocol can be represented as a sequence of two steps: | ||
1. Transform the Bell pair he shares with Alice back to $\ket{\Phi ^+}$. This can be done by applying the $Z$ and $X$ gates to Bob's qubit. | ||
2. Apply the standard teleportation protocol. | ||
|
||
The final set of corrections we need is the $Z$ and $X$ gates, followed by the standard teleportation corrections: | ||
- For 00, both Z and X correction is required. | ||
- For 01, only X correction is required. | ||
- For 10, only Z correction is required. | ||
- For 11, no change is requried. | ||
|
||
@[solution]({ | ||
"id": "teleportation__reconstruct_message_psi_minus_solution", | ||
"codePath": "./Solution.qs" | ||
}) |
5 changes: 5 additions & 0 deletions
5
katas/content/teleportation/reconstruct_message_psi_plus/Placeholder.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Kata { | ||
operation ReconstructMessage_PsiPlus(qBob : Qubit, (b1 : Bool, b2 : Bool)) : Unit { | ||
// Implement your solution here... | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
katas/content/teleportation/reconstruct_message_psi_plus/Solution.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Kata { | ||
operation ReconstructMessage_PsiPlus(qBob : Qubit, (b1 : Bool, b2 : Bool)) : Unit { | ||
if b1 { | ||
Z(qBob); | ||
} | ||
if not b2 { | ||
X(qBob); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
katas/content/teleportation/reconstruct_message_psi_plus/Verification.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Kata.Verification { | ||
open Microsoft.Quantum.Diagnostics; | ||
open Microsoft.Quantum.Katas; | ||
|
||
@EntryPoint() | ||
operation CheckSolution() : Bool { | ||
let teleport = ComposeTeleportation(StatePrep_BellState(_, _, 2), SendMessage_Reference, Kata.ReconstructMessage_PsiPlus, _, _, _); | ||
return TeleportTestLoop(teleport); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
katas/content/teleportation/reconstruct_message_psi_plus/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**Goal:** | ||
Transform Bob's qubit `qBob` into the state in which the message qubit had been originally. It is given that `qAlice` and `qBob` were initially entangled in $\ket{\Psi ^{+}} = \frac{1}{\sqrt{2}}(\ket{00}+\ket{11})$ state. |
14 changes: 14 additions & 0 deletions
14
katas/content/teleportation/reconstruct_message_psi_plus/solution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Bob's side of this protocol can be represented as a sequence of two steps: | ||
1. Transform the Bell pair he shares with Alice back to $\ket{\Phi ^+}$. This can be done by applying the $X$ gate to Bob's qubit. | ||
2. Apply the standard teleportation protocol. | ||
|
||
The final set of corrections we need is the $X$ gate, followed by the standard teleportation corrections: | ||
- For 00, only X correction is required. | ||
- For 01, both Z and X correction is required. | ||
- For 10, no change is required. | ||
- For 11, only Z correction is requried. | ||
|
||
@[solution]({ | ||
"id": "teleportation__reconstruct_message_psi_plus_solution", | ||
"codePath": "./Solution.qs" | ||
}) |