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

Yinelemeli faz kestirimi

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
10faa686a7e0701a141d267ed4c67fcfe907e87b146074bb5f682ada00b1fc13

Status: proposed Revision: 1 (2026-08-11) Feature flag: experimental.iterativePhaseEstimation=true Depends on: NM-RFC-0002 exact-version imports, NM-RFC-0011 measurement-conditioned control, NM-RFC-0015 generalized circuit signatures Implementation gate: the section 12 review record is mandatory before implementation Does not change: generic QPE status, the five-qubit statevector ceiling, ctrl limits, pow expansion limits, or hardware claims

1. Purpose

Algorithm Pack 0.2 includes a fixed two-counting-qubit phase-estimation lesson. NM-RFC-0010 correctly excludes generic QPE: expanding pow(2^k) @ U repeats a circuit exponentially and does not model the direct controlled powers that make phase estimation useful.

Iterative phase estimation (IPE) is a different bounded product. It reuses one control qubit, measures it after every round, resets it, and applies a classical phase correction before the next round. This matches the narrow feed-forward model of NM-RFC-0011, but only if direct controlled powers, bit order, phase convention, resource budgets, and eigenstate preconditions are frozen.

Revision 1 defines that boundary. It creates no parser rule, runtime path, capability entry, standard-library export, provider adapter, or UI control.

2. Mathematical convention

For a normalized target eigenstate |psi> and named unitary U:

text
U |psi> = exp(2 * PI * i * phi) |psi>
0 <= phi < 1

The requested precision P produces the binary fraction 0.b1 b2 ... bP. The report stores bits most-significant first and estimates:

text
phi_hat = sum(b_k / 2^k), k = 1..P
interval width = 1 / 2^P

Phase distance is circular: min(|a-b|, 1-|a-b|). A fixture whose exact phase lies on a binary boundary must declare the accepted adjacent representation; floating-point equality is never inferred.

The algorithm does not prove that an arbitrary input is an eigenstate. An exact-version package must bind a named eigenstate-preparation circuit and the direct controlled-power family. General input states yield sampled mixture behavior and are outside the first ready range.

3. No Unitary<N> type

This RFC does not introduce a Unitary<N> value type. A phase source is one exact-version package manifest, nm-ipe-phase-source@0.1, that binds:

  • package specifier and source digest;
  • target width N;
  • named eigenstate-preparation export;
  • P named or const-specialized direct controlled-power exports;
  • gate-set and target compatibility;
  • controlled-form availability for every operation in every power;
  • concrete gate/depth/two-qubit counts for each specialization; and
  • review and verifier identities.

Each power export must directly implement controlled U^(2^k) for its stated round. The compiler must not synthesize it by repeating U 2^k times. A manifest that contains only U plus a requested pow modifier is rejected.

All circuit exports are statically named or exact-version package exports. Runtime circuit values, closures, callbacks, or network-loaded bodies are not allowed.

4. Bounded IPE plan

nm-ipe-plan@0.1 is the execution input:

json
{
  "format": "nm-ipe-plan",
  "version": "0.1",
  "phaseSource": "package.example@1.4.0::phase_source",
  "targetWidth": 1,
  "precisionBits": 3,
  "seed": 29,
  "backend": "browser-statevector"
}

Rules:

  • N and P are compile-time constants bound by the manifest;
  • revision 1 planning bounds are 1 <= N <= 4 and 1 <= P <= 8;
  • an executable ready range may be narrower and must satisfy N + 1 <= the separately published statevector ceiling;
  • the one control qubit is disjoint from the target register;
  • the seed is mandatory because each round measures a non-deterministic bit;
  • noise, mitigation, QPU targets, provider fallback, and unbounded retries are rejected; and
  • requested/effective backend and all resource totals are recorded.

The planning bounds are parser/allocation limits, not a ready-range claim.

5. Round semantics

Round order is most-significant bit to least-significant bit. For round k:

  1. the reusable control qubit is verified to be |0>;
  2. H prepares |+>;
  3. the manifest-bound direct controlled power for the round is applied;
  4. the phase correction derived only from previously measured bits is applied;
  5. H is applied;
  6. the control is measured in Z and the bit is appended in canonical order;
  7. the control is reset before the next round.

Measurement and reset are legal here because this is an algorithm, not an oracle body. The classical correction must be expressible in the accepted NM-RFC-0011 predicate/value subset and must not inspect a future bit.

Randomness consumption follows NM-RFC-0011 exactly. A deterministic measurement consumes no draw; a non-deterministic measurement consumes one. Rerunning the same source, package, plan, backend, and seed must reproduce the bit sequence.

6. Resource model

Resource accounting is performed before execution and includes:

  • eigenstate preparation;
  • every direct controlled-power specialization;
  • P Hadamard pairs, corrections, measurements, and resets;
  • target-native lowering and routing when selected; and
  • the maximum live width N + 1 + A including declared ancillas.

The existing expanded-gate, depth, two-qubit, and output budgets apply. Direct power construction avoids exponential source repetition but does not exempt a large specialized circuit from budgets. No general multi-control synthesis is added; each controlled power must stay within the accepted gate set or fail closed.

7. Verification and run artifact

nm-ipe-run@0.1 records:

  • exact plan and phase-source identity;
  • target/precision constants;
  • ordered round bits and per-round measurement probabilities;
  • correction angle used at each round;
  • requested and effective backend;
  • per-round and aggregate resources;
  • estimated phase and canonical interval;
  • seeded runtime provenance; and
  • integrity metadata.

For retained conformance fixtures only, an independent exact phase may be included in a separate verifier input. The report then stores circular error and whether it lies inside the declared precision interval. Production runs do not invent an exact phase when none is independently known.

The first verification tier is numerical and bounded: prepare the declared eigenstate, apply each direct power, and verify the expected eigenphase action within a frozen tolerance on the approved statevector range. Syntax inspection alone is early diagnosis, not proof.

8. Ready range

Revision 1 publishes no executable range. The first implementation must show at least:

  • N = 1, P = 3 for an exactly representable phase;
  • N = 1, P = 3 for a non-exact phase with the correct interval semantics;
  • N = 2, P = 3 if the package advertises two-target-qubit support;
  • deterministic seeded replay and independent numeric verification; and
  • fail-closed rejection of repeated-pow, missing controlled powers, stale package digests, and resource overflow.

If only N = 1, P <= 3 is proven, that is the published range. A wider parsing bound must never be presented as execution readiness.

9. Diagnostics

Tablo 1
CodeMeaning
NM-IPE-001feature not explicitly negotiated
NM-IPE-002target width, precision, seed, or backend is invalid
NM-IPE-003phase-source package or exact digest binding differs
NM-IPE-004a direct controlled-power export is absent or unsupported
NM-IPE-005repeated pow expansion was requested instead of a direct power
NM-IPE-006width, gate, depth, or two-qubit budget is exceeded
NM-IPE-007round order, reset state, or feed-forward dependency is invalid
NM-IPE-008numerical eigenphase verification fails
NM-IPE-009run artifact or recomputation digest differs

10. Security and failure behavior

  • Readers reject unknown fields, future versions, non-finite values, and oversized artifacts.
  • Package resolution is exact-version only; no mutable latest lookup occurs during a run.
  • A requested hardware target never falls back to a simulator.
  • A failed controlled-power verification never falls back to repeated pow.
  • Cancellation or incomplete rounds produce no complete phase estimate.
  • Source, package bodies, session state, and provider credentials are not embedded in public reports unless an explicit source-bearing local artifact contract says so.

11. Acceptance

  • Printer/IR/sidecar changes, if any, preserve round order and exact package identities without claiming generic QPE compatibility.
  • Core, CLI, Worker, Test Explorer, and UI agree on canonical IPE artifacts.
  • Seed fixtures prove the NM-RFC-0011 draw contract across reset rounds.
  • Direct-power fixtures prove that gate count follows the specialized package carrier, not 2^k source repetition.
  • Existing algorithms.phase_estimation2@0.2 remains a fixed teaching circuit.
  • Capability/runtime/Playground surfaces remain unchanged while proposed.

12. Required review record

Tablo 2
ReviewRequired decisionStatus
Language ownerphase convention, bit order, precision constants, and result semanticspending
Compiler ownerexact direct controlled-power manifest, specialization identity, and no-pow fallbackpending
Runtime ownerreset/feed-forward order, seed stream, cancellation, and bounded resource accountingpending
Verification ownernumerical eigenphase fixtures, circular error, interval semantics, and tolerancespending
Security ownerstrict readers, exact-version phase-source trust, allocation limits, and hostile inputspending
Product ownermeasured ready range, fixed lesson separation, and no generic-QPE claimpending

Approval must record reviewer identity, date, rationale, and a retained review artifact for every row. A merge, prototype, passing test, or local UI is not approval. Until every row is approved, no feature flag, parser/runtime surface, package export, capability, Test Explorer action, or lab control may be added.

13. Implementation sequence

  1. Approve phase convention, bit order, and direct-power manifest.
  2. Add strict plan/source/run readers and hostile-input fixtures.
  3. Add the one-control iterative kernel using NM-RFC-0011 semantics.
  4. Add independent numerical verification for retained phase sources.
  5. Connect CLI, Worker, Test Explorer, and an explicitly experimental lab.
  6. Publish only the measured ready range proven by the retained fixtures.