Skip to content

Commit 2d69659

Browse files
committed
Updated code blocks and screenshot to align with modern QDK
1 parent d89e051 commit 2d69659

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

learn-pr/quantum/explore-entanglement/includes/3-create-entanglement-qsharp.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,16 @@ To create a Bell state with Q# code, follow these steps in Visual Studio Code (V
7171

7272
To create the Bell state :::no-loc text="$\\ket{\\phi^+}$"::: in Q#, follow these steps:
7373

74-
1. Import the `Microsoft.Quantum.Diagnostics` namespace from the Q# standard library so that you can use the `DumpMachine` function. This function shows information about the qubit states when you call the function in your code. To import the namespace, copy the following Q# code into your **Main.qs** file:
74+
1. Import the `Std.Diagnostics` namespace from the Q# standard library so that you can use the `DumpMachine` function. This function shows information about the qubit states when you call the function in your code. To import the namespace, copy the following Q# code into your **Main.qs** file:
7575

7676
```qsharp
77-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
77+
import Std.Diagnostics.*;
7878
```
7979
80-
> [!TIP]
81-
> You can use `Std` instead of `Microsoft.Quantum` to import from the standard library. For example, `import Std.Diagnostics.*` is equivalent to `import Microsoft.Quantum.Diagnostics.*`.
82-
8380
1. Create the `Main` operation that returns two `Result` type values, which are the measurement results of the qubits.
8481
8582
```qsharp
86-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
83+
import Std.Diagnostics.*;
8784
8885
operation Main() : (Result, Result) {
8986
// Your code goes here
@@ -93,7 +90,7 @@ To create the Bell state :::no-loc text="$\\ket{\\phi^+}$"::: in Q#, follow thes
9390
1. Inside the `Main` operation, allocate two qubits to be entangled, `q1` and `q2`.
9491
9592
```qsharp
96-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
93+
import Std.Diagnostics.*;
9794
9895
operation Main() : (Result, Result) {
9996
use (q1, q2) = (Qubit(), Qubit());
@@ -103,7 +100,7 @@ To create the Bell state :::no-loc text="$\\ket{\\phi^+}$"::: in Q#, follow thes
103100
1. Apply the Hadamard gate, `H`, to the control qubit,`q1`. This puts only that qubit into a superposition state. Then apply the CNOT gate, `CNOT`, to both qubits to entangle the two qubits. The first argument to `CNOT` is the control qubit and the second argument is the target qubit.
104101
105102
```qsharp
106-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
103+
import Std.Diagnostics.*;
107104
108105
operation Main() : (Result, Result) {
109106
use (q1, q2) = (Qubit(), Qubit());
@@ -116,7 +113,7 @@ To create the Bell state :::no-loc text="$\\ket{\\phi^+}$"::: in Q#, follow thes
116113
1. Use the `DumpMachine` function to display the state of the qubits after you entangle them. Note that `DumpMachine` doesn't perform a measurement on the qubits, so `DumpMachine` doesn't affect the qubit states.
117114
118115
```qsharp
119-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
116+
import Std.Diagnostics.*;
120117
121118
operation Main() : (Result, Result) {
122119
use (q1, q2) = (Qubit(), Qubit());
@@ -131,7 +128,7 @@ To create the Bell state :::no-loc text="$\\ket{\\phi^+}$"::: in Q#, follow thes
131128
1. Use the `M` operation to measure the qubits, and store the results in `m1` and `m2`. Then use the `Reset` operation to reset the qubits.
132129
133130
```qsharp
134-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
131+
import Std.Diagnostics.*;
135132
136133
operation Main() : (Result, Result) {
137134
@@ -151,7 +148,7 @@ To create the Bell state :::no-loc text="$\\ket{\\phi^+}$"::: in Q#, follow thes
151148
1. Return the measurement results of the qubits with the `return` statement. Here is final program in your **Main.qs** file:
152149
153150
```qsharp
154-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
151+
import Std.Diagnostics.*;
155152
156153
operation Main() : (Result, Result) {
157154
use (q1, q2) = (Qubit(), Qubit());
@@ -208,7 +205,7 @@ Here's how to create the :::no-loc text="$\\ket{\\phi^-}$"::: state:
208205
To create the :::no-loc text="$\\ket{\\phi^-}$"::: Bell state in Q#, replace the code in the your **Main.qs** with the following code:
209206
210207
```qsharp
211-
import Microsoft.Quantum.Diagnostics.*; // Aka Std.Diagnostics.*;
208+
import Std.Diagnostics.*;
212209
213210
operation Main() : (Result, Result) {
214211
use (q1, q2) = (Qubit(), Qubit());
3.4 KB
Loading

0 commit comments

Comments
 (0)