Skip to content

Commit

Permalink
Added teleportation tasks 2.1 to 2.3 (#1619)
Browse files Browse the repository at this point in the history
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
3 people authored Jun 7, 2024
1 parent f57ccee commit 3663b28
Show file tree
Hide file tree
Showing 16 changed files with 174 additions and 2 deletions.
52 changes: 50 additions & 2 deletions katas/content/teleportation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ We split the teleportation protocol into several steps:

@[section]({
"id": "teleportation__testing_standard_teleportation",
"title": "Testing standard quantum teleportation"
"title": "Testing Quantum Teleportation"
})

In this lesson, your goal is to put together the code from the previous exercises to teleport the states $\ket{0}$ and $\ket{1}$, as well as superposition states $\frac{1}{2}(\ket{0}+\ket{1})$, $\frac{1}{2}(\ket{0}-\ket{1})$, $\frac{1}{2}(\ket{0}+i\ket{1})$ and $\frac{1}{2}(\ket{0}-i\ket{1})$, and to verify that teleportation succeeds each time.
Expand All @@ -98,6 +98,54 @@ In this lesson, your goal is to put together the code from the previous exercise
"codePath": "./examples/TestingStandardTeleportation.qs"
})


@[section]({
"id": "teleportation__different_entanglement_pair",
"title": "Teleportation Using Different Entangled Pair"
})

In this lesson we will take a look at the changes in the reconstruction process (Bob's task) if the qubits shared between Alice and Bob are entangled in a different state. Alice's part of the protocol remains the same in all exercises.

As a reminder, the standard teleportation protocol requires shared qubits in state $\ket{\Phi^{+}} = \frac{1}{\sqrt{2}}(\ket{00} + \ket{11})$.

In each exercise, the inputs are:

1. Bob's part of the entangled pair of qubits `qBob`.
2. The tuple of classical bits received from Alice, in the format used in `SendMessage` exercise.

The goal is to transform Bob's qubit `qBob` into the state in which the message qubit had been originally.

@[exercise]({
"id": "teleportation__reconstruct_message_phi_minus",
"title": "Reconstruct Message with |Φ⁻⟩",
"path": "./reconstruct_message_phi_minus",
"qsDependencies": [
"../KatasLibrary.qs",
"./Common.qs"
]
})

@[exercise]({
"id": "teleportation__reconstruct_message_psi_plus",
"title": "Reconstruct Message with |Ψ⁺⟩",
"path": "./reconstruct_message_psi_plus",
"qsDependencies": [
"../KatasLibrary.qs",
"./Common.qs"
]
})

@[exercise]({
"id": "teleportation__reconstruct_message_psi_minus",
"title": "Reconstruct Message with |Ψ⁻⟩",
"path": "./reconstruct_message_psi_minus",
"qsDependencies": [
"../KatasLibrary.qs",
"./Common.qs"
]
})


@[section]({
"id": "teleportation__three_parties",
"title": "Teleportation with Three Parties"
Expand All @@ -116,4 +164,4 @@ There are multiple variants of teleportation protocol that involve more than two
"../KatasLibrary.qs",
"./Common.qs"
]
})
})
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...
}
}
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);
}
}
}
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);
}
}
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.
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"
})
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...
}
}
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);
}
}
}
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);
}
}
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.
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"
})
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...
}
}
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);
}
}
}
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);
}
}
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.
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"
})

0 comments on commit 3663b28

Please sign in to comment.