Return to the full study

KEDDEH SYSTEMS · QUANTUM-CANDIDATE · R1 · 18 October 2026

P15/A15 bounded input-admission repair proposal

Reading edition · 18 October 2026. This complete technical text retains the original findings and formulas. Local artifact locations are shown by clean file labels; exact locations, identities and the unchanged original text remain in the source record. No original runtime or receipt is modified.

Status: tested local proposal; not installed, deployed, or physically validated.

Exact source and immutable boundary

Reproduced defects and bounded result

Original nominal self-tests: 9/9 pass. The original code also reproduces four adverse outcomes:

1. A matrix containing NaN is incorrectly reported unitary, and applying it yields a nonfinite state norm.
2. K_POS.measure(-0.1) returns outcome 0 with probability 0.
3. K_NEG.measure(1) returns outcome 1 with probability 0.
4. A normalized state [1/sqrt(2), 1/sqrt(2), 0] has cumulative total 0.9999999999999998; draw 0.9999999999999999, which is valid, falls through to the original trailing-zero index.

The proposed module passes 62/62 independent grouped checks. The complete original self-test result, nominal arrays, complex phases, finite arithmetic outputs, labels and representative measurement results are compared exactly, without loosening tolerances. The receipt distinguishes the 9 built-in tests from the 62 independent checks; these are not 71 wholly independent experiments.

Function-level change contract

1. Shared admission predicates

Add finiteComplex(z): true only for an object with finite primitive-number re and im components.

Add squareMatrix(U, n): require a nonempty Array of exactly n Array rows, each of exactly n entries. Check rows by index so holes cannot evade .some().

Add finiteMatrix(U): check every coordinate by index with finiteComplex, including holes. Call only after the shape has been checked.

Do not change complex arithmetic helpers, EPS (1e-10), gate tables or unitarity tolerance (1e-9).

2. KQuantumState.constructor(amplitudes, labels=null)

Keep the existing C(x.re,x.im) conversion and defaulting. After it, and after the existing empty-vector guard, reject any resulting nonfinite complex coefficient with E_NONFINITE_AMPLITUDE. Iterate over all entries, so a hole is rejected.

Keep label handling, normalization order and scalar arithmetic unchanged. The existing all-zero/near-zero guard remains norm < EPS and raises E_ZERO_VECTOR. This proposal does not silently convert that existing threshold into an exact-zero-only predicate.

Compatibility detail: the original constructor's Number conversion remains; for example finite numeric strings in amplitude inputs still convert, and omitted im still defaults to 0. Matrix inputs require actual finite number components, because they were never passed through C on admission.

3. norm2() / norm()

Compute the existing reduction in the same order. If the resulting squared norm is not finite, throw E_NONFINITE_NORM before returning it. This catches both nonfinite propagation and overflow from finite coefficients. norm() continues to take the square root of this admitted squared norm.

No rescaling trick is added to admit huge coefficients whose existing arithmetic overflows. Rejection is deliberately bounded and preserves ordinary numeric output.

4. apply(U) remains the general conditional-map API

Do not add a blanket unitarity requirement to this method. A finite nonunitary map may have a valid nonzero conditional output. This method alone does not supply a complete measurement instrument, a success probability, a CPTP-channel proof, or a physically implementable operation.

5. New applyUnitary(U) is the explicit gate API

If unitary(U) is false, throw E_NONUNITARY_GATE; otherwise call the existing admitted apply(U). A unitary matrix of the wrong state dimension is still rejected by apply with E_DIM.

Route the built-in Hadamard and CNOT calls inside bell(), plus the Hadamard call in selfTest(), through applyUnitary. No changes to their results or self-test wording are intended. External callers which specifically claim unitary gate evolution must use the gate API or explicitly call the predicate before applying. Existing callers of apply continue to receive its general conditional-map contract.

6. unitary(U) is a total predicate for ordinary plain-data matrix inputs

Return false for invalid array shape, holes, nonnumeric coefficients, NaN, and either infinity. Only then form the unchanged U†U. Return false if any Gram-matrix component is nonfinite, even when all input components were finite. Only then apply the original elementwise 1e-9 tolerance.

The earlier bug arose because Math.abs(NaN) > tolerance is false. An explicit finite check must precede those comparisons.

No deep freezing, arbitrary accessor execution containment, or hostile Proxy hardening is claimed. The data contract is ordinary arrays and complex-number records.

7. measure(sample=Math.random())

Measurement remains a sampled outcome plus conditional successor; it is not required to be unitary. The rounding fallback is numerical admission behavior, not a claim of experimentally measured Born statistics.

Independent test coverage

verify-proposal.mjs checks:

A portable selection of critical independent vectors is in test-vectors.json. The complete executable assertions are in the verification runner. Tagged special numeric values in the JSON must be decoded as specified; a string "NaN" is not the numeric NaN vector.

Reproduction and later authoring

Run from the workspace root:

node verify-proposal.mjs

The only written outputs are inside this proposal directory: candidate-p15-runtime.js and verification-receipt.json. proposal-transform.mjs requires the exact original SHA before changing a string in memory, and requires each replacement context to occur exactly once.

For later authorized KEX compiler/bootstrapper/assembler authoring, the transformed module is a candidate input, not an installed repair. The actual authoring route must retain the original source identity, produce a new identity, rerun these vectors on the assembled runtime, validate its full-host integration, and obtain fresh target-runtime readback before promotion. This local receipt must not be substituted for such a readback.

Qualification boundary

This proposal repairs input admission and a numerical sampling edge in the existing bounded reference state-vector simulator. It does not establish a native quantum substrate, quantum hardware execution, physical equivalence, or universal unitarity of all quantum operations. It preserves the distinction among reversible unitary gates, general finite conditional maps, and measurement successors.

Active reader and source records

Open this paper in its own source-bound Keddeh runtime to keep a working note, inspect its local parent and reconstruct the reader state.

Open active reader · Exact manuscript · Download public source records

The full manuscript and admitted source records are included. Original-source references retain their stated access conditions.

Manuscript SHA-256: bc43630bddbb973bea66eba01392e40dd6bcf15a9aea893b4e6cca9d8a675e44. Public delivery edition R1; complete owner edition 6a8188d6e0ebe0d9e6bb3929a19e09e4d58df90526aa3e621ba0fb58473773d5.