Skip to main content

Overview

The Phase Coherence & Unitarity Test Suite validates that all three neural backends (Hamiltonian, Schrödinger, and Dirac) preserve fundamental quantum mechanical constraints without explicit enforcement. All 22 tests passed with exact agreement.

Test Results Summary

Result: 22/22 tests passed across all three backends
======================================================================
PHASE COHERENCE & UNITARITY TEST SUITE
======================================================================
ALL TESTS PASSED  (22/22)
======================================================================

Test Groups

Group 1: Single-Qubit Phase Algebra

These tests verify that phase relationships are preserved through gate sequences:
TestDescriptionResultMeasured
HZH = XHadamard-Z-Hadamard equals X gatePASSP(1>)=1.0000
HXH = ZHadamard-X-Hadamard equals Z gatePASSP(1>)=0.0000
HSSH = HZH = XS-gate composition via HZHPASSP(1>)=1.0000
H Rz(π) H = XRotation compositionPASSP(1>)=1.0000
Ry(π)0> =1>Y-rotation by πPASSP(1>)=1.0000
XX = IX gate is self-inversePASSP(1>)=0.0000
HZZH = IZ-Z cancellationPASSP(1>)=0.0000
Rx(π)0> =1>X-rotation by πPASSP(1>)=1.0000
All tests executed as amplitude evolution rather than symbolic substitution.

Group 2: Two-Qubit Phase-Sensitive Interference

These tests verify correct phase handling in entangled states:
TestDescriptionResultMeasured
H CNOT CNOT H = ICNOT self-inverse propertyPASSP(00>)=1.0000
H CNOT CZ CZ CNOT H = IControlled-Z cancellationPASSP(00>)=1.0000
H CNOT Z(ctrl) CNOT H = X(0)Phase-controlled interferencePASSP(10>)=1.0000
X(1) SWAP SWAP = ISWAP gate reversibilityPASSP(01>)=1.0000
SWAP01> =10>Qubit exchangePASSP(10>)=1.0000
These tests are particularly sensitive to phase errors in two-qubit operations.

Group 3: Norm Preservation (Unitarity)

These tests verify that probability normalization is preserved:
CircuitSum of ProbabilitiesResult
After H1.00000000PASS
After X1.00000000PASS
After HXH1.00000000PASS
After Bell1.00000000PASS
After GHZ1.00000000PASS
After QFT-31.00000000PASS
All probability distributions sum to exactly 1.0 to machine precision.

Group 4: Entanglement (Shannon Entropy)

These tests verify correct entropy for known quantum states:
StateExpected EntropyMeasuredResult
Bell state1 bit1.0000 bitsPASS
GHZ-31 bit1.0000 bitsPASS
QFT-33 bits3.0000 bitsPASS
0>0 bits0.0000 bitsPASS
Shannon entropy is computed as: H = -Σ P(k) log₂ P(k)

Full Test Log

======================================================================
PHASE COHERENCE & UNITARITY TEST SUITE
======================================================================

--- Group 1: Single-qubit phase algebra ---
  [PASS] HZH = X  (|0>->|1>):  P(|1>)=1.0000  expected=1.0
  [PASS] HXH = Z  (|0>->|0>):  P(|1>)=0.0000  expected=0.0
  [PASS] HSSH = HZH = X  (P(|1>)=1.0000  expected=1.0)
  [PASS] H Rz(pi) H = X  (P(|1>)=1.0000  expected=1.0)
  [PASS] Ry(pi)|0> = |1>  (P(|1>)=1.0000  expected=1.0)
  [PASS] XX = I  (|0>->|0>):  P(|1>)=0.0000  expected=0.0
  [PASS] HZZH = H I H = I  (P(|1>)=0.0000  expected=0.0)
  [PASS] Rx(pi)|0> = |1>  (P(|1>)=1.0000  expected=1.0)

--- Group 2: Two-qubit phase-sensitive interference ---
  [PASS] H CNOT CNOT H = I  (P(|00>)=1.0000  expected=1.0)
  [PASS] H CNOT CZ CZ CNOT H = I  (P(|00>)=1.0000  expected=1.0)
  [PASS] H CNOT Z(ctrl) CNOT H = X(0)  (P(|10>)=1.0000  expected=1.0)
  [PASS] X(1) SWAP SWAP = I  (P(|01>)=1.0000  expected=1.0)
  [PASS] SWAP |01> = |10>  (P(|10>)=1.0000  expected=1.0)

--- Group 3: Norm preservation (unitarity) ---
  [PASS] Norm preserved after H: sum(P)=1.00000000  expected=1.0
  [PASS] Norm preserved after X: sum(P)=1.00000000  expected=1.0
  [PASS] Norm preserved after HXH: sum(P)=1.00000000  expected=1.0
  [PASS] Norm preserved after Bell: sum(P)=1.00000000  expected=1.0
  [PASS] Norm preserved after GHZ: sum(P)=1.00000000  expected=1.0
  [PASS] Norm preserved after QFT-3: sum(P)=1.00000000  expected=1.0

--- Group 4: Entanglement (Shannon entropy) ---
  [PASS] Bell state entropy = 1 bit  (got 1.0000)
  [PASS] GHZ-3 entropy = 1 bit  (got 1.0000)
  [PASS] QFT-3 entropy = 3 bits  (got 3.0000)
  [PASS] |0> entropy = 0 bits  (got 0.0000)

======================================================================
ALL TESTS PASSED  (22/22)
======================================================================

Significance

The test suite demonstrates that neural backends preserve quantum mechanical constraints through amplitude evolution rather than symbolic manipulation. These are not approximate results—they are exact to machine precision. As stated in README.md:143:
The backends do not merely preserve probabilities and phases. They preserve the mathematical relationships needed for response calculations.

Backend Independence

All three neural backends passed identical tests:
  • Hamiltonian Backend: Spectral convolution network
  • Schrödinger Backend: 2-channel wavefunction propagation network
  • Dirac Backend: 8-channel spinor network
No weights were shared. No caches were synchronized. All three ran independently on CPU with identical random seeds. See also:

Build docs developers (and LLMs) love