The question
Does a larger code recover more complete bytes after the same transport?
Circuit & method
Compare shortened Hamming with extended binary Golay [24,12,8] in one Kingston job, 256 shots per code. Four fixed zeros plus ASCII A form Golay’s 12-bit payload. All eight data paths and the twelve Hamming paths are shared with the Golay layout.
Results
Hamming decoded A on 203/256 shots; Golay on 222/256 (86.7%). Golay returned 12 wrong bytes and flagged 22 shots. Among the 234 kept shots, 222 were correct (94.9%).
| Code | Correct / all | Wrong byte | Flagged | Correct / kept |
|---|---|---|---|---|
| Hamming | 203/256 | 38 | 15 | 203/241 (84.2%) |
| Golay | 222/256 | 12 | 22 | 222/234 (94.9%) |
| Physical bit errors | Hamming shots | Golay shots |
|---|---|---|
| 0 | 102 | 34 |
| 1 | 101 | 76 |
| 2 | 35 | 71 |
| 3 | 15 | 41 |
| 4 | 3 | 21 |
| 5 | 0 | 10 |
| 6 | 0 | 0 |
| 7 | 0 | 2 |
| 8 | 0 | 1 |
What this supports
Percentages are rounded for reading. The original integer counts, physical layouts, settings and available uncertainty calculations remain in the records below. Sampling intervals do not account for drift or every systematic error.
Full experiment record
Every top-level field from the primary hardware JSON is reproduced below, including the complete saved measurement distributions where present. Field names and outcome strings retain their original order and spelling.
- Golay-Hamming-Charlie-Kingston.jsonQuantum Field Report.pdf / Experiment-results.zip · 40,110 bytes
- Golay-Hamming-Charlie-Kingston.jsonThrough the Noise Wall.pdf / Kingston measurements and source.zip · 38,526 bytes
- Golay-Hamming-Charlie-Kingston.jsonWorkspace original · 40,110 bytes
backend
ibm_kingston
order
[ "Hamming", "Golay" ]
physical_paths_lsb_first
{
"Hamming": [
[
122,
123,
136,
143,
144
],
[
60,
61,
62,
63,
56
],
[
48,
49,
50,
51,
58
],
[
68,
69,
78,
89,
88
],
[
106,
105,
117,
125,
126
],
[
148,
149,
150,
151,
152
],
[
108,
109,
118,
129,
128
],
[
90,
91,
98,
111,
110
],
[
55,
59,
75,
74,
73
],
[
40,
41,
42,
43,
44
],
[
93,
94,
95,
99,
115
],
[
4,
5,
6,
7,
17
]
],
"Golay": [
[
122,
123,
136,
143,
144
],
[
90,
91,
98,
111,
110
],
[
60,
61,
62,
63,
56
],
[
9,
10,
11,
12,
13
],
[
68,
69,
78,
89,
88
],
[
20,
21,
22,
23,
24
],
[
66,
67,
57,
47,
46
],
[
14,
15,
19,
35,
34
],
[
28,
27,
26,
25,
37
],
[
154,
155,
139,
135,
134
],
[
38,
29,
30,
31,
18
],
[
0,
1,
2,
3,
16
],
[
48,
49,
50,
51,
58
],
[
106,
105,
117,
125,
126
],
[
148,
149,
150,
151,
152
],
[
108,
109,
118,
129,
128
],
[
55,
59,
75,
74,
73
],
[
40,
41,
42,
43,
44
],
[
93,
94,
95,
99,
115
],
[
4,
5,
6,
7,
17
],
[
32,
33,
39,
53,
52
],
[
76,
81,
82,
83,
96
],
[
84,
85,
77,
65,
64
],
[
132,
133,
119,
113,
114
]
]
}input_codewords
{
"Hamming": "010010000100",
"Golay": "000001000001001110101010"
}native_ops
[
{
"sx": 216,
"rz": 144,
"cz": 96,
"measure_2": 24,
"if_else": 24,
"measure": 12,
"x": 3,
"barrier": 1
},
{
"sx": 432,
"rz": 288,
"cz": 192,
"measure_2": 48,
"if_else": 48,
"measure": 24,
"x": 8,
"barrier": 1
}
]stage
done
tag
voyager-golay24-hamming12-charlie-kingston-20261120
shots_per_circuit
256
job_id
dc0gbkthdvas73bjfnj0
counts
[
{
"010010000100010100110011110001001000": 1,
"010010000100111101111111001000011001": 1,
"010010000100101111010100111011111101": 1,
"010010000100111000101011010011010100": 1,
"010010000100001001110011011100111011": 1,
"010011000100110000000010011001101000": 1,
"010010000100100111111001010000101000": 1,
"010010010100111110011011110001000100": 1,
"010010000100101111110101011111110101": 1,
"010010000100001111001011100000001001": 1,
"010010000100101000101000001111010010": 1,
"010010110100010111100100100010101101": 1,
"010010000100001101110111010010100001": 1,
"011010001100010101101010101010000101": 1,
"010010000011101110011111000111001000": 1,
"010010000101001100010010100110011000": 1,
"010010000001000100100011101000101100": 1,
"010010000100100111010010000110011001": 1,
"010010000100101001110000000111011010": 1,
"010010001100010001011000011111101000": 1,
"010110000101010000111111011101101100": 1,
"110010000100111110111100111111101010": 1,
"011010000100001001100001101110101010": 1,
"010010000100011111010000111011110010": 1,
"010010001100100000010001111110011000": 1,
"000010000100001000010101011010110100": 1,
"010000000100100100001111001011010011": 1,
"010010000000001111110100110000100100": 1,
"010010100100010011101111100010011011": 1,
"010010000100010101110011010101101100": 1,
"010010000100101110010000010110000101": 1,
"000010001001110010010011100000101010": 1,
"000010000100101010100001000000011011": 1,
"110010000100101000111001011011100100": 1,
"010010000100110001001011111100101000": 1,
"000010000100100100111100101010110100": 1,
"010000001100110110001010111011110110": 1,
"010010000100011100001111000110110100": 1,
"010010000100001110011001101111001000": 1,
"010000100100010010010110110100100110": 1,
"010010001000100111110011101111010100": 1,
"010000000100001101101010110010111000": 1,
"010010000100111000001100011101000100": 1,
"010000000100000000000011100001011111": 1,
"010010000100000001001011111100111101": 1,
"010010000100100001100010000001011001": 1,
"010010000100000101010110000000010001": 1,
"010010000000001111000010011100111000": 1,
"000010000100010100000110111111011010": 1,
"010010000100001100100110010110001010": 1,
"000010000100011101111111111011010111": 1,
"010010000100000000110100000111111011": 1,
"010010000110101101111000011010001100": 1,
"010010001100110100111010110001001001": 1,
"010010100100011111100111000010101000": 1,
"010010000100011100001001010001110000": 1,
"010010000100011101011111110011101011": 1,
"010010001100101100100110011100110110": 1,
"010010000100011110001010110010011110": 1,
"010010010110011100111111100011110110": 1,
"000010000100101110011011100100101100": 1,
"010010000100011101111000110110100000": 1,
"010010000100001101111000010110100101": 1,
"010010000000010111000110011010100011": 1,
"011010000100011100101100011110001111": 1,
"010010000100011001100010010010100001": 1,
"010000000100100100110101101110111000": 1,
"010010000110110011110001111011000110": 1,
"010010000100011011100101110101000000": 1,
"010010000100110110111110011010000101": 1,
"010000000100101010001100110000101111": 1,
"000010000100001011101000001111000100": 1,
"010010000100110111000111000011000100": 1,
"010010001100100101011100011001010101": 1,
"010010000100010110111011101011111010": 1,
"010010011110101101001010011001100100": 1,
"010010000110001000101010010010101110": 1,
"010010000100011100110100111100000001": 1,
"000010000100111000010100001010001100": 1,
"010010000100011000001110000011010000": 1,
"010100000100000011010000111000010010": 1,
"010010000100001001100110000110110101": 1,
"110110001100100011001101001101101010": 1,
"010010000100001110111010111011010010": 1,
"000010010100000001010111000010101010": 1,
"000010000100011100111111011101010010": 1,
"011011000100000100100111010010010001": 1,
"000010000100101110111100000111111000": 1,
"000000000100010110100001010010010000": 1,
"010010001100110000110111101110011101": 1,
"000000000100111000111000000000010111": 1,
"010000000100010101011101111001100100": 1,
"110010000100101101001011101111101111": 1,
"010000000100000001111100011010001000": 1,
"010110000100011000001011100000001101": 1,
"010000000100001101100100100100101101": 1,
"010010000100110010100101110011110100": 1,
"000010000110000101111110110010001010": 1,
"010010000000000011001000001101100111": 1,
"010010001100100110100000001101101100": 1,
"010010001100101111110001010011010000": 1,
"010010000110010101011011100010110111": 1,
"010010000100101101110010011011101011": 1,
"010000000100000101110100011110110110": 1,
"010010000100000101110001001000011010": 1,
"000010000100010011101100011011000000": 1,
"110010001110000101101100000100010100": 1,
"010010010100010101001111110111011100": 1,
"010010000110100110110011111100001110": 1,
"110010000100000001000000001100000010": 1,
"010010000101010010011101000000101011": 1,
"010010000100100010000000011010110110": 1,
"110010000100011101111000101111110100": 1,
"010010000100111101110011110001101110": 1,
"010010100100100101001101011110111001": 1,
"010000010100100000011110011001101000": 1,
"010010000100101010011010111111101111": 1,
"010010000100011011111000000100000101": 1,
"010010000100000010010010001110100000": 1,
"010000000100000101110011101011010110": 1,
"110010000100111111000010111001101111": 1,
"000000000100001011111110001010010000": 1,
"010010010100101110111110101100101101": 1,
"010000000100001101100000111111100001": 1,
"010010000100010100100101111111110110": 1,
"010010000100100101000001100110010100": 1,
"010010001100001000011101101111001010": 1,
"010010000100111111101100110110010100": 1,
"011000000101111000011010110010100100": 1,
"011010000100001001010101001010000001": 1,
"010010000100001001001101010101101011": 1,
"000110000100101100011110010001001000": 1,
"010010000100110100110000100001101001": 1,
"010010000100111110101011111110101100": 1,
"000000000110100101100011001101110100": 1,
"010000100100100101010001111110101110": 1,
"011001000100011111011101010110100111": 1,
"011010000100000000101111010000000001": 1,
"010000000100100000100011110100111101": 1,
"010010000100010101011011101001001110": 1,
"010010000100110011100101101111100101": 1,
"000010000000010111111111001010101010": 1,
"010010000100010101110110001000000011": 1,
"110010000100100110100111010010011001": 1,
"010010000100111011001001111000111100": 1,
"010010000100010011111101101100101101": 1,
"010010000100011001000011001010100100": 1,
"010010000110110011010011001001111010": 1,
"011000000100000111101100111000100110": 1,
"010010000100111101110101010001000010": 1,
"010010000101110011011000000111100110": 1,
"010010000100011111100101011101001011": 1,
"000010000100110010010101001101011000": 1,
"010000100100110111001100010011010111": 1,
"000010000100101101110011100011001111": 1,
"010010000100000001101011011011101000": 1,
"010010000100000111100001111001000110": 1,
"010010001100100010001100000110100100": 1,
"010010000110101101000011001101100001": 1,
"010010000110100011001000001111110110": 1,
"010000000001110001010010011101110110": 1,
"010010000100110110001001101100010111": 1,
"010000100100100001110110000110110001": 1,
"010010000100110000010100010001011010": 1,
"010000000100000010110000011001101111": 1,
"000011010100001100110001001101010110": 1,
"110000000100111011101000100111110100": 1,
"010010000100001100000010111110011011": 1,
"010010000100111010010000110001110111": 1,
"010010000100100111100001101001101011": 1,
"010010000100000000010011001010000011": 1,
"010011000000100111101001011111110000": 1,
"000000100101110000000001001001100111": 1,
"010010000100101110011000011001110100": 1,
"010010000000110011001100101001101001": 1,
"110010000100111001110111110110010001": 1,
"010010010100001011010001101011000101": 1,
"000010000100000011010010001010011000": 1,
"000000100110010111101011100101110100": 1,
"000000000100001110001101000101010001": 1,
"010010000100001100100010101110111101": 1,
"010010000100101100100010101111011101": 1,
"000010000100110001010111000100101110": 1,
"010010000100011011010110101001101000": 1,
"010010001100110111101111111110100111": 1,
"010010000111111001000101010000100000": 1,
"010010001100100011011111000011110111": 1,
"010011000100101110011011011101000010": 1,
"011000000110000001010011011101100100": 1,
"001010000000100111111001100101010111": 1,
"010000000100001001111001111100001110": 1,
"101010000100111001111011011111010100": 1,
"010110000100101011111101110111001101": 1,
"010110100100111100110110000111001000": 1,
"010010100100010110011000000001100101": 1,
"011000000000001001101111110000111101": 1,
"010010000100110010000111001011101000": 1,
"010110000100011011000101101101001111": 1,
"010010010100000011101011011000001101": 1,
"010010000000100111000011101110011110": 1,
"010010101100001010010101000001101100": 1,
"010010001100000110101011001001111010": 1,
"010010000100001011011001011010010110": 1,
"010010000100101000111100010001111101": 1,
"010010000100100110111101110111110000": 1,
"010010000100011100010111000111011100": 1,
"011010001100110011000101011001101100": 1,
"010010010100110101110101111001111101": 1,
"010001000000000010011001011011011010": 1,
"010000000100011010110001110001010000": 1,
"010010000100000110001001111011001101": 1,
"010010000100110111111110010101001010": 1,
"010010000100000000001110010110100001": 1,
"010011001100111000101000001010101111": 1,
"010010000000011110100101110111100110": 1,
"010010000100001101011101100010100000": 1,
"010010000100101111010010011100111101": 1,
"010010001100111100101110110000000010": 1,
"000010000100100111011100110111010001": 1,
"010010000010100101011111011101101001": 1,
"010010000100101011111100000000111001": 1,
"100000000100001110111111010110100110": 1,
"010010000101000010000010011000111100": 1,
"010010000100100011000110111110111101": 1,
"010010000100111000001101001101101101": 1,
"011010000100000111001100110110110100": 1,
"010010000100000101101000110111011010": 1,
"010010000100111101010101111101010101": 1,
"010010000100001101000100110110101101": 1,
"010000000100100111011111110111110000": 1,
"010010000100100101110100011110100111": 1,
"010010000100001000111010110110110100": 1,
"000010000100110101101100110001110111": 1,
"000010001100001010101110110101110001": 1,
"010010000100011110000101110001011110": 1,
"000010100100010101100111011110100011": 1,
"000010000110001010111010001101101010": 1,
"010010001100001101001100000000000101": 1,
"010010001100010111100010111110101000": 1,
"010010000100001000011100001000011101": 1,
"010010000100100001011010110000010001": 1,
"010010000100110010110100001001000100": 1,
"110000000100010010010101000010010001": 1,
"010010000100001001000101000101101111": 1,
"000010000100110111110000001111011100": 1,
"010010000000101011101100000100111111": 1,
"010010000100011011111000000001001011": 1,
"010010000100111011010110011110001110": 1,
"010010000100100111101100100010110101": 1,
"010010000100111110011001000000000100": 1,
"010010000100100110010111011000111010": 1,
"010010000101000110001001010001100101": 1,
"010011000100111110110001011000110111": 1,
"000010000100000110010111100110110111": 1,
"010010000100110000101111111001010101": 1,
"010010000100000101011101110111111111": 1
},
{
"000000000011001110101010100001001100101110011110010110011001011101001011": 1,
"000001000001001110100010100010010010001111000000011110111101100101110001": 1,
"000001000000001111101010100000001110010001100110010110110011111001000100": 1,
"000101000001001110101010100000010001000110111001011011001101011101010000": 1,
"000001000001001110101010000000010101001011001010110100110001001011100011": 1,
"010101000001101110101010001111111101001001110000010011011110100011100101": 1,
"001001000001001100101010100010110010001000000001111010011000111011110110": 1,
"000001000001001111100010111001101010011001000010010011100110110111001010": 1,
"001000000001001110111010110010110101100010111110010101110111101000010001": 1,
"000011000001000110100010001000001100010101101101110101100011111000100001": 1,
"000001000001001100010010000111101100011100011101110111010000100000010011": 1,
"000001100001000110000010011011001101000011011111011111100010011100100011": 1,
"010001000010001110110100000111000110110011101101011101101010010101011111": 1,
"000010000001001110101010101010100111101000101010111111100110101010000111": 1,
"001000000000001011101010100110010001101100000100011100010010101010001011": 1,
"110001000001001110100010100111000010100001110000111101100111001011101110": 1,
"000001000001001110100010100000001010010101100111010100110000110111111000": 1,
"000001000001001110100010011111110001000100100010010011000001011010101101": 1,
"100000000001001010101010110010110110010110000111111001000110111011011000": 1,
"000001000101000010100010111100000111011110101100011110011010011100001011": 1,
"000001000001001110100010010010001111001101100011010010110110011010111110": 1,
"000001000000001110101010001001111110001111010000010011100110000000001000": 1,
"000001000001010110101010110010110001101100100100011111101000110010101111": 1,
"000001000001001010101010111110010101011101001000010010010010010101111100": 1,
"000001000001001110101110001011111100001110010011010000110110010101011110": 1,
"000001000001001110101010100010011000101000101011010011000001001110101010": 1,
"000001000001000110101010001101001001011100011100011101110101000000110001": 1,
"010001101001001110101010111001000010010111101100010011100100000010000010": 1,
"000001000001000110100000000111100101000010001000110111000001110010010011": 1,
"100001000001001110000010011000011111100100001100110011011100010000110100": 1,
"000001000000001110111010101011100011001110100001111010110110010011001110": 1,
"000000000111001110101010101000100111100111100010111001110011101011001000": 1,
"000001000001001010101010101110010100100111000100010110011011110101110111": 1,
"000100000001001110101010110101010100101010001010110100110100110100011010": 1,
"001001000001001110101010001110101000111111111010110001101101001011001000": 1,
"000001000101001010101010000001101010110111100111110111001001111111000010": 1,
"001101000001001010101000010110101000100010011011111010000100001101010101": 1,
"000001000001001110110010001111010100011101101000011001000001010000010101": 1,
"000001000001001110101010111001000000111110100100111111011000101010000010": 1,
"000001000001001110101010011111101100011110100101010110111000011100011110": 1,
"000000000001000110100010100001011110000101011111010101000011010110000000": 1,
"000001000001001110101010110010100001110010101010010100011010100111100110": 1,
"000001000101000110101010100011100011011000011111011001001101111111101101": 1,
"000001000001001110111010110101011010001000110011111110101111000100011010": 1,
"000001000001001110101010001101010010100000001001110011000000110000010110": 1,
"000001000001011110111010011111010011010011011110111011011110010011110110": 1,
"000001000001000110001010110011110100010111001100110001011101100000011001": 1,
"000001000001001010101000000010011010011010001000111101011101000011011010": 1,
"000001000000001010101010010010000110111011111000111111011011110001011011": 1,
"000001000101001110001010000010101100101001001100010100011100001100011100": 1,
"000000000001001110100010000000010111100101010101010111110100001101111110": 1,
"000001100001001110101011111000010001000000110000110110011010101011101110": 1,
"000001000001001110101010101110100100100000010101010011101100111111011011": 1,
"000101000001001010101010001111000011011100011001010011001011000011001100": 1,
"001000000001001110101010011111111111100000111110111011100011110011111001": 1,
"000001000001001110101110101001001000101001100100111011110010011001011100": 1,
"000001000001001110101010100110000010101010011001010111111000000010100100": 1,
"000001000001001110101000101111101011100011110111111101000001101011101100": 1,
"100001010001001110111110101101111100110100000000110110100011100001110110": 1,
"000001000101001010101010010011010001110110001011011111110000000110100110": 1,
"001001000001001110101010101100010111110011100110110100000101100001111100": 1,
"000001000001000110100010101011011110110001001011010111110001011001101100": 1,
"000001000001001110101010101001010100101100001000010100010110000110111011": 1,
"000101000001001110101010011101010100001111111001011100100001110101101001": 1,
"001001000001001110001010010110010111110111100111111110001010100111011100": 1,
"000100000001001110101000111001111001100110100000011000111011100001111100": 1,
"000001000001001110101010000110101101110010010001011011110101000100011000": 1,
"000001000001001010101010001000000000010111111110010000110000001011000000": 1,
"000001000000000110101010001110100110111010100000011011001101011101001111": 1,
"000001000001001110110011110111111001111011010101010010111000100100000100": 1,
"000001000001001110101010000110000111000100100101010100101100110100110010": 1,
"100000000001001110101010011011001110110111000001111011011111101111011001": 1,
"000011010001001110101010001110101110000110001011010001110110101111111000": 1,
"000011000100001110111010010010101101100110011100010000111101000010011001": 1,
"000001000001001110001010010101101011100100101000111000000111111100011100": 1,
"010001001101001110101010010101101011011100001110111000010111010100101010": 1,
"000001000001011010001010101110000011010010011100011000010101001101001101": 1,
"001011000001000010001010110001100000010010110111001011101110001010000010": 1,
"000101000001001110101010000100110110100001111110011011111011011110110110": 1,
"000001000001001110101010011001101001110010101110111100111101110110111110": 1,
"000001000001001110001010101100010110111111100001011110111100000011110001": 1,
"000000000011001110101010001001101000011111010011111111111011001010101110": 1,
"000001000001001110101010011001000001100010000111111001000010111001011011": 1,
"000001000001011110101010010101111001110111100100110000111011011111101010": 1,
"000001000001001110111010010101001101000111011100110101101010001111011100": 1,
"000001000001001110101010111111000010010100011100110000111000111111100111": 1,
"000001000001001010101010001111110010001111111110110001011100101011010100": 1,
"000001000001001100100110010110101101101100001101110010011100110100101011": 1,
"000011000001000110101010101000110000001110010101010010001101000001101100": 1,
"100001000011101110100010010000010111000111100111011000110001001001111001": 1,
"000000010101000110101000110101001011110000100101110001010111011100100001": 1,
"000111010001001110101010110010001101001001010100011110011010111000010001": 1,
"010001000001001110111010010101110110110111100011110011000100010001111000": 1,
"000001100001001110100010100001011010001011100110011100010100100110011001": 1,
"000001000001001110001010010110001000010000011111110111000111100011010010": 1,
"000001000001001111001010101000010011111111001101011101101011000111010101": 1,
"000101000001001110101010000010001111100001011000111101010000000101000100": 1,
"000001000001000100101010100001010010010000001111010100101000001001010001": 1,
"010001000001000100111010001001000110111100101001010001001100000101111011": 1,
"000001000001001010101110100101100011001000110001011010001001101001101101": 1,
"001101000001001110101011011001001000110100110101111101111111110010111110": 1,
"001000000001101011101010010011101010100010001101110001000010101101101100": 1,
"001001000001001110101011000110010000111100001011111101000110100111001100": 1,
"000001000001001100101110100011001100010101000100010000111010101100110010": 1,
"000001000001001110101010011000000111011111110011010011100111110110100111": 1,
"000001000001001100101010001100111011001101001100010001001000011011100010": 1,
"001001000001001110101010010000000110000110100001110000111100001000101110": 1,
"000100000001001110101010100100000110010010110110110101100110000110010100": 1,
"000001000001000110101010100010001011100110011010110011101100101000110000": 1,
"000001000001000110111010100000011011101100101010110001110100110100110100": 1,
"000001000000001110101010100111011110111101000011111111000000001010100101": 1,
"000001000001000110101010110000100000110110110100011110100011001100110011": 1,
"001001000001001100101010001010100110000110100100110101000110100000100111": 1,
"000000000001010110101010111111010100010101011111011110110000010101110000": 1,
"011011000000001110101010000101100001000100011100011110000100010100001010": 1,
"000001010001001110101110011110101000110000111011010101000110001110010001": 1,
"000001000001000110101010000100110011000000010010011000010111011001011011": 1,
"000001000001001110101010011011101000001110010111011101101111110010110010": 1,
"100001000001001110101010011010101011001111001110111010010101011110110011": 1,
"000001000001001110101010000010101101000110101000110100101001101000010000": 1,
"001000000001001010100010111010000100101001001001110001110000111111110110": 1,
"000001100001001010101010110101111101110011000010010010011110111010101010": 1,
"000001000001001110111110001101101011110001000000111010001111010111101011": 1,
"000001000001000110101010000000000010001111101001010100011100100011011001": 1,
"100001000001001100001010110010111001001110001100010000111100001100110100": 1,
"010001000001000110110000110111010010111100011000010010110111110101001101": 1,
"000000000001001000100010000101110100110011000110011110010110011011101100": 1,
"000001000001001110100010010100101111000101110100011110011110001011111000": 1,
"000001000001001110101110101100001100000100110010010011111110100010100101": 1,
"000101000001001110101010101111010010110110010110110010011110001000001110": 1,
"000001000001001111101011111011101000100100100000011000000111110000010010": 1,
"000001000001001110111010101010001011010000010101011001111001110111111001": 1,
"000001000001001110101010101010011010101011111101110011011110011011000011": 1,
"000001100001001110101010010100101001011001111110111100111011100011011010": 1,
"000001000001001110101010011011010000001110001101110110000011010011111110": 1,
"000001000000001110101000011100111100111001001000010111000001000011101010": 1,
"000001000001001010101010110000001001111011101100111101111101100110001111": 1,
"000001000101001100101010000001000100010111111000010100111011000010111000": 1,
"000001000101001110101010100011101011001100001010111000111100101110100000": 1,
"001001000001001010101000001110001001101000001001111001000111100101111000": 1,
"000000010001001110101000111100001000000001001111011100111100101001000110": 1,
"001000000001000110101010010110000011011000010110111010010111101111010101": 1,
"000001000001011110100010110100001100100000010011010101100000001001111001": 1,
"000011000001100010101010101001000110110010111011100101000000110001101000": 1,
"000001000001001110101010100111010110010110000101010101111011111101010001": 1,
"000000000001001110101010111001101100010000001011110111100111001011001010": 1,
"010001000001001111001010111110101101110000001101010011100101100101101000": 1,
"000001000000101010101000001000001101110111001000111011111100010000001011": 1,
"100001000001001100101010100011010011110111010110011001001011100111010111": 1,
"001000000001001010100000101110010011110100001111011011101000001110100001": 1,
"100101000001001010101010101000000001111100110011110010011100000111101000": 1,
"001000010111000111101010000101100110111110000100111110001001000011010101": 1,
"000001000000001110100110001100000100111101100011110000100100011011011001": 1,
"000001000001001110101010110001000111110111111111110010010010010100001010": 1,
"000001000001001111001010001101110101111001100111110101010101010100100011": 1,
"000000000001001010101010100110010000111011000100011001101101101101001110": 1,
"000001000001001110101011001011011000100010001111011010111000000010000000": 1,
"000001000001001010101010100010010110000110000111010001111101111100111100": 1,
"000001000001001110101010001010111101000001110101111001001000010111101010": 1,
"000001000001000111100010111101111010001110101001011001001101100110101111": 1,
"100101000001001110111010000101100110101010111001110000100010010001010101": 1,
"000101000001000110001010011101011011011011010100110001100100010010101000": 1,
"000001000001001000101010010011010111010111101100111110100001110110100001": 1,
"000001000101001110101010001101100010111011101100011101100001110110111010": 1,
"000100010001001110101010010100010001000100010000011011110011010011110110": 1,
"010001000001111110101000000010010000010000111100110101010011000000010101": 1,
"001101000001000110101010000101000000111011010110111111100010001001111010": 1,
"010010001101111010101010011110000110011001010110011111000001010011011001": 1,
"000001000001001110101010101001111101111010100000011110011011100100011101": 1,
"000001000001011110101010000111010011110100110011111001110110011100001000": 1,
"000101000001001110101010111111101100010101010000011010011100101000010000": 1,
"000001000001011010101110001001101111110000101010011001110100100111000110": 1,
"000001000001000110111010011001100100111101010010010000100000000111010000": 1,
"000001000001001110101011101110111111010101100001111000011101101001110100": 1,
"000001000001001110000010110000001011001110101001111011100101010011010111": 1,
"000001000001001110101011100010101010100101100110110111101100011101101111": 1,
"100001000001001111111000111010111110001100101010011000010111000100010001": 1,
"000000000101101110101010001101010001100111011111111011110101101010011011": 1,
"000001000000000110101010011101011100001100000010110100001110000111101100": 1,
"000001000101001110101010000111010000000111011100111110000010101000001011": 1,
"000000000001000110101000111001110000011000101111011111001110101110010010": 1,
"000001000001001110111010110101100100111101001110010110110110111000111010": 1,
"000001101001000110101000101010101001101110100010011110011100110101111111": 1,
"000001001001000110100010100011110110001111100011010000000101111000100001": 1,
"000001000001001110101010011110011001100001011100110001110010100000110001": 1,
"000001000001001110101010101000011000110111101011110111001000111111111010": 1,
"000001000001001100101010011111010111001110011111011110001000001011010111": 1,
"000001000001000110101010010011101010000001110000111000000010110110010000": 1,
"000101000000001110101010011000000110011011101111111001001101011010011111": 1,
"000101000001001110101010110011010010011000000101111101010101101111111010": 1,
"000001100001001100111010100011010111111100001011110000101101111001110001": 1,
"000010100001000010101010100111000101001111101101110110100001000110101010": 1,
"100101010001001100101010000110110000010000111011011010011101111111111100": 1,
"000001001001001110110010001110110100000101001011010010010001110001011100": 1,
"000001000001001100101010001100000110100100010010110011111010010000011110": 1,
"000001000001001110101010110001011000110010011111110011111010011010000111": 1,
"000001000101011110101000101010110011010001111110011001101010000110011000": 1,
"000001000001001110001010011111011000000000100111111110001110111111001001": 1,
"000001100001000110101010101001101001000011111000110111000010110001011010": 1,
"000011000001011110001010101000010000011100000011011010101001001100010111": 1,
"010001000001001110101010010001010011101110110001110100100001101010100011": 1,
"000001000001001110101010100111110111100110100110111110001001111000011001": 1,
"000001000101001110101010011100100101010101010100011101110100101001011110": 1,
"000001000000001110101010001100011011010111010011011001100011100101000100": 1,
"000011010001001110101010111010110110011000001000010111010100101111111000": 1,
"000101000001001110101000011010010110111100101000101000101010001101110001": 1,
"000001000001001110100011100100000000111101111000110110001010111001010011": 1,
"000011000011001000100010010100000100000101011101010000000010110000011110": 1,
"000011000000001110101010100100000001110000010110010000010110001000011110": 1,
"000001000001001110101011110000100100000000100110110011011000010110001010": 1,
"000000000001001110101010111111000000001110000010111000000001101101111101": 1,
"000011000001001110101010101000111000010000101100110101001010010100111100": 1,
"000001000001001110101010111110100000000101111010110010000001100010110111": 1,
"000001000001001110101010000010001000010101101110010000100011111010100100": 1,
"000001000001001110101010000111011110101111011010111000001101100111011101": 1,
"000001000001001110101010001010010011101101011100010100000000011100000000": 1,
"000001000001001100101010011111101100110110101110111111110100101101110100": 1,
"000011000001001110101010101010110011110100101100111000111101001010000100": 1,
"000001000001001111101010101001101110100110011001010010011110101111001110": 1,
"000001000001101110101011100001011101010101101000111110010110011011001111": 1,
"010001010001001110100011111111111011000001011011010111000110110001011101": 1,
"000101000001001110101010111001000100001011011110110101111000101110001110": 1,
"100011000001001100101100001000000001011000101001011010111100110110110010": 1,
"000000000000001110001000110001011010101100011011111101111011111000101101": 1,
"000001000001001110101010101011010001100110010101010101100010110001100010": 1,
"000001000001001110101010001110100010011100001100111111100001110101101011": 1,
"000001000000001110100001010110011000010100010110110111010000110111011011": 1,
"001001000001001110101010110101100111001110111100011000010001100000101010": 1,
"000101000001001110001000001001111100110001011001011110011010001010001101": 1,
"010100000001001110101000001001110010011010000110011010010100101010100101": 1,
"100001010001001010100000011111110100111101111011010110110011011010001011": 1,
"000001100001001110101010101000011001011000100110011001100110010011010110": 1,
"000001001001001010101010011100011000001000101001110111110001101101101010": 1,
"010000000001001110101010100101111010000001010110011101000000111010010101": 1,
"000001000001000110101010010101010101100101000101010100000111011111010011": 1,
"000001000101001111101010010111110111011111001000111101011111010111110000": 1,
"000101000001001110101010100001001111010110100111010011000010100010010000": 1,
"001001000001001100101011001111001101010110011100010000111000000101010110": 1,
"000011001001001110101010010001010010010101111111011110100100100111001101": 1,
"000101000001001010101010010100110011110101100111011110010010100100000000": 1,
"100001000001011110101010110100001101011100011010111011110111011011010011": 1,
"000001000101001110111010011000000111111100101011110000000011001100101011": 1,
"000000000001001110101010000111010110001111000110011101100001110001110000": 1,
"000001000001001010101010010010010000100001011001111100010100110100011010": 1,
"000011000001001110101010101101101101010001001011010000001010010010101111": 1,
"000001000001000110101010101011101000110100001110011110110011101111110111": 1,
"000001000101011110101010111101001001000110011010010110010111000110001101": 1,
"001011000001001010101010011000110101010000001010011111101101011100010011": 1,
"000011000101001110101010110111101011110101011100111010111001110011011000": 1,
"000001000001001110101010100000010010101100011000010001100000110000101101": 1,
"010001000101001110101010100010011001000101010000110110000011100000100110": 1,
"010001000001001110100010010000001100001010001011111001001011011110010101": 1,
"000001000101001110101010010011100010000100110010000111011000111101110010": 1,
"001001000001001110101010100010100101010111011110110001100001001011100001": 1,
"000001000001001110001110101000001011100000010110011000110111011011110100": 1,
"000001000001000110101010111000101000010001110001010100001110001011110111": 1
}
]metrics
{
"caller": "qiskit",
"qiskit_version": "qiskit_ibm_runtime-0.52.1,qiskit-2.6.2*,qiskit_aer-0.17.2*",
"timestamps": {
"created": "2026-11-21T02:45:39.285816Z",
"finished": "2026-11-21T02:45:45.506172Z",
"running": "2026-11-21T02:45:40.865836Z"
},
"usage": {
"qpu_charge_time_seconds": 2,
"value": 0.030656,
"unit": "resource_units",
"status": "complete",
"details": [
{
"value": 0.030656,
"unit": "resource_units",
"metric": {
"id": "caffe3ca-729c-5750-8777-df63bbf8bfd9",
"value": 2
}
}
]
},
"circuits_execution_time_ns": 135268864
}analysis
{
"Hamming": {
"raw_byte_correct": 149,
"flagged": 15,
"full_payload_correct": 203,
"decoded_byte_correct": 203,
"wrong_byte_returned": 38,
"bit_errors": {
"0": 102,
"1": 101,
"2": 35,
"3": 15,
"4": 3
}
},
"Golay": {
"raw_byte_correct": 152,
"flagged": 22,
"full_payload_correct": 222,
"decoded_byte_correct": 222,
"wrong_byte_returned": 12,
"bit_errors": {
"0": 34,
"1": 76,
"2": 71,
"3": 41,
"4": 21,
"5": 10,
"7": 2,
"8": 1
}
}
}Simulation & checks
These are the supplied simulator records and their preserved variants. Their model, seed, settings and results appear exactly as saved. Shared simulator references on fresh-map pages describe the ideal graph protocol, rather than a new hardware-matched calibration.
- Golay-Hamming-Charlie-simulator.jsonQuantum Field Report.pdf / Experiment-results.zip · 940 bytes
- Golay-Hamming-Charlie-simulator.jsonThrough the Noise Wall.pdf / Kingston measurements and source.zip · 940 bytes
- Golay-Hamming-Charlie-simulator.jsonWorkspace original · 940 bytes
field-report/final/Golay-Hamming-Charlie-simulator.json · full record
{
"shots": 256,
"analysis": {
"Hamming": {
"raw_byte_correct": 256,
"flagged": 0,
"full_payload_correct": 256,
"decoded_byte_correct": 256,
"wrong_byte_returned": 0,
"bit_errors": {
"0": 256
}
},
"Golay": {
"raw_byte_correct": 256,
"flagged": 0,
"full_payload_correct": 256,
"decoded_byte_correct": 256,
"wrong_byte_returned": 0,
"bit_errors": {
"0": 256
}
}
},
"native_ops_on_snapshot": {
"Hamming": {
"sx": 216,
"rz": 144,
"cz": 96,
"measure_2": 24,
"if_else": 24,
"measure": 12,
"x": 3,
"barrier": 1
},
"Golay": {
"sx": 432,
"rz": 288,
"cz": 192,
"measure_2": 48,
"if_else": 48,
"measure": 24,
"x": 8,
"barrier": 1
}
},
"verified_error_masks": 2325
}noise-wall/results/Golay-Hamming-Charlie-simulator.json · full record
{
"shots": 256,
"analysis": {
"Hamming": {
"raw_byte_correct": 256,
"flagged": 0,
"full_payload_correct": 256,
"decoded_byte_correct": 256,
"wrong_byte_returned": 0,
"bit_errors": {
"0": 256
}
},
"Golay": {
"raw_byte_correct": 256,
"flagged": 0,
"full_payload_correct": 256,
"decoded_byte_correct": 256,
"wrong_byte_returned": 0,
"bit_errors": {
"0": 256
}
}
},
"native_ops_on_snapshot": {
"Hamming": {
"sx": 216,
"rz": 144,
"cz": 96,
"measure_2": 24,
"if_else": 24,
"measure": 12,
"x": 3,
"barrier": 1
},
"Golay": {
"sx": 432,
"rz": 288,
"cz": 192,
"measure_2": 48,
"if_else": 48,
"measure": 24,
"x": 8,
"barrier": 1
}
},
"verified_error_masks": 2325
}workspace/Golay-Hamming-Charlie-simulator.json · full record
{
"shots": 256,
"analysis": {
"Hamming": {
"raw_byte_correct": 256,
"flagged": 0,
"full_payload_correct": 256,
"decoded_byte_correct": 256,
"wrong_byte_returned": 0,
"bit_errors": {
"0": 256
}
},
"Golay": {
"raw_byte_correct": 256,
"flagged": 0,
"full_payload_correct": 256,
"decoded_byte_correct": 256,
"wrong_byte_returned": 0,
"bit_errors": {
"0": 256
}
}
},
"native_ops_on_snapshot": {
"Hamming": {
"sx": 216,
"rz": 144,
"cz": 96,
"measure_2": 24,
"if_else": 24,
"measure": 12,
"x": 3,
"barrier": 1
},
"Golay": {
"sx": 432,
"rz": 288,
"cz": 192,
"measure_2": 48,
"if_else": 48,
"measure": 24,
"x": 8,
"barrier": 1
}
},
"verified_error_masks": 2325
}Source code
Original experiment and verification programs are preserved byte for byte. These are historical listings; dependencies, authentication prompts and machine-specific input paths may need adjustment before a rerun.
- golay_charlie.pyQuantum Field Report.pdf / Experiment-source.zip · 9,600 bytes
- golay_charlie.pyThrough the Noise Wall.pdf / Kingston measurements and source.zip · 9,600 bytes
- golay_charlie.pyWorkspace original · 9,600 bytes
field-report/final/golay_charlie.py · complete source
"""Send a full extended Golay block and a shortened Hamming block to Charlie."""
import getpass
import logging
import sys
import traceback
from collections import Counter, defaultdict
from itertools import combinations
from pathlib import Path
import numpy as np
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeKingston
from scipy.optimize import Bounds, LinearConstraint, milp
from scipy.sparse import csc_matrix
HERE = Path(__file__).resolve().parent
PRIOR = Path.home() / "Documents/Codex/2026-11-19/tonight-we-will-be-doing-actual/outputs"
sys.path.insert(0, str(PRIOR))
import hamming_ascii as ham
from graph156 import save
from run_switch_puzzles import load, execute, SHOTS
from teleport_ascii_a import circuit as teleport, SEED
SIM = HERE / "Golay-Hamming-Charlie-simulator.json"
HW = HERE / "Golay-Hamming-Charlie-Kingston.json"
STATUS = HERE / "golay-status.json"
TAG = "voyager-golay24-hamming12-charlie-kingston-20261120"
VALUE = ord("A")
NAMES = ("Hamming", "Golay")
def golay(m):
shifted = m << 11
rem = shifted
for bit in range(22, 10, -1):
if rem & (1 << bit):
rem ^= 0xAE3 << (bit - 11)
cyclic = shifted | rem
return (cyclic << 1) | (cyclic.bit_count() % 2)
BOOK = tuple(golay(m) for m in range(4096))
WORDS = {"Hamming": (12, ham.encode(VALUE)), "Golay": (24, golay(VALUE))}
def syndrome(word):
return (word ^ golay(word >> 12)) & 0xfff
def make_decoder():
lookup = {}
for size in range(4):
for bits in combinations(range(24), size):
mask = sum(1 << bit for bit in bits)
check = syndrome(mask)
assert check not in lookup
lookup[check] = mask
assert len(lookup) == 2325 and min(w.bit_count() for w in BOOK[1:]) == 8
return lookup
ERRORS = make_decoder()
def score(name, counts):
width, sent = WORDS[name]
row = Counter()
distances = Counter()
for bits, n in counts.items():
assert len(bits) == width*3 and set(bits) <= {"0", "1"}
received = int(bits[:width], 2)
distances[(received ^ sent).bit_count()] += n
if name == "Golay":
raw = (received >> 12) & 255
mask = ERRORS.get(syndrome(received))
decoded = None if mask is None else (received ^ mask) >> 12
else:
raw = ham.payload(received)
decoded = ham.decode(received)
row["raw_byte_correct"] += n * (raw == VALUE)
row["flagged"] += n * (decoded is None)
row["full_payload_correct"] += n * (decoded == VALUE)
row["decoded_byte_correct"] += n * (decoded is not None and (decoded & 255) == VALUE)
assert sum(distances.values()) == SHOTS
row["wrong_byte_returned"] = SHOTS-row["flagged"]-row["decoded_byte_correct"]
return dict(**row, bit_errors=dict(sorted(distances.items())))
def circuit(name, fast=False):
n, word = WORDS[name]
src = teleport("teleport", fast, word, n)
# Replace only Bob's final measurements; preserve both measurements at Alice.
for i in reversed(range(len(src.data))):
op = src.data[i]
if op.operation.name == "measure" and src.find_bit(op.clbits[0]).index >= 2*n:
del src.data[i]
q = QuantumCircuit(5*n, 3*n, name=name)
q.compose(src, qubits=[5*i+j for i in range(n) for j in range(3)], inplace=True)
for i in range(n):
bob = 5*i+2
q.swap(bob, bob+1)
q.swap(bob+1, bob+2)
q.measure(bob+2, 2*n+i)
return q
def layout(backend):
old = [tuple(p) for p in load(PRIOR/"Charlie-A-Kingston.json")["paths_by_hamming_position"]]
props = backend.properties()
bad = set(props.faulty_qubits())
blocked = {tuple(sorted(g.qubits)) for g in props.faulty_gates() if len(g.qubits) == 2}
adj = defaultdict(dict)
for (a,b), gate in backend.target["cz"].items():
if not bad.intersection((a,b)) and tuple(sorted((a,b))) not in blocked and gate and gate.error is not None:
adj[a][b] = adj[b][a] = gate.error
def extend(path):
if len(path) == 5:
yield path
else:
for nxt in adj[path[-1]]:
if nxt not in path:
yield from extend((*path, nxt))
def cost(p):
gates = sum(w*adj[a][b] for w,a,b in zip((1,1,3,3), p, p[1:]))
return gates + sum(props.readout_error(p[i]) for i in (0,1,4))
choices = []
for q in adj:
for p in extend((q,)):
if p[0] < p[-1]:
choices.append(min((p, p[::-1]), key=lambda v: (v not in old, cost(v))))
incidence = np.zeros((backend.num_qubits+1, len(choices)))
for j, p in enumerate(choices):
incidence[list(p),j] = 1
incidence[-1,:] = 1
lo, hi = np.zeros(len(incidence)), np.ones(len(incidence))
lo[-1] = hi[-1] = 24
result = milp([cost(p) - 100*(p in old) for p in choices], integrality=np.ones(len(choices)),
bounds=Bounds(0,1), constraints=LinearConstraint(csc_matrix(incidence), lo, hi),
options={"time_limit": 30})
if result.x is None:
raise RuntimeError("No verified packing of 24 routes")
selected = {p for p,x in zip(choices,result.x) if x > 0.5}
assert len(selected) == 24 and len({q for p in selected for q in p}) == 120
spare = iter(sorted(selected.difference(old), key=cost))
hamming = [p if p in selected else next(spare) for p in old]
golay_paths = [None]*24
for bit, pos in enumerate(ham.DATA):
golay_paths[12+bit] = hamming[pos-1]
for pos in ham.PARITY:
bit = (WORDS["Hamming"][1] >> (pos-1)) & 1
i = next(i for i in range(12) if golay_paths[i] is None and ((WORDS["Golay"][1] >> i) & 1) == bit)
golay_paths[i] = hamming[pos-1]
for i,p in enumerate(golay_paths):
if p is None:
golay_paths[i] = next(spare)
return {"Hamming":hamming,"Golay":golay_paths}
def compile_circuit(backend, name, paths):
n = len(paths)
fast = all(backend.target.instruction_supported("measure_2", (p[i],)) for p in paths for i in (0,1))
q = transpile(circuit(name, fast), backend, initial_layout=[v for p in paths for v in p],
routing_method="none", optimization_level=0, num_processes=1, seed_transpiler=SEED)
backend.check_faulty(q)
edges, measures, controls = Counter(), {}, {}
for op in q.data:
wires = tuple(q.find_bit(b).index for b in op.qubits)
g = op.operation
if g.name == "cz":
edges[tuple(sorted(wires))] += 1
if g.name in ("measure", "measure_2"):
measures[q.find_bit(op.clbits[0]).index] = wires[0]
if g.name == "if_else":
flag, val = g.condition
assert val == 1
controls[q.find_bit(flag).index] = wires[0]
expected = Counter()
for p in paths:
for i,k in enumerate((1,1,3,3)):
expected[tuple(sorted(p[i:i+2]))] = k
assert edges == expected
assert measures == {c:wire for i,p in enumerate(paths) for c,wire in ((2*i,p[0]), (2*i+1,p[1]), (2*n+i,p[4]))}
assert controls == {2*i+j:p[2] for i,p in enumerate(paths) for j in (0,1)}
return q
def simulate():
assert BOOK[VALUE] == int("000001000001001110101010",2)
for mask in ERRORS.values():
damaged = BOOK[VALUE] ^ mask
assert damaged ^ ERRORS[syndrome(damaged)] == BOOK[VALUE]
result = AerSimulator(method="stabilizer").run([circuit(k) for k in NAMES], shots=SHOTS, seed_simulator=SEED).result()
rows = {k:score(k,result.get_counts(i)) for i,k in enumerate(NAMES)}
assert all(r["bit_errors"] == {0:SHOTS} for r in rows.values())
fake = FakeKingston()
paths = layout(fake)
ops = {k:dict(compile_circuit(fake,k,paths[k]).count_ops()) for k in NAMES}
save(SIM, dict(shots=SHOTS, analysis=rows, native_ops_on_snapshot=ops, verified_error_masks=len(ERRORS)))
print(rows)
def hardware():
rec = load(HW)
if rec.get("analysis"):
return
assert load(SIM)["verified_error_masks"] == 2325
save(STATUS, {"stage":"waiting for private key"})
key = getpass.getpass("IBM Cloud API key for Kingston (hidden): ").strip()
if not key:
save(STATUS, {"stage":"cancelled"})
return
save(STATUS, {"stage":"connecting"})
service = QiskitRuntimeService(channel="ibm_quantum_platform", token=key, plans_preference=["open"], region="us-east")
backend = service.backend("ibm_kingston")
circuits = []
if not rec:
paths = layout(backend)
circuits = [compile_circuit(backend,k,paths[k]) for k in NAMES]
rec = dict(backend=backend.name, order=NAMES, physical_paths_lsb_first=paths,
input_codewords={k:format(w,f"0{n}b") for k,(n,w) in WORDS.items()},
native_ops=[dict(q.count_ops()) for q in circuits])
rec = execute(service, backend, HW, TAG, rec, lambda:circuits)
rec["analysis"] = {k:score(k,c) for k,c in zip(NAMES,rec["counts"],strict=True)}
save(HW,rec)
save(STATUS, {"stage":"finished"})
if __name__ == "__main__":
if sys.argv[1:] == ["simulate"]:
simulate()
if sys.argv[1:] == ["hardware"]:
logging.disable(logging.CRITICAL)
try:
hardware()
except Exception as exc:
save(STATUS, {"stage":"error", "type":type(exc).__name__,
"frames":[f.name for f in traceback.extract_tb(exc.__traceback__)]})
raise SystemExit(1)
noise-wall/source/golay_charlie.py · complete source
"""Send a full extended Golay block and a shortened Hamming block to Charlie."""
import getpass
import logging
import sys
import traceback
from collections import Counter, defaultdict
from itertools import combinations
from pathlib import Path
import numpy as np
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeKingston
from scipy.optimize import Bounds, LinearConstraint, milp
from scipy.sparse import csc_matrix
HERE = Path(__file__).resolve().parent
PRIOR = Path.home() / "Documents/Codex/2026-11-19/tonight-we-will-be-doing-actual/outputs"
sys.path.insert(0, str(PRIOR))
import hamming_ascii as ham
from graph156 import save
from run_switch_puzzles import load, execute, SHOTS
from teleport_ascii_a import circuit as teleport, SEED
SIM = HERE / "Golay-Hamming-Charlie-simulator.json"
HW = HERE / "Golay-Hamming-Charlie-Kingston.json"
STATUS = HERE / "golay-status.json"
TAG = "voyager-golay24-hamming12-charlie-kingston-20261120"
VALUE = ord("A")
NAMES = ("Hamming", "Golay")
def golay(m):
shifted = m << 11
rem = shifted
for bit in range(22, 10, -1):
if rem & (1 << bit):
rem ^= 0xAE3 << (bit - 11)
cyclic = shifted | rem
return (cyclic << 1) | (cyclic.bit_count() % 2)
BOOK = tuple(golay(m) for m in range(4096))
WORDS = {"Hamming": (12, ham.encode(VALUE)), "Golay": (24, golay(VALUE))}
def syndrome(word):
return (word ^ golay(word >> 12)) & 0xfff
def make_decoder():
lookup = {}
for size in range(4):
for bits in combinations(range(24), size):
mask = sum(1 << bit for bit in bits)
check = syndrome(mask)
assert check not in lookup
lookup[check] = mask
assert len(lookup) == 2325 and min(w.bit_count() for w in BOOK[1:]) == 8
return lookup
ERRORS = make_decoder()
def score(name, counts):
width, sent = WORDS[name]
row = Counter()
distances = Counter()
for bits, n in counts.items():
assert len(bits) == width*3 and set(bits) <= {"0", "1"}
received = int(bits[:width], 2)
distances[(received ^ sent).bit_count()] += n
if name == "Golay":
raw = (received >> 12) & 255
mask = ERRORS.get(syndrome(received))
decoded = None if mask is None else (received ^ mask) >> 12
else:
raw = ham.payload(received)
decoded = ham.decode(received)
row["raw_byte_correct"] += n * (raw == VALUE)
row["flagged"] += n * (decoded is None)
row["full_payload_correct"] += n * (decoded == VALUE)
row["decoded_byte_correct"] += n * (decoded is not None and (decoded & 255) == VALUE)
assert sum(distances.values()) == SHOTS
row["wrong_byte_returned"] = SHOTS-row["flagged"]-row["decoded_byte_correct"]
return dict(**row, bit_errors=dict(sorted(distances.items())))
def circuit(name, fast=False):
n, word = WORDS[name]
src = teleport("teleport", fast, word, n)
# Replace only Bob's final measurements; preserve both measurements at Alice.
for i in reversed(range(len(src.data))):
op = src.data[i]
if op.operation.name == "measure" and src.find_bit(op.clbits[0]).index >= 2*n:
del src.data[i]
q = QuantumCircuit(5*n, 3*n, name=name)
q.compose(src, qubits=[5*i+j for i in range(n) for j in range(3)], inplace=True)
for i in range(n):
bob = 5*i+2
q.swap(bob, bob+1)
q.swap(bob+1, bob+2)
q.measure(bob+2, 2*n+i)
return q
def layout(backend):
old = [tuple(p) for p in load(PRIOR/"Charlie-A-Kingston.json")["paths_by_hamming_position"]]
props = backend.properties()
bad = set(props.faulty_qubits())
blocked = {tuple(sorted(g.qubits)) for g in props.faulty_gates() if len(g.qubits) == 2}
adj = defaultdict(dict)
for (a,b), gate in backend.target["cz"].items():
if not bad.intersection((a,b)) and tuple(sorted((a,b))) not in blocked and gate and gate.error is not None:
adj[a][b] = adj[b][a] = gate.error
def extend(path):
if len(path) == 5:
yield path
else:
for nxt in adj[path[-1]]:
if nxt not in path:
yield from extend((*path, nxt))
def cost(p):
gates = sum(w*adj[a][b] for w,a,b in zip((1,1,3,3), p, p[1:]))
return gates + sum(props.readout_error(p[i]) for i in (0,1,4))
choices = []
for q in adj:
for p in extend((q,)):
if p[0] < p[-1]:
choices.append(min((p, p[::-1]), key=lambda v: (v not in old, cost(v))))
incidence = np.zeros((backend.num_qubits+1, len(choices)))
for j, p in enumerate(choices):
incidence[list(p),j] = 1
incidence[-1,:] = 1
lo, hi = np.zeros(len(incidence)), np.ones(len(incidence))
lo[-1] = hi[-1] = 24
result = milp([cost(p) - 100*(p in old) for p in choices], integrality=np.ones(len(choices)),
bounds=Bounds(0,1), constraints=LinearConstraint(csc_matrix(incidence), lo, hi),
options={"time_limit": 30})
if result.x is None:
raise RuntimeError("No verified packing of 24 routes")
selected = {p for p,x in zip(choices,result.x) if x > 0.5}
assert len(selected) == 24 and len({q for p in selected for q in p}) == 120
spare = iter(sorted(selected.difference(old), key=cost))
hamming = [p if p in selected else next(spare) for p in old]
golay_paths = [None]*24
for bit, pos in enumerate(ham.DATA):
golay_paths[12+bit] = hamming[pos-1]
for pos in ham.PARITY:
bit = (WORDS["Hamming"][1] >> (pos-1)) & 1
i = next(i for i in range(12) if golay_paths[i] is None and ((WORDS["Golay"][1] >> i) & 1) == bit)
golay_paths[i] = hamming[pos-1]
for i,p in enumerate(golay_paths):
if p is None:
golay_paths[i] = next(spare)
return {"Hamming":hamming,"Golay":golay_paths}
def compile_circuit(backend, name, paths):
n = len(paths)
fast = all(backend.target.instruction_supported("measure_2", (p[i],)) for p in paths for i in (0,1))
q = transpile(circuit(name, fast), backend, initial_layout=[v for p in paths for v in p],
routing_method="none", optimization_level=0, num_processes=1, seed_transpiler=SEED)
backend.check_faulty(q)
edges, measures, controls = Counter(), {}, {}
for op in q.data:
wires = tuple(q.find_bit(b).index for b in op.qubits)
g = op.operation
if g.name == "cz":
edges[tuple(sorted(wires))] += 1
if g.name in ("measure", "measure_2"):
measures[q.find_bit(op.clbits[0]).index] = wires[0]
if g.name == "if_else":
flag, val = g.condition
assert val == 1
controls[q.find_bit(flag).index] = wires[0]
expected = Counter()
for p in paths:
for i,k in enumerate((1,1,3,3)):
expected[tuple(sorted(p[i:i+2]))] = k
assert edges == expected
assert measures == {c:wire for i,p in enumerate(paths) for c,wire in ((2*i,p[0]), (2*i+1,p[1]), (2*n+i,p[4]))}
assert controls == {2*i+j:p[2] for i,p in enumerate(paths) for j in (0,1)}
return q
def simulate():
assert BOOK[VALUE] == int("000001000001001110101010",2)
for mask in ERRORS.values():
damaged = BOOK[VALUE] ^ mask
assert damaged ^ ERRORS[syndrome(damaged)] == BOOK[VALUE]
result = AerSimulator(method="stabilizer").run([circuit(k) for k in NAMES], shots=SHOTS, seed_simulator=SEED).result()
rows = {k:score(k,result.get_counts(i)) for i,k in enumerate(NAMES)}
assert all(r["bit_errors"] == {0:SHOTS} for r in rows.values())
fake = FakeKingston()
paths = layout(fake)
ops = {k:dict(compile_circuit(fake,k,paths[k]).count_ops()) for k in NAMES}
save(SIM, dict(shots=SHOTS, analysis=rows, native_ops_on_snapshot=ops, verified_error_masks=len(ERRORS)))
print(rows)
def hardware():
rec = load(HW)
if rec.get("analysis"):
return
assert load(SIM)["verified_error_masks"] == 2325
save(STATUS, {"stage":"waiting for private key"})
key = getpass.getpass("IBM Cloud API key for Kingston (hidden): ").strip()
if not key:
save(STATUS, {"stage":"cancelled"})
return
save(STATUS, {"stage":"connecting"})
service = QiskitRuntimeService(channel="ibm_quantum_platform", token=key, plans_preference=["open"], region="us-east")
backend = service.backend("ibm_kingston")
circuits = []
if not rec:
paths = layout(backend)
circuits = [compile_circuit(backend,k,paths[k]) for k in NAMES]
rec = dict(backend=backend.name, order=NAMES, physical_paths_lsb_first=paths,
input_codewords={k:format(w,f"0{n}b") for k,(n,w) in WORDS.items()},
native_ops=[dict(q.count_ops()) for q in circuits])
rec = execute(service, backend, HW, TAG, rec, lambda:circuits)
rec["analysis"] = {k:score(k,c) for k,c in zip(NAMES,rec["counts"],strict=True)}
save(HW,rec)
save(STATUS, {"stage":"finished"})
if __name__ == "__main__":
if sys.argv[1:] == ["simulate"]:
simulate()
if sys.argv[1:] == ["hardware"]:
logging.disable(logging.CRITICAL)
try:
hardware()
except Exception as exc:
save(STATUS, {"stage":"error", "type":type(exc).__name__,
"frames":[f.name for f in traceback.extract_tb(exc.__traceback__)]})
raise SystemExit(1)
workspace/golay_charlie.py · complete source
"""Send a full extended Golay block and a shortened Hamming block to Charlie."""
import getpass
import logging
import sys
import traceback
from collections import Counter, defaultdict
from itertools import combinations
from pathlib import Path
import numpy as np
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeKingston
from scipy.optimize import Bounds, LinearConstraint, milp
from scipy.sparse import csc_matrix
HERE = Path(__file__).resolve().parent
PRIOR = Path.home() / "Documents/Codex/2026-11-19/tonight-we-will-be-doing-actual/outputs"
sys.path.insert(0, str(PRIOR))
import hamming_ascii as ham
from graph156 import save
from run_switch_puzzles import load, execute, SHOTS
from teleport_ascii_a import circuit as teleport, SEED
SIM = HERE / "Golay-Hamming-Charlie-simulator.json"
HW = HERE / "Golay-Hamming-Charlie-Kingston.json"
STATUS = HERE / "golay-status.json"
TAG = "voyager-golay24-hamming12-charlie-kingston-20261120"
VALUE = ord("A")
NAMES = ("Hamming", "Golay")
def golay(m):
shifted = m << 11
rem = shifted
for bit in range(22, 10, -1):
if rem & (1 << bit):
rem ^= 0xAE3 << (bit - 11)
cyclic = shifted | rem
return (cyclic << 1) | (cyclic.bit_count() % 2)
BOOK = tuple(golay(m) for m in range(4096))
WORDS = {"Hamming": (12, ham.encode(VALUE)), "Golay": (24, golay(VALUE))}
def syndrome(word):
return (word ^ golay(word >> 12)) & 0xfff
def make_decoder():
lookup = {}
for size in range(4):
for bits in combinations(range(24), size):
mask = sum(1 << bit for bit in bits)
check = syndrome(mask)
assert check not in lookup
lookup[check] = mask
assert len(lookup) == 2325 and min(w.bit_count() for w in BOOK[1:]) == 8
return lookup
ERRORS = make_decoder()
def score(name, counts):
width, sent = WORDS[name]
row = Counter()
distances = Counter()
for bits, n in counts.items():
assert len(bits) == width*3 and set(bits) <= {"0", "1"}
received = int(bits[:width], 2)
distances[(received ^ sent).bit_count()] += n
if name == "Golay":
raw = (received >> 12) & 255
mask = ERRORS.get(syndrome(received))
decoded = None if mask is None else (received ^ mask) >> 12
else:
raw = ham.payload(received)
decoded = ham.decode(received)
row["raw_byte_correct"] += n * (raw == VALUE)
row["flagged"] += n * (decoded is None)
row["full_payload_correct"] += n * (decoded == VALUE)
row["decoded_byte_correct"] += n * (decoded is not None and (decoded & 255) == VALUE)
assert sum(distances.values()) == SHOTS
row["wrong_byte_returned"] = SHOTS-row["flagged"]-row["decoded_byte_correct"]
return dict(**row, bit_errors=dict(sorted(distances.items())))
def circuit(name, fast=False):
n, word = WORDS[name]
src = teleport("teleport", fast, word, n)
# Replace only Bob's final measurements; preserve both measurements at Alice.
for i in reversed(range(len(src.data))):
op = src.data[i]
if op.operation.name == "measure" and src.find_bit(op.clbits[0]).index >= 2*n:
del src.data[i]
q = QuantumCircuit(5*n, 3*n, name=name)
q.compose(src, qubits=[5*i+j for i in range(n) for j in range(3)], inplace=True)
for i in range(n):
bob = 5*i+2
q.swap(bob, bob+1)
q.swap(bob+1, bob+2)
q.measure(bob+2, 2*n+i)
return q
def layout(backend):
old = [tuple(p) for p in load(PRIOR/"Charlie-A-Kingston.json")["paths_by_hamming_position"]]
props = backend.properties()
bad = set(props.faulty_qubits())
blocked = {tuple(sorted(g.qubits)) for g in props.faulty_gates() if len(g.qubits) == 2}
adj = defaultdict(dict)
for (a,b), gate in backend.target["cz"].items():
if not bad.intersection((a,b)) and tuple(sorted((a,b))) not in blocked and gate and gate.error is not None:
adj[a][b] = adj[b][a] = gate.error
def extend(path):
if len(path) == 5:
yield path
else:
for nxt in adj[path[-1]]:
if nxt not in path:
yield from extend((*path, nxt))
def cost(p):
gates = sum(w*adj[a][b] for w,a,b in zip((1,1,3,3), p, p[1:]))
return gates + sum(props.readout_error(p[i]) for i in (0,1,4))
choices = []
for q in adj:
for p in extend((q,)):
if p[0] < p[-1]:
choices.append(min((p, p[::-1]), key=lambda v: (v not in old, cost(v))))
incidence = np.zeros((backend.num_qubits+1, len(choices)))
for j, p in enumerate(choices):
incidence[list(p),j] = 1
incidence[-1,:] = 1
lo, hi = np.zeros(len(incidence)), np.ones(len(incidence))
lo[-1] = hi[-1] = 24
result = milp([cost(p) - 100*(p in old) for p in choices], integrality=np.ones(len(choices)),
bounds=Bounds(0,1), constraints=LinearConstraint(csc_matrix(incidence), lo, hi),
options={"time_limit": 30})
if result.x is None:
raise RuntimeError("No verified packing of 24 routes")
selected = {p for p,x in zip(choices,result.x) if x > 0.5}
assert len(selected) == 24 and len({q for p in selected for q in p}) == 120
spare = iter(sorted(selected.difference(old), key=cost))
hamming = [p if p in selected else next(spare) for p in old]
golay_paths = [None]*24
for bit, pos in enumerate(ham.DATA):
golay_paths[12+bit] = hamming[pos-1]
for pos in ham.PARITY:
bit = (WORDS["Hamming"][1] >> (pos-1)) & 1
i = next(i for i in range(12) if golay_paths[i] is None and ((WORDS["Golay"][1] >> i) & 1) == bit)
golay_paths[i] = hamming[pos-1]
for i,p in enumerate(golay_paths):
if p is None:
golay_paths[i] = next(spare)
return {"Hamming":hamming,"Golay":golay_paths}
def compile_circuit(backend, name, paths):
n = len(paths)
fast = all(backend.target.instruction_supported("measure_2", (p[i],)) for p in paths for i in (0,1))
q = transpile(circuit(name, fast), backend, initial_layout=[v for p in paths for v in p],
routing_method="none", optimization_level=0, num_processes=1, seed_transpiler=SEED)
backend.check_faulty(q)
edges, measures, controls = Counter(), {}, {}
for op in q.data:
wires = tuple(q.find_bit(b).index for b in op.qubits)
g = op.operation
if g.name == "cz":
edges[tuple(sorted(wires))] += 1
if g.name in ("measure", "measure_2"):
measures[q.find_bit(op.clbits[0]).index] = wires[0]
if g.name == "if_else":
flag, val = g.condition
assert val == 1
controls[q.find_bit(flag).index] = wires[0]
expected = Counter()
for p in paths:
for i,k in enumerate((1,1,3,3)):
expected[tuple(sorted(p[i:i+2]))] = k
assert edges == expected
assert measures == {c:wire for i,p in enumerate(paths) for c,wire in ((2*i,p[0]), (2*i+1,p[1]), (2*n+i,p[4]))}
assert controls == {2*i+j:p[2] for i,p in enumerate(paths) for j in (0,1)}
return q
def simulate():
assert BOOK[VALUE] == int("000001000001001110101010",2)
for mask in ERRORS.values():
damaged = BOOK[VALUE] ^ mask
assert damaged ^ ERRORS[syndrome(damaged)] == BOOK[VALUE]
result = AerSimulator(method="stabilizer").run([circuit(k) for k in NAMES], shots=SHOTS, seed_simulator=SEED).result()
rows = {k:score(k,result.get_counts(i)) for i,k in enumerate(NAMES)}
assert all(r["bit_errors"] == {0:SHOTS} for r in rows.values())
fake = FakeKingston()
paths = layout(fake)
ops = {k:dict(compile_circuit(fake,k,paths[k]).count_ops()) for k in NAMES}
save(SIM, dict(shots=SHOTS, analysis=rows, native_ops_on_snapshot=ops, verified_error_masks=len(ERRORS)))
print(rows)
def hardware():
rec = load(HW)
if rec.get("analysis"):
return
assert load(SIM)["verified_error_masks"] == 2325
save(STATUS, {"stage":"waiting for private key"})
key = getpass.getpass("IBM Cloud API key for Kingston (hidden): ").strip()
if not key:
save(STATUS, {"stage":"cancelled"})
return
save(STATUS, {"stage":"connecting"})
service = QiskitRuntimeService(channel="ibm_quantum_platform", token=key, plans_preference=["open"], region="us-east")
backend = service.backend("ibm_kingston")
circuits = []
if not rec:
paths = layout(backend)
circuits = [compile_circuit(backend,k,paths[k]) for k in NAMES]
rec = dict(backend=backend.name, order=NAMES, physical_paths_lsb_first=paths,
input_codewords={k:format(w,f"0{n}b") for k,(n,w) in WORDS.items()},
native_ops=[dict(q.count_ops()) for q in circuits])
rec = execute(service, backend, HW, TAG, rec, lambda:circuits)
rec["analysis"] = {k:score(k,c) for k,c in zip(NAMES,rec["counts"],strict=True)}
save(HW,rec)
save(STATUS, {"stage":"finished"})
if __name__ == "__main__":
if sys.argv[1:] == ["simulate"]:
simulate()
if sys.argv[1:] == ["hardware"]:
logging.disable(logging.CRITICAL)
try:
hardware()
except Exception as exc:
save(STATUS, {"stage":"error", "type":type(exc).__name__,
"frames":[f.name for f in traceback.extract_tb(exc.__traceback__)]})
raise SystemExit(1)
Personal comments
Personal comments will be added here.