|
40 | 40 | " self.d = max_faults * 2 + 1\n", |
41 | 41 | "\n", |
42 | 42 | " def stabilizers(self):\n", |
| 43 | + " \"\"\"Cat state stabilizes the pairwise parity operators of the physical qubits.\"\"\"\n", |
43 | 44 | " return [\n", |
44 | 45 | " PauliString(f\"Z{i}*Z{j}\")\n", |
45 | 46 | " for (i, j) in zip(range(self.num_qubits), range(1, self.num_qubits))\n", |
|
50 | 51 | " return PauliString(\"X\" * self.num_qubits)\n", |
51 | 52 | "\n", |
52 | 53 | " def physical_z_stabilizers(self):\n", |
| 54 | + " \"\"\"The initial state is |0> for all (physical) qubits\"\"\"\n", |
53 | 55 | " return [PauliString(f\"Z{i}\") for i in range(self.num_qubits)]" |
54 | 56 | ] |
55 | 57 | }, |
56 | 58 | { |
57 | 59 | "cell_type": "code", |
58 | | - "execution_count": 5, |
| 60 | + "execution_count": null, |
59 | 61 | "id": "4702c9af", |
60 | 62 | "metadata": {}, |
61 | 63 | "outputs": [ |
62 | 64 | { |
63 | 65 | "name": "stderr", |
64 | 66 | "output_type": "stream", |
65 | 67 | "text": [ |
66 | | - "[ Info: '`bitwuzla -rwl 1`' is used as smt solver for FT_condition case\n", |
67 | | - "[ Info: '`bitwuzla -rwl 1`' has solved the problem\n", |
68 | | - "[ Info: The assignment that generates the bug has been written to ./_temp_check_FT_condition_.output\n" |
| 68 | + "Precompiling QuantumSE...\n", |
| 69 | + " 1534.5 ms ✓ QuantumSE\n", |
| 70 | + " 1 dependency successfully precompiled in 2 seconds. 65 already precompiled.\n" |
69 | 71 | ] |
70 | 72 | }, |
71 | 73 | { |
|
75 | 77 | "shape: (4, 8)\n", |
76 | 78 | "shape: (4, 8)\n", |
77 | 79 | "1\n", |
78 | | - ">>> 45 INIT target_qubit=1\n", |
| 80 | + ">>> 1 INIT target_qubit=1\n", |
79 | 81 | "2\n", |
80 | | - ">>> 47 H target_qubit=1\n", |
| 82 | + ">>> 3 H target_qubit=1\n", |
81 | 83 | "3\n", |
82 | | - ">>> 48 INIT target_qubit=2\n", |
| 84 | + ">>> 4 INIT target_qubit=2\n", |
83 | 85 | "4\n", |
84 | | - ">>> 52 CNOT target_qubit1=1, target_qubit2=2\n", |
| 86 | + ">>> 8 CNOT target_qubit1=1, target_qubit2=2\n", |
85 | 87 | "5\n", |
86 | | - ">>> 53 INIT target_qubit=3\n", |
| 88 | + ">>> 9 INIT target_qubit=3\n", |
87 | 89 | "6\n", |
88 | | - ">>> 57 CNOT target_qubit1=1, target_qubit2=3\n", |
| 90 | + ">>> 13 CNOT target_qubit1=1, target_qubit2=3\n", |
89 | 91 | "7\n", |
90 | | - ">>> 58 INIT target_qubit=4\n", |
| 92 | + ">>> 14 INIT target_qubit=4\n", |
91 | 93 | "8\n", |
92 | | - ">>> 62 CNOT target_qubit1=1, target_qubit2=4\n", |
| 94 | + ">>> 18 CNOT target_qubit1=1, target_qubit2=4\n", |
93 | 95 | "9\n", |
94 | | - ">>> 63 INIT target_qubit=5\n", |
| 96 | + ">>> 19 INIT target_qubit=5\n", |
95 | 97 | "10\n", |
96 | | - ">>> 67 CNOT target_qubit1=1, target_qubit2=5\n", |
| 98 | + ">>> 23 CNOT target_qubit1=2, target_qubit2=5\n", |
97 | 99 | "11\n", |
98 | | - ">>> 71 CNOT target_qubit1=2, target_qubit2=5\n", |
| 100 | + ">>> 27 CNOT target_qubit1=3, target_qubit2=5\n", |
99 | 101 | "12\n", |
100 | | - ">>> 75 CNOT target_qubit1=2, target_qubit2=5\n", |
101 | | - "13\n", |
102 | | - ">>> 79 CNOT target_qubit1=3, target_qubit2=5\n", |
103 | | - "14\n", |
104 | | - ">>> 83 CNOT target_qubit1=3, target_qubit2=5\n", |
105 | | - "15\n", |
106 | | - ">>> 87 CNOT target_qubit1=4, target_qubit2=5\n", |
107 | | - "16\n", |
108 | | - ">>> 88 DestructiveM target_qubit=5, sym_name=DestructiveM_cat_prep_5_2\n", |
109 | | - ">>> Fail!\n", |
110 | | - "The cat state preparation circuit is not fault-tolerant.\n" |
| 102 | + ">>> 28 DestructiveM target_qubit=5, sym_name=DestructiveM_cat_prep_5_1\n", |
| 103 | + ">>> Fail!\n" |
111 | 104 | ] |
| 105 | + }, |
| 106 | + { |
| 107 | + "name": "stderr", |
| 108 | + "output_type": "stream", |
| 109 | + "text": [ |
| 110 | + "[ Info: '`bitwuzla -rwl 1`' is used as smt solver for FT_condition case\n", |
| 111 | + "[ Info: '`bitwuzla -rwl 1`' has solved the problem\n", |
| 112 | + "[ Info: The assignment that generates the bug has been written to ./_temp_check_FT_condition_.output\n" |
| 113 | + ] |
| 114 | + }, |
| 115 | + { |
| 116 | + "data": { |
| 117 | + "text/plain": [ |
| 118 | + "False" |
| 119 | + ] |
| 120 | + }, |
| 121 | + "execution_count": 3, |
| 122 | + "metadata": {}, |
| 123 | + "output_type": "execute_result" |
112 | 124 | } |
113 | 125 | ], |
114 | 126 | "source": [ |
|
131 | 143 | " res = 0;\n", |
132 | 144 | " h state[0];\n", |
133 | 145 | "\n", |
134 | | - " // QASM ranges are inclusive for both start and end\n", |
| 146 | + " // QASM loops supported\n", |
135 | 147 | " for int i in [1:(size-1)] {\n", |
136 | 148 | " reset state[i];\n", |
137 | 149 | " cx state[0], state[i];\n", |
138 | 150 | " }\n", |
139 | 151 | "\n", |
140 | 152 | " // Parity check\n", |
141 | 153 | " reset ancilla;\n", |
142 | | - " for int i in [1:(size-1)] {\n", |
143 | | - " cx state[i-1], ancilla;\n", |
144 | | - " cx state[i], ancilla;\n", |
| 154 | + " { // Fails check\n", |
| 155 | + " cx state[1], ancilla;\n", |
| 156 | + " cx state[2], ancilla;\n", |
145 | 157 | " }\n", |
| 158 | + "\n", |
| 159 | + " /*\n", |
| 160 | + " { //passes check\n", |
| 161 | + " cx state[2], ancilla;\n", |
| 162 | + " cx state[3], ancilla;\n", |
| 163 | + " }*/\n", |
146 | 164 | " res = measure ancilla;\n", |
147 | 165 | " }\n", |
148 | 166 | "}\n", |
149 | 167 | "\"\"\".replace(\"__NUM_QUBITS__\", str(num_qubits))\n", |
150 | 168 | "\n", |
151 | 169 | "res = ft_check(code, circuit, \"cat_prep\", \"prepare\", num_ancilla=1)\n", |
152 | 170 | "\n", |
153 | | - "if res:\n", |
154 | | - " print(\"The cat state preparation circuit is fault-tolerant.\")\n", |
155 | | - "else:\n", |
156 | | - " print(\"The cat state preparation circuit is not fault-tolerant.\")" |
| 171 | + "if not res.is_ft:\n", |
| 172 | + " print(\"Circuit is not fault tolerant.\")\n", |
| 173 | + " print(f\"Error cause: {res.error_cause}\")\n" |
157 | 174 | ] |
158 | 175 | }, |
159 | 176 | { |
|
0 commit comments