Conversation
|
Two independent adversarial reviews (blind arms), both REVISE, with heavily convergent findings -- and one arm's 400-seed differential fuzz validated the StabVec collapse fix decisively (0/400 failures on this branch versus 197/400 on dev, including the exact Confirmed and fixedThe checker flip-ledger retained MPZ entries on a live wire (both arms, HIGH). MPZ hands back a usable |0> wire, so a retained ledger X spread through later gates as a phantom -- and the fused gate disagreed with its own The dispatch sweep's blind spot was real (both arms; the review prompt asked for exactly this hunt). Sites keyed on explicit Fixing the sampler lane surfaced one more real defect: the QASM export mangled MPZ into literal
Docs: the Deliberately unchanged, with reasons
VerificationAt the pushed commit: cold |
Phase 1 of #412: first-class measure-and-prepare in the core gate set.
GateType::MPZ(measure +Z, then prepare |0>) exists end to end -- gate type, builders, propagation, execution -- so circuits no longer spell the fused hardware operation as two gates, andCliffordGateable::mpzis reachable from the circuit layer for the first time.What MPZ is, at every layer
GateType::MPZ = 107,consumes_measurement_record() == true(it records likeMZ),Gate::mpz, validate rules, display/diagram entries.DagCircuit::mpz/try_mpzandTickCircuittick handlempz(), returning measurement refs exactly likemz()-- ids mint through the shared predicate, so annotations, conversions, and resolution work unchanged.cross_measurement): nothing crosses in either direction -- the record flip is taken by the walker before the crossing, then the built-in preparation absorbs the error forward and blocks observables backward. Discriminators pin it: an X before an MPZ flips its readout and nothing after the reset; the checker flip-ledger keeps the recorded flip readable (its built-in preparation deliberately does not clear the ledger, mirroringMeasureFree).sim.mpz; ByteMessage gains thempzbuilder; the symbolic replay, hidden-measurement synthesis, and fault-catalog history lower it as measure-then-prepare; eeg's expansion lowers it to its measurement-plus-projection form. Thepecos-neoruntime and HUGR/QASM translators refuse it loudly (their vocabularies are later First-class measure-and-prepare (MP*) across the gate sets #412 phases).mpzand themz; pzidiom build byte-identical eeg DEMs atp_prep = 0, and a three-engine execution test pinsX; MPZ; MZ -> [1, 0].Noise: consistency over fidelity, deliberately
Every noise path models MPZ as the measurement-half fault only (a fault before the readout). The engines runtime, both DEM builders, and eeg therefore agree with each other; the prepare-half fault arrives for all of them at once with #412's dedicated measure-prepare channel, which also needs the after-location the location model does not yet give measurements. Until then, the split spelling's explicit reset draws preparation noise the fused gate does not -- the equivalence test documents this and tests at
p_prep = 0.A simulator bug this surfaced and fixes
Making
mpzreachable exposed thatStabVechad the #394 defect at the simulator level: its diagonal-frame measurement shortcut flipped the reported outcome while collapsing the stored, unflipped eigenstate and discarding the frame -- soX; MZ; MZread[1, 0]where the state-vector ground truth reads[1, 1], and the default measure-and-prepare correction composed against the wrong state. Latent for the usual reason: re-prepared ancillas never re-measure. The projection now re-aligns the state with the report (collapse projects; it does not reset), pinned by regressions for both the bare repeated measurement and thempzcorrection.Scope and follow-ups (recorded on #412)
Vocabulary surfaces deliberately out of phase 1: Python bindings (
run_gatedispatch, tick/dag binding methods), SLR/PHIR/QIS/Guppy/QASM translators, thepecos-neogate set, the dedicated measure-prepare noise channel, and theMPX/MPYfamily plus theMeasureFree -> MZFreerename candidate. Everything unreachable refuses loudly rather than guessing.Verification
Cold
cargo clippy --locked --workspace --all-targets -- -D warningson a fresh target dir,cargo fmt --check, the CI-shapedcargo testset, both extensions rebuilt, the full Python lane withCARGO_TARGET_DIRunset, the #391 DEM ordering harness, and pre-commit -- all green at the pushed commit. Mutations killed by named tests: MPZ crossing behaves likeMZ(keeps X), eeg passes MPZ through unlowered, and all three executor arms run it as a plainmz(no reset) -- each caught, plus the StabVec collapse regressions.