Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
quantum-information
quantum-error-correction
schur-channels
semidefinite-programming
research-artifact
File size: 13,330 Bytes
1f85192 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | #!/usr/bin/env python3
"""Finite checks of exact minimax recovery for nonnegative Schur channels.
These computations supplement the mathematical proofs. They do not establish
the theorem or certify novelty. Only NumPy, SciPy, and the standard library are
required. No semidefinite optimizer or recovery-search claim is used.
"""
from __future__ import annotations
import argparse
import json
from pathlib import Path
import numpy as np
from scipy.optimize import minimize
import scipy
SEED = 20261102
TOLERANCE = 5.0e-7
def trace_norm_hermitian(matrix: np.ndarray) -> float:
matrix = (matrix + matrix.conj().T) / 2
return float(np.sum(np.abs(np.linalg.eigvalsh(matrix))))
def solve_simplex(correlation: np.ndarray) -> dict:
"""Return a feasible primal vector and a rigorous-form dual certificate.
The certificate expressions are mathematically valid for an exact feasible
vector; their floating-point evaluation is subject to roundoff. The optimizer
is never treated as a proof of optimality.
"""
dimension = len(correlation)
result = minimize(
lambda q: float(q @ correlation @ q),
np.full(dimension, 1.0 / dimension),
jac=lambda q: 2 * correlation @ q,
method="SLSQP",
bounds=[(0.0, 1.0)] * dimension,
constraints=[{"type": "eq", "fun": lambda q: float(np.sum(q) - 1),
"jac": lambda q: np.ones(dimension)}],
options={"ftol": 1e-14, "maxiter": 2000},
)
assert result.success, result.message
q = np.maximum(result.x, 0.0)
q /= np.sum(q)
upper = float(q @ correlation @ q)
lower = float(2 * np.min(correlation @ q) - upper)
gap = max(0.0, upper - lower)
assert gap < TOLERANCE
return {"q": q, "upper": upper, "lower": lower, "duality_gap": gap}
def random_recovery(dimension: int, input_dimension: int,
rng: np.random.Generator) -> list[np.ndarray]:
kraus_count = max(3, (input_dimension + dimension - 1) // dimension + 1)
gaussian = rng.normal(size=(kraus_count * dimension, input_dimension))
gaussian = gaussian + 1j * rng.normal(size=gaussian.shape)
isometry, _ = np.linalg.qr(gaussian, mode="reduced")
kraus = [isometry[i * dimension:(i + 1) * dimension, :]
for i in range(kraus_count)]
assert np.linalg.norm(sum(r.conj().T @ r for r in kraus)
- np.eye(input_dimension)) < 1e-10
return kraus
def random_recovery_fidelity(correlation: np.ndarray, q: np.ndarray,
rng: np.random.Generator) -> float:
dimension = len(correlation)
recovery = random_recovery(dimension, dimension, rng)
diagonals = np.array([np.diag(kraus) for kraus in recovery])
diagonal_gram = diagonals.T @ diagonals.conj()
fidelity = float(np.real(q @ (correlation * diagonal_gram) @ q))
return fidelity
def positive_correlation(dimension: int, branches: int,
rng: np.random.Generator) -> np.ndarray:
vectors = rng.uniform(0.001, 1.0, (branches, dimension))
vectors /= np.linalg.norm(vectors, axis=0, keepdims=True)
return vectors.T @ vectors
def verify_channel(correlation: np.ndarray, rng: np.random.Generator,
name: str, require_nonnegative: bool = True) -> dict:
dimension = len(correlation)
assert np.max(np.abs(correlation - correlation.T)) < 1e-12
assert np.max(np.abs(np.diag(correlation) - 1)) < 1e-12
assert np.linalg.eigvalsh(correlation)[0] > -1e-10
if require_nonnegative:
assert np.min(correlation) > -1e-12
solution = solve_simplex(correlation)
q, upper, lower = solution["q"], solution["upper"], solution["lower"]
difference_kernel = np.ones_like(correlation) - correlation
worst_weighted_excess = 0.0
for _ in range(16):
p = rng.dirichlet(np.ones(dimension))
weighted = np.sqrt(p)[:, None] * difference_kernel * np.sqrt(p)[None, :]
norm = trace_norm_hermitian(weighted)
worst_weighted_excess = max(worst_weighted_excess, norm - 2 * (1 - lower))
assert norm <= 2 * (1 - lower) + TOLERANCE
assert np.count_nonzero(np.linalg.eigvalsh(weighted) > 1e-10) <= 1
weighted = np.sqrt(q)[:, None] * difference_kernel * np.sqrt(q)[None, :]
extremal_error = abs(trace_norm_hermitian(weighted) - 2 * (1 - upper))
assert extremal_error < TOLERANCE
fidelity_excess = 0.0
if require_nonnegative:
for _ in range(4):
fidelity = random_recovery_fidelity(correlation, q, rng)
fidelity_excess = max(fidelity_excess, fidelity - upper)
assert fidelity <= upper + TOLERANCE
return {
"kind": "nonnegative_schur" if require_nonnegative else "real_schur_fixed_channel_only",
"name": name, "dimension": dimension,
"simplex_minimum_upper": upper, "simplex_minimum_lower": lower,
"duality_gap": solution["duality_gap"],
"extremal_trace_norm_identity_error": extremal_error,
"maximum_random_input_bound_excess": max(0.0, worst_weighted_excess),
"maximum_random_recovery_fidelity_excess": max(0.0, fidelity_excess),
}
def verify_flagged(dimension: int, branches: int,
rng: np.random.Generator) -> dict:
probabilities = rng.uniform(0.0, 1.0, (branches, dimension))
probabilities /= np.sum(probabilities, axis=0, keepdims=True)
roots = np.sqrt(probabilities)
correlation = roots.T @ roots
solution = solve_simplex(correlation)
q = solution["q"]
noise, polar_recovery = [], []
for b in range(branches):
embedding = np.zeros((branches * dimension, dimension), dtype=complex)
embedding[b * dimension:(b + 1) * dimension, :] = np.eye(dimension)
noise.append(embedding @ np.diag(roots[b]))
polar_recovery.append(embedding.conj().T)
assert np.linalg.norm(sum(e.conj().T @ e for e in noise) - np.eye(dimension)) < 1e-10
assert np.linalg.norm(sum(r.conj().T @ r for r in polar_recovery)
- np.eye(branches * dimension)) < 1e-10
seed = rng.normal(size=(dimension, dimension)) + 1j * rng.normal(size=(dimension, dimension))
rho = seed @ seed.conj().T
rho /= np.trace(rho)
noisy = sum(e @ rho @ e.conj().T for e in noise)
recovered = sum(r @ noisy @ r.conj().T for r in polar_recovery)
polar_channel_error = float(np.linalg.norm(recovered - correlation * rho))
assert polar_channel_error < 1e-10
maximum_fidelity_excess = 0.0
for _ in range(4):
recovery = random_recovery(dimension, branches * dimension, rng)
fidelity = sum(abs(np.trace(np.diag(q) @ r @ e)) ** 2
for r in recovery for e in noise)
maximum_fidelity_excess = max(maximum_fidelity_excess,
float(fidelity - solution["upper"]))
assert fidelity <= solution["upper"] + TOLERANCE
return {"kind": "orthogonal_flagged_commuting_channel", "dimension": dimension,
"branches": branches, "duality_gap": solution["duality_gap"],
"polar_channel_identity_error": polar_channel_error,
"maximum_random_recovery_fidelity_excess": max(0.0, maximum_fidelity_excess)}
def verify_binary(dimension: int, rng: np.random.Generator) -> dict:
a, b = sorted(rng.uniform(-1, 1, 2))
lambdas = np.concatenate(([a, b], rng.uniform(a, b, dimension - 2)))
roots = np.sqrt(np.vstack(((1 - lambdas) / 2, (1 + lambdas) / 2)))
correlation = roots.T @ roots
solution = solve_simplex(correlation)
fidelity = 0.5 * (np.sqrt((1 + a) * (1 + b))
+ np.sqrt((1 - a) * (1 - b)))
exact_error = 1 - fidelity
qp_error = 2 * (1 - solution["upper"])
assert abs(qp_error - exact_error) < TOLERANCE
return {"kind": "binary_closed_formula", "dimension": dimension,
"minimum_eigenvalue": float(a), "maximum_eigenvalue": float(b),
"closed_form_diamond_error": float(exact_error),
"closed_formula_error": abs(qp_error - exact_error),
"duality_gap": solution["duality_gap"]}
def verify_tensor(rng: np.random.Generator) -> dict:
first = positive_correlation(3, 4, rng)
second = positive_correlation(4, 3, rng)
left, right = solve_simplex(first), solve_simplex(second)
product = np.kron(first, second)
joint = solve_simplex(product)
q_product = np.kron(left["q"], right["q"])
expected = left["upper"] * right["upper"]
tensor_error = abs(joint["upper"] - expected)
assert tensor_error < TOLERANCE
assert abs(q_product @ product @ q_product - expected) < 1e-12
product_gap = max(0.0, 2 * (q_product @ product @ q_product
- np.min(product @ q_product)))
assert product_gap < TOLERANCE
return {"kind": "tensorization", "dimensions": [3, 4],
"joint_simplex_minimum": joint["upper"],
"product_of_simplex_minima": expected,
"tensorization_error": tensor_error,
"product_witness_duality_gap": float(product_gap),
"duality_gap": joint["duality_gap"]}
def run_checks() -> dict:
rng = np.random.default_rng(SEED)
checks = []
for d in (2, 3, 5, 8):
checks.append(verify_channel(np.eye(d), rng, f"complete_dephasing_{d}"))
checks.append(verify_channel(np.ones((5, 5)), rng, "identity_channel"))
for d, p in ((3, 0.15), (4, 0.5), (6, 0.8), (7, 1.0)):
correlation = (1 - p) * np.ones((d, d)) + p * np.eye(d)
record = verify_channel(correlation, rng, f"equicorrelation_{d}_{p}")
exact = 1 - p + p / d
assert abs(record["simplex_minimum_upper"] - exact) < 1e-12
checks.append(record)
for repetition in range(7):
d, branches = 3 + repetition % 4, 2 + repetition % 5
checks.append(verify_channel(positive_correlation(d, branches, rng),
rng, f"positive_gram_{repetition}"))
for repetition in range(3):
points = rng.normal(size=(6, 2))
squared = np.sum((points[:, None, :] - points[None, :, :]) ** 2, axis=2)
correlation = np.exp(-(0.2 + repetition) * squared)
checks.append(verify_channel(correlation, rng, f"gaussian_phase_kernel_{repetition}"))
cycle = np.eye(5)
for i in range(5):
cycle[i, (i + 1) % 5] = cycle[(i + 1) % 5, i] = 0.6
checks.append(verify_channel(cycle, rng, "nonnegative_five_cycle_correlation"))
for repetition in range(8):
checks.append(verify_binary(2 + repetition % 5, rng))
for repetition in range(8):
checks.append(verify_flagged(2 + repetition % 4, 2 + repetition % 3, rng))
for _ in range(8):
checks.append(verify_tensor(rng))
for repetition in range(4):
vectors = rng.normal(size=(3, 4))
vectors /= np.linalg.norm(vectors, axis=0, keepdims=True)
checks.append(verify_channel(vectors.T @ vectors, rng,
f"signed_real_gram_{repetition}", False))
negative_phase = np.array([[1.0, -1.0], [-1.0, 1.0]])
solution = solve_simplex(negative_phase)
assert abs(solution["upper"]) < 1e-12
assert np.linalg.norm(negative_phase * negative_phase - np.ones((2, 2))) < 1e-12
checks.append({"kind": "negative_phase_counterexample_to_identity_optimality",
"fixed_channel_diamond_error": 2.0,
"phase_unitary_corrected_diamond_error": 0.0})
complex_phase = np.array([[1, 1j], [-1j, 1]], dtype=complex)
p = np.array([0.5, 0.5])
weighted = np.sqrt(p)[:, None] * (np.ones((2, 2)) - complex_phase) * np.sqrt(p)[None, :]
measured = trace_norm_hermitian(weighted)
wrong_real_extension = 2 * (1 - float(np.real(p @ complex_phase @ p)))
assert abs(measured - np.sqrt(2)) < 1e-12
assert abs(measured - wrong_real_extension) > 0.4
checks.append({"kind": "complex_phase_counterexample_to_real_distance_formula",
"fixed_channel_diamond_error": measured,
"invalid_real_formula_value": wrong_real_extension})
return {
"label": "Finite numerical checks; not a proof of universal optimality or a novelty certificate.",
"seed": SEED, "numpy_version": np.__version__, "scipy_version": scipy.__version__,
"tolerance": TOLERANCE, "all_checks_passed": True,
"check_count": len(checks),
"maximum_simplex_duality_gap": max(entry.get("duality_gap", 0.0) for entry in checks),
"maximum_extremal_trace_norm_identity_error": max(entry.get("extremal_trace_norm_identity_error", 0.0) for entry in checks),
"maximum_binary_closed_formula_error": max(entry.get("closed_formula_error", 0.0) for entry in checks),
"maximum_tensorization_error": max(entry.get("tensorization_error", 0.0) for entry in checks),
"checks": checks,
}
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--output", type=Path,
default=Path(__file__).with_name("minimax_results.json"))
arguments = parser.parse_args()
results = run_checks()
arguments.output.write_text(json.dumps(results, indent=2) + "\n", encoding="utf-8")
print(json.dumps({key: value for key, value in results.items() if key != "checks"}, indent=2))
if __name__ == "__main__":
main()
|