The library:
- Tableau::measure measures a qubit of the wide tableau and leaves the state
the outcome selects; a random outcome is the caller's to choose, so a
branch can be followed on purpose. The anticommuting stabilizer is
multiplied into every other row at once, each row's phase summed mod 4 in
two bit planes. Tableau::is_random answers in one column scan.
- StateVector::probability_one (fixed-chunk sum) and StateVector::collapse.
- Tests: against the state vector's projection over 60 random circuits of six
measurements each; on wide tableaux, measuring every qubit lands in the
support held before, one random outcome per dimension. Mutants caught:
signs kept, Y phase swapped, destabilizer not moved.
The service:
- reads measurement and reset anywhere, if/else on measured bits (bit,
!bit, ==, !=, OpenQASM 2's if(c==n)), and `bit b = measure q;`. A program
that needs them is kept as steps (qasm::Instr); every other program is
exactly what it was.
- runs such a program on statevector or stabilizer (src/dynamic.rs): counts
split their shots at each measurement and reset as independent shots
would, each outcome running on in its own copy; expectation values are the
exact mixture over the branches, of the state before the final
measurements. Noise in such a program, amplitudes of one, and loops are
refused with their reasons.
- Tests: teleportation (<Z> = cos θ, <X> = sin θ exactly; the tableau and the
state vector agree), reset and re-measurement, a bit-flip syndrome that
corrects the flip, the step structure with its jumps, the planner. Mutants
caught: terminal measurements made, a branch's outcome swapped, reset
without its flip, condition bits reversed.
Lockfiles: wai-quantum 0.6.5 in every workspace that pins it; cargo's
rewrite of wai-rs's also re-picks two Windows-only edges (windows-sys
0.52, getrandom 0.3), both already in the lock.
Co-Authored-By: Claude Opus 5.5 <[email protected]>