From 79d92ab2af199ade4740350ef25b6257180c15c8 Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Wed, 30 Sep 2026 20:57:47 -0500 Subject: [PATCH] Certify an explicit-word polynomial through exact H0 bin counts Add an exact real-to-complex dyadic lift and transport nodal/Hessian error into the original field units. Reconstruct one deterministic K1 example and certify its finite-polynomial lifetime-bin counts without promoting it to a Gaussian draw. Preserve all frozen source objects. --- .github/workflows/periodic-h0-pilot.yml | 2 + .../periodic_h0/CONFIRMATION_READINESS.md | 6 +- experiments/periodic_h0/README.md | 8 + experiments/periodic_h0/WORD_POLYNOMIAL.md | 217 ++++++++++++++++++ .../results/word_polynomial1/CERTIFICATE.json | 1 + .../results/word_polynomial1/RESULTS.md | 47 ++++ .../results/word_polynomial1/RUN.json | 1 + .../results/word_polynomial1/RUN.sha256 | 1 + .../periodic_h0/test_word_polynomial.py | 68 ++++++ .../test_word_polynomial_certificate.py | 72 ++++++ experiments/periodic_h0/word_polynomial.py | 79 +++++++ .../word_polynomial_certificate.py | 156 +++++++++++++ 12 files changed, 656 insertions(+), 2 deletions(-) create mode 100644 experiments/periodic_h0/WORD_POLYNOMIAL.md create mode 100644 experiments/periodic_h0/results/word_polynomial1/CERTIFICATE.json create mode 100644 experiments/periodic_h0/results/word_polynomial1/RESULTS.md create mode 100644 experiments/periodic_h0/results/word_polynomial1/RUN.json create mode 100644 experiments/periodic_h0/results/word_polynomial1/RUN.sha256 create mode 100644 experiments/periodic_h0/test_word_polynomial.py create mode 100644 experiments/periodic_h0/test_word_polynomial_certificate.py create mode 100644 experiments/periodic_h0/word_polynomial.py create mode 100644 experiments/periodic_h0/word_polynomial_certificate.py diff --git a/.github/workflows/periodic-h0-pilot.yml b/.github/workflows/periodic-h0-pilot.yml index dd39a6b43..e2390f9a0 100644 --- a/.github/workflows/periodic-h0-pilot.yml +++ b/.github/workflows/periodic-h0-pilot.yml @@ -47,6 +47,8 @@ jobs: run: python -B -S experiments/periodic_h0/gaussian_tail_certificate.py --verify experiments/periodic_h0/results/gaussian_tail1 - name: Replay the prospective finite-word coupling under its input model run: python -B -S experiments/periodic_h0/gaussian_coupling_certificate.py --verify experiments/periodic_h0/results/gaussian_coupling1 + - name: Replay explicit words through the finite-polynomial barcode bridge + run: python -B -S experiments/periodic_h0/word_polynomial_certificate.py --verify experiments/periodic_h0/results/word_polynomial1 - name: Execute the complete fixed pilot run: | python -B experiments/periodic_h0/run_pilot.py --output "$RUNNER_TEMP/periodic-h0-replay" diff --git a/experiments/periodic_h0/CONFIRMATION_READINESS.md b/experiments/periodic_h0/CONFIRMATION_READINESS.md index 51b601127..a2704d202 100644 --- a/experiments/periodic_h0/CONFIRMATION_READINESS.md +++ b/experiments/periodic_h0/CONFIRMATION_READINESS.md @@ -14,6 +14,7 @@ paired differences, finite-sample error, and the last refinement remain relevant | Certified numeric nodal input | [New seed34000 / 128² snapshot](NODAL_CERTIFICATE.md), every node independently enclosed | Nodal error and abstract finite-field diagram bound supplied for this snapshot only; historical samples and computed barcode endpoints remain uncertified | | Sharper finite-field spatial bound | [Hessian/grid certificate](HESSIAN_GRID.md), with a 256² derivative grid and a separate 1024² dyadic sample grid | Exact abstract-filtration error evaluated for deterministic new samples; no transfer of historical histogram counts | | Exact fine-grid H0 endpoints | [Integer barcode and independent connectivity verification](EXACT_H0.md) | One C38 grid and its frozen finite polynomial only; exact endpoints and deterministic bin-count sandwich | +| New sampler → exact polynomial barcode | [Explicit-word bridge](WORD_POLYNOMIAL.md) and [complete deterministic example](results/word_polynomial1/RESULTS.md) | Exact finite-polynomial bin counts at cutoff 1; no random input law or full-field diagram claim | | Ideal infinite-field truncation | [Exact Gaussian shell/theta bound](GAUSSIAN_TAIL.md), including all modes beyond64 and the normalization correction | Uniform probabilistic tail supplied for the explicitly defined ideal field | | Coupling the stored coefficients to the ideal field | Explicit low-mode sup-norm/coefficient contract in the same proof | rho remains unknown; no full-field probability or count bound for the frozen polynomial | | Lifetime range | Larger bins exhibit numerical stability; shortest bins still drift | No certified finite-lifetime range for the leading law | @@ -63,8 +64,9 @@ or a pass threshold now would conceal missing analytic inputs. The barcode computation on the certified fine dyadic grid now has exact integer endpoints and separate connectivity checks. A quantified ideal-field tail is now available. A [constructive low-mode coupling](GAUSSIAN_COUPLING.md) also -exists for a new sampler under explicit independent uniform inputs. The next -experiment must construct and certify that sampler's polynomial and barcode; +exists for a new sampler under explicit independent uniform inputs. A [new deterministic example](results/word_polynomial1/RESULTS.md) now connects +that sampler to certified polynomial and barcode calculations. A declared +ensemble at the matching cutoff is still needed for a statistical experiment; the old seed-labelled coefficients do not acquire this coupling. A numerical remainder budget and exceptional-count moments remain separate inputs. The finite-polynomial derivative input is now available. The source-bound manuscript diff --git a/experiments/periodic_h0/README.md b/experiments/periodic_h0/README.md index fc98f9c94..4ac69b882 100644 --- a/experiments/periodic_h0/README.md +++ b/experiments/periodic_h0/README.md @@ -33,6 +33,14 @@ at cutoffs24 and32. The [construction](GAUSSIAN_COUPLING.md) preserves the historical sample's separate status; a newly sampled and certified barcode is still needed to use this new path in an experiment. +A [new word-to-polynomial example](results/word_polynomial1/RESULTS.md) now +connects that construction to exact grid evaluation and barcode bounds. For +one explicitly specified deterministic polynomial, it certifies exactly one +smooth-field bar in the lifetime range [0.008, 0.016). The +[derivation](WORD_POLYNOMIAL.md) transports every coefficient and error bound +without rounding. This example is a deterministic check; a declared random +ensemble and the remaining statistical inputs are still needed. + This small experiment samples a truncated version of the periodized Gaussian field on a side-24 square torus and measures finite ordinary superlevel H₀ bars using GUDHI. It accompanies the [manuscript draft](../../docs/research-translation/20260930/MANUSCRIPT.md), [statement crosswalk](../../docs/research-translation/20260930/CROSSWALK.md) and [original protocol](../../docs/research-translation/20260930/EXPERIMENT.md). It is numerical evidence about the declared discretized ensemble, not a continuum certificate or a new mathematical acceptance. ## Reproduce the pilot diff --git a/experiments/periodic_h0/WORD_POLYNOMIAL.md b/experiments/periodic_h0/WORD_POLYNOMIAL.md new file mode 100644 index 000000000..ef520730c --- /dev/null +++ b/experiments/periodic_h0/WORD_POLYNOMIAL.md @@ -0,0 +1,217 @@ +# From explicit words to a certified finite-polynomial barcode + +[Sampler and coupling premise](GAUSSIAN_COUPLING.md) · +[Exact nodal evaluator](NODAL_CERTIFICATE.md) · +[Hessian enclosure](HESSIAN_GRID.md) · [Exact H₀](EXACT_H0.md) + +This bridge takes the exact real coefficients constructed by +`gaussian_coupling.polynomial` from an explicit ordered word list. It converts +them to complex Fourier coefficients without rounding, evaluates a new exact +dyadic grid, and bounds its barcode error against that same smooth finite +polynomial. The implementation is [word_polynomial.py](word_polynomial.py). + +The fixture below is deterministic. It is not a Gaussian +sample, a held-out experiment, or a replacement for the historical PCG64 +polynomial. The sampler's independent uniform-word law remains a premise of +its ensemble theorem. A selected fixed word list does not inherit that law or +its unconditional probability statement. + +## Exact object and Fourier conventions + +Set the torus side to 24 and let + +```text +R_K = {(kx,ky): 0 <= kx <= K, -K <= ky <= K, + kx > 0 or (kx = 0 and ky > 0)}. +theta_k(x) = 2 pi k·x/24. +P(x) = d + sum_{k in R_K} [C_k cos(theta_k(x)) + S_k sin(theta_k(x))]. +``` + +Here `d`, `C_k` and `S_k` are the exact dyadic `Fraction` values returned by +the sampler, not floating approximations to those values. The word order is +DC first, then the cosine and sine coordinates for each frequency in increasing +`kx`, then increasing `ky`. There are `2K(K+1)` pairs and `(2K+1)^2` words. +The bridge requires the complete ordered mode set, strict integer frequencies +and cutoff, and real coefficients with denominator at most `2^192`. + +Define + +```text +z_0 = d, z_k = (C_k - i S_k)/2. +P(x) = z_0 + 2 Re sum_{k in R_K} z_k exp(+i theta_k(x)). +``` + +This identity follows by multiplying `C_k-iS_k` by `cos(theta)+i sin(theta)` +and taking its real part. Both the minus sign and the division by two are +necessary. The DC term is real and is neither halved nor duplicated. The +negative-frequency coefficient is the conjugate of the positive-frequency +coefficient. The sampler's real weight +`sqrt(2) exp(-beta |k|^2)/S_alpha,64` therefore becomes +`exp(-beta |k|^2)/(sqrt(2) S_alpha,64)` in the complex convention, with no +further normalization change. + +At row-major vertex `a*n+b`, the physical point is `(24a/n,24b/n)` and the +phase is `2 pi (kx*a+ky*b)/n`. The existing inverse DFT uses the positive +exponent and no normalization in either axis. In particular, no factor `n^2` +is inserted or removed. Both grids must be supported powers of two, at most +1024 and strictly greater than `2K`; the sample grid is at least four. + +## Exact lifting into the existing evaluator + +The real coefficients can require denominator `2^192`; after conversion, +a complex component can require `2^193`. The unchanged nodal evaluator uses +`S=2^96` and requires every input coefficient to be exactly representable at +that scale. Converting these inputs to float64 or silently rounding them to +that scale would define a different polynomial. + +Instead, let `r` be the largest denominator exponent among the DC and all +converted complex components, and set + +```text +lambda = 2^max(0,r-96), P_lift = lambda P. +``` + +Every component of `P_lift` multiplied by `S` is an integer. This is the +smallest nonnegative power-of-two lift with that property; `lambda <= 2^97` +for the accepted inputs. The bridge stores canonical rational strings for +the lifted complex record and performs no coefficient rounding. Its legacy +`seed=0` field is solely a compatibility record label, with no RNG meaning. + +Suppose `nodal_core.evaluate` returns complex integer centers `a_v`, its +stage records, and an error `E_lift` bounding each component of every exact +node of `P_lift`. Define the supplied real samples and their error by + +```text +sample_scale = lambda S, +s_v = Re(a_v)/sample_scale, +eta = E_lift/lambda. +``` + +Dividing the existing component inequality by positive `lambda` proves +`max_v |P(v)-s_v| <= eta`. Since `P` is real, the same inequality bounds +`|Im(a_v)|/sample_scale`; the implementation also checks this consequence. +There is no added coefficient-conversion error. A scale of `2^193` describes +the exact sample denominator, not 193-bit transcendental accuracy: the bound +still includes the evaluator's existing 96-bit twiddle errors. + +The sample digest is the SHA-256 of the canonical JSON array of decimal real +integer strings in row-major order, including the canonical trailing newline. +The full array need not be stored when replay regenerates it, its stage bounds +and its digest. A digest identifies an array; the regenerated arithmetic and +the nodal proof supply its error bound. + +## Hessian, stability and exact bin transfer + +Apply `hessian_grid_core.bound_record` to `P_lift` on a derivative grid of +size `m`. This consumes all derivative-grid nodes and the existing fourth +derivative interpolation covers. Let `c_lift` denote its returned +`spatial_coefficient`. For sample grid size `n`, set + +```text +B = (24/n)^2 c_lift/lambda, epsilon = eta+B. +``` + +Every actual derivative of `P_lift` is `lambda` times the corresponding +derivative of `P`, so division by positive `lambda` transports the certified +upper bound to `P`. This argument does not require the rounded upper bounds +returned by the program to be exactly homogeneous. The complete lifted +Hessian result remains available for replay in its original units. + +The [existing approximation argument](APPROXIMATION.md) constructs a +continuous PL representative of the periodic vertex cubical filtration with +uniform error at most `eta+B` from the smooth finite polynomial. Its cited +persistence stability theorem supplies an epsilon-matching to `D(P)`. +No Morse assumption, distinct-critical-value assumption or Gaussian premise +is added by this step. + +The bridge computes `exact_h0.compute(Re(a_v),n)` with the four periodic +axis neighbors and runs `verify_by_connectivity` on that same integer array. +The latter checks plateau births, essential elder, complete finite-bar labels +and both sides of every proposed death level. This is algorithmic independent +verification, not a claim of organizationally independent review. Endpoint +integers remain unchanged; a pair `(b,d)` has exact lifetime +`(b-d)/sample_scale`. One essential class is kept separate, zero pairs are +omitted, and no longest finite interval is removed. The computed endpoint +arithmetic error is zero relative to these supplied samples. + +For the exact sample diagram `Q`, put `delta=2 epsilon`. The existing +[bin-transfer proof](EXACT_H0.md) gives, for `0 delta. +``` + +The lower count is zero when the contracted interval is empty. The upper +bound is absent when `a <= delta`, including equality. All endpoints, scales, +errors and comparisons remain exact integers or rational numbers. Essential +classes and diagonal points are not counted. These are realization counts +for the specified finite polynomial, not ensemble expectations. + +## Deterministic fixture and certified result + +The new fixture has cutoff one and nine ordered words + +```text +word_i = floor(j_i (2^128-1)/17), +(j_0,...,j_8) = (1,13,4,16,7,11,2,15,9). +sample grid n=128; derivative grid m=32. +``` + +It is distinct from the evenly spaced clipping fixture in the earlier +coupling certificate. It is deliberately selected arithmetic input. The +frozen clipping fixture remains useful for checking the conversion, but its +existence does not certify this new grid or barcode. + +The [produced certificate](results/word_polynomial1/CERTIFICATE.json) regenerates +this fixture from the words, with `lambda=2^97` and sample scale `2^193`. +Its [readable result](results/word_polynomial1/RESULTS.md) reports three +positive finite grid bars and the exact rational diagram bound. Decimal error +bounds in that report are rounded upward, rather than probe approximations. + +Both the lower and upper counts for `[1/125,2/125)=[0.008,0.016)` equal one. +The smooth finite polynomial therefore has **exactly one finite bar in that +bin**, and zero in each of the other seven displayed bins spanning +`[1/1000,32/125)`. This does not exclude bars outside those bins. The two +smaller grid bars are below `2 epsilon` and are not certified smooth-field +detections. No conclusion about all sufficiently short smooth-field bars +follows from this bin result. + +The [execution receipt](results/word_polynomial1/RUN.json) binds the sources. +Run the certificate verifier to regenerate and compare every value, rather +than treating the prose or file hashes alone as a numerical proof. + +## Frozen dependencies and verification boundary + +The construction uses the unchanged sampler documented in +[GAUSSIAN_COUPLING.md](GAUSSIAN_COUPLING.md), with the frozen upstream objects + +```text +results/gaussian_coupling1/CERTIFICATE.json +1ab5e225ec3e0a570910afc11026adf38ce39d01a4a8a16caa9ad487c95e1e32 +results/gaussian_coupling1/RUN.json +dbc5b27e6ea7e147133b48194889599a7fe1471bdb218c0513cb1ccb96a77d61 +``` + +The consumed mathematical interfaces are the unchanged +[nodal core](nodal_core.py), [Hessian core](hessian_grid_core.py), +[integer H₀ algorithm](exact_h0.py), and their linked derivations above. +The new receipt must bind their actual source bytes, the sampler inputs and +the new bridge. Its verifier must regenerate the polynomial, exact lift, +centers, Hessian bound, barcode and bin counts, and check the rendered report. +Rebinding the hashes of a false result does not replace this semantic replay. + +Focused controls cover the sine sign, factor two, DC and transform +normalization; complete mode and word ordering; the 193-bit conversion case; +minimal lift; sample and error units; malformed types and aliased grids; and +altered outputs with rebound receipt hashes. The existing independent +connectivity checker remains necessary for each produced barcode. + +This bridge supplies a deterministic finite-polynomial certificate. It does +not prove any actual word source IID, attach an unconditional Gaussian +probability to the fixture, apply K24/K32 tail budgets to K1, promote the +historical PCG64 polynomial, or establish an infinite-field observation, +expected-count bound, lifetime asymptotic or numerical remainder. The +historical coupling error and this fixture's infinite-field diagram bound +remain unknown in the output. Author work, substantive review, formal +evidence and scientific acceptance retain their separate meanings. diff --git a/experiments/periodic_h0/results/word_polynomial1/CERTIFICATE.json b/experiments/periodic_h0/results/word_polynomial1/CERTIFICATE.json new file mode 100644 index 000000000..97c487b56 --- /dev/null +++ b/experiments/periodic_h0/results/word_polynomial1/CERTIFICATE.json @@ -0,0 +1 @@ +{"historical_objects_unchanged":true,"iid_input_law_certified":false,"input":{"bin_edges":["1/1000","1/500","1/250","1/125","2/125","4/125","8/125","16/125","32/125"],"cutoff":1,"grid":128,"hessian_grid":32,"kind":"deterministic arithmetic fixture; no RNG used","record_id":0,"side":24,"word_order":"DC then cosine,sine for each ordered half-square mode","words":["20016609818878733144904388672456953615","260215927645423530883757052741940396995","80066439275514932579617554689827814460","320265757102059730318470218759311257840","140116268732151132014330720707198675305","220182708007666064593948275397026489765","40033219637757466289808777344913907230","300249147283180997173565830086854304225","180149488369908598304139498052112582535"]},"input_sha256":"377459fd0b6c4434cf7681e764c72315a763a14dfa8a08b2f387461d50c21acb","new_deterministic_barcodes":1,"new_gaussian_barcodes":0,"next_obligation":"A declared ensemble at a matching cutoff, with source-law premises and exceptional-count control, is still needed for statistical or infinite-field conclusions.","parent_certificate_sha256":"1ab5e225ec3e0a570910afc11026adf38ce39d01a4a8a16caa9ad487c95e1e32","parent_receipt_sha256":"dbc5b27e6ea7e147133b48194889599a7fe1471bdb218c0513cb1ccb96a77d61","real_polynomial":{"dc":"-128229013988295542567833856603121750387525058952548055593/784637716923335095479473677900958302012794430558004314112","modes":[[0,1,"657598914795187010037550760904790169201706316914779957715/6277101735386680763835789423207666416102355444464034512896","-657598914795187010037550760904790169201706316914779957715/6277101735386680763835789423207666416102355444464034512896"],[1,-1,"700935820556631627509587072504339577712846381425766723471/3138550867693340381917894711603833208051177722232017256448","-199797446814712101211009191879141689632429603187600118525/6277101735386680763835789423207666416102355444464034512896"],[1,0,"171978425492521822268478596861822525845274237856657715119/3138550867693340381917894711603833208051177722232017256448","-1081683933471058221962528104976814821641857086936029511481/6277101735386680763835789423207666416102355444464034512896"],[1,1,"1063307459043748068684207708266097877406450807238947776647/6277101735386680763835789423207666416102355444464034512896","33055583837413854706755993523881332265929343322687299165/3138550867693340381917894711603833208051177722232017256448"]]},"real_polynomial_sha256":"fed79e5c7b63241a1baf88c101d2b512d9519601585c9bacf9740d12736e8d6f","result":{"barcode":{"birth_vertices":[11097,9935,9806],"essential":["5487831002403163687526053868914344313549067885195223862582"],"essential_vertices":[15356],"intervals":[["1829068272828507040239070345026338268626473726986104889715","1826426137735556621048953630088429235560622376963860668626"],["1967223961583193233009223894382749292619461505758283504929","1967164359178795463695286572110638119643436127718907164867"],["1969212478849953687221367020728415635738167951667843893116","1826338419548252009695835793598211946915344233083858569973"]],"zero_count":16380},"bins":[{"clean_upper":true,"lower":"1/1000","nonempty_contraction":false,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"1/500"},{"clean_upper":true,"lower":"1/500","nonempty_contraction":true,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"1/250"},{"clean_upper":true,"lower":"1/250","nonempty_contraction":true,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"1/125"},{"clean_upper":true,"lower":"1/125","nonempty_contraction":true,"sample_count":1,"target_lower_count":1,"target_upper_count":1,"upper":"2/125"},{"clean_upper":true,"lower":"2/125","nonempty_contraction":true,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"4/125"},{"clean_upper":true,"lower":"4/125","nonempty_contraction":true,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"8/125"},{"clean_upper":true,"lower":"8/125","nonempty_contraction":true,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"16/125"},{"clean_upper":true,"lower":"16/125","nonempty_contraction":true,"sample_count":0,"target_lower_count":0,"target_upper_count":0,"upper":"32/125"}],"compatibility_seed_label_has_no_rng_meaning":true,"computed_barcode_error":"0","cutoff":1,"finite_polynomial_diagram_bound":"4553349179289174851548341882571430046196215586543866448318543193908708965713182288664345371793073730388953598830612680171627679243451889726099103966108814499861038636591496483414086418269347272316847864018202393642513441707451/12129047596099288555851402253613301212944422008724192274523844047078523067862319424459987568973800608988185396071336509423215469094646987433158494336259227650034804500162889887111447543996862850197367181200909912116350366045437952","finite_polynomial_diagram_bound_decimal_up":"0.000375408633135674692468","gaussian_law_certified":false,"grid":128,"hessian_grid":32,"historical_coupling_error":null,"independent_connectivity_check":true,"infinite_field_diagram_bound":null,"lifetime_law_certified":false,"lift":"158456325028528675187087900672","lifted_hessian":{"H":"505927686587686094615790061962087122094485303341254789376770655903115727225321993330753748624551027475878551867832622958455421599262489210955156503620924178429154079268892590591792741247530981226867920158556805041913305551011/74751027079122046462216955587793573067050655862760405902609490213261724339546970300512875500623813013973275600053770769378323738155015176163371603062328757260320680744718580942157810765768356265984","Mxx":"100675253940352097620754453491950367358301192488891451510868868914117645602668933546049130784756923679310214119732788845828325459283264479860343645883518919363065706651915935597744105294055613606395359785401138068674526898217/18687756769780511615554238896948393266762663965690101475652372553315431084886742575128218875155953253493318900013442692344580934538753794040842900765582189315080170186179645235539452691442089066496","Mxy":"40699384894970493344421350142551700246507718894599786541178460634468406302959167349202533358072494462868692539614575044317477143837780871071383397737702977878333347177197014297881041244876485832933992212433389056685243051267/9343878384890255807777119448474196633381331982845050737826186276657715542443371287564109437577976626746659450006721346172290467269376897020421450382791094657540085093089822617769726345721044533248","Myy":"206381262887888779043940191218913291883891882430136011607312431770054963639588976874846135722212803668734366708090959027237686722853056613184877216705675583710163517233255850931108079045339496256910898481566983849940268548177/37375513539561023231108477793896786533525327931380202951304745106630862169773485150256437750311906506986637800026885384689161869077507588081685801531164378630160340372359290471078905382884178132992","components":{"xx":{"center_error_bound":"5418494441403101787372712054663687715530592738389700159684868929/3213876088517980551083924184682325205044405987565585670602752","center_object_sha256":"1d669cedb471671f7b4de24695db93db75e913aba35316f5032060320a3857ae","global_bound":"100675253940352097620754453491950367358301192488891451510868868914117645602668933546049130784756923679310214119732788845828325459283264479860343645883518919363065706651915935597744105294055613606395359785401138068674526898217/18687756769780511615554238896948393266762663965690101475652372553315431084886742575128218875155953253493318900013442692344580934538753794040842900765582189315080170186179645235539452691442089066496","grid_abs_bound":"31527868115810799328533267203218940054390097264733817562757101879683628921429617462286706459218755015577446949444869470807626044487497525505185861343787541530461093713/5954262829429611647380060634218533145425030026750509549825967711687797048224955787888157087447151129073766576998532529631515456541611261952","grid_center_abs_max":"6120810507716030102470149828803410290663971271093440817009/79228162514264337593543950336","interpolation_cover":"1723436108952912859750074730939256278191988928744254839390274849271731379777370803350420911027295681304104193424223021138323084164055371439221081667597765877144283693128379762198593582760975754671222180640834298978845386793/18687756769780511615554238896948393266762663965690101475652372553315431084886742575128218875155953253493318900013442692344580934538753794040842900765582189315080170186179645235539452691442089066496","stages":[{"axis":"rows","error_bound":"1601669087927975356230183336927434926315254534835905540635/6277101735386680763835789423207666416102355444464034512896","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":2},{"axis":"rows","error_bound":"11211683615495827493611283358492044484206781743851338784445/12554203470773361527671578846415332832204710888928069025792","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":4},{"axis":"rows","error_bound":"62465094429191038892977150140169962126294926858600316084765/25108406941546723055343157692830665664409421777856138051584","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":8},{"axis":"rows","error_bound":"328185839246504034798319647188628143719722445725023304213753/50216813883093446110686315385661331328818843555712276103168","input_l1_integer_max":1982545887568605041679237060932677554773844260205943498573,"length":16},{"axis":"rows","error_bound":"1690720628461115067108029544043719153446120803391309126648253/100433627766186892221372630771322662657637687111424552206336","input_l1_integer_max":3111964514287180819776956756246538096712153754090265873550,"length":32},{"axis":"columns","error_bound":"8582387339545671258164159379637675127631316087935067990382737/200867255532373784442745261542645325315275374222849104412672","input_l1_integer_max":4024506163752997582000364356806615931265120049282051685503,"length":2},{"axis":"columns","error_bound":"43169505092208548136068820217026534358958004581632384666196629/401734511064747568885490523085290650630550748445698208825344","input_l1_integer_max":4024506163752997582000364356806615931265120049282051685503,"length":4},{"axis":"columns","error_bound":"216362662250003124370840147722808989236392871192076012759549033/803469022129495137770981046170581301261101496891396417650688","input_l1_integer_max":4024506163752997582000364356806615931265120049282051685503,"length":8},{"axis":"columns","error_bound":"1082843584827936389235192831889397581065170052528208242654876941/1606938044258990275541962092341162602522202993782792835301376","input_l1_integer_max":4024506163752997582000364356806615931265120049282051685503,"length":16},{"axis":"columns","error_bound":"5418494441403101787372712054663687715530592738389700159684868929/3213876088517980551083924184682325205044405987565585670602752","input_l1_integer_max":8352572780116877337398232845077202724880515777802732732809,"length":32}]},"xy":{"center_error_bound":"5372172775228518298079419758128701124357177600019232641238508321/3213876088517980551083924184682325205044405987565585670602752","center_object_sha256":"0144f62dd2e78d5a25acb043ab60e51b24934ddb7c59188ce899fe3ec9ce01d9","global_bound":"40699384894970493344421350142551700246507718894599786541178460634468406302959167349202533358072494462868692539614575044317477143837780871071383397737702977878333347177197014297881041244876485832933992212433389056685243051267/9343878384890255807777119448474196633381331982845050737826186276657715542443371287564109437577976626746659450006721346172290467269376897020421450382791094657540085093089822617769726345721044533248","grid_abs_bound":"25442376942083117288325632414346849554054272801977101698870570517892482149146659286583317065890649818810961579209793170722397060200739004916806416533111832043283801393/5954262829429611647380060634218533145425030026750509549825967711687797048224955787888157087447151129073766576998532529631515456541611261952","grid_center_abs_max":"4939375144438609006917183889057328680069477905129296624813/79228162514264337593543950336","interpolation_cover":"773287781092491395791325486303506492729260065884439982181252636426909838138610823473707640365629725546937305869005671881462969886304187148419517479877120002951747979741121889761171822321889104070570153711464891763252735235/9343878384890255807777119448474196633381331982845050737826186276657715542443371287564109437577976626746659450006721346172290467269376897020421450382791094657540085093089822617769726345721044533248","stages":[{"axis":"rows","error_bound":"1601669087927975356230183336927434926315254534835905540635/6277101735386680763835789423207666416102355444464034512896","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":2},{"axis":"rows","error_bound":"11211683615495827493611283358492044484206781743851338784445/12554203470773361527671578846415332832204710888928069025792","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":4},{"axis":"rows","error_bound":"62465094429191038892977150140169962126294926858600316084765/25108406941546723055343157692830665664409421777856138051584","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":8},{"axis":"rows","error_bound":"328185839246504034798319647188628143719722445725023304213753/50216813883093446110686315385661331328818843555712276103168","input_l1_integer_max":1982545887568605041679237060932677554773844260205943498573,"length":16},{"axis":"rows","error_bound":"1690720628461115067108029544043719153446120803391309126648253/100433627766186892221372630771322662657637687111424552206336","input_l1_integer_max":3111964514287180819776956756246538096712153754090265873550,"length":32},{"axis":"columns","error_bound":"8536766834443075998436175850079260411684679109930288952247729/200867255532373784442745261542645325315275374222849104412672","input_l1_integer_max":2598865379296895715500879058106156057932714486632706743784,"length":2},{"axis":"columns","error_bound":"42850161556490381317972935510117631347331545735598931399251573/401734511064747568885490523085290650630550748445698208825344","input_l1_integer_max":2598865379296895715500879058106156057932714486632706743784,"length":4},{"axis":"columns","error_bound":"214583462551001909241448790070030815314474029049889630272283721/803469022129495137770981046170581301261101496891396417650688","input_l1_integer_max":2598865379296895715500879058106156057932714486632706743784,"length":8},{"axis":"columns","error_bound":"1073811435163830492913747861311460280200065819246015641474896237/1606938044258990275541962092341162602522202993782792835301376","input_l1_integer_max":3492665659456823072280902192562743839429094380294986280604,"length":16},{"axis":"columns","error_bound":"5372172775228518298079419758128701124357177600019232641238508321/3213876088517980551083924184682325205044405987565585670602752","input_l1_integer_max":6085155096417643575547756975350470600087601794395481665510,"length":32}]},"yy":{"center_error_bound":"5372172775228518298079419758128701124357177600019232641238508321/3213876088517980551083924184682325205044405987565585670602752","center_object_sha256":"207ccc2acf875b010c384f471a2b1132116d2ead75c9f19b146b4a7b80e4d182","global_bound":"206381262887888779043940191218913291883891882430136011607312431770054963639588976874846135722212803668734366708090959027237686722853056613184877216705675583710163517233255850931108079045339496256910898481566983849940268548177/37375513539561023231108477793896786533525327931380202951304745106630862169773485150256437750311906506986637800026885384689161869077507588081685801531164378630160340372359290471078905382884178132992","grid_abs_bound":"32339494470392097959672532654006350010268009298429328737485321091970854335547922825234723870729377251580811110335538259761730618007788081138680924598285446560459515185/5954262829429611647380060634218533145425030026750509549825967711687797048224955787888157087447151129073766576998532529631515456541611261952","grid_center_abs_max":"6278379395698315814985935137297088045083374628606412305167/79228162514264337593543950336","interpolation_cover":"3382966026262574387115271686152430323925251255047744836406746508807687021213009709417725409425673081235721340260859288913369946648044135160162767346352621980689424150656998392735521869668096778977973329332896967140478222417/37375513539561023231108477793896786533525327931380202951304745106630862169773485150256437750311906506986637800026885384689161869077507588081685801531164378630160340372359290471078905382884178132992","stages":[{"axis":"rows","error_bound":"1601669087927975356230183336927434926315254534835905540635/6277101735386680763835789423207666416102355444464034512896","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":2},{"axis":"rows","error_bound":"11211683615495827493611283358492044484206781743851338784445/12554203470773361527671578846415332832204710888928069025792","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":4},{"axis":"rows","error_bound":"62465094429191038892977150140169962126294926858600316084765/25108406941546723055343157692830665664409421777856138051584","input_l1_integer_max":1601669087927975356230183336887820845058122366039133565467,"length":8},{"axis":"rows","error_bound":"328185839246504034798319647188628143719722445725023304213753/50216813883093446110686315385661331328818843555712276103168","input_l1_integer_max":1982545887568605041679237060932677554773844260205943498573,"length":16},{"axis":"rows","error_bound":"1690720628461115067108029544043719153446120803391309126648253/100433627766186892221372630771322662657637687111424552206336","input_l1_integer_max":3111964514287180819776956756246538096712153754090265873550,"length":32},{"axis":"columns","error_bound":"8536766834443075998436175850079260411684679109930288952247729/200867255532373784442745261542645325315275374222849104412672","input_l1_integer_max":2598865379296895715500879058106156057932714486632706743784,"length":2},{"axis":"columns","error_bound":"42850161556490381317972935510117631347331545735598931399251573/401734511064747568885490523085290650630550748445698208825344","input_l1_integer_max":2598865379296895715500879058106156057932714486632706743784,"length":4},{"axis":"columns","error_bound":"214583462551001909241448790070030815314474029049889630272283721/803469022129495137770981046170581301261101496891396417650688","input_l1_integer_max":2598865379296895715500879058106156057932714486632706743784,"length":8},{"axis":"columns","error_bound":"1073811435163830492913747861311460280200065819246015641474896237/1606938044258990275541962092341162602522202993782792835301376","input_l1_integer_max":3492665659456823072280902192562743839429094380294986280604,"length":16},{"axis":"columns","error_bound":"5372172775228518298079419758128701124357177600019232641238508321/3213876088517980551083924184682325205044405987565585670602752","input_l1_integer_max":6085155096417643575547756975350470600087601794395481665510,"length":32}]}},"fixed_point_scale":"79228162514264337593543950336","fourth_matrix":{"operator_bound":"856270410553599819639226262057948150391950387008570381881866852227758242462077148327995646437678708036585126983961119875674352232849032233491705273026753321626001775360306765726712834904037190145570847489276875665790066251/583992399055640987986069965529637289586333248927815671114136642291107221402710705472756839848623539171666215625420084135768154204336056063776340648924443416096255318318113913610607896607565283328","xx":"191492900994768095527786081215472919799109880971583871043363872141303486641930089261157879003032853478233799269358113459813676018228374604357897963066418430793809299236486640244288175862330639407913575626759366553205042977/145998099763910246996517491382409322396583312231953917778534160572776805350677676368189209962155884792916553906355021033942038551084014015944085162231110854024063829579528478402651974151891320832","xy":"-6071269998854425791410988360063549894327571518608211927395340208784804934367323176578368065601222556202049541344885031926353983555851751671390185048509902331351315147677713433290137344407193768979904843786129822818696459/36499524940977561749129372845602330599145828057988479444633540143194201337669419092047302490538971198229138476588755258485509637771003503986021290557777713506015957394882119600662993537972830208","yy":"375885114029174931901696854016936702658361250560860537378527389867520780134778856601969489936185897915080148917873254323707771849782681684462529705150291331187713794517444265859502429963121864330885925481432996348942024713/291996199527820493993034982764818644793166624463907835557068321145553610701355352736378419924311769585833107812710042067884077102168028031888170324462221708048127659159056956805303948303782641664"},"grid":32,"grid_hessian_center_norm":"15409104889154647139320556795933405635019633363253126044369/158456325028528675187087900672","grid_hessian_error_bound":"685100728616860991262993711120638993917047219842016115570771815541706248650826716419050283630130795203945476719211678300218445697241109762625/2977131414714805823690030317109266572712515013375254774912983855843898524112477893944078543723575564536883288499266264815757728270805630976","grid_hessian_norm_bound":"19842806198441053720200781928289651032563567537125836431378971183175979998687489011165164621992568343684849468862693181195776911033100313572234580681881097361770418753/2977131414714805823690030317109266572712515013375254774912983855843898524112477893944078543723575564536883288499266264815757728270805630976","operator_interpolation_cover":"7706433694982398376753036358521533353527553483077133436936801670049824182158694334951960817939108372329266142855650078881069170095641290101425347457240779894634015978242760891540415514136334711310137627403491880992110596259/74751027079122046462216955587793573067050655862760405902609490213261724339546970300512875500623813013973275600053770769378323738155015176163371603062328757260320680744718580942157810765768356265984","side":24,"spatial_coefficient":"505927686587686094615790061962087122094485303341254789376770655903115727225321993330753748624551027475878551867832622958455421599262489210955156503620924178429154079268892590591792741247530981226867920158556805041913305551011/299004108316488185848867822351174292268202623451041623610437960853046897358187881202051502002495252055893102400215083077513294952620060704653486412249315029041282722978874323768631243063073425063936"},"lifted_nodal_error":"261632929682198663073548241370660114392595308332269932277577105019/3213876088517980551083924184682325205044405987565585670602752","lifted_record":{"dc":["-128229013988295542567833856603121750387525058952548055593/4951760157141521099596496896","0"],"modes":[[0,1,"657598914795187010037550760904790169201706316914779957715/79228162514264337593543950336","657598914795187010037550760904790169201706316914779957715/79228162514264337593543950336"],[1,-1,"700935820556631627509587072504339577712846381425766723471/39614081257132168796771975168","199797446814712101211009191879141689632429603187600118525/79228162514264337593543950336"],[1,0,"171978425492521822268478596861822525845274237856657715119/39614081257132168796771975168","1081683933471058221962528104976814821641857086936029511481/79228162514264337593543950336"],[1,1,"1063307459043748068684207708266097877406450807238947776647/79228162514264337593543950336","-33055583837413854706755993523881332265929343322687299165/39614081257132168796771975168"]],"seed":0},"lifted_stages":[{"axis":"rows","error_bound":"128229013988295542567833856605597630466095819502346304041/392318858461667547739736838950479151006397215279002157056","input_l1_integer_max":2051664223812728681085341705649948006200400943240768889488,"length":2},{"axis":"rows","error_bound":"897603097918068797974836996239183413262670736516424128287/784637716923335095479473677900958302012794430558004314112","input_l1_integer_max":2051664223812728681085341705649948006200400943240768889488,"length":4},{"axis":"rows","error_bound":"5000931545543526160145520407618307588177736960591505857599/1569275433846670190958947355801916604025588861116008628224","input_l1_integer_max":2051664223812728681085341705649948006200400943240768889488,"length":8},{"axis":"rows","error_bound":"26030489839623995141270272890936318984617451358976299720323/3138550867693340381917894711603833208051177722232017256448","input_l1_integer_max":2051664223812728681085341705649948006200400943240768889488,"length":16},{"axis":"rows","error_bound":"132204113421932704387436706160371157010544789906919039466271/6277101735386680763835789423207666416102355444464034512896","input_l1_integer_max":2051664223812728681085341705649948006200400943240768889488,"length":32},{"axis":"rows","error_bound":"665123895557288979299354214213234909227639015758670279060667/12554203470773361527671578846415332832204710888928069025792","input_l1_integer_max":2051664223812728681085341705649948006200400943240768889488,"length":64},{"axis":"rows","error_bound":"3338139931268222046057146106654458774682044790497126731931887/25108406941546723055343157692830665664409421777856138051584","input_l1_integer_max":3130113370444287390093758897031443054705295757147062181970,"length":128},{"axis":"columns","error_bound":"16722899182391629119506422921147404795561108616227323843010867/50216813883093446110686315385661331328818843555712276103168","input_l1_integer_max":4024940756314861152586548484349251187603450798914500943761,"length":2},{"axis":"columns","error_bound":"83678894964059183375973499381487245822107312408619999581757199/100433627766186892221372630771322662657637687111424552206336","input_l1_integer_max":4024940756314861152586548484349251187603450798914500943761,"length":4},{"axis":"columns","error_bound":"418523272924497992436750266458936672799140100698066758642191723/200867255532373784442745261542645325315275374222849104412672","input_l1_integer_max":4024940756314861152586548484349251187603450798914500943761,"length":8},{"axis":"columns","error_bound":"2092873960830894113297516871397684251372907580800267314677770071/401734511064747568885490523085290650630550748445698208825344","input_l1_integer_max":4024940756314861152586548484349251187603450798914500943761,"length":16},{"axis":"columns","error_bound":"10464924320185141397063638201295075061458169854186703973287289267/803469022129495137770981046170581301261101496891396417650688","input_l1_integer_max":4332156489615863875420658645693234306492478654386039731386,"length":32},{"axis":"columns","error_bound":"52325730632987048646470298695088682916478113171304254666233324159/1606938044258990275541962092341162602522202993782792835301376","input_l1_integer_max":4332156489615863875420658645693234306492478654386039731386,"length":64},{"axis":"columns","error_bound":"261632929682198663073548241370660114392595308332269932277577105019/3213876088517980551083924184682325205044405987565585670602752","input_l1_integer_max":8352572780116877337398232845077202724880515777802732732809,"length":128}],"nodal_error":"261632929682198663073548241370660114392595308332269932277577105019/509258994083621521567111422102344540262867098416484062659035112338595324940834176545849344","sample_count":16384,"sample_digest_encoding":"canonical JSON array of row-major decimal integer strings","sample_scale":"12554203470773361527671578846415332832204710888928069025792","sample_sha256":"8273fb4aeb8c1136700f50f07e745fc85d2a4c7a2d264ac2d6f6285ca8e67088","side":24,"spatial_error":"4553349179289174851542110557658784098850367730071293104390935903128041545027897939976783737620959247282906966810493606626098794393362402898596408532588317605862386713420033315326134671227778831041811281427011245377219749959099/12129047596099288555851402253613301212944422008724192274523844047078523067862319424459987568973800608988185396071336509423215469094646987433158494336259227650034804500162889887111447543996862850197367181200909912116350366045437952"},"schema_version":1,"scope":"One deterministic cutoff 1 side 24 finite-word polynomial: exact coefficient conversion, certified grid/Hessian error and finite H0 lifetime-bin counts. No IID source law, Gaussian observation, infinite-field diagram bound, historical coupling or lifetime-law confirmation certified."} diff --git a/experiments/periodic_h0/results/word_polynomial1/RESULTS.md b/experiments/periodic_h0/results/word_polynomial1/RESULTS.md new file mode 100644 index 000000000..d5717a606 --- /dev/null +++ b/experiments/periodic_h0/results/word_polynomial1/RESULTS.md @@ -0,0 +1,47 @@ +# From explicit words to a certified smooth-field barcode + +This deterministic example connects the new finite-word sampler to +exact Fourier-grid evaluation and periodic H₀ persistence. It uses +nine declared words, cutoff 1, a 128×128 sample grid and a 32×32 +Hessian grid. No random source is used. + +The exact grid has **3 positive finite bars** and one essential class. +A separate breadth-first connectivity calculation verifies the barcode. +Its endpoints are exact for the computed dyadic samples. + +The diagram bound against the original smooth finite polynomial is at most **0.000375408633135674692468**. +The bounds below account for both nodal arithmetic and spatial interpolation. + +| Lifetime bin | Exact grid count | Smooth polynomial lower count | Smooth polynomial upper count | +|---|---:|---:|---:| +| [1/1000, 1/500) | 0 | 0 | 0 | +| [1/500, 1/250) | 0 | 0 | 0 | +| [1/250, 1/125) | 0 | 0 | 0 | +| [1/125, 2/125) | 1 | 1 | 1 | +| [2/125, 4/125) | 0 | 0 | 0 | +| [4/125, 8/125) | 0 | 0 | 0 | +| [8/125, 16/125) | 0 | 0 | 0 | +| [16/125, 32/125) | 0 | 0 | 0 | + +Thus the smooth finite polynomial has **exactly one finite bar in +[1/125,2/125)** and none in the other seven displayed bins. This does +not exclude bars below 1/1000 or above 32/125. The two smaller positive +grid bars are below twice the diagram error and are not certified +smooth-field detections. Counts here are for this one polynomial, +not expected intensities or evidence for a Gaussian lifetime law. + +The real Fourier coefficients are converted without rounding. An +exact positive power of two lifts them into the existing fixed-point +evaluator; sample units and all error bounds are divided back by +that same factor. The 96-bit twiddle accuracy is unchanged. The +`seed:0` field in the compatibility record is only record ID 0. + +[Derivation and scope](../../WORD_POLYNOMIAL.md) · +[Exact inputs, endpoints and bounds](CERTIFICATE.json) · +[Source receipt](RUN.json) + +```sh +python -B -S experiments/periodic_h0/word_polynomial_certificate.py --verify experiments/periodic_h0/results/word_polynomial1 +``` + +One deterministic cutoff 1 side 24 finite-word polynomial: exact coefficient conversion, certified grid/Hessian error and finite H0 lifetime-bin counts. No IID source law, Gaussian observation, infinite-field diagram bound, historical coupling or lifetime-law confirmation certified. diff --git a/experiments/periodic_h0/results/word_polynomial1/RUN.json b/experiments/periodic_h0/results/word_polynomial1/RUN.json new file mode 100644 index 000000000..cb4dc6acd --- /dev/null +++ b/experiments/periodic_h0/results/word_polynomial1/RUN.json @@ -0,0 +1 @@ +{"outputs":{"CERTIFICATE.json":{"bytes":28369,"sha256":"0c6157788b2dfbb2480a1b7deae5d6287feebf39b951b70487cafa64b77d7e95"}},"platform":"macOS-15.7.4-arm64-arm-64bit","python":"3.12.14 (main, Aug 25 2026, 13:50:33) [Clang 22.1.3 ]","schema_version":1,"scope":"One deterministic cutoff 1 side 24 finite-word polynomial: exact coefficient conversion, certified grid/Hessian error and finite H0 lifetime-bin counts. No IID source law, Gaussian observation, infinite-field diagram bound, historical coupling or lifetime-law confirmation certified.","sources":{"APPROXIMATION.md":{"bytes":17970,"sha256":"dae4e01b35602077442796a1150294cce3eb544f2d0c2297f8fa7aa6ab16caef"},"EXACT_H0.md":{"bytes":14491,"sha256":"a788b46b1ea5640661e2692b84816bb3acfd1bae5a1fd3083dd18d5d8ba19fff"},"FINITE_CERTIFICATE.md":{"bytes":9966,"sha256":"4c9991db82a94725a893526cf310bd84221b7787e704b649a94e161591efa7aa"},"GAUSSIAN_COUPLING.md":{"bytes":9302,"sha256":"d83abd492ee9404dc47071303b8410106e755a166ef2ae0b03b1bead8fa12f78"},"GAUSSIAN_TAIL.md":{"bytes":9791,"sha256":"7a0ddc8d390dbc2b06e90731a49be8d4f36d6b8614168c17a05e9bdf818c8807"},"HESSIAN_GRID.md":{"bytes":8683,"sha256":"a6e7053da42e10f7fdf637c66e4948e62136e26e80a2d0d80bde9b822d052225"},"NODAL_CERTIFICATE.md":{"bytes":8477,"sha256":"6b39f935c66a129dc3661f464586912bc034bd46a47a8f96a9a3167c26601940"},"WORD_POLYNOMIAL.md":{"bytes":10519,"sha256":"7fee78ff0c23466fcbdf20fdb3b7dd400316a85f41bae3592dc23d350751a4d3"},"exact_barcode_certificate.py":{"bytes":10590,"sha256":"986da88dd703b4598ebf7782f874854124272ef6dbf67d7deb130972a86a217b"},"exact_h0.py":{"bytes":9089,"sha256":"48ee16f2316cb1a233594ed10466340aa321d553c2b888198fe86b4bd9052970"},"experiment.py":{"bytes":7020,"sha256":"affcefd3e3e0c44dbd312be25a5e8294ea270a9287db22fdc018d7aad99cb733"},"finite_certificate.py":{"bytes":14843,"sha256":"0674a2621dff6c040cbb24cc0b6e6df7847541ebc171ebdb28070afa05e04e6b"},"gaussian_coupling.py":{"bytes":6036,"sha256":"07e4d38720b778fb2a7487996a1beeafe29ffae34273491f5d6e1245e4dddffe"},"gaussian_coupling_certificate.py":{"bytes":8319,"sha256":"75023f4ab771ffd86a434ef3fc3bc9e9744ca6906c225ee986d85aec58a803b6"},"gaussian_tail.py":{"bytes":4688,"sha256":"07e55a62ed0bb6da6a9395762e2e0c033126f83b46abd48db4c24df710779db8"},"gaussian_tail_certificate.py":{"bytes":8456,"sha256":"a6855f836f04fe43aa3837f9d517237f09c0b886db3abb38a56fc3734d565631"},"hessian_grid_certificate.py":{"bytes":10447,"sha256":"3cc56eff4bfc3e648ad9ac74917db819288b606f7eddc5af5c24f8b835467690"},"hessian_grid_core.py":{"bytes":4304,"sha256":"0cd8cc11fc8c87893400b56153a5c8ce3e5aea9ec9e97df95b699a823aedc119"},"nodal_core.py":{"bytes":6388,"sha256":"a9b326664bb9f9fb9983491566cbf2030eaa0533f776ccd7a4f64ba809cc7b7e"},"results/certificate8/COEFFICIENTS.json":{"bytes":857299,"sha256":"f9703c9098bff546efda6eb8da6f012ac0e8f23b84b48cb2d997562d235faf71"},"results/exact_h0_1/CERTIFICATE.json":{"bytes":7635,"sha256":"845dc940e1781e570d4a6614a00889f33b239274c00e367dc2af1e3b86906fb8"},"results/exact_h0_1/RUN.json":{"bytes":2297,"sha256":"e51fba013218e746c6845283312cd9ac1e688a8b960e9a2c577a097be5b54c45"},"results/exact_h0_1/RUN.sha256":{"bytes":65,"sha256":"3d51e65e03a26bd2017a00ee601e4844e604c30bfb1795573b0fd8eec7fa44d5"},"results/gaussian_coupling1/CERTIFICATE.json":{"bytes":18341,"sha256":"1ab5e225ec3e0a570910afc11026adf38ce39d01a4a8a16caa9ad487c95e1e32"},"results/gaussian_coupling1/RUN.json":{"bytes":3851,"sha256":"dbc5b27e6ea7e147133b48194889599a7fe1471bdb218c0513cb1ccb96a77d61"},"results/gaussian_coupling1/RUN.sha256":{"bytes":65,"sha256":"5401d9a451d79197a2ef8d8b5658e3e5485d9daeae8ae485bd673a3c2ba23899"},"results/gaussian_tail1/CERTIFICATE.json":{"bytes":15004,"sha256":"9284099183648476bbceb6ddc6cd54bb212713402b1b8c15a8684e237587c960"},"results/gaussian_tail1/RUN.json":{"bytes":3100,"sha256":"2bab16d8bb51c55f599d30ff119aba57bf31d24bcb5ce1192658e085a25a199c"},"results/gaussian_tail1/RUN.sha256":{"bytes":65,"sha256":"ba49dcace0e45b866a11bec1d674120b8d055f5a6671fc669d572dab6a61ed02"},"results/hessian1/CERTIFICATE.json":{"bytes":25301,"sha256":"c46cfc061465b951968f675270b649cd6b61c1dc4989635a1c3c7a3f7a564519"},"results/hessian1/RUN.json":{"bytes":1573,"sha256":"3bea8119b5fc3b8aadf887b439d3032f7d88377771c338db44e320dfc60979e1"},"results/hessian1/RUN.sha256":{"bytes":65,"sha256":"ad4536f2bcfc15863af27f7f26176c30973beb4a87efaee95ca34410a0e7bb4b"},"word_polynomial.py":{"bytes":4155,"sha256":"98616041d9fbb9a5d2ec44225a7deaaf11d8fa4c459d7bf7e220144779596bce"},"word_polynomial_certificate.py":{"bytes":9603,"sha256":"6299087deca2a7aa2c4e8e5e6a58dc1f5325364a36c8fcbbd7bcd2a28af9724a"}},"utc":"2026-10-01T01:53:01.455813+00:00"} diff --git a/experiments/periodic_h0/results/word_polynomial1/RUN.sha256 b/experiments/periodic_h0/results/word_polynomial1/RUN.sha256 new file mode 100644 index 000000000..241e38182 --- /dev/null +++ b/experiments/periodic_h0/results/word_polynomial1/RUN.sha256 @@ -0,0 +1 @@ +dba004cd54233c47f4a5fccbef5382bd0d049ec9b87979020f018b3658e2c581 diff --git a/experiments/periodic_h0/test_word_polynomial.py b/experiments/periodic_h0/test_word_polynomial.py new file mode 100644 index 000000000..27439e9f4 --- /dev/null +++ b/experiments/periodic_h0/test_word_polynomial.py @@ -0,0 +1,68 @@ +"""Exact controls for the real-basis sampler's deterministic grid bridge.""" +import copy +import unittest +from fractions import Fraction as Q +import nodal_core as nc +try: + import word_polynomial as wp +except ModuleNotFoundError: + wp = None + + +def polynomial(): + return {'dc': Q(3), 'modes': [(0,1,Q(2),Q(4)), (1,-1,Q(0),Q(0)), + (1,0,Q(0),Q(0)), (1,1,Q(0),Q(0))]} + + +class WordPolynomialTests(unittest.TestCase): + def setUp(self): + self.assertIsNotNone(wp, 'Exact word-polynomial bridge is missing') + + def test_real_complex_identity_at_quarter_turns(self): + record, lift = wp.lift_record(polynomial(), 1) + self.assertEqual(lift, 1) + centers, _, error = nc.evaluate(record, 4) + # 3 + 2*cos(theta) + 4*sin(theta), not twice this or the wrong sine. + for i, expected in enumerate([5, 7, 1, -1]): + self.assertLessEqual(abs(Q(centers[i][0], nc.SCALE)-expected), error) + self.assertEqual(record['dc'], ['3', '0']) + + def test_smallest_exact_lift_and_no_coefficient_rounding(self): + p = polynomial(); p['dc'] = Q(1, 1<<192) + p['modes'][0] = (0,1,Q(1,1<<192),Q(3,1<<192)) + record, lift = wp.lift_record(p, 1) + self.assertEqual(lift, 1<<97) + self.assertEqual(Q(record['modes'][0][2])/lift, Q(1,1<<193)) + self.assertEqual(Q(record['modes'][0][3])/lift, -Q(3,1<<193)) + nc._input(record, 4) + too_small = copy.deepcopy(record) + too_small['modes'][0][2] = str(Q(record['modes'][0][2])/2) + with self.assertRaises(ValueError): nc._input(too_small, 4) + + def test_rejects_incomplete_nondyadic_and_wrong_types(self): + bad=[] + p=polynomial();p['modes'].pop();bad.append(p) + p=polynomial();p['dc']=Q(1,3);bad.append(p) + p=polynomial();p['dc']=3;bad.append(p) + p=polynomial();p['modes'][0]=(0,1,Q(1,1<<193),Q(0));bad.append(p) + p=polynomial();p['modes'][0]=(True,1,Q(1),Q(0));bad.append(p) + p=polynomial();p['modes'].reverse();bad.append(p) + for p in bad: + with self.subTest(p=p), self.assertRaises(ValueError):wp.lift_record(p,1) + for k in (True,0,65,1.0): + with self.assertRaises(ValueError):wp.lift_record(polynomial(),k) + + def test_grid_and_bound_units_survive_lifting(self): + p=polynomial();p['dc']+=Q(1,1<<192) + result=wp.analyze(p,1,8,8,[Q(1,10),Q(1),Q(10)]) + lift=int(result['lift']);scale=int(result['sample_scale']) + self.assertEqual(scale,lift*nc.SCALE) + self.assertEqual(Q(result['nodal_error']),Q(result['lifted_nodal_error'])/lift) + self.assertEqual(Q(result['spatial_error']),Q(24**2,8**2)*Q(result['lifted_hessian']['spatial_coefficient'])/lift) + self.assertEqual(Q(result['finite_polynomial_diagram_bound']),Q(result['nodal_error'])+Q(result['spatial_error'])) + self.assertTrue(result['independent_connectivity_check']) + self.assertFalse(result['gaussian_law_certified']) + with self.assertRaises(ValueError):wp.analyze(p,1,2,8,[Q(1),Q(2)]) + + +if __name__=='__main__':unittest.main() diff --git a/experiments/periodic_h0/test_word_polynomial_certificate.py b/experiments/periodic_h0/test_word_polynomial_certificate.py new file mode 100644 index 000000000..eded47006 --- /dev/null +++ b/experiments/periodic_h0/test_word_polynomial_certificate.py @@ -0,0 +1,72 @@ +"""Rebound metadata cannot certify a different polynomial or scientific scope.""" +import copy +import importlib +import importlib.util +import tempfile +import unittest +from pathlib import Path +from fractions import Fraction as Q +import finite_certificate as fc + + +class WordPolynomialCertificateTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + if importlib.util.find_spec('word_polynomial_certificate') is None: + raise AssertionError('Word-polynomial certificate is missing') + cls.m=importlib.import_module('word_polynomial_certificate') + cls.c=cls.m.certify() + + def test_exact_fixture_and_bin_count(self): + c=self.c; r=c['result'] + self.assertTrue(self.m.verify(c)) + self.assertEqual(c['input']['words'],[str(j*((1<<128)-1)//17) for j in [1,13,4,16,7,11,2,15,9]]) + self.assertEqual(int(r['lift']),1<<97) + self.assertEqual(len(r['barcode']['intervals']),3) + target=next(x for x in r['bins'] if Q(x['lower'])==Q(1,125)) + self.assertEqual(Q(target['upper']),Q(2,125)) + self.assertEqual((target['target_lower_count'],target['target_upper_count']),(1,1)) + for row in r['bins']: + if row is not target:self.assertEqual((row['target_lower_count'],row['target_upper_count']),(0,0)) + + def test_semantic_mutants_fail_even_after_rebinding(self): + mutations=[lambda c:c['input']['words'].__setitem__(0,'0'), + lambda c:c['real_polynomial'].update(dc='0'), + lambda c:c['result'].update(sample_scale=str(1<<96)), + lambda c:c['result'].update(nodal_error='0'), + lambda c:c['result'].update(spatial_error='0'), + lambda c:c['result'].update(sample_sha256='0'*64), + lambda c:c['result']['barcode']['intervals'].pop(), + lambda c:c['result']['bins'][3].update(target_upper_count=0), + lambda c:c.update(iid_input_law_certified=True), + lambda c:c.update(new_gaussian_barcodes=1), + lambda c:c['result'].update(infinite_field_diagram_bound='0'), + lambda c:c['result'].update(historical_coupling_error='0')] + for mutate in mutations: + bad=copy.deepcopy(self.c);mutate(bad) + bad['input_sha256']=fc.digest(bad['input']) + bad['real_polynomial_sha256']=fc.digest(bad['real_polynomial']) + with self.assertRaises(ValueError):self.m.verify(bad) + + def test_strict_receipt_and_report_custody(self): + m=self.m + with tempfile.TemporaryDirectory() as tmp: + d=Path(tmp)/'run';m.produce(d);self.assertTrue(m.verify_directory(d)) + original=fc.load_json(d/'RUN.json') + mutations=[lambda r:r.update(schema_version=True), + lambda r:r.update(utc='2026-10-01'), + lambda r:r.update(extra='ignored'), + lambda r:r['sources'].pop(next(iter(r['sources']))), + lambda r:r['outputs']['CERTIFICATE.json'].update(bytes=True)] + for mutate in mutations: + r=copy.deepcopy(original);mutate(r) + (d/'RUN.json').write_bytes(fc.canonical_bytes(r)) + (d/'RUN.sha256').write_text(m.identity(d/'RUN.json')['sha256']+'\n') + with self.assertRaises(ValueError):m.verify_directory(d) + (d/'RUN.json').write_bytes(fc.canonical_bytes(original)) + (d/'RUN.sha256').write_text(m.identity(d/'RUN.json')['sha256']+'\n') + (d/'RESULTS.md').write_text('Promoted to a Gaussian theorem.\n') + with self.assertRaises(ValueError):m.verify_directory(d) + + +if __name__=='__main__':unittest.main() diff --git a/experiments/periodic_h0/word_polynomial.py b/experiments/periodic_h0/word_polynomial.py new file mode 100644 index 000000000..c1b90345a --- /dev/null +++ b/experiments/periodic_h0/word_polynomial.py @@ -0,0 +1,79 @@ +"""Exact unit transport from real dyadic Fourier modes to a finite H0 diagram.""" +from fractions import Fraction as Q +import finite_certificate as fc +import nodal_core as nc +import hessian_grid_core as hc +import exact_h0 as h0 + + +def _dyadic(value): + fc.require(type(value) is Q, 'Exact Fraction coefficient required') + d=value.denominator + fc.require(d & (d-1)==0 and d<=1<<192, + 'Real coefficient must be dyadic with denominator at most2^192') + return value + + +def lift_record(polynomial, cutoff): + """Return (complex record for L*P, minimal integer power-of-two L). + + The complete real mode order is the sampler's half-square order. The + legacy `seed=0` field is only a compatibility label, never an RNG seed. + No coefficient is rounded. See WORD_POLYNOMIAL.md for the unit proof. + """ + fc.require(type(cutoff) is int and 1<=cutoff<=64, 'Cutoff in [1,64] required') + fc.require(type(polynomial) is dict and set(polynomial)=={'dc','modes'}, + 'Unexpected real polynomial schema') + dc=_dyadic(polynomial['dc']);modes=polynomial['modes'] + expected=[(x,y) for x in range(cutoff+1) for y in range(-cutoff,cutoff+1) + if x>0 or (x==0 and y>0)] + fc.require(type(modes) is list and len(modes)==len(expected), 'Complete real mode set required') + converted=[];bits=dc.denominator.bit_length()-1 + for item,frequency in zip(modes,expected): + fc.require(type(item) in (tuple,list) and len(item)==4,'Malformed real mode') + x,y,a,b=item + fc.require(type(x) is int and type(y) is int and (x,y)==frequency, + 'Incomplete, unordered or invalid frequency') + real,imag=_dyadic(a)/2,-_dyadic(b)/2 + bits=max(bits,real.denominator.bit_length()-1,imag.denominator.bit_length()-1) + converted.append((x,y,real,imag)) + lift=1<=4, 'Sample grid at least4 required') + record,lift=lift_record(polynomial,cutoff) + centers,stages,error=nc.evaluate(record,grid) + hessian=hc.bound_record(record,24,hessian_grid) + scale=lift*nc.SCALE;eta=error/lift + fc.require(all(Q(abs(b),scale)<=eta for _,b in centers), + 'Imaginary centers escape the real polynomial error') + spatial=Q(24**2,grid**2)*Q(hessian['spatial_coefficient'])/lift + epsilon=eta+spatial + values=[a for a,_ in centers] + barcode=h0.compute(values,grid) + fc.require(h0.verify_by_connectivity(values,grid,barcode) is True, + 'Independent exact connectivity check failed') + bins=h0.bin_transfer(barcode,scale,epsilon,edges) + encoded=dict(barcode) + encoded['intervals']=[[str(b),str(d)] for b,d in barcode['intervals']] + encoded['essential']=[str(b) for b in barcode['essential']] + return {'cutoff':cutoff,'side':24,'grid':grid,'hessian_grid':hessian_grid, + 'lift':str(lift),'lifted_record':record, + 'compatibility_seed_label_has_no_rng_meaning':True, + 'sample_scale':str(scale),'sample_count':len(values), + 'sample_sha256':fc.digest([str(v) for v in values]), + 'sample_digest_encoding':'canonical JSON array of row-major decimal integer strings', + 'lifted_stages':stages,'lifted_nodal_error':str(error), + 'lifted_hessian':hessian,'nodal_error':str(eta),'spatial_error':str(spatial), + 'finite_polynomial_diagram_bound':str(epsilon), + 'finite_polynomial_diagram_bound_decimal_up':fc.decimal_up(epsilon,24), + 'barcode':encoded,'computed_barcode_error':'0', + 'bins':[{k:str(v) if type(v) is Q else v for k,v in row.items()} for row in bins], + 'independent_connectivity_check':True,'gaussian_law_certified':False, + 'infinite_field_diagram_bound':None,'historical_coupling_error':None, + 'lifetime_law_certified':False} diff --git a/experiments/periodic_h0/word_polynomial_certificate.py b/experiments/periodic_h0/word_polynomial_certificate.py new file mode 100644 index 000000000..60f1f2657 --- /dev/null +++ b/experiments/periodic_h0/word_polynomial_certificate.py @@ -0,0 +1,156 @@ +"""Replay explicit finite words through a smooth polynomial and exact H0 bounds.""" +import argparse +import hashlib +import platform +import re +import sys +from datetime import datetime, timezone +from pathlib import Path +from fractions import Fraction as Q +import finite_certificate as fc +import gaussian_coupling as gc +import gaussian_coupling_certificate as prior +import word_polynomial as wp + +BASE=Path(__file__).resolve().parent +PARENT_CERT='results/gaussian_coupling1/CERTIFICATE.json' +PARENT_RUN='results/gaussian_coupling1/RUN.json' +PARENT_SHA256='1ab5e225ec3e0a570910afc11026adf38ce39d01a4a8a16caa9ad487c95e1e32' +PARENT_RUN_SHA256='dbc5b27e6ea7e147133b48194889599a7fe1471bdb218c0513cb1ccb96a77d61' +SOURCE_PATHS=tuple(sorted(set(prior.SOURCE_PATHS)|{ + 'word_polynomial.py','word_polynomial_certificate.py','WORD_POLYNOMIAL.md', + 'nodal_core.py','NODAL_CERTIFICATE.md','hessian_grid_core.py','HESSIAN_GRID.md', + 'exact_h0.py','EXACT_H0.md','APPROXIMATION.md',PARENT_CERT,PARENT_RUN, + 'results/gaussian_coupling1/RUN.sha256'})) +SCOPE=('One deterministic cutoff 1 side 24 finite-word polynomial: exact coefficient ' + 'conversion, certified grid/Hessian error and finite H0 lifetime-bin counts. ' + 'No IID source law, Gaussian observation, infinite-field diagram bound, ' + 'historical coupling or lifetime-law confirmation certified.') +identity=prior.identity + + +def load_parent(): + """Consume fixed reviewed bytes; unchanged parent replay remains in master CI.""" + fc.require(identity(BASE/PARENT_CERT)['sha256']==PARENT_SHA256,'Frozen sampler certificate changed') + fc.require(identity(BASE/PARENT_RUN)['sha256']==PARENT_RUN_SHA256,'Frozen sampler receipt changed') + r=fc.load_json(BASE/PARENT_RUN) + # The exact receipt hash fixes its schema and every role; also bind all bytes + # it consumes. We do not reinterpret or promote its probabilistic premises. + fc.require(set(r['sources'])==set(prior.SOURCE_PATHS),'Parent source roles changed') + fc.require((BASE/'results/gaussian_coupling1/RUN.sha256').read_bytes()== + (PARENT_RUN_SHA256+'\n').encode(),'Parent receipt digest changed') + for name,expected in r['sources'].items(): + fc.require(identity(BASE/name)==expected,'Changed sampler dependency: '+name) + fc.require(identity(BASE/PARENT_CERT)==r['outputs']['CERTIFICATE.json'],'Parent output changed') + + +def certify(): + load_parent() + words=[j*((1<<128)-1)//17 for j in (1,13,4,16,7,11,2,15,9)] + edges=[Q(2**j,1000) for j in range(9)] + inp={'kind':'deterministic arithmetic fixture; no RNG used','record_id':0, + 'cutoff':1,'side':24,'grid':128,'hessian_grid':32, + 'words':[str(x) for x in words], + 'word_order':'DC then cosine,sine for each ordered half-square mode', + 'bin_edges':[str(x) for x in edges]} + p=gc.polynomial(1,words) + real={'dc':str(p['dc']),'modes':[[x,y,str(a),str(b)] for x,y,a,b in p['modes']]} + result=wp.analyze(p,1,128,32,edges) + return {'schema_version':1,'scope':SCOPE,'input':inp,'input_sha256':fc.digest(inp), + 'real_polynomial':real,'real_polynomial_sha256':fc.digest(real), + 'parent_certificate_sha256':PARENT_SHA256,'parent_receipt_sha256':PARENT_RUN_SHA256, + 'result':result,'iid_input_law_certified':False,'new_gaussian_barcodes':0, + 'new_deterministic_barcodes':1,'historical_objects_unchanged':True, + 'next_obligation':'A declared ensemble at a matching cutoff, with source-law premises and exceptional-count control, is still needed for statistical or infinite-field conclusions.'} + + +def verify(cert): + fc.require(fc.canonical_bytes(cert)==fc.canonical_bytes(certify()),'Word-polynomial certificate differs from exact replay') + return True + + +def render_report(c): + r=c['result'] + lines=['# From explicit words to a certified smooth-field barcode','', + 'This deterministic example connects the new finite-word sampler to', + 'exact Fourier-grid evaluation and periodic H₀ persistence. It uses', + 'nine declared words, cutoff 1, a 128×128 sample grid and a 32×32', + 'Hessian grid. No random source is used.','', + f"The exact grid has **{len(r['barcode']['intervals'])} positive finite bars** and one essential class.", + 'A separate breadth-first connectivity calculation verifies the barcode.', + 'Its endpoints are exact for the computed dyadic samples.','', + f"The diagram bound against the original smooth finite polynomial is at most **{r['finite_polynomial_diagram_bound_decimal_up']}**.", + 'The bounds below account for both nodal arithmetic and spatial interpolation.','', + '| Lifetime bin | Exact grid count | Smooth polynomial lower count | Smooth polynomial upper count |', + '|---|---:|---:|---:|'] + for row in r['bins']: + upper=row['target_upper_count'] + lines.append(f"| [{row['lower']}, {row['upper']}) | {row['sample_count']} | {row['target_lower_count']} | {upper if upper is not None else 'not bounded'} |") + lines+=['','Thus the smooth finite polynomial has **exactly one finite bar in', + '[1/125,2/125)** and none in the other seven displayed bins. This does', + 'not exclude bars below 1/1000 or above 32/125. The two smaller positive', + 'grid bars are below twice the diagram error and are not certified', + 'smooth-field detections. Counts here are for this one polynomial,', + 'not expected intensities or evidence for a Gaussian lifetime law.','', + 'The real Fourier coefficients are converted without rounding. An', + 'exact positive power of two lifts them into the existing fixed-point', + 'evaluator; sample units and all error bounds are divided back by', + 'that same factor. The 96-bit twiddle accuracy is unchanged. The', + '`seed:0` field in the compatibility record is only record ID 0.','', + '[Derivation and scope](../../WORD_POLYNOMIAL.md) ·', + '[Exact inputs, endpoints and bounds](CERTIFICATE.json) ·', + '[Source receipt](RUN.json)','', + '```sh','python -B -S experiments/periodic_h0/word_polynomial_certificate.py --verify experiments/periodic_h0/results/word_polynomial1','```','',SCOPE,''] + return '\n'.join(lines) + + +def validate_directory(directory): + directory=Path(directory);r=fc.load_json(directory/'RUN.json') + fc.require(type(r) is dict and set(r)=={'schema_version','utc','python','platform','sources','outputs','scope'},'Invalid receipt fields') + fc.require(type(r['schema_version']) is int and r['schema_version']==1 and r['scope']==SCOPE,'Invalid receipt version/scope') + fc.require(type(r['utc']) is str and re.fullmatch(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}\+00:00',r['utc']) is not None,'Invalid UTC') + stamp=datetime.fromisoformat(r['utc']) + fc.require(stamp.tzinfo==timezone.utc and stamp.isoformat(timespec='microseconds')==r['utc'],'Invalid UTC') + for key in ('python','platform'): + fc.require(type(r[key]) is str and 00,'Invalid byte count') + fc.require(type(item['sha256']) is str and re.fullmatch('[0-9a-f]{64}',item['sha256']) is not None,'Invalid hash') + fc.require((directory/'RUN.sha256').read_bytes()==(identity(directory/'RUN.json')['sha256']+'\n').encode(),'Receipt binding mismatch') + for name in SOURCE_PATHS:fc.require(identity(BASE/name)==r['sources'][name],'Source binding mismatch: '+name) + fc.require(identity(directory/'CERTIFICATE.json')==r['outputs']['CERTIFICATE.json'],'Output binding mismatch') + cert=fc.load_json(directory/'CERTIFICATE.json') + fc.require((directory/'RESULTS.md').read_bytes()==render_report(cert).encode(),'Report mismatch') + return cert + + +def verify_directory(directory): + verify(validate_directory(directory));return True + + +def produce(directory): + directory=Path(directory);fc.require(not directory.exists(),'Output must be new') + cert=certify();directory.mkdir(parents=True) + (directory/'CERTIFICATE.json').write_bytes(fc.canonical_bytes(cert)) + r={'schema_version':1,'utc':datetime.now(timezone.utc).isoformat(timespec='microseconds'), + 'python':sys.version,'platform':platform.platform(),'scope':SCOPE, + 'sources':{name:identity(BASE/name) for name in SOURCE_PATHS}, + 'outputs':{'CERTIFICATE.json':identity(directory/'CERTIFICATE.json')}} + raw=fc.canonical_bytes(r);(directory/'RUN.json').write_bytes(raw) + (directory/'RUN.sha256').write_text(hashlib.sha256(raw).hexdigest()+'\n') + (directory/'RESULTS.md').write_text(render_report(cert)) + return cert + + +def main(): + p=argparse.ArgumentParser(description=__doc__);g=p.add_mutually_exclusive_group(required=True) + g.add_argument('--produce',type=Path);g.add_argument('--verify',type=Path);a=p.parse_args() + if a.verify:verify_directory(a.verify) + else:produce(a.produce) + print('Exact word-to-polynomial H0 replay passed; deterministic finite-polynomial scope only.') + + +if __name__=='__main__':main()