I want to simulate erasures in a surface code using stim, assuming that any gate on the data qubits can cause an erasure. If I induce erasure after each gate by the method described in How do I perform an erasure error in stim?, the loss-ancilla can be flipped an even number of times, making the even number of erasures on the same qubit unheralded. On the other hand, if I add a different loss-ancilla to any gate, it looks like over-heralding the erasure since it gives information on the specific gate where the loss occurred. Any idea?


1 Answer 1


Use a different ancilla for each erasure error, or reset the ancilla before each erasure error.

Note that now that PAULI_CHANNEL_2 exists, it's much easier to simultaneously apply the same "if this qubit was hurt, that ancilla was flipped" noise to many pairs of qubits (compared to using ELSE_CORRELATED_ERROR).

  • $\begingroup$ But wouldn't it create over-heralding, since the specific gate where the erasure occurred is heralded? $\endgroup$ Commented Feb 5, 2023 at 7:20
  • 1
    $\begingroup$ @YaronJarach Oh, I understand what you mean now. In general, Stim circuits don't support any kind of ANDing or ORing, even classically, as that goes outside the space of efficiently simulable circuits. So probably there's no way to do it other than by using stim.TableauSimulator and giving it operations one by one while generating an recording the erasure errors for yourself. $\endgroup$ Commented Feb 5, 2023 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.