Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow OBSERVABLE_INCLUDE to target Pauli terms #853

Merged
merged 8 commits into from
Jan 23, 2025
Merged

Conversation

Strilanc
Copy link
Collaborator

@Strilanc Strilanc commented Nov 11, 2024

There are two use cases driving this change:

  1. Magic state injection needing requiring partially deterministic observables
  2. Simulating all observables of a code without needing to add noiseless ancilla qubits to the circuit

This change allows observables to be split into pieces (e.g. obs 1 for the first half of the circuit and obs 2 for the second half, with the "true" observable their xor). The flip of each individual piece can even be recovered when using flip simulation, if stabilizer randomization is disabled.

This change allows finer control over the logical labels that appear in the detector error model. For example:

import stim
assert stim.Circuit("""
    OBSERVABLE_INCLUDE(0) X0
    OBSERVABLE_INCLUDE(1) Y0
    OBSERVABLE_INCLUDE(2) Z0
    X_ERROR(0.125) 0
    Y_ERROR(0.25) 0
    Z_ERROR(0.375) 0
    OBSERVABLE_INCLUDE(0) X0
    OBSERVABLE_INCLUDE(1) Y0
    OBSERVABLE_INCLUDE(2) Z0
""").detector_error_model() == stim.DetectorErrorModel("""
    error(0.375) L0 L1
    error(0.25) L0 L2
    error(0.125) L1 L2
""")

There are two use cases driving this change:

1. Magic state injection needing requiring partially deterministic observables
2. Simulating all observables of a code without needing to add noiseless ancilla qubits to the circuit

This change allows observables to be split into pieces (e.g. obs 1 for the first half of the circuit and obs 2 for the second half, with the "true" observable their xor). The flip of each individual piece can even be recovered when using flip simulation, if stabilizer randomization is disabled.

This change allows finer control over the logical labels that appear in the detector error model. For example:

```
import stim
assert stim.Circuit("""
    OBSERVABLE_INCLUDE(0) X0
    OBSERVABLE_INCLUDE(1) Y0
    OBSERVABLE_INCLUDE(2) Z0
    X_ERROR(0.125) 0
    Y_ERROR(0.25) 0
    Z_ERROR(0.375) 0
    OBSERVABLE_INCLUDE(0) X0
    OBSERVABLE_INCLUDE(1) Y0
    OBSERVABLE_INCLUDE(2) Z0
""").detector_error_model() == stim.DetectorErrorModel("""
    error(0.375) L0 L1
    error(0.25) L0 L2
    error(0.125) L1 L2
""")
```
@Strilanc Strilanc changed the title [WIP] Allow OBSERVABLE_INCLUDE to target Pauli terms Allow OBSERVABLE_INCLUDE to target Pauli terms Jan 22, 2025
@Strilanc Strilanc merged commit 3751bef into main Jan 23, 2025
57 checks passed
@Strilanc Strilanc deleted the obstargetpaulis branch January 23, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant