Ana içeriğe geç
NM-RFC-0016

QEC deneyleri ve tur izleri

Tasarım belgesi · Özgün kaynak

RFC'ler tasarım ve değişiklik kayıtlarıdır. Bir önerinin burada bulunması, özelliğin kullanıma hazır olduğu anlamına gelmez. Güncel dil desteğini incele

Özgün belgedeki durum: Öneri

Bağlı özgün kaynak · SHA-256
5d6fb056339d8726223d2011cd52afd7202fb6b97f9a37aea607e168f6915f42

  • Status: proposed
  • Revision: 1 (2026-08-09)
  • Target contract: 0.1.0-experimental
  • Feature flag: experimental.qecExperiments=true
  • Owners: language, runtime, verification, product
  • Depends on: NM-RFC-0011 feed-forward, Algorithm Pack 0.4 QEC correction artifacts
  • Does not change: stochastic @noise, stabilizer/statevector ceilings, hardware claims, or fault-tolerance readiness

1. Summary

N/M already has two separate QEC-adjacent surfaces:

  • stochastic, global @noise(model, probability) simulation; and
  • exact, algebraically verified single-error correction maps in Algorithm Pack 0.4.

Neither surface defines a structured error schedule, a round trace, decoder identity, or a logical-state invariant result. This RFC adds a closed, explicitly negotiated experiment declaration that evaluates the existing exact correction artifacts without pretending to be a noisy threshold simulation:

nm
qec experiment steane_rounds {
  code: qec.steane7_code@0.4;
  rounds: 3;
  inject round 1 X(q[2]);
}

The declaration produces a deterministic artifact containing every round's injection, syndrome, selected correction, residual class, logical invariant, and decoder provenance. It is a discrete algebraic experiment, not a quantum trajectory or hardware run.

2. Goals

  • Bind an experiment to one exact-version, built-in QEC correction artifact.
  • Define one to eight compile-time rounds.
  • Permit at most one supported single-qubit Pauli injection per round.
  • Produce a complete round trace with exact syndrome/correction provenance.
  • State the logical invariant only inside the artifact's published single-error model.
  • Carry the result through Core, token structural frontend, CLI, Worker, Playground, docs, and the QEC Lab.
  • Reject exporters and combinations that cannot preserve the experiment.

3. Non-goals

  • Stochastic sampling, threshold estimation, logical error rates, decoder benchmarking, correlated noise, leakage, crosstalk, erasure, or calibration.
  • Multiple physical errors in one correction round.
  • Repeated syndrome extraction circuits, ancilla reset, measurement latency, or hardware feed-forward.
  • Claiming that a correction-map result is a decoded quantum state.
  • Extending @noise or allowing @mitigation to reinterpret this artifact.
  • Publishing a stable QEC language surface.

4. Closed grammar

ebnf
qec-experiment = "qec" "experiment" identifier "{" experiment-item* "}" ;
experiment-item = code-item | rounds-item | injection-item ;
code-item       = "code" ":" qec-code-id "@" "0.4" ";" ;
rounds-item     = "rounds" ":" integer ";" ;
injection-item  = "inject" "round" integer pauli "(" "q" "[" integer "]" ")" ";" ;
pauli           = "X" | "Y" | "Z" ;

The closed code identifiers are:

  • qec.perfect5_code@0.4
  • qec.steane7_code@0.4
  • qec.surface_d3_patch@0.4
  • qec.repetition_code25@0.4

Every integer is a source literal in revision 1. Runtime expressions, aliases, package ranges, omitted versions, and imported user decoders are invalid.

5. Schedule rules

  • rounds is required and must be in 1..8.
  • code is required exactly once.
  • Each round index is in 0..rounds-1.
  • At most one injection may target a round.
  • The qubit index must address a data qubit in the selected artifact.
  • The 25-qubit repetition-code artifact accepts only X; the other frozen artifacts accept X, Y, and Z.
  • A round without an injection has the all-zero syndrome and no correction.
  • Experiment declarations cannot coexist with @noise or @mitigation.

The one-error-per-round restriction is semantic, not a UI default. A future multi-error contract requires a new revision and new verification evidence.

6. Normative evaluation

For every injected error label Pq, the compiler looks up the unique verified correction-map entry whose corrects set contains that label. It records:

  1. the exact syndrome;
  2. the artifact-selected representative correction;
  3. that the injected error times the correction is in the stabilizer class, as already proven when the correction artifact was built; and
  4. logicalInvariant = holds-within-published-model.

No matrix/statevector execution is inferred. A missing entry is a compiler error, not an uncorrected runtime result. Clean rounds record the zero syndrome and logicalInvariant = holds-clean-round.

7. Typed artifact

The program metadata is closed and contains:

  • contract version and RFC id;
  • experiment name, source line, exact code/package identity, round count, and error model;
  • ordered injection schedule;
  • an ordered, gap-free trace for all rounds;
  • decoder provenance: correction contract, verification kind, artifact hash, generator rank, coverage, and publication state;
  • the logical invariant scope;
  • a deterministic experiment identity hash; and
  • an explicit limitation string.

The artifact contains no raw source and is recomputed from the built-in correction map before use.

8. Lowering and export

The declaration is removed before ordinary executable statements reach the simulator. Runtime output may display the compiler-produced trace, but may not recompute the correction map.

NM JSON IR may carry the typed experiment metadata. OpenQASM 2, OpenQASM 3, framework exporters, and target-native transpilation must fail closed until a versioned carrier explicitly includes this contract. They must not emit a concrete circuit and silently discard experiment provenance.

9. Diagnostics

Tablo 1
CodeMeaning
NM-QEC-EXP-001explicit negotiation required
NM-QEC-EXP-002invalid declaration or duplicate field
NM-QEC-EXP-003unknown/non-exact QEC artifact
NM-QEC-EXP-004invalid round count or round index
NM-QEC-EXP-005invalid/unsupported Pauli or data-qubit index
NM-QEC-EXP-006more than one injection in a round
NM-QEC-EXP-007incompatible stochastic noise or mitigation
NM-QEC-EXP-008artifact, trace, or lowering integrity failure

Diagnostics point to the declaration item and describe the bounded accepted form. None recommends raising runtime or hardware limits.

10. Product surface

The QEC Lab may show a three-round compiler-produced trace for the selected correction-map row. The trace must visibly distinguish:

  • scheduled injection;
  • syndrome;
  • selected correction;
  • residual stabilizer class;
  • logical invariant scope; and
  • decoder artifact hash.

The Playground deep link includes qecExperiments=1. The UI labels the result as an algebraic artifact and repeats that it is not noisy, multi-round decoder, fault-tolerance, or hardware evidence.

11. Compatibility and rollout

  1. Freeze flag-off behavior and negotiation diagnostics.
  2. Land the closed parser, artifact builder, validator, and Core/token parity.
  3. Add CLI and Worker negotiation plus deterministic output.
  4. Add QEC Lab round trace and Playground deep links.
  5. Add fail-closed IR/export/transpilation behavior.
  6. Close maximum-carrier, fuzz, EN/TR, browser, accessibility, security, and named language/runtime/product review evidence.

The RFC remains proposed and the feature remains experimental until the full evidence matrix is reviewed. Implementing revision 1 is not approval.

12. Acceptance criteria

  • Disabled syntax produces NM-QEC-EXP-001 and no executable residue.
  • Core and token structural frontends produce identical metadata.
  • Every frozen correction artifact accepts all of its published covered errors.
  • Trace length equals the declared round count and indices are gap-free.
  • Duplicate-round, out-of-range, unsupported-Pauli, invalid-qubit, non-exact package, @noise, and @mitigation cases fail closed.
  • Experiment identity is deterministic and changes when schedule/code changes.
  • CLI JSON, Worker, Playground share state, QEC Lab, spec catalog, and EN/TR content expose the same contract and limits.
  • Unsupported exporters produce NM-QEC-EXP-008 instead of dropping metadata.
  • Published text never calls the artifact a threshold, logical error rate, hardware result, or fault-tolerant decoder.