### wai-quantum 0.6.5 and the service: programs that measure in the middle

Additive. Every pinned digest is unchanged, and a program that measures only at the end
runs exactly as before.

- **`Tableau::measure`** (`quantum_tableau`) 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` says
  in one column scan whether an outcome is random.
  - Tested against the state vector's projection, Pauli string by Pauli string, over 60
    random circuits of six measurements each.
  - On wide tableaux, measuring every qubit lands inside the support held before, with one
    random outcome per dimension.
  - Three mutants are caught: signs kept, the Y phase swapped, the destabilizer not moved.
- **`StateVector::probability_one` and `StateVector::collapse`** (`quantum_sv`): a qubit's
  probability of reading 1, summed in fixed chunks, and the state a reading leaves.
- **The service runs dynamic programs.** It reads measurement and `reset` anywhere,
  `if (c[0]) …`, `if (!c[0]) …`, `if (c == 3) { … } else { … }`, OpenQASM 2's
  `if(c==n) gate;`, and `bit b = measure q;`.
  - Such a program runs on `statevector` or `stabilizer`. Its shots split at each
    measurement and reset as independent shots would, and each outcome runs on in its own
    copy of the state.
  - Expectation values are the exact mixture over the branches, of the state before the
    final measurements.
  - Tests: teleportation gives ⟨Z⟩ = cos θ and ⟨X⟩ = sin θ exactly. It agrees between the
    tableau and the state vector, reset and re-measurement behave, and a bit-flip syndrome
    corrects the flip. Four mutants are caught.
  - Loops, noise in such a program, and amplitudes of one are refused with their reasons.

