"""Reproducible diagram of the proved velocity tests, VD0–VD9."""
from pathlib import Path
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch,FancyArrowPatch,Rectangle
plt.rcParams.update({'font.family':'DejaVu Sans','svg.fonttype':'none','mathtext.fontset':'dejavusans','font.size':15})
fig=plt.figure(figsize=(14,18),dpi=100,facecolor='#f6f8fb')
ax=fig.add_axes([0,0,1,1]);ax.set_xlim(0,1);ax.set_ylim(0,1);ax.axis('off')
ink='#17304a'
def txt(x,y,s,size=16,**kw):ax.text(x,y,s,color=ink,fontsize=size,va='top',**kw)
def box(x,y,w,h,c):ax.add_patch(FancyBboxPatch((x,y),w,h,boxstyle='round,pad=.012,rounding_size=.008',facecolor=c,edgecolor='#8fa9be',linewidth=1.1))
def arrow(x1,y1,x2,y2):ax.add_patch(FancyArrowPatch((x1,y1),(x2,y2),arrowstyle='-|>',mutation_scale=17,color='#426b91',linewidth=1.8))
txt(.5,.976,'Two velocity tests that withstand diffusion',26,ha='center',weight='bold')
txt(.5,.946,'The force prescribes horizontal instructions and a vertical source.',17,ha='center')
box(.055,.823,.89,.09,'#e4e8f3')
txt(.08,.9,r'$U=(a_1,a_2,w),\quad f=(a_t+(a\cdot\nabla)a-\nu\Delta a,\ h),\quad p=0$',20)
txt(.08,.86,r'$w_t+a\cdot\nabla w=\nu\Delta w+h,\qquad w(0)=0$  |  VD1',20)
box(.055,.48,.89,.308,'#e4edf6')
txt(.08,.77,'VD3–VD4  |  Fixed torus chart, short bursts',21,weight='bold')
txt(.08,.735,r'$p=(1/4,1/4),\quad E=\{1/32<y<1/8\},\quad U_3>1/2$',20)
for x,w,label,c in [(.08,.205,'Inject height one','#b7cfea'),(.285,.235,'Run n periods','#bdd7bf'),(.52,.38,'Heat-only wait','#d6dce3')]:
    ax.add_patch(Rectangle((x,.642),w,.047,facecolor=c,edgecolor='#8fa9be'))
    txt(x+w/2,.675,label,15,ha='center')
txt(.08,.707,r'Block n starts at physical time $2n/\nu$.',14)
txt(.1825,.628,r'Duration $\delta_n/\nu$',16,ha='center')
txt(.4025,.628,r'Duration $\delta_n/\nu$',16,ha='center')
txt(.71,.628,r'Duration $(2-2\delta_n)/\nu>1/\nu$',15,ha='center')
txt(.08,.586,r'$b_n=10^{-6}(2R)^{-n},\quad R=4^L,\quad \delta_n=[100(1+D_n)]^{-1}$',19)
txt(.08,.548,r'$\|w^{\mathrm{new}}-w^0\|_\infty\leq2\delta_nD_n<1/50$',20)
txt(.08,.51,'Halting height > 15/16; nonhalting height on E < 1/2.',17)
box(.055,.151,.89,.293,'#e6f0e8')
txt(.08,.427,'VD5–VD7  |  Expanding array, bounded force derivatives',20,weight='bold')
txt(.08,.391,r'$S_n=16R_n,\quad R_{n+1}=\Lambda R_n,\quad \Lambda=4b^2$',19)
for x,label in [(.08,'1  Source columns'),(.37,'2  Private rows'),(.66,'3  Target columns')]:
    txt(x,.352,label,16,weight='bold')
    ax.plot([x,x+.24],[.31,.31],color='#8294a7',linestyle='--',linewidth=1)
    txt(x,.306,r'$X_2=0$',12)
arrow(.12,.287,.12,.246);arrow(.27,.287,.27,.227)
arrow(.4,.255,.55,.255);arrow(.56,.231,.41,.231)
arrow(.7,.231,.7,.28);arrow(.85,.255,.85,.325)
txt(.08,.209,r'Column gap $\geq S_n$',14)
txt(.37,.209,r'Row gap $\geq S_n$',14)
txt(.66,.209,r'Column gap $\geq S_{n+1}$',14)
txt(.08,.178,r'Gate support radius $3R_n$; exact translation on radius $2R_n$.',16)
box(.055,.047,.89,.071,'#f4ecdd')
txt(.08,.105,r'$\mathcal{I}(t)\geq\theta(t)-\delta,\quad \delta<1/24$  |  moving cutoff',19)
txt(.08,.071,'Upper-half-plane mass: < 1/24 if nonhalting; > 23/24 at first halt.',16)
txt(.5,.028,'Source: OpenAI, Velocity-Field Detection of Computation (2026); proofs VD0–VD9.',13,ha='center')
txt(.5,.012,'Time bars and routes are schematic, not to scale or sampled trajectories.',12,ha='center')
out=Path(__file__).with_suffix('');fig.savefig(out.with_suffix('.svg'),metadata={'Date':None});fig.savefig(out.with_suffix('.png'));plt.close(fig)
p=out.with_suffix('.svg');p.write_text(p.read_text(encoding='utf8').replace('width="1008pt" height="1296pt"','width="1400" height="1800"'),encoding='utf8')
