Datasets:
Languages:
English
Size:
< 1K
ArXiv:
Tags:
nanofabrication
photochemistry
photonics
mathematical-physics
optimal-control
reaction-diffusion
File size: 11,103 Bytes
d980d12 | 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 | #!/usr/bin/env python3
"""Deterministic, reproducible checks for ELYRION III.
Run from any directory. Results are numerical evidence for supplied proofs,
not experiments, proof-assistant verification, or global novelty certification.
"""
from __future__ import annotations
import argparse
from fractions import Fraction as F
from itertools import product
import json
from math import pi
from pathlib import Path
import platform
import time
import numpy as np
import scipy
from model import (A,B,X,C, transition, ideal_filter, finite_filter, ideal_commit,
run_pass, fringes, comb_profile, log_midpoint_yield, optimal_action,
limit_product_bounds, cubic_constant, repeated_commits,
hazard_example, diffusion_comb)
ROOT = Path(__file__).resolve().parents[1]
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--output', type=Path, default=ROOT/'results'/'verification.json')
parser.add_argument('--skip-diffusion', action='store_true')
args = parser.parse_args()
begin=time.perf_counter()
rng=np.random.default_rng(20261020)
tests=[]
def check(name: str, condition: bool, **data):
record={'name':name, 'passed':bool(condition), **data}
tests.append(record)
if not condition:
raise AssertionError(record)
# Exact rational recurrence, including commit and mass conservation.
rational_cases=0
for m in range(1,7):
for sample in range(20):
ps=[F(int(rng.integers(1,10)),10) for _ in range(m)]
state=[F(1),F(0),F(0),F(0)]
expected=F(1)
for p in ps:
marked=state[A]*p
state[A]-=marked; state[B]+=marked
state=[state[B],F(0),state[X]+state[A],state[C]]
expected*=p
q=F(3,7)
committed=q*state[A]
state=[1-committed,F(0),F(0),committed]
rational_cases+=1
check(f'exact_fraction_pass_{m}_{sample}',
committed==q*expected and sum(state)==1 and min(state)>=0)
for source,target in [(A,B),(A,X),(B,A),(A,C),(X,A)]:
for action in [0.,.01,1.,10.,40.]:
mat=transition(source,target,action)
check(f'stochastic_transition_{source}_{target}_{action}',
np.min(mat)>=0 and np.max(abs(mat.sum(axis=0)-1))<1e-14)
for h in [.1,1.,3.,8.,16.]:
ff=finite_filter(h,h)
tv=np.max(np.sum(abs(ff-ideal_filter()),axis=0))/2
check(f'finite_filter_error_{h}',tv<=2*np.exp(-h)+1e-14, observed_tv=float(tv))
for m in range(2,17):
theta=2*pi*np.arange(256*m)/(256*m)
u=optimal_action(m,.5)
s=comb_profile(m,u,theta)
check(f'comb_range_{m}',s.min()>=0 and s.max()<=1+1e-14)
check(f'comb_nodes_{m}',np.max(s[::256])<1e-24)
check(f'comb_midpoints_{m}',np.max(abs(s[128::256]-.5))<2e-11)
check(f'cyclic_symmetry_{m}',np.max(abs(s-np.roll(s,256)))<2e-12)
ft=np.fft.rfft(s)/len(s)
forbidden=np.arange(len(ft))%m!=0
check(f'forbidden_Fourier_modes_{m}',np.max(abs(ft[forbidden]))<1e-12)
state=run_pass(fringes(m,theta),np.full(m,u),committed=.17)
check(f'four_state_vs_product_{m}',np.max(abs(state[A]-.83*s))<2e-13)
check(f'four_state_mass_{m}',np.max(abs(state.sum(axis=0)-1))<3e-13)
# Removing the selection operation gives integrated dose, not the conjunction.
no_filter=-np.expm1(-u*fringes(m,theta).sum(axis=0))
check(f'no_filter_is_uniform_{m}',np.ptp(no_filter)<2e-12)
small=.0005
p0=np.prod(fringes(m,theta),axis=0)
ss=comb_profile(m,small,theta)/small**m
check(f'weak_gate_root_limit_{m}',
np.max(ss-p0)<1e-12 and np.max(np.exp(-m*small/2)*p0-ss)<1e-12)
# Noise budget at the nominal dark nodes, not a claim about all Fourier errors.
delta=rng.uniform(-.03,.03,m)
floor=.0001
nodes=2*pi*np.arange(m)/m
pert=comb_profile(m,u,nodes,phases=nodes+delta,floor=floor)
bound=-np.expm1(-u*(floor+2*np.sin(delta/2)**2))
check(f'dark_phase_floor_bound_{m}',np.max(pert-bound)<1e-13)
allocation_trials=0
for m in [2,3,4,6,8,12]:
u=optimal_action(m,.5)
x=2*pi*(np.arange(m)+.5)/m
for j in range(100):
alloc=rng.dirichlet(np.ones(m))*m*u
worst=float(comb_profile(m,alloc,x).min())
allocation_trials+=1
check(f'max_min_allocation_{m}_{j}',worst<=.5+1e-12)
grid_allocation_count=0
for m in [2,3,4]:
quanta=12
best=0.0
x=2*pi*(np.arange(m)+.5)/m
for alloc in product(range(quanta+1),repeat=m-1):
last=quanta-sum(alloc)
if last<0: continue
a=np.asarray((*alloc,last),dtype=float)/4
value=float(comb_profile(m,a,x).min())
best=max(best,value)
grid_allocation_count+=1
exact=float(np.exp(log_midpoint_yield(m,quanta/(4*m))))
check(f'exhaustive_allocation_grid_{m}',abs(best-exact)<1e-13,
maximum=float(best))
for j in range(100):
a,b,g=rng.uniform(.001,20,3)
separate=(-np.expm1(-a*g))*(-np.expm1(-b*g))
merged=-np.expm1(-(a+b)*g)
check(f'repeated_node_consolidation_{j}',separate<=merged+1e-14)
for case in range(100):
m=int(rng.integers(2,10))
theta=2*pi*np.arange(257)/257
allocations=rng.uniform(.01,5,(3,m))
separate_remaining=np.ones(len(theta))
for aa in allocations:
separate_remaining*=1-comb_profile(m,aa,theta)
combined=comb_profile(m,allocations.sum(axis=0),theta)
check(f'multipass_merge_domination_{case}',
np.max((1-separate_remaining)-combined)<1e-13)
constants={str(q):cubic_constant(q) for q in [.1,.5,.9,.99]}
dose_rows=[]
for q in [.1,.5,.9,.99]:
c=constants[str(q)]
for m in [2,3,4,8,16,32,64,128,256]:
u=optimal_action(m,q)
dose_rows.append(dict(m=m,q=q,action=u,total_action=m*u,ratio=u/m**2))
check(f'dose_inverse_{q}_{m}',abs(np.exp(log_midpoint_yield(m,u))-q)<2e-12)
lower=m*(-np.log1p(-np.sqrt(q)))/(2*np.sin(pi/(2*m))**2)
check(f'two_nearest_gate_lower_bound_{q}_{m}',m*u+2e-12*max(1.0,lower)>=lower)
check(f'cubic_limit_{q}',abs(dose_rows[-1]['ratio']/c-1)<5e-5)
for c in [.025,.05,.1,.25,.6,1.0]:
for r in [1,2,4,8]:
lo,hi=limit_product_bounds(c,r)
ref=limit_product_bounds(c,64)[1]
check(f'analytic_product_tail_{c}_{r}',lo-2e-15<=ref<=hi+2e-15)
hazard_rows=[]
for action in [.2,.1,.05,.025]:
data=hazard_example(action)
check(f'universal_hazard_bound_{action}',data['error']<=data['bound']+1e-13)
check(f'universal_hazard_contraction_{action}',data['error']<=data['hazard_error']+1e-13)
check(f'universal_hazard_probability_{action}',
data['written'].min()>=0 and data['written'].max()<1)
hazard_rows.append({k:v for k,v in data.items() if not isinstance(v,np.ndarray)})
check('hazard_example_convergence',all(hazard_rows[i+1]['error']<hazard_rows[i]['error']
for i in range(len(hazard_rows)-1)))
for case in range(20):
q=rng.uniform(.001,.4,15)
scale=.03
coeff=float(rng.uniform(.001,.2))
logs,count,frac=repeated_commits(q,coeff,scale)
remaining=np.ones(15)
whole=int(np.floor(coeff/scale))
for _ in range(whole): remaining*=1-q
remaining*=1-frac*q
check(f'collapsed_finite_passes_{case}',np.max(abs(np.exp(logs)-remaining))<1e-13)
# A single-pass retention ceiling is NOT a multi-pass impossibility theorem.
single_lossy=(.8**4)*.9
two_lossy=1-(1-single_lossy)**2
check('retention_ceiling_is_single_pass_only',single_lossy<.5<two_lossy,
one_pass=single_lossy,two_passes=two_lossy)
diffusion_rows=[]
if not args.skip_diffusion:
for m in [2,3,4,6]:
u=optimal_action(m,.5)
for d in [0.,1e-6,1e-4,1e-3]:
data=diffusion_comb(m,u,d)
check(f'diffusion_positivity_{m}_{d}',data['survival'].min()>-1e-12)
check(f'diffusion_subprobability_{m}_{d}',data['survival'].max()<1+1e-12)
check(f'diffusion_dark_bound_{m}_{d}',np.max(data['dark']-data['bounds'])<2e-11)
if d==0:
ref=comb_profile(m,u,data['theta'])
check(f'diffusion_zero_reduction_{m}',np.max(abs(ref-data['survival']))<1e-11)
refinement=diffusion_comb(m,u,d,n=128*m)
grid_error=float(abs(data['survival']-refinement['survival'][::2]).max())
check(f'diffusion_grid_refinement_{m}_{d}',grid_error<.002)
diffusion_rows.append(dict(m=m,diffusion=d,action=u,time=data['time'],
max_dark=float(data['dark'].max()),min_bright=float(data['bright'].min()),
max_dark_bound=float(data['bounds'].max()),grid_error=grid_error,
n=data['n']))
example_m=8
ex_u=optimal_action(example_m,.5)
dark=.01
report=dict(
project='EVE / ELYRION III',version='3.0',date='2026-10-20',seed=20261020,
epistemic_status='ANALYTIC_PROOFS_PLUS_EXACT_RATIONAL_AND_FLOATING_TESTS; NO_EXPERIMENTS',
tests_passed=sum(t['passed'] for t in tests),tests_total=len(tests),
exact_rational_pass_cases=rational_cases,random_allocation_trials=allocation_trials,
exhaustive_grid_allocations=grid_allocation_count,
cubic_constants=constants,dose_table=dose_rows,hazard_examples=hazard_rows,
diffusion_examples=diffusion_rows,
m8_dark01_budget=dict(action=ex_u,total_action=example_m*ex_u,
extinction_floor=-np.log1p(-dark)/ex_u,
phase_radians=float(np.arccos(1+np.log1p(-dark)/ex_u))),
environment=dict(python=platform.python_version(),numpy=np.__version__,scipy=scipy.__version__),
elapsed_seconds=time.perf_counter()-begin,tests=tests,
limitations=['No actual material is identified or characterized.',
'Floating tests and tail evaluations are not interval certificates.',
'Diffusion computations discretize the continuum PDE; refinement is numerical.',
'Cubic optimality is for the declared exact-node serial gate class only.',
'Positive 3D universality has no efficient runtime guarantee.'])
args.output.parent.mkdir(parents=True,exist_ok=True)
args.output.write_text(json.dumps(report,indent=2),encoding='utf-8')
print(json.dumps({k:report[k] for k in ['tests_passed','tests_total','exact_rational_pass_cases',
'exhaustive_grid_allocations','elapsed_seconds']},indent=2))
print('Results:',args.output)
if __name__=='__main__':
main()
|