Skip to content

Commit 626c473

Browse files
authored
Clarify documentation for OBSERVABLE_INCLUDE. (#1016)
1 parent b1de042 commit 626c473

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

dev/util_gen_stub_file.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"__next__",
3838
}
3939
skip = {
40+
"__annotate_func__",
41+
"__annotations_cache__",
4042
"__firstlineno__",
4143
"__static_attributes__",
4244
"__replace__",

doc/gates.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4879,13 +4879,19 @@ detection event simulations and affect whether the observable is included in err
48794879
makes it easier to benchmark all observables of a code, without having to introduce noiseless qubits entangled with the
48804880
logical qubit to avoid the testing of the X observable anticommuting with the testing of the Z observable.
48814881

4882+
Unlike a `DETECTOR` instruction which provides a complete description of a detector by listing all its constituent
4883+
measurement records, an individual `OBSERVABLE_INCLUDE` instruction is not required to (and generally does not) fully
4884+
describe a logical observable. Instead, measurement records or Pauli targets are added to it incrementally. A logical
4885+
observable can be given both types of description: as a collection of Pauli targets and as a collection of measurement
4886+
record targets.
4887+
48824888
Parens Arguments:
48834889

48844890
A non-negative integer specifying the index of the logical observable to add the measurement records to.
48854891

48864892
Targets:
48874893

4888-
The measurement records to add to the specified observable.
4894+
The measurement records or Pauli terms to add to the specified observable.
48894895

48904896
Example:
48914897

@@ -4921,6 +4927,12 @@ Example:
49214927
OBSERVABLE_INCLUDE(0) X0 X1
49224928
OBSERVABLE_INCLUDE(1) Z0 Z2
49234929

4930+
# Stim circuit may include a description of an observable in terms of Pauli targets
4931+
# alongside a description in terms of measurement records.
4932+
OBSERVABLE_INCLUDE(0) Z0 Z1
4933+
M 0 1
4934+
OBSERVABLE_INCLUDE(0) rec[-2] rec[-1]
4935+
49244936
<a name="QUBIT_COORDS"></a>
49254937
### The 'QUBIT_COORDS' Instruction
49264938

src/stim/gates/gate_data_annotations.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,19 @@ detection event simulations and affect whether the observable is included in err
137137
makes it easier to benchmark all observables of a code, without having to introduce noiseless qubits entangled with the
138138
logical qubit to avoid the testing of the X observable anticommuting with the testing of the Z observable.
139139
140+
Unlike a `DETECTOR` instruction which provides a complete description of a detector by listing all its constituent
141+
measurement records, an individual `OBSERVABLE_INCLUDE` instruction is not required to (and generally does not) fully
142+
describe a logical observable. Instead, measurement records or Pauli targets are added to it incrementally. A logical
143+
observable can be given both types of description: as a collection of Pauli targets and as a collection of measurement
144+
record targets.
145+
140146
Parens Arguments:
141147
142148
A non-negative integer specifying the index of the logical observable to add the measurement records to.
143149
144150
Targets:
145151
146-
The measurement records to add to the specified observable.
152+
The measurement records or Pauli terms to add to the specified observable.
147153
148154
Example:
149155
@@ -178,6 +184,12 @@ Parens Arguments:
178184
DETECTOR rec[-3] rec[-6]
179185
OBSERVABLE_INCLUDE(0) X0 X1
180186
OBSERVABLE_INCLUDE(1) Z0 Z2
187+
188+
# Stim circuit may include a description of an observable in terms of Pauli targets
189+
# alongside a description in terms of measurement records.
190+
OBSERVABLE_INCLUDE(0) Z0 Z1
191+
M 0 1
192+
OBSERVABLE_INCLUDE(0) rec[-2] rec[-1]
181193
)MARKDOWN",
182194
.unitary_data = {},
183195
.flow_data = {},

0 commit comments

Comments
 (0)