PureOne's picture
Release VSCE v6.0: manuscript, proofs, reproducible evidence and 10 research tables
347a3de verified
Raw History Blame Contribute Delete
8.1 kB
"""Small, auditable quantum-adapter checks for the rebuilt VSCE release.
This checks algebra and Fock-cutoff diagnostics. It does not simulate an
adiabatic dissipative gate or demonstrate a hardware/AI advantage.
"""
from __future__ import annotations
import argparse
import json
from pathlib import Path
import numpy as np
from scipy.special import gammaln
from scipy.stats import poisson
def annihilation(dim: int) -> np.ndarray:
return np.diag(np.sqrt(np.arange(1, dim)), k=1).astype(complex)
def coherent(alpha: complex, dim: int) -> np.ndarray:
n = np.arange(dim)
if alpha == 0:
vec = np.zeros(dim, dtype=complex)
vec[0] = 1
return vec
vec = np.exp(-abs(alpha) ** 2 / 2 + n * np.log(complex(alpha)) - gammaln(n + 1) / 2)
return vec
def cat(alpha: complex, dim: int, parity: int) -> np.ndarray:
vec = coherent(alpha, dim)
mask = np.arange(dim) % 2 == parity
vec = np.where(mask, vec, 0)
return vec / np.linalg.norm(vec)
def wrap_phase(phi: float) -> float:
return float(np.angle(np.exp(1j * phi)))
def cat_holonomy(a_squared: float, steps: int = 4096) -> dict:
dim = max(32, int(np.ceil(a_squared + 12 * np.sqrt(a_squared + 1) + 16)))
n = np.arange(dim)
alpha = np.sqrt(a_squared)
dtheta = np.pi / steps
numeric = []
means = []
for parity in (0, 1):
start = cat(alpha, dim, parity)
# Exact equidistant quadrature of the Pancharatnam connection. The
# endpoint overlap matters: the odd cat acquires a minus sign.
overlap_step = np.sum(abs(start) ** 2 * np.exp(1j * n * dtheta))
endpoint = np.vdot(start, start * np.exp(1j * n * np.pi))
numeric.append(wrap_phase(np.angle(endpoint) - steps * np.angle(overlap_step)))
means.append(float(np.vdot(start, n * start).real))
mean_even = a_squared * np.tanh(a_squared)
mean_odd = a_squared / np.tanh(a_squared)
defect = 2 * np.pi * a_squared / np.sinh(2 * a_squared)
relative = np.pi - defect
numeric_relative = wrap_phase(numeric[1] - numeric[0])
error = abs(wrap_phase(numeric_relative - relative))
assert error < 2e-5, (a_squared, error)
assert max(abs(means[0] - mean_even), abs(means[1] - mean_odd)) < 1e-11
return {
"A": float(a_squared), "fock_dimension": dim,
"phase_steps": steps, "mean_n_even": float(mean_even),
"mean_n_odd": float(mean_odd),
"ideal_relative_phase_radians": float(relative),
"phase_defect_from_pi_radians": float(defect),
"overlap_quadrature_relative_phase_radians": numeric_relative,
"wrapped_absolute_quadrature_error": error,
"single_photon_parity_jump_rates_per_kappa1": [float(mean_even), float(mean_odd)],
"assumption": "Ideal adiabatic dark-subspace transport; no dissipative gap certified.",
}
def gram_projector_check() -> dict:
roots = np.array([1.7 + 0.3j, -1.2 + 0.9j, 0.1 - 1.8j])
dim = 72
synthesis = np.column_stack([coherent(alpha, dim) for alpha in roots])
gram = synthesis.conj().T @ synthesis
analytic = np.exp(-abs(roots[:, None]) ** 2 / 2 - abs(roots[None, :]) ** 2 / 2
+ roots[:, None].conj() * roots[None, :])
projector = synthesis @ np.linalg.solve(gram, synthesis.conj().T)
identity_error = float(np.linalg.norm(projector @ projector - projector))
hermitian_error = float(np.linalg.norm(projector - projector.conj().T))
gram_error = float(np.linalg.norm(gram - analytic))
assert max(identity_error, hermitian_error, gram_error) < 1e-12
return {
"roots": [[float(z.real), float(z.imag)] for z in roots],
"fock_dimension": dim, "gram_condition_number": float(np.linalg.cond(gram)),
"gram_vs_exact_frobenius_error": gram_error,
"projector_idempotence_frobenius_error": identity_error,
"projector_hermiticity_frobenius_error": hermitian_error,
"projector_trace": float(np.trace(projector).real),
"logical_dimension": len(roots),
"ideal_dark_operator_space_dimension": len(roots) ** 2,
}
def cutoff_check(alpha: complex = 2.0, dimensions=(12, 20, 32, 48, 64)) -> list[dict]:
rows = []
A = abs(alpha) ** 2
for dim in dimensions:
ladder = annihilation(dim)
jump = ladder @ ladder - alpha ** 2 * np.eye(dim)
unnormalized = coherent(alpha, dim)
vec = unnormalized / np.linalg.norm(unnormalized)
residual = float(np.linalg.norm(jump @ vec))
mass = poisson.cdf(dim - 1, A)
predicted = float(A * np.sqrt((poisson.pmf(dim - 2, A) + poisson.pmf(dim - 1, A)) / mass))
eigenvalue_error = float(np.max(abs(np.linalg.eigvals(jump) + alpha ** 2)))
sign, logdet = np.linalg.slogdet(jump)
expected_logdet = dim * np.log(abs(alpha) ** 2)
assert abs(logdet - expected_logdet) < 1e-10
assert abs(residual - predicted) < 2e-13
assert eigenvalue_error < 1e-12
rows.append({
"fock_dimension": dim, "A": A,
"discarded_poisson_probability": float(poisson.sf(dim - 1, A)),
"normalized_coherent_jump_residual": residual,
"analytic_boundary_residual": predicted,
"minimum_jump_singular_value_float64": float(np.linalg.svd(jump, compute_uv=False)[-1]),
"log_abs_determinant": float(logdet),
"exact_all_jump_eigenvalues": [-float((alpha ** 2).real), -float((alpha ** 2).imag)],
"exact_kernel_dimension": 0,
"note": "Triangular jump has nonzero diagonal −alpha²; tiny singular values are near-dark behavior, not an exact finite-cutoff kernel.",
})
assert rows[0]["normalized_coherent_jump_residual"] > rows[-1]["normalized_coherent_jump_residual"]
return rows
def displacement_identity_check() -> dict:
# Verify the Weyl identity on coherent matrix elements analytically rather
# than exponentiating a cutoff ladder, whose CCR fail at the boundary.
alpha = 0.7 + 0.4j
b = -0.2 + 0.3j
dim = 64
lhs = coherent(alpha + b, dim)
a = annihilation(dim)
residual = float(np.linalg.norm((a - (alpha + b) * np.eye(dim)) @ lhs))
assert residual < 1e-12
return {"coherent_eigenvector_residual_at_shifted_root": residual,
"scope": "Checks shifted coherent root only. Exact displacement transport proof is algebraic in the untruncated oscillator."}
def shifted_dissipator_identity_check() -> dict:
dim = 7
rng = np.random.default_rng(61903)
sample = rng.normal(size=(dim, dim)) + 1j * rng.normal(size=(dim, dim))
rho = sample @ sample.conj().T
rho = rho / np.trace(rho)
ladder = annihilation(dim)
pair = ladder @ ladder
c = 1.3 + 0.7j
def dissipator(jump, state):
square = jump.conj().T @ jump
return jump @ state @ jump.conj().T - (square @ state + state @ square) / 2
h = 0.5j * (c * pair.conj().T - c.conjugate() * pair)
lhs = dissipator(pair - c * np.eye(dim), rho)
rhs = dissipator(pair, rho) - 1j * (h @ rho - rho @ h)
error = float(np.linalg.norm(lhs - rhs))
assert error < 1e-12
return {"fock_dimension": dim, "frobenius_identity_error": error,
"scope": "Exact matrix identity only; does not validate a device reduction or quantum gate."}
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--output", default=str(Path(__file__).with_name("quantum_checks.json")))
args = parser.parse_args()
output = {
"status": "Analytic adapter sanity checks passed; no hardware demonstration or gap certification.",
"cat_holonomy": [cat_holonomy(A) for A in (0.25, 0.5, 1, 2, 4, 6, 9)],
"coherent_gram_projector": gram_projector_check(),
"finite_cutoff": cutoff_check(),
"shifted_root": displacement_identity_check(),
"shifted_dissipator_identity": shifted_dissipator_identity_check(),
}
Path(args.output).write_text(json.dumps(output, indent=2) + "\n")
print(f"Quantum algebra checks passed; saved {args.output}")
if __name__ == "__main__":
main()