interplane.Get Omega
Read in your language

yang

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

yang / src / ufbi_phase4_cert.om

551 lines · 14903 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note src/ufbi_phase4_cert.om: Pure Seeded-OM-2 Zero-Monte-Carlo Phase IV Dual-Cliff Verifier
3note
4note Zero randomness, zero Monte Carlo, zero C/Python/Rust/libcuda:
5note Part A scans 2048 angle boxes and 128 staple-field boxes for each sampled beta.
6note It reports coefficients for 18, 14 and 12 neighbor incidences.
7note Part B integrates core and tail terms for a single quaternion star cell at eight couplings.
8note Part A uses integer dyadic quadrature and exact comparisons. Part B uses padded binary64.
9note A rigorous end-to-end floating-point enclosure remains open.
10note
11note Composed after src/ufbi_math.om, src/ufbi_ivmath.om and src/ufbi_w2_dyadic.om.
12
13note Part B globals (keep every fn <= 6 FP locals to stay inside omc FP reg pool)
14global rowFailures ulong 1
15global qPrm f64 16
16global qRes f64 14
17global qTmp f64 12
18global qFar f64 8
19
20text tP4Hdr "=== PHASE IV ZERO-MONTE-CARLO DUAL-CLIFF VERIFIER (PURE SEEDED OM-2) ===\n"
21text tP4AHdr "=== PART A: RIGHT CLIFF — PERIOD-2 LINK INCIDENCES (deg=12) + DYADIC S^3 W_2 TRIAL ENERGIES (2048 x 128 BOXES) ===\n"
22text tP4ACols "beta\tW2_par_hi\tW2_perp_hi\tL_W2_hi\tUnfix18_hi\tTG14_hi\tBT12_hi\tcert\n"
23text tP4BHdr "=== PART B: PADDED BINARY64 STAR-CELL DIAGNOSTICS — 4-REGION SHIFTED QUATERNION LANDAU GAUGE (K_{2,2,2,2} + K_{1,2,2,2}) ===\n"
24text tP4BCols "beta\tR1\tR7\tu_core\tcore_up_hi\tcore_dn_hi\tmid_hi\tgt_hi\t1bad_hi\t2bad_hi\tdTV_hi\tL1_hi\tstatus\n"
25text tPassU "PASS_UNFIX18"
26text tPassTG "PASS_TG14_W2"
27text tPassBT "PASS_BT12_W2"
28text tOpen "OPEN"
29text tClosedL1 "CLOSED_FULL_L1"
30text tClosedTV "CLOSED_TV_ONLY"
31text tTab "\t"
32text tNl "\n"
33text tDone "PHASE4_CERT_DONE status=PASS\n"
34
35fn min2 a f64 b f64 to f64
36if lt a b
37ret a
38end
39ret b
40end
41
42fn max2 a f64 b f64 to f64
43if gt a b
44ret a
45end
46ret b
47end
48
49fn ivMulHi alo f64 ahi f64 blo f64 bhi f64 to f64
50p1 = mul alo blo
51p2 = mul alo bhi
52p3 = mul ahi blo
53p4 = mul ahi bhi
54ret ivHi max2 max2 p1 p2 max2 p3 p4
55end
56
57fn printPartACert u18 long tg14 long bt12 long expected ulong to void
58actual = ulong 0
59if ne u18 0
60actual = ulong 18
61uPrint tPassU
62else
63if ne tg14 0
64actual = ulong 14
65uPrint tPassTG
66else
67if ne bt12 0
68actual = ulong 12
69uPrint tPassBT
70else
71uPrint tOpen
72end
73end
74end
75uPrint tNl
76if ne actual expected
77put rowFailures 0 add get rowFailures 0 1
78end
79end
80
81fn scanW2Beta bps long expected ulong to void
82scanDyadicW2 bps
83beta = div f64 bps 10000.0f64
84par = uSqrt64 div f64 get wMaxEnergy 0 f64 wScale
85perp = uSqrt64 div f64 get wMaxEnergy 1 f64 wScale
86energy = larger get wMaxEnergy 0 get wMaxEnergy 1
87lW2 = max2 par perp
88u18 = mul 18.0f64 mul beta lW2
89tg14 = mul 14.0f64 mul beta lW2
90bt12 = mul 12.0f64 mul beta lW2
91uPrintF64 beta
92uPrint tTab
93uPrintF64 par
94uPrint tTab
95uPrintF64 perp
96uPrint tTab
97uPrintF64 lW2
98uPrint tTab
99uPrintF64 u18
100uPrint tTab
101uPrintF64 tg14
102uPrint tTab
103uPrintF64 bt12
104uPrint tTab
105printPartACert dyadicSubunit energy 18 bps dyadicSubunit energy 14 bps dyadicSubunit energy 12 bps expected
106end
107
108note =========================================================================
109note PART B: 4-Region Shifted Quaternion Landau Gauge (K_{2,2,2,2} + K_{1,2,2,2})
110note qPrm: 0=beta, 1=lam1, 2=lam2, 3=v, 4=c, 5=logZshiftLo, 6=ratioUpHi, 7=qCoeffHi,
111note 8=eSumS2Hi, 9=logNormChi21Lo, 10=R1, 11=S1Hi, 12=u2Lo, 13=alphaMidHi, 14=s1FloorLo
112note qFar: 0=bestSum, 1=R7, 2=rMin, 3=tail1bHi, 4=tail2bHi
113note qRes: 0=L1, 1=dTV, 2=R1, 3=R7, 4=u, 5=remUp, 6=remDn, 7=midTail, 8=gtTail, 9=t1b, 10=t2b
114note =========================================================================
115note Exact log(2^{21/2} Gamma(21/2)) = log(654729075) + 0.5*log(2*pi) (lower bound => upper bound on density!)
116fn initChi21Norm to void
117ln19df = ivLo uLog64 654729075.0f64
118ln2pi = ivLo uLog64 uTwoPi
119put qPrm 9 ivLo add ln19df mul 0.5f64 ln2pi
120end
121
122note Outward-rounded upper bound on chi_21^2 density f(t) at point t > 0
123fn fChi21PtHi t f64 to f64
124if le t 0.0f64
125ret 0.0f64
126end
127lg = ivHi mul 9.5f64 ivHi uLog64 t
128ex = ivHi sub ivHi sub lg ivLo mul 0.5f64 t get qPrm 9
129ret ivHi uExp64 ex
130end
131
132note Exact unimodal box upper bound on chi_21^2 density over [t0, t1] (unique peak at t = 19.0!)
133fn fChi21BoxHi t0 f64 t1 f64 to f64
134if and le t0 19.0f64 ge t1 19.0f64
135ret fChi21PtHi 19.0f64
136end
137ret max2 fChi21PtHi t0 fChi21PtHi t1
138end
139
140note Exact outward-rounded upper bound on P(chi_21^2 > a) for a >= 19.0 (decreasing density on [a, 240] + Chernoff on [240, inf))
141fn chi21TailHi a f64 to f64
142if ge a 240.0f64
143ret 0.000000000000001f64
144end
145h = ivHi div sub 240.0f64 a 400.0f64
146acc = f64 0.0f64
147for i ulong 400
148t0 = add a mul f64 i h
149acc = ivHi add acc ivHi mul fChi21BoxHi t0 add t0 h h
150end
151ret ivHi add acc 0.000000000000001f64
152end
153
154note Exact lower bound on log(Z_shift_q(beta)) for 8-link shifted quaternion Landau gauge
155fn initBetaParams beta f64 to void
156put qPrm 0 beta
157lam1 = sub mul 6.0f64 beta 0.625f64
158lam2 = sub mul 8.0f64 beta 0.625f64
159put qPrm 1 lam1
160put qPrm 2 lam2
161v = add div 0.5f64 lam1 div 0.375f64 lam2
162c = neg div 0.125f64 lam2
163put qPrm 3 v
164put qPrm 4 c
165ln8 = ivLo uLog64 8.0f64
166ln2pi = ivLo uLog64 uTwoPi
167ln2pi2 = ivHi uLog64 mul 2.0f64 mul uPi uPi
168num = ivLo add mul 1.5f64 ln8 mul 10.5f64 ln2pi
169den = ivHi add mul 7.0f64 ln2pi2 ivHi add mul 6.0f64 ivHi uLog64 lam1 mul 4.5f64 ivHi uLog64 lam2
170put qPrm 5 ivLo sub num den
171put qPrm 6 ivHi div ivHi mul 120.0f64 ivHi mul ivHi mul v v ivHi mul lam1 lam1 483.0f64
172v2mc2 = ivHi sub ivHi mul v v ivLo mul c c
173put qPrm 7 ivHi div ivHi mul 36.0f64 ivHi mul beta v2mc2 483.0f64
174eS = ivHi add ivHi div 12.0f64 lam1 ivHi div 9.0f64 lam2
175varS = ivHi add ivHi div 24.0f64 ivLo mul lam1 lam1 ivHi div 18.0f64 ivLo mul lam2 lam2
176put qPrm 8 ivHi add ivHi mul eS eS varS
177end
178
179note Exact lower bound on s1_floor(R) = 24*(1 - r_*^2) where 4 r_*^2 - cos(R)*r_* - 3 = 0
180fn s1FloorLo R f64 to f64
181cH = radialCosHi R
182rH = ivHi div ivHi add cH ivHi uSqrt64 ivHi add ivHi mul cH cH 48.0f64 8.0f64
183ret ivLo mul 24.0f64 ivLo sub 1.0f64 ivHi mul rH rH
184end
185
186note Exact lower bound on s2_floor(R) = 24*(1 - r_*^2) where 5 r_*^2 - 2*cos(R)*r_* - 3 = 0
187fn s2FloorLo R f64 to f64
188cH = radialCosHi R
189rH = ivHi div ivHi add cH ivHi uSqrt64 ivHi add ivHi mul cH cH 15.0f64 5.0f64
190ret ivLo mul 24.0f64 ivLo sub 1.0f64 ivHi mul rH rH
191end
192
193note Exact upper bound on S^3 Haar cap measure P(theta >= th0) = 1 - (th0 - sin(th0)*cos(th0))/pi
194fn haarCapHi th0 f64 to f64
195if le th0 0.0f64
196ret 1.0f64
197end
198if ge th0 uPi
199ret 0.0f64
200end
201scH = ivMulHi radialSinLo th0 radialSinHi th0 radialCosLo th0 radialCosHi th0
202numL = ivLo sub th0 scH
203ret ivHi sub 1.0f64 ivLo div numL uPi
204end
205
206note Upper bound on log Z_1bad(mu1, mu2) = [1.5 ln7 + 9 ln(2pi)] - [6 ln(2pi^2) + 4.5 ln mu1 + 4.5 ln mu2]
207note (split out of eval1BadEta: one function holding all these values exceeded omc's 16-register pool, error 12)
208fn lnZ1bHi mu1 f64 mu2 f64 to f64
209ln7 = ivHi uLog64 7.0f64
210ln2pi = ivHi uLog64 uTwoPi
211numHi = ivHi add mul 1.5f64 ln7 mul 9.0f64 ln2pi
212ln2pi2 = ivLo uLog64 mul 2.0f64 mul uPi uPi
213lnMu1Lo = ivLo uLog64 mu1
214lnMu2Lo = ivLo uLog64 mu2
215muLo = ivLo add mul 4.5f64 lnMu1Lo mul 4.5f64 lnMu2Lo
216denLo = ivLo add mul 6.0f64 ln2pi2 muLo
217ret ivHi sub numHi denLo
218end
219
220note Evaluate 1-bad-link upper bound at given (eta, shift7, cap0)
221fn eval1BadEta eta f64 shift7 f64 cap0 f64 to f64
222beta = get qPrm 0
223ome = ivLo sub 1.0f64 eta
224mu1 = ivLo sub mul 5.0f64 mul ome beta shift7
225mu2 = ivLo sub mul 7.0f64 mul ome beta shift7
226if or le mu1 0.2f64 le mu2 0.2f64
227ret 999.0f64
228end
229lnZ1b = lnZ1bHi mu1 mu2
230arg = ivHi add ivHi sub lnZ1b get qPrm 5 neg ivLo mul eta ivLo mul get qPrm 14 beta
231ret ivHi mul 8.0f64 ivHi mul cap0 ivHi uExp64 arg
232end
233
234note Shift for the 7 near links given the far-link sine bound s7 = sin(R7)^2 (split out of scan1BadR7, error 12)
235fn shift7Hi squareLo f64 s7 f64 to f64
236cLog7 = ivHi div neg ivLo uLog64 ivLo sub 1.0f64 s7 squareLo
237ret max2 0.0f64 ivHi sub cLog7 div 3.0f64 7.0f64
238end
239
240note Best 1-bad-link bound over the 34-point eta grid (split out of scan1BadR7, error 12)
241fn best1bOverEta shift7 f64 cap0 f64 to f64
242best1b = f64 999.0f64
243for ei ulong 34
244eta = add 0.25f64 mul f64 ei 0.02f64
245v1 = eval1BadEta eta shift7 cap0
246if lt v1 best1b
247best1b = v1
248end
249end
250ret best1b
251end
252
253fn sineSquareLo angle f64 to f64
254s = max2 0.0f64 radialSinLo angle
255ret max2 0.0f64 ivLo mul s s
256end
257
258fn scan1BadR7 R7 f64 rMin f64 delta f64 cap0 f64 to void
259beta = get qPrm 0
260R1 = get qPrm 10
261s7 = ivHi mul radialSinHi R7 radialSinHi R7
262if ge s7 0.998f64
263ret
264end
265r2Eff = min2 R1 ivLo sub R7 delta
266if le r2Eff 0.5f64
267ret
268end
269s2F = min2 ivLo mul 24.0f64 ivLo sub 1.0f64 ivHi mul rMin rMin s2FloorLo r2Eff
270t2b = ivHi uExp64 ivHi sub neg ivLo mul s2F beta get qPrm 5
271if gt t2b 0.5f64
272ret
273end
274if le sineSquareLo R7 0.0f64
275ret
276end
277shift7 = shift7Hi sineSquareLo R7 s7
278best1b = best1bOverEta shift7 cap0
279tot = ivHi add best1b t2b
280if lt tot get qFar 0
281put qFar 0 tot
282put qFar 1 R7
283put qFar 2 rMin
284put qFar 3 best1b
285put qFar 4 t2b
286end
287end
288
289fn optimizeFarTails to void
290R1 = get qPrm 10
291put qFar 0 999.0f64
292for rmi ulong 6
293rMin = add 0.74f64 mul f64 rmi 0.02f64
294note atan(x) <= x for x > 0 is an exact elementary upper bound!
295delta = ivHi div 1.0f64 ivLo sub mul 8.0f64 rMin 1.0f64
296cap0 = haarCapHi ivLo sub R1 delta
297for r7i ulong 12
298R7 = add 1.28f64 mul f64 r7i 0.02f64
299scan1BadR7 R7 rMin delta cap0
300end
301end
302end
303
304note Single outward-rounded box step [t0, t1] for core integrals (remUp, dnQuat, dnFp)
305fn coreBoxStep t0 f64 t1 f64 h f64 to void
306lam1 = get qPrm 1
307ftH = fChi21BoxHi t0 t1
308stH = ivHi div t1 lam1
309if ge stH 0.995f64
310put qTmp 0 999.0f64
311ret
312end
313omS = ivLo sub 1.0f64 stH
314invSq = ivHi div 1.0f64 ivLo uSqrt64 omS
315upVal = ivHi sub ivHi mul invSq ivHi uExp64 neg ivLo mul 0.5f64 ivLo div t0 lam1 1.0f64
316if lt upVal 0.0f64
317upVal = 0.0f64
318end
319put qTmp 0 ivHi add get qTmp 0 ivHi mul get qPrm 6 ivHi mul upVal ivHi mul ftH h
320qVal = ivHi div ivHi mul t1 t1 omS
321put qTmp 1 ivHi add get qTmp 1 ivHi mul get qPrm 7 ivHi mul qVal ivHi mul ftH h
322end
323
324note Faddeev-Popov remainder coefficient upper bound on a box with s in [stL, stH]
325note (split out of coreBoxFpStep: one function holding all these values exceeded omc's 16-register pool, error 12)
326fn fpCoeffHi stH f64 to f64
327sqOm = ivLo uSqrt64 ivLo sub 1.0f64 stH
328xH = ivHi sub 1.0f64 sqOm
329note (1 - s/2 - sqrt(1-s))/s^2 = 1/(2*(1+sqrt(1-s))^2).
330denL = ivLo add 1.0f64 sqOm
331d2H = ivHi div 0.5f64 ivLo mul denL denL
332note (-log(1-x)-x)/x^2 has a positive power series, hence increases in x.
333note Evaluate at xH; enclose log(1-xH) directly at that same point.
334c2XH = ivHi div ivHi sub neg ivLo uLog64 ivLo sub 1.0f64 xH xH ivLo mul xH xH
335csqH = ivHi div 1.0f64 denL
336tA = ivHi mul mul 0.375f64 d2H ivHi mul 120.0f64 ivHi mul get qPrm 3 get qPrm 3
337tB = ivHi mul 3.0f64 ivHi mul c2XH ivHi mul ivHi mul div csqH 8.0f64 div csqH 8.0f64 get qPrm 8
338ret ivHi div ivHi add tA tB 483.0f64
339end
340
341fn coreBoxFpStep t0 f64 t1 f64 h f64 to void
342lam1 = get qPrm 1
343ftH = fChi21BoxHi t0 t1
344stH = ivHi div t1 lam1
345if le stH 0.0001f64
346stH = 0.0001f64
347end
348if ge stH 0.995f64
349put qTmp 2 999.0f64
350ret
351end
352fpC = fpCoeffHi stH
353put qTmp 2 ivHi add get qTmp 2 ivHi mul fpC ivHi mul ivHi mul t1 t1 ivHi mul ftH h
354end
355
356fn evalMidLo u f64 u2 f64 to f64
357if le u2 u
358ret 0.0f64
359end
360lam1 = get qPrm 1
361h = ivHi div sub u2 u 100.0f64
362acc = f64 0.0f64
363for i ulong 100
364t0 = add u mul f64 i h
365t1 = min2 u2 add t0 h
366stH = ivHi div t1 lam1
367omS = ivLo sub 1.0f64 stH
368upV = ivHi sub ivHi mul ivHi div 1.0f64 ivLo uSqrt64 omS ivHi uExp64 neg ivLo mul 0.5f64 ivLo div t0 lam1 1.0f64
369if lt upV 0.0f64
370upV = 0.0f64
371end
372fac = ivHi add 1.0f64 ivHi mul get qPrm 6 upV
373acc = ivHi add acc ivHi mul fac ivHi mul fChi21BoxHi t0 t1 h
374end
375ret acc
376end
377
378fn tryCoreU u f64 midHi f64 to void
379u2 = get qPrm 12
380put qTmp 0 0.0f64
381put qTmp 1 0.0f64
382put qTmp 2 0.0f64
383h = ivHi div u 200.0f64
384for i ulong 200
385t0 = mul f64 i h
386t1 = min2 u add t0 h
387coreBoxStep t0 t1 h
388coreBoxFpStep t0 t1 h
389end
390midTail = ivHi add evalMidLo u u2 midHi
391gtTail = chi21TailHi u
392aUp = ivHi add get qTmp 0 ivHi add midTail ivHi add get qFar 3 get qFar 4
393aDn = ivHi add get qTmp 1 ivHi add get qTmp 2 gtTail
394l1 = ivHi add aUp aDn
395dTV = f64 9.99f64
396if lt aDn 0.9999f64
397dTV = max2 aUp ivHi div aDn ivLo sub 1.0f64 aDn
398end
399if lt l1 get qRes 0
400put qRes 0 l1
401put qRes 1 dTV
402put qRes 2 get qPrm 10
403put qRes 3 get qFar 1
404put qRes 4 u
405put qRes 5 get qTmp 0
406put qRes 6 ivHi add get qTmp 1 get qTmp 2
407put qRes 7 midTail
408put qRes 8 gtTail
409put qRes 9 get qFar 3
410put qRes 10 get qFar 4
411end
412end
413
414fn scanR1 R1 f64 to void
415lam1 = get qPrm 1
416put qPrm 10 R1
417s1H = ivHi mul radialSinHi R1 radialSinHi R1
418s1L = sineSquareLo R1
419if le s1L 0.0f64
420ret
421end
422if ge s1H 0.996f64
423ret
424end
425put qPrm 11 s1H
426put qPrm 14 s1FloorLo R1
427optimizeFarTails
428if gt get qFar 0 0.8f64
429ret
430end
431cLin1 = ivHi div ivHi sub neg ivLo uLog64 ivLo sub 1.0f64 s1H s1L s1L
432alphaM = ivHi div cLin1 mul 2.0f64 lam1
433if ge mul 2.0f64 alphaM 0.94f64
434ret
435end
436put qPrm 13 alphaM
437u2 = ivLo mul lam1 mul s1L 0.994f64
438put qPrm 12 u2
439scL = ivLo sub 1.0f64 mul 2.0f64 alphaM
440scPow = ivHi uExp64 mul neg 10.5f64 ivLo uLog64 scL
441midHi = ivHi mul scPow chi21TailHi ivLo mul scL u2
442for ui ulong 24
443u = add 28.0f64 mul f64 ui 2.0f64
444if le u u2
445tryCoreU u midHi
446end
447end
448end
449
450fn evalZeroLoopholeStar beta f64 expected ulong to void
451initBetaParams beta
452put qRes 0 999.0f64
453put qRes 1 999.0f64
454put qRes 2 0.0f64
455put qRes 3 0.0f64
456put qRes 4 0.0f64
457put qRes 5 999.0f64
458put qRes 6 999.0f64
459put qRes 7 999.0f64
460put qRes 8 999.0f64
461put qRes 9 999.0f64
462put qRes 10 999.0f64
463for r1i ulong 16
464R1 = add 1.20f64 mul f64 r1i 0.02f64
465scanR1 R1
466end
467uPrintF64 beta
468uPrint tTab
469uPrintF64 get qRes 2
470uPrint tTab
471uPrintF64 get qRes 3
472uPrint tTab
473uPrintF64 get qRes 4
474uPrint tTab
475uPrintF64 get qRes 5
476uPrint tTab
477uPrintF64 get qRes 6
478uPrint tTab
479uPrintF64 get qRes 7
480uPrint tTab
481uPrintF64 get qRes 8
482uPrint tTab
483uPrintF64 get qRes 9
484uPrint tTab
485uPrintF64 get qRes 10
486uPrint tTab
487uPrintF64 get qRes 1
488uPrint tTab
489uPrintF64 get qRes 0
490uPrint tTab
491actual = ulong 0
492if lt get qRes 0 1.0f64
493actual = ulong 2
494uPrint tClosedL1
495else
496if lt get qRes 1 1.0f64
497actual = ulong 1
498uPrint tClosedTV
499else
500uPrint tOpen
501end
502end
503uPrint tNl
504if ne actual expected
505put rowFailures 0 add get rowFailures 0 1
506end
507end
508
509text tRowFail "PHASE4_CERT_DONE status=FAIL\n"
510text tTrigFail "TRIG_ENDPOINT status=FAIL\n"
511
512fn main to int
513initTrigGrid
514initW2Angles
515if eq trigGridOK 0
516uPrint tTrigFail
517ret 1
518end
519initChi21Norm
520uPrint tP4Hdr
521uPrint tP4AHdr
522uPrint tP4ACols
523scanW2Beta 1272 18
524scanW2Beta 1800 18
525scanW2Beta 2400 14
526scanW2Beta 2600 12
527scanW2Beta 2750 12
528scanW2Beta 2800 12
529scanW2Beta 2830 12
530scanW2Beta 2880 0
531if ne get wFailed 0 0
532uPrint tRowFail
533ret 1
534end
535uPrint tP4BHdr
536uPrint tP4BCols
537evalZeroLoopholeStar 6.0f64 1
538evalZeroLoopholeStar 6.5f64 2
539evalZeroLoopholeStar 7.0f64 2
540evalZeroLoopholeStar 8.0f64 2
541evalZeroLoopholeStar 10.0f64 2
542evalZeroLoopholeStar 12.0f64 2
543evalZeroLoopholeStar 15.0f64 2
544evalZeroLoopholeStar 20.0f64 2
545if ne get rowFailures 0 0
546uPrint tRowFail
547ret 1
548end
549uPrint tDone
550ret 0
551end