Route gadget_checker propagation through the shared measurement-crossing flip ledger - #541
Open
ciaranra wants to merge 2 commits into
Open
Route gadget_checker propagation through the shared measurement-crossing flip ledger#541ciaranra wants to merge 2 commits into
ciaranra wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 2 of #411.
Problem
GadgetCheckercarried its own hand-rolled gate dispatch in two places -- the end-to-end walk (propagate_through_circuit) and the per-round syndrome-history walk (propagate_up_to_tick) -- and both treated state preparation and measurement as identity. That was a fourth opinion about measurement crossings, and a wrong one:propagate_faults-- which already uses the checker's shared flip ledger -- so a single analysis mixed two different crossing semantics.Fix
Both walks now apply every gate through
apply_gate_flip_ledger, the same end-read ledger used bypropagate_faultsand the fault-tolerance checker's own walkers: a measurement absorbs the commuting component and keeps the outcome flip readable (basis-aware, MZ and MX), and a preparation clears the wire. This also strictly widens unitary coverage -- the hand-rolled dispatch silently ignored gates outside its list, while the shared dispatch handles the full named-Clifford set plus Clifford-angle rotations.Tests
Four crossing regressions, each pinned by mutation:
a_preparation_clears_a_fault_arriving_before_it,a_measurement_absorbs_the_commuting_component, andmeasurements_keep_the_anticommuting_flip_readablekill a mutant that restores identity crossings in the end-to-end walk (and only that mutant's site).round_history_respects_measurement_and_reprep_crossingskills the same mutant applied to the history walk: an X just before round 1's readout flips round 1 and only round 1, and a Z there is harmless in every round.All 28 gadget tests pass; the 24 pre-existing ones are unchanged, confirming none of them ever exercised a measurement crossing -- which is how the defect lived this long.
Boundary noted
With one shared ledger, a fused MPZ's own-round flip is invisible to per-round reads in both this walk and the canonical checker's (
propagate_until_tickprocesses the round tick inclusively, and MPZ's reset half clears the flip before the read). That is pre-existing on the canonical side and is filed separately with evidence rather than silently choosing a model here.Verification
cargo fmt --check, coldcargo clippy --locked --workspace --all-targets -- -D warningson a fresh target, the fullpecos-qecsuite, the CI-shaped workspace test set, andpre-commit run --all-files-- all green.