From c1bac3be06b3ec8a921b67cd7882254bbec6a9d4 Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Wed, 30 Sep 2026 18:22:12 -0500 Subject: [PATCH] Certify exact periodic H0 counts and isolate the cap interior assumption --- .github/workflows/periodic-h0-pilot.yml | 4 +- docs/RESEARCH_INDEX.md | 8 +- docs/research-translation/20260930/README.md | 18 + .../20260930/cap-assumption-ablation/PROOF.md | 255 ++++++++++++++ .../cap-assumption-ablation/RESULTS.json | 62 ++++ .../SOURCE_BINDINGS.json | 77 +++++ .../20260930/cap-assumption-ablation/probe.py | 175 ++++++++++ .../cap-assumption-ablation/sources/AUDIT.md | 327 ++++++++++++++++++ .../sources/MARKED_CYLINDER_CAP_PROOF.md | 230 ++++++++++++ .../periodic_h0/CONFIRMATION_READINESS.md | 15 +- experiments/periodic_h0/EXACT_H0.md | 263 ++++++++++++++ experiments/periodic_h0/README.md | 5 +- .../periodic_h0/exact_barcode_certificate.py | 190 ++++++++++ experiments/periodic_h0/exact_h0.py | 201 +++++++++++ .../results/exact_h0_1/CERTIFICATE.json | 1 + .../periodic_h0/results/exact_h0_1/RESULTS.md | 35 ++ .../periodic_h0/results/exact_h0_1/RUN.json | 1 + .../periodic_h0/results/exact_h0_1/RUN.sha256 | 1 + .../test_exact_barcode_certificate.py | 70 ++++ experiments/periodic_h0/test_exact_h0.py | 177 ++++++++++ 20 files changed, 2103 insertions(+), 12 deletions(-) create mode 100644 docs/research-translation/20260930/cap-assumption-ablation/PROOF.md create mode 100644 docs/research-translation/20260930/cap-assumption-ablation/RESULTS.json create mode 100644 docs/research-translation/20260930/cap-assumption-ablation/SOURCE_BINDINGS.json create mode 100644 docs/research-translation/20260930/cap-assumption-ablation/probe.py create mode 100644 docs/research-translation/20260930/cap-assumption-ablation/sources/AUDIT.md create mode 100644 docs/research-translation/20260930/cap-assumption-ablation/sources/MARKED_CYLINDER_CAP_PROOF.md create mode 100644 experiments/periodic_h0/EXACT_H0.md create mode 100644 experiments/periodic_h0/exact_barcode_certificate.py create mode 100644 experiments/periodic_h0/exact_h0.py create mode 100644 experiments/periodic_h0/results/exact_h0_1/CERTIFICATE.json create mode 100644 experiments/periodic_h0/results/exact_h0_1/RESULTS.md create mode 100644 experiments/periodic_h0/results/exact_h0_1/RUN.json create mode 100644 experiments/periodic_h0/results/exact_h0_1/RUN.sha256 create mode 100644 experiments/periodic_h0/test_exact_barcode_certificate.py create mode 100644 experiments/periodic_h0/test_exact_h0.py diff --git a/.github/workflows/periodic-h0-pilot.yml b/.github/workflows/periodic-h0-pilot.yml index 4858541dd..9773581e2 100644 --- a/.github/workflows/periodic-h0-pilot.yml +++ b/.github/workflows/periodic-h0-pilot.yml @@ -41,9 +41,11 @@ jobs: run: python -B -S experiments/periodic_h0/nodal_certificate.py --verify experiments/periodic_h0/results/nodal1 - name: Replay the sharper finite-field Hessian and fine-grid bound run: python -B -S experiments/periodic_h0/hessian_grid_certificate.py --verify experiments/periodic_h0/results/hessian1 + - name: Replay exact integer H0 and independent connectivity witnesses + run: python -B -S experiments/periodic_h0/exact_barcode_certificate.py --verify experiments/periodic_h0/results/exact_h0_1 - name: Execute the complete fixed pilot run: | python -B experiments/periodic_h0/run_pilot.py --output "$RUNNER_TEMP/periodic-h0-replay" python -B experiments/periodic_h0/run_pilot.py --verify "$RUNNER_TEMP/periodic-h0-replay/observations.json" - name: State scientific scope - run: echo 'Tests and a fresh discrete periodic H0 pilot passed. This is not a continuum error certificate, coefficient confirmation, or scientific acceptance.' >> "$GITHUB_STEP_SUMMARY" + run: echo 'Tests, exact finite-field barcode bounds and a fresh discrete periodic H0 pilot passed. Ideal Gaussian/infinite-field error control, coefficient confirmation and scientific acceptance remain separate.' >> "$GITHUB_STEP_SUMMARY" diff --git a/docs/RESEARCH_INDEX.md b/docs/RESEARCH_INDEX.md index c58ec1538..4a1abed33 100644 --- a/docs/RESEARCH_INDEX.md +++ b/docs/RESEARCH_INDEX.md @@ -33,9 +33,11 @@ A [new one-field nodal certificate](../experiments/periodic_h0/NODAL_CERTIFICATE supplies an error bound for every newly recorded node and the associated abstract filtration. A [sharper Hessian/grid bound](../experiments/periodic_h0/HESSIAN_GRID.md) now covers a separate 1024² grid of deterministically regenerated dyadic samples. -Historical FFT samples, computed barcodes, the infinite-field relation -and the asymptotic remainder remain -separate requirements before interpreting the study as coefficient confirmation. +An [exact integer H0 computation](../experiments/periodic_h0/EXACT_H0.md) now supplies +barcode endpoints and deterministic bin-count bounds for that one frozen finite field, +checked by a separate connectivity method. Historical FFT samples, the infinite-field +relation and the asymptotic remainder remain separate requirements before +interpreting the study as coefficient confirmation. ## RN counting diff --git a/docs/research-translation/20260930/README.md b/docs/research-translation/20260930/README.md index aa0b71022..3d5492571 100644 --- a/docs/research-translation/20260930/README.md +++ b/docs/research-translation/20260930/README.md @@ -48,6 +48,24 @@ The assembly target is the parent's leading law and D2's bounded remainder, with Write the short exposition first, then attach full proofs or precise appendices. A page count is an editorial target, not a substitute for a complete argument. Keep a paragraph-by-paragraph statement crosswalk during assembly: source statement, exact version, hypotheses, repairs, review scope and unresolved alignment question. The successor [draft](MANUSCRIPT.md) and [crosswalk](CROSSWALK.md) now implement this assembly step; complete proof appendices and theorem-level literature comparison remain. +## Why the cap needs an interior-height bound + +A separate [smooth counterexample](cap-assumption-ablation/PROOF.md) isolates +one deterministic assumption in the elder-pairing argument. A perturbation can +preserve **every pin derivative**, the entire old cap boundary and the old path, +and have arbitrarily small uniform size, while introducing an older maximum +inside the cap and changing the actual elder saddle. The construction is on a +fixed compact torus with distinct Morse critical values; it proves the new death +value by an explicit smaller cap and path. + +This does not contradict the sufficient cap theorem. It shows why the condition +that the whole cap lies below the birth height cannot be replaced by endpoint +or boundary data. The [exact controls](cap-assumption-ablation/probe.py), +[recorded bounds](cap-assumption-ablation/RESULTS.json) and +[source/exposure record](cap-assumption-ablation/SOURCE_BINDINGS.json) accompany +this narrow result. It supplies no Gaussian probability or numerical lifetime +remainder and does not alter the manuscript's frozen parent chain. + ## Next mathematical work, after accounting for existing results 1. **Make the existential error usable.** Seek explicit constants and a justified lifetime window for the exact finite-torus observable. The evaluated SIDE24 coefficient alone does not make a finite sample or finite lifetime lie in the asymptotic regime. A negative result establishing an impractically small sufficient window is still useful. diff --git a/docs/research-translation/20260930/cap-assumption-ablation/PROOF.md b/docs/research-translation/20260930/cap-assumption-ablation/PROOF.md new file mode 100644 index 000000000..7158f3788 --- /dev/null +++ b/docs/research-translation/20260930/cap-assumption-ablation/PROOF.md @@ -0,0 +1,255 @@ +# Interior smooth bumps: all pin jets and the old boundary do not determine the elder pair + +Dylan Roy — delegated AI review. Actual performer: OpenAI/Codex agent +`/root/c39_elder_proof_review`. Principal: Dylan Roy. His personal reading is +PENDING. Organizational-independence credit: zero. This is a fresh, narrow +assumption-ablation derivation, not a second acceptance vote for the D1 theorem. +The executor saw the OpenAI source chain and Claude review 5369064629 before +constructing this example. The valid cap theorem is not refuted. + +Coordination: root owns claim `261de489-5594-464a-9542-719b9dfd8493`, Work Event +370, and PR196 comment 5921236957. No remote write, branch edit, merge, scientific +register change, Gaussian estimate, Kac–Rice audit or formal verification occurs +in this packet. + +## 1. Exact source and question + +PR196 at `9706a2cb3ca4cc2df792b33ab440c92ee7c76dcc`, source/base +`3e0a91b69892b9717564c592e7a966492a81566a`, gives the following sufficient +conditions in `reviews/d1_external_audit_20260930/AUDIT.md`, lines 34–72: + +- M is interior to a compact cap C, b=f(M), sb with all path heights >=s. + +Then the global connection value + + d_f(M)=sup_{gamma(0)=M, f(gamma(1))>b} min_t f(gamma(t)) + +equals s. The exact first-exit proof is sound: C1 puts every older endpoint +outside C; C2 bounds each path from above by s; C3 bounds the supremum from below. +On the compact Morse/distinct-critical-value locus, the unique critical point +of height s identifies the elder saddle. Neither branch adjacency nor a ridge +being a gradient trajectory is used in this implication. + +The present question is different from repeating its already-reviewed proof: +could C1 be replaced by agreement of all pin jets, agreement near the complete +old cap boundary, and arbitrarily small uniform error? The answer is NO, even +for smooth Morse functions on a fixed compact torus with distinct critical +values. C2 and C3 will remain literally true at the old saddle height. C1 fails +through an older maximum inside the cap. + +Sources: AUDIT blob `fdfccaf5356f4cc0cf8764bf323f94b6ff071768`, 19468 bytes, +SHA256 `98356c5625aa07bcf62b9e6f1a3869ec1fea7dd789e8ea495a97b5c7abb473cf`; +CAP blob `0633aca3c2a2882b0de4399da0a75d64c2e6b2e1`, 15160 bytes, +SHA256 `0bf922b9203c29088b12388807aa0e2ecd020485eb0f6e919679841b5b2636fc`. +Inspected slices: AUDIT §§2–6 and CAP §§1–5. The other D1 analytic interfaces +are outside this result. PR194 and PR175 were checked only to distinguish +the existing polynomial and thin-hard-chart examples from this fixed-cap, +all-jets, arbitrarily-small-C0 construction. + +## 2. The explicit perturbation + +Define the smooth bump + + eta(t)=exp(1-1/(1-t^2)) for |t|<1, and eta(t)=0 otherwise. + +It has values in [0,1], equals 1 only at zero, and is C-infinity, including +at ±1: every derivative from the interior is an exponential times a rational +function of 1-t^2, and therefore tends to zero at the endpoints. It is even, +increasing on (-1,0), and decreasing on (0,1). + +Take D=[-2,2] x [-2,2], C=[-2,1/2] x [-2,2], + + q(x)=2x^3-(3/2)x-1/2, + f0(x,y)=q(x)-128y^2, + M=(-1/2,0), S=(1/2,0), b=0, s=-1. + +For 0=-128delta^2>-1/2>-1, (B2) + +and its endpoint has height 128delta^2>0. Hence + + d_f_delta(M)>=-128delta^2>-1. (B3) + +This is a continuous-path inequality, not sampling. It applies to every +continuous extension preserving D. Therefore S is not the elder saddle for any +compact Morse/distinct-value completion. Meanwhile C2 and C3 at s=-1 still +hold: the old cap boundary is unchanged and the y=0 path from x=-1/2 to x=2 +has minimum -1 and endpoint q(2)=25/2>0. Precisely C1 is lost, since the point +(-1/2,delta) inside C is older than M. + +## 3. Exact new saddle and exact death, independent of the exterior + +For completeness, the construction has a definite local Morse saddle; it is +not relying on a possibly degenerate new peak. On x=-1/2 put t=y/delta and + + v(t)=-128t^2+256 eta(2t-2). + +For t in (1/2,1), write u=2-2t in (0,1). The stationary equation v'(t)=0 is +equivalent to + + A(u)=256, + A(u)=32(2-u)(1-u^2)^2 exp(u^2/(1-u^2))/u. (B4) + +Its logarithmic derivative has positive denominator and numerator + + A'(u)/A(u) + =2[-1+u^3+3u^4-2u^5]/[u(2-u)(1-u^2)^2]. (B5) + +The polynomial p(u)=-1+u^3+3u^4-2u^5 has p(0)=-1, p(1)=1 and + + p'(u)=u^2(3+12u-10u^2)>0 for 00, since exp(-1/3)>2/3. +For t in [1,3/2], the bump derivative is nonpositive, so v'<0. Elsewhere on +the positive half-line it is just -256t. There are no further positive roots. + +Set m=v(t_-) and h=v(t_+). Then + + -128-1/2. Outside that support the x derivative is q'(x). Therefore +its only zeros, for every y, are x=-1/2 and x=1/2. At x=1/2 the bump vanishes +and the only y zero is 0; at x=-1/2 the preceding one-variable analysis applies. +At the latter line the mixed derivative is zero and + + f_xx=-6-8192delta^2 eta(2t-2)<0, + +because eta''(0)=-2. The simple y roots give f_yy=v''(t_-) >0 at T_delta +and f_yy=v''(t_+) <0 at O_delta. Thus T_delta is a nondegenerate saddle, +O_delta is a nondegenerate maximum, and M,S retain their original Hessians. +Their four heights are delta^2 m, delta^2 h, 0,-1, all distinct for delta<1/16. + +There is an exact smaller cap + + C_delta=[-2,1/2] x [-2,delta t_-]. + +On the x interval, q<=0 and xi<=1, so f_delta(x,y)<=f_delta(-1/2,y). +The latter is <=0 throughout this smaller cap. On the top boundary it is +at most delta^2 m. On the left and right boundaries the bump vanishes and +the values are at most -27/2 and -1, respectively; on the bottom they are +at most -512. All these are below delta^2 m>-1/2. The vertical path to +(-1/2,delta) has minimum exactly delta^2 m and older endpoint 128delta^2. +Applying the two first-exit inequalities directly gives + + d_f_delta(M)=delta^2 m, and -128delta^2(4/3)12^2=192. F_delta preserves lambda and every endpoint jet, but +the bound is over the entire cylinder. From the expansion + + eta(t)=1-t^2-(1/2)t^4+O(t^6) + +one gets eta''''(0)=-12, hence at (-1/2,delta) + + |partial_y^4 B_delta|=49152/delta^2. (B8) + +Therefore the whole-cylinder M4 is at least 49152/delta^2, and r M4<=3/10 +fails decisively. No violation of the source cap theorem has been found. + +The narrow technical conclusion is that its interior-height hypothesis C1 +cannot be dropped even if C2, C3, all pin jets and arbitrarily good uniform +closeness are retained. The explicit G_r-to-C1 derivation in PR196 remains +load-bearing and is not replaceable by those weaker data. This result does +not re-audit or accept the other deterministic estimates or any stochastic, +coefficient, unrestricted-remainder or formal claim. + +`probe.py` checks the finite algebra, a rigorous rational exponential bound, +the two root isolations and resulting death enclosure. Those controls do not +formalize this smooth continuum construction or constitute external review. diff --git a/docs/research-translation/20260930/cap-assumption-ablation/RESULTS.json b/docs/research-translation/20260930/cap-assumption-ablation/RESULTS.json new file mode 100644 index 000000000..9d964e222 --- /dev/null +++ b/docs/research-translation/20260930/cap-assumption-ablation/RESULTS.json @@ -0,0 +1,62 @@ +{ + "result": "PASS", + "scientific_effect": "NONE", + "formal_or_external_review": false, + "method": "exact Fraction polynomial identities and Taylor-remainder intervals", + "root_min_t": { + "lower_exact": "148041614451/274877906944", + "upper_exact": "37010403613/68719476736", + "lower_decimal": "0.538572255940380273386836", + "upper_decimal": "0.538572255944018252193928" + }, + "root_max_t": { + "lower_exact": "122774774901/137438953472", + "upper_exact": "245549549803/274877906944", + "lower_decimal": "0.893304058270587120205163", + "upper_decimal": "0.893304058274225099012256" + }, + "normalized_death_m_decimal_enclosure": [ + "-36.3058375860613450211102", + "-36.3058375850581760211564" + ], + "samples": [ + { + "delta": "1/64", + "C0_norm_exact": "1/16", + "path_floor_exact": "-1/32", + "older_endpoint_exact": "1/32", + "death_decimal_enclosure": [ + "-0.00886372987940950806179448", + "-0.00886372987916459375516514" + ], + "M4_lower_exact": "201326592" + }, + { + "delta": "1/128", + "C0_norm_exact": "1/64", + "path_floor_exact": "-1/128", + "older_endpoint_exact": "1/128", + "death_decimal_enclosure": [ + "-0.00221593246985237701544862", + "-0.00221593246979114843879128" + ], + "M4_lower_exact": "805306368" + }, + { + "delta": "1/1024", + "C0_norm_exact": "1/4096", + "path_floor_exact": "-1/8192", + "older_endpoint_exact": "1/8192", + "death_decimal_enclosure": [ + "-0.0000346239448414433908663847", + "-0.0000346239448404866943561138" + ], + "M4_lower_exact": "51539607552" + } + ], + "local_exact_source_bindings_checked": [ + "AUDIT.md", + "MARKED_CYLINDER_CAP_PROOF.md" + ], + "scope": "finite algebra/interval controls, not a continuum proof or a D1 verdict" +} diff --git a/docs/research-translation/20260930/cap-assumption-ablation/SOURCE_BINDINGS.json b/docs/research-translation/20260930/cap-assumption-ablation/SOURCE_BINDINGS.json new file mode 100644 index 000000000..b202f0c10 --- /dev/null +++ b/docs/research-translation/20260930/cap-assumption-ablation/SOURCE_BINDINGS.json @@ -0,0 +1,77 @@ +{ + "artifact": "D1 interior smooth-bump ablation", + "created_at_utc": "2026-09-30T23:11:51Z", + "review_principal": "Dylan Roy", + "owner_facing_attribution": "Dylan Roy — delegated AI review", + "actual_performer": "OpenAI/Codex agent /root/c39_elder_proof_review", + "personal_Dylan_reading": "PENDING", + "organizational_independence_credit": 0, + "scope": "Fresh all-jets/C0/interior-cap assumption-ablation derivation; not a re-review or acceptance of D1", + "author_line_exposure": "OpenAI source/author line exposed; read AUDIT, original CAP and Claude native review 5369064629 before deriving this example. This agent did not edit their bytes.", + "coordination": { + "claim_id": "261de489-5594-464a-9542-719b9dfd8493", + "work_event": 370, + "comment": "https://github.com/d6g8k5htny-coder/Math-/pull/196#issuecomment-5921236957" + }, + "live_target": { + "pr": 196, + "head": "9706a2cb3ca4cc2df792b33ab440c92ee7c76dcc", + "base": "3e0a91b69892b9717564c592e7a966492a81566a", + "state": "open", + "merged": false + }, + "scientific_effect": "NONE", + "publications_or_remote_mutations": [], + "inspected_primary_slices": [ + { + "id": "AUDIT", + "path": "reviews/d1_external_audit_20260930/AUDIT.md", + "commit": "9706a2cb3ca4cc2df792b33ab440c92ee7c76dcc", + "git_blob": "fdfccaf5356f4cc0cf8764bf323f94b6ff071768", + "bytes": 19468, + "sha256": "98356c5625aa07bcf62b9e6f1a3869ec1fea7dd789e8ea495a97b5c7abb473cf", + "slice": "Sections 2–6; source/scope prose inspected without auditing Gaussian interfaces" + }, + { + "id": "CAP", + "path": "imports/lifetime_parent_20260925/MARKED_CYLINDER_CAP_PROOF.md", + "commit": "3e0a91b69892b9717564c592e7a966492a81566a", + "git_blob": "0633aca3c2a2882b0de4399da0a75d64c2e6b2e1", + "bytes": 15160, + "sha256": "0bf922b9203c29088b12388807aa0e2ecd020485eb0f6e919679841b5b2636fc", + "slice": "Sections 1–5 only; probabilistic corollary not consumed" + } + ], + "other_exposure": [ + { + "id": "CLAUDE_REVIEW", + "url": "https://github.com/d6g8k5htny-coder/Math-/pull/196#pullrequestreview-5369064629", + "role": "Read before derivation; existing COMMENTED A/B scoped ACCEPT is not this agent's new verdict. Body snapshot adds one terminating newline." + }, + { + "id": "PR194", + "head": "5bea43bca2bd8163596375e2193510c1c342ae3a", + "role": "PR body only, collision and novelty check" + }, + { + "id": "PR175", + "head": "701dff49119897932ebe1891657126eafe395711", + "path": "frontiers/concave_fibre_elder_20260930/HARD_FIBRE_LEMMA.md", + "role": "Full local-fibre statement and vertical-escape example read to distinguish our fixed-D, C0-small, all-pin-jets ablation; no review verdict on PR175" + }, + { + "id": "OP_POLICY", + "path": "main/governance/OP-WORKFLOW-20260930.md", + "role": "Live operational policy read; saved snapshot hashes are locally derived byte identities" + } + ], + "limits": [ + "No Gaussian or Kac–Rice estimates audited", + "No external-human review", + "No Lean/kernel proof", + "No theorem/register promotion", + "Exact finite controls do not prove the continuum construction", + "Compact torus completion is a written constructive existence proof, not an executed mesh model" + ], + "result": "C1 cannot be replaced by all endpoint jets, old entire cap boundary, old ridge witness and arbitrarily small C0 error; original G_r cap theorem remains unrefuted" +} diff --git a/docs/research-translation/20260930/cap-assumption-ablation/probe.py b/docs/research-translation/20260930/cap-assumption-ablation/probe.py new file mode 100644 index 000000000..0f273fd91 --- /dev/null +++ b/docs/research-translation/20260930/cap-assumption-ablation/probe.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +"""Stdlib exact controls for PROOF.md, not a continuum/formal proof.""" +from fractions import Fraction as F +from decimal import Decimal, localcontext, ROUND_FLOOR, ROUND_CEILING +import hashlib +import json +from pathlib import Path + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def add(*polys): + out = [F(0)] * max(map(len, polys)) + for p in polys: + for i, x in enumerate(p): + out[i] += x + while len(out) > 1 and not out[-1]: + out.pop() + return out + + +def scale(p, c): + return [c * x for x in p] + + +def mul(p, q): + out = [F(0)] * (len(p) + len(q) - 1) + for i, x in enumerate(p): + for j, y in enumerate(q): + out[i+j] += x*y + return add(out) + + +def exp_bounds(x, n=80): + """Exact rational bounds on exp(x), x>=0, via a geometric tail.""" + require(x >= 0, 'exponential argument must be nonnegative') + term = total = F(1) + for k in range(1, n+1): + term *= x / k + total += term + first_omitted = term * x / (n+1) + ratio = x / (n+2) + require(ratio < 1, 'Taylor remainder ratio is not contractive') + return total, total + first_omitted / (1-ratio) + + +def eta_bounds(t): + if abs(t) >= 1: + return F(0), F(0) + lo, hi = exp_bounds(t*t/(1-t*t)) + return 1/hi, 1/lo + + +def derivative_bounds(t): + # Only the increasing side of eta is needed for both stationary roots. + require(F(1, 2) <= t <= 1, 'root bracket outside the proved interval') + if t == F(1, 2): + return F(-128), F(-128) + u = 2-2*t + lo, hi = eta_bounds(u) + multiplier = 1024*u/(1-u*u)**2 + return -256*t+multiplier*lo, -256*t+multiplier*hi + + +def isolate_root(a, b, rising): + # Uniqueness/nondegeneracy is analytic in PROOF.md, not inferred by sampling. + for _ in range(36): + c = (a+b)/2 + lo, hi = derivative_bounds(c) + require(lo > 0 or hi < 0, 'uncertain derivative sign; refine exponential') + positive = lo > 0 + if positive == rising: + b = c + else: + a = c + al, ah = derivative_bounds(a) + bl, bh = derivative_bounds(b) + require((ah < 0 and bl > 0) if rising else (al > 0 and bh < 0), + 'bracket does not carry opposite certified signs') + return a, b + + +def decimal_bound(x, rounding): + with localcontext() as ctx: + ctx.prec = 24 + ctx.rounding = rounding + return str(Decimal(x.numerator)/Decimal(x.denominator)) + + +def interval_report(lo, hi): + return { + 'lower_exact': str(lo), 'upper_exact': str(hi), + 'lower_decimal': decimal_bound(lo, ROUND_FLOOR), + 'upper_decimal': decimal_bound(hi, ROUND_CEILING), + } + + +def main(): + # Check the complete numerator after clearing the positive denominator in B5. + u = [F(0), F(1)] + two_minus_u = [F(2), F(-1)] + one_minus_u2 = [F(1), F(0), F(-1)] + square = mul(one_minus_u2, one_minus_u2) + numerator = add( + scale(mul(u, square), -1), + scale(mul(mul(mul(u, u), two_minus_u), one_minus_u2), -4), + scale(mul(two_minus_u, square), -1), + scale(mul(mul(u, u), two_minus_u), 2), + ) + expected = list(map(F, [-2, 0, 0, 2, 6, -4])) + require(numerator == expected, 'B5 logarithmic derivative identity failed') + mutated = list(map(F, [-2, 0, 0, 2, 6, 4])) + require(numerator != mutated, 'wrong final sign was not rejected') + # exp(-t^2-t^4+O(t^6)) has coefficients 1,-1,-1/2 through degree 4. + exponent = [F(0), F(0), F(-1), F(0), F(-1)] + expansion = add([F(1)], exponent, scale(mul(exponent, exponent), F(1, 2)))[:5] + require(expansion == [1, 0, -1, 0, F(-1, 2)], 'eta fourth-jet identity failed') + eta_fourth = 24*expansion[4] + require(eta_fourth == -12, 'eta fourth derivative differs') + require(256*16*abs(eta_fourth) == 49152, 'M4 scaling differs') + exp_lo, exp_hi = exp_bounds(F(1, 3)) + require(exp_hi < F(3, 2), 'needed exp(1/3)<3/2 bound failed') + require(54*exp_hi < 256, 'B4 two-root level inequality failed') + tmin = isolate_root(F(1, 2), F(3, 4), rising=True) + tmax = isolate_root(F(3, 4), F(1), rising=False) + # eta(2t-2) is increasing on the minimum's bracket. Interval dependency + # is deliberately not cancelled: these are rigorous enclosing endpoints. + eta_lo = eta_bounds(2*tmin[0]-2)[0] + eta_hi = eta_bounds(2*tmin[1]-2)[1] + mlo = -128*tmin[1]**2+256*eta_lo + mhi = -128*tmin[0]**2+256*eta_hi + require(-128 < mlo < mhi < 0, 'minimum enclosure is inconsistent') + samples = [] + for delta in [F(1, 64), F(1, 128), F(1, 1024)]: + norm = 256*delta**2 + floor = -128*delta**2 + require(F(-1, 2) < floor < 0, 'path floor does not exclude old saddle') + require(49152/delta**2 > F(3, 10), 'M4 failure was lost') + samples.append({'delta': str(delta), 'C0_norm_exact': str(norm), + 'path_floor_exact': str(floor), + 'older_endpoint_exact': str(128*delta**2), + 'death_decimal_enclosure': [ + decimal_bound(delta**2*mlo, ROUND_FLOOR), + decimal_bound(delta**2*mhi, ROUND_CEILING)], + 'M4_lower_exact': str(49152/delta**2)}) + sources = { + 'AUDIT.md': (19468, '98356c5625aa07bcf62b9e6f1a3869ec1fea7dd789e8ea495a97b5c7abb473cf', + 'fdfccaf5356f4cc0cf8764bf323f94b6ff071768'), + 'MARKED_CYLINDER_CAP_PROOF.md': + (15160, '0bf922b9203c29088b12388807aa0e2ecd020485eb0f6e919679841b5b2636fc', + '0633aca3c2a2882b0de4399da0a75d64c2e6b2e1'), + } + for filename, (size, digest, blob) in sources.items(): + raw = (Path(__file__).parent/'sources'/filename).read_bytes() + require(len(raw) == size, 'source size mismatch: '+filename) + require(hashlib.sha256(raw).hexdigest() == digest, 'source digest mismatch: '+filename) + require(hashlib.sha1(b'blob '+str(len(raw)).encode()+b'\0'+raw).hexdigest() == blob, + 'source Git-blob mismatch: '+filename) + print(json.dumps({ + 'result': 'PASS', + 'scientific_effect': 'NONE', 'formal_or_external_review': False, + 'method': 'exact Fraction polynomial identities and Taylor-remainder intervals', + 'root_min_t': interval_report(*tmin), 'root_max_t': interval_report(*tmax), + 'normalized_death_m_decimal_enclosure': [ + decimal_bound(mlo, ROUND_FLOOR), decimal_bound(mhi, ROUND_CEILING)], + 'samples': samples, 'local_exact_source_bindings_checked': list(sources), + 'scope': 'finite algebra/interval controls, not a continuum proof or a D1 verdict', + }, indent=2)) + + +if __name__ == '__main__': + main() diff --git a/docs/research-translation/20260930/cap-assumption-ablation/sources/AUDIT.md b/docs/research-translation/20260930/cap-assumption-ablation/sources/AUDIT.md new file mode 100644 index 000000000..fdfccaf53 --- /dev/null +++ b/docs/research-translation/20260930/cap-assumption-ablation/sources/AUDIT.md @@ -0,0 +1,327 @@ +# D1 external-audit response: the separating cap really gives a global elder pair + +Object: OA-D1-CAP-AUDIT-20260930-v1. Author/executor: OpenAI / GPT-6 Astra Pro. +Requested by Dylan in the current conversation; coordination: Math- issue #193. +Source cut: `3e0a91b69892b9717564c592e7a966492a81566a`. + +**Disposition:** source/author-exposed reconstruction and new explanatory corollaries; +new nonauthor review requested. Not an independent-human or institutional review. +Scientific effect NONE: no original proof, verdict, GRAPH, STATUS, prize, premise +or formal-scope change. The executor is exposed to the original OpenAI proof chain. + +## 1. What this audit resolves, and what it does not + +The external critique identifies the right load-bearing question: why does a local +Hessian event identify the GLOBAL ordinary superlevel H0 elder partner? Sections +2–7 reconstruct that implication without relying on an ACCEPT label. The crucial +information is stronger than endpoint jets: a closed neighborhood has no exit above +the saddle height, and a separately constructed path reaches an older point at +exactly that height. Remote excursions, loops and reentry cannot avoid the first exit. +No deterministic gap was found in CAP §§1–5 under their full hypotheses. + +This is not a fresh audit of all Gaussian estimates or of the entire D1 theorem. +The matrix boundary layer, pinned genericity, marked Kac–Rice extension and source +coefficient identification remain their own analytic interfaces. `SOURCES.json` +binds the exact source set; an identity match never establishes its truth. + +The critique also contains a statement that is correct for D1 alone but outdated +for the program: a separate, source-bound reviewed D2 theorem already supplies an +unrestricted **O(1) additive remainder**, not the stronger compact O(ell^(2/3)) +difference. Section8 separates this update from genuine open validation and +numerical-constant requirements. Institutional external review and a complete Lean +formalization are not provided by this response and are not marked resolved. + +## 2. The topological lemma, independent of Gaussian probability + +Let X be a compact smooth manifold, f continuous, M in the interior of a compact +set C, b=f(M), and sb and f>=s everywhere on it. + +Define the connection value + + d_f(M)=sup_{gamma(0)=M, f(gamma(1))>b} min_{t in[0,1]} f(gamma(t)). (A1) + +Then **d_f(M)=s**. + +Proof of the upper bound: every older endpoint f(z)>b is outside C by C1. Since M +is interior, a continuous path to that endpoint has a first boundary exit. Its +value is <=s by C2, so the path minimum is <=s. Later excursions or reentry cannot +remove that already-encountered value. Taking the supremum proves d_f(M)<=s. +C3 proves the opposite inequality and also shows that the path family is nonempty. +This argument needs no smooth boundary, no absence of remote critical points, +no stochastic independence, and no identification of a ridge with a flow line. + +For a Morse f with distinct critical values, this is precisely the ordinary +superlevel-component elder death level. One can see it directly from the rule: +for sh} cannot contain a point above b, since an +open connected manifold subset is path connected and that would contradict the +upper bound. Thus no older maximum has merged with M's class at those levels. +For every hh} and reaches a point above b, so +the component now contains an older maximum. A component containing such a point +has a maximum of value greater than b: maximize f on its compact closure. Since +the maximum is above h, it lies in the component interior, not its level-h boundary. +Therefore death occurs at level s, not above or below it. The nonempty older path +excludes the essential global-maximum class. If a unique critical point S has +critical value s, that point is the elder death saddle. + +The argument does NOT say that a path with minimum s by itself determines death: +it proves only d_f(M)>=s. Nor does an exit barrier alone guarantee finite death: +without an older endpoint the class can be essential. Both directions are necessary. + +## 3. The exact local hypotheses in D1 + +Write local coordinates (x,y) in R x R^(d-1), with d>=2. For r>0 the full cylinder is + + D=[-2r,2r] x closed_ball(0,2r). + +For the torus X=R^d/(LZ^d), impose `r0 and a C4 function near D with +critical pins M=(-r/2,0), S=(r/2,0), f(M)=b, f(S)=s=b-kr^3. +For j=3,4 use exactly the partial-block operator norms from CAP: + + M_j=max_{a+c=j} sup_D ||partial_x^a D_y^c f||_op, + lambda=lambda_min(-D_y^2 f(M)). + +The event used in P §7 is + + G_r: lambda > (4/(3k))r M_3^2, rM_4 <= 3k/10. (A2) + +These are bounds on the WHOLE CYLINDER, not just the Hessians or jets at M and S. +Using arbitrary-coordinate entry maxima without the appropriate dimension factors +would not be the same event. The transverse Hessian inequality is a matrix-order +inequality, not an entrywise scalar assertion. + +Normalize by f_tilde=f/(6k). Its gap is r^3/6. Put m=M_3/(6k), n=M_4/(6k), and +lambda_tilde=lambda/(6k). The hypotheses become + + lambda_tilde>8r m^2, rn<=1/20. (A3) + +In Sections4–6 all derivatives/heights refer to f_tilde. Write b_tilde=b/(6k), +s_tilde=b_tilde-r^3/6, a=-r/2 and c=r/2. + +## 4. Reconstructing the transverse ridge without a vector Rolle shortcut + +The two critical pins yield the exact Hermite identity + + f_tilde(c,0)-f_tilde(a,0) + =-1/2 integral_a^c (x-a)(c-x) f_tilde_xxx(x,0) dx. (A4) + +The positive kernel has integral r^3/6. Its weighted derivative average is therefore +2; in particular m>=2, and f_tilde_xxx=2 somewhere in the pin interval. Each point +of D is at product distance <5r from that point and from M. The block norms give + + f_tilde_xxx>=2-5rn>=7/4, + D_y^2 f_tilde <= -delta I, + delta=lambda_tilde-5rm>rm(8m-5). (A5) + +Let K=8m-5>=11 and w(x)=grad_y f_tilde(x,0). Both endpoint values of w are zero. +Apply the two-node scalar interpolation remainder to each unit-vector projection: + + ||w(x)|| <= (m/2)|x^2-r^2/4| <=(15/8)mr^2<2mr^2. (A6) + +This also holds outside the pin interval: use the convex hull of x,a,c when +applying the scalar interpolation remainder. For its derivative, use the average: + + w'(x)=r^-1 integral_a^c [w'(x)-w'(t)]dt, + ||w'(x)|| <=(m/r) integral_a^c |x-t|dt <=2mr. (A7) + +There is no assertion of one point where all components of w' vanish. Indeed the +exact vector w=(x^2-1/4, x^3-x/4) has both endpoint zeros but no common zero of w'. + +On ||y||=2r, strong concavity gives + + grad_y f_tilde(x,y).y <= ||w(x)|| ||y||-delta||y||^2<0. + +The maximum in each compact transverse ball is interior and unique. Call it h(x). +The implicit-function theorem gives h in C3, h(a)=h(c)=0 and + + ||h||<2r/K, + ||h'||<(2/K)+(2/K^2)<=24/121, + m||h'|| <=(1+6/K+5/K^2)/4<=48/121. (A8) + +For example h'=-(D_y^2 f_tilde)^(-1) partial_x grad_y f_tilde; (A7) plus the +mixed derivative bound at h gives the second inequality. All estimates use vector +operator norms and have no hidden dimension-dependent coordinate sum. + +## 5. The reduced derivative and EVERY boundary face + +Let g(x)=f_tilde(x,h(x)) and F=g'. Put v=(1,h'). Differentiating the transverse +critical equation gives (H_f_tilde v)_y=0. In the third derivative of g, the +h'' term pairs this Hessian vector with a purely transverse vector and is zero; +the h''' term pairs grad_y f_tilde=0. Therefore exactly + + F''=f_xxx+3f_xxy[h']+3f_xyy[h',h']+f_yyy[h',h',h']. (A9) + +This does not make h a gradient-flow trajectory. The adverse part in (A9) is at +most (48/121)[3+3(24/121)+(24/121)^2]=2554128/1771561. Hence + + F''>7/4-2554128/1771561=2184415/7086244>1/4. (A10) + +Since F(a)=F(c)=0, strict convexity gives F<0 between the pins and F>0 outside. +It also gives F'(a)<0=s_tilde+9r^3/32=b_tilde+11r^3/96. (A11) + +For the lateral boundary ||y||=2r, (A5)–(A8) give delta>22r and +||y-h||>20r/11. Hence, for every x in the cap, + + f_tilde(x,y)<=g(x)-(delta/2)||y-h||^2 + b_tilde. +This establishes C3. A path through S at level s is not an above-s preemption path. + +Multiplication by6k returns to the original function. The axial drop/rise is at +least (27/16)kr^3; the older-point excess is at least (11/16)kr^3; the lateral drop +is greater than (26400/121)kr^3. Heights b,s and all critical points retain their +order. By Section2 the global elder partner is S on the Morse/distinct-value +locus. This is the desired implication (A2), in all fixed d>=2. + +The optional ascending-branch conclusion also follows: an ascent-unstable vector +at S cannot lie in the negative transverse hyperplane. One half-branch enters C +at height>s and cannot leave it. Its omega-limit lies among the finitely many +critical points in C; the strictly increasing gradient Lyapunov function excludes +S, so the limit is M. The other half-branch cannot cross the boundary at height>s +or approach the interior point M. The same reasoning works with a smooth positive +definite Riemannian metric; no Morse–Smale property is used. The branch claim is +not needed for the elder maximin proof. + +## 6. Two useful audit consequences + +### Exterior invariance + +Let f satisfy the preceding cylinder hypotheses. Any other compact Morse extension +f_hat that agrees with f on a neighborhood of D and has distinct critical values +also pairs M with S, regardless of its values outside D. The proof uses exactly +the same cap C, boundary and older-reaching ridge segment. Thus modifying remote +maxima, creating remote saddles or providing an exterior high corridor cannot +preempt the pair while these protected data remain unchanged. This is a corollary +of the first-exit proof, not a probabilistic decorrelation assertion. + +### Endpoint jets alone are insufficient: an exact local counterexample + +For r=k=1, in two variables put + + q(x)=2x^3-(3/2)x-1/2, + f0(x,y)=q(x)-128y^2, + f1(x,y)=f0(x,y)+65536y^4+y^5. (A13) + +Both pins M=(-1/2,0), S=(1/2,0) have the same heights0,-1 and identical jets through +order3. Both have the same max/saddle Hessian types. The unmodified f0 has M3=12, +M4=0 and lambda=256>192, so its local cylinder satisfies (A2). + +For f1 the vertical path x=-1/2,0<=y<=1/16 has values + + 65536(y^2-1/1024)^2-1/16+y^5 >=-1/16>-1, + +and its endpoint has value 1/2+1/16^5>0. It connects M to an older point above the +candidate saddle level. Therefore S cannot be its elder partner in any extension +preserving this path. This is an exact continuous path inequality, not an endpoint +sampling argument. The example does not contradict CAP: f1_yyyy(M)=24*65536, so it +violates the required whole-neighborhood fourth-derivative bound severely. It +shows why local pictures, pins or third jets alone cannot replace (A2). + +## 7. How the deterministic audit plugs into D1, and the corrected reading set + +P §7 uses exactly (A2). P §8 establishes Morse/distinct-value genericity for each +fixed conditional law and transfers it to Q^W by absolute continuity; no common +null set for all uncountably many parameters is asserted. The cap proof therefore +implies pointwise on that full-measure locus + + 1{S not the ordinary elder partner of M} <= 1{G_r fails}. + +Its expectation under the ORIGINAL full weight is bounded by Q^W(G_r^c). The +separate matrix calculation in P §§3–7 gives E_Q[W 1{G_r^c}]=O(r^5), while the +full Z_r is of order r^2; that supplies the O(r^3) probability bound. Today's +deterministic proof does not independently re-establish those stochastic inputs. +No regional D5 witness-collision mechanism is used to prove this implication. + +The citable parent is NOT its immutable uncorrected text in isolation: + +- P §5 must use E1: `D_r=diag(r^(-1/2),I)`. For H=[[r alpha,r beta^t],[r beta,A]], + `D_r H D_r=[[alpha,sqrt(r) beta^t],[sqrt(r) beta,A]]` and det(D_r H D_r)=det(H)/r. + The old diag(sqrt(r),I) would give r^2 alpha, not alpha. +- REC §5 W1 supplies the correct joint-convergence reading for the type argument; + it does not pretend arbitrary conditioned fields live in an unspecified common + almost-sure coupling. +- P §9 is replaced by E2's Borel marked Kac–Rice proof; an elder indicator is not + assumed continuous. This is a second essential amendment, not just typography. +- REC supplies the explicit embedding radius r=2 and use coordinates (x,y) in R x R^(d-1) on an embedded product cylinder + + D=[-2r,2r] x closed_ball(0,2r), r>0. + +Suppose f is C4 on a neighborhood of D, has critical pins M=(-r/2,0), S=(r/2,0), with f(M)=b and f(S)=b-kappa*r^3, kappa>0. For j=3,4 define the partial-block norm + + M_j=max_{a+c=j} sup_D || partial_x^a D_y^c f ||_op. + +For c=0 this is absolute value. For c>=1 the operator norm is the supremum on c transverse Euclidean unit vectors, independently chosen. In dimension two this is exactly the maximum of the coordinate partial derivatives used by #57, not the larger full-tensor operator norm. Put + + lambda=lambda_min(-D_y^2 f(M)). + +The explicit sufficient conditions are + + lambda > (4/(3*kappa))*r*M_3^2, + r*M_4 <= 3*kappa/10. (1) + +They give a unique transverse-critical ridge on D and a closed cap through S separating M from every older point. On a compact manifold, for a global Morse extension with distinct critical values, the ordinary superlevel elder death partner of M is S. Exactly one ascending unstable branch of S ends at M, for a smooth Riemannian gradient. No Morse-Smale assumption and no identification of the ridge with a flow trajectory are used. + +**Probabilistic corollary, narrower scope.** Retain EXACTLY the fixed-x-axis 2D normalized SIDE24 six-pin law of #57/#58: b=6/5, kappa=1/6, 08*r*m^2, r*n<=1/20. (4) + +The exact critical pins give the Hermite identity + + f(S)-f(M)=-(1/2) integral_{-r/2}^{r/2} + (x+r/2)(r/2-x) f_xxx(x,0) dx. + +The positive kernel has integral r^3/6, so its weighted average of f_xxx is 2. In particular m>=2 and some x0 in the pin interval satisfies f_xxx(x0,0)=2. This forced lower bound on m is useful; replacing m by the larger 1+m is unnecessary. + +The partial-block norms control increments by |Delta x|+||Delta y||, with no factor depending on dimension. Every point of D is within this product distance <5r of (x0,0), and likewise <5r from M. Thus + + f_xxx >= 2-5rn >= 7/4, + D_y^2 f <= -(lambda-5rm) I = -delta I, (5) + delta>rm(8m-5), 8m-5>=11. + +The Hessian inequality is in the quadratic-form order throughout D. A scalar lower bound on a diagonal entry cannot substitute for this matrix inequality when d>2. + +## 3. A vector ridge exists globally across the cylinder + +Let w(x)=grad_y f(x,0). It vanishes at the two pins and ||w''||<=m. Applying the scalar two-node interpolation remainder to every unit-vector projection of w gives, including outside the pin interval, + + ||w(x)|| <= (m/2)|x^2-r^2/4| <= (15/8)mr^2 <2mr^2. (6) + +The bound outside the nodes follows from the interpolation remainder on the convex hull of the three points, not from an unjustified inside-only estimate. + +Also integral_{-r/2}^{r/2} w'(t)dt=0. Subtract this average from w'(x), use the Lipschitz constant m, and integrate |x-t| to obtain + + ||w'(x)|| <= (m/r) integral_{-r/2}^{r/2}|x-t|dt + <=2mr, |x|<=2r. (7) + +This vector average argument does not posit a common point at which every component of w' vanishes. + +For fixed x, f(x,.) is delta-strongly concave on the transverse ball. On its boundary ||y||=2r, + + grad_y f(x,y).y <= ||w(x)|| ||y|| -delta||y||^2 <0. + +The maximum on the compact ball is therefore interior (moving inward increases the value at a boundary point). Strict concavity makes it unique. Call it h(x). It solves grad_y f(x,h(x))=0, has h(+-r/2)=0 and is C3 by the implicit function theorem. Strong monotonicity gives + + ||h(x)|| <= ||w(x)||/delta <2r/k, k=8m-5>=11. (8) + +Its derivative satisfies + + h'=-(D_y^2 f)^(-1) partial_x grad_y f. + +Equations (7),(8) and the mixed derivative bound give + + ||h'|| < (2rm+m||h||)/delta + <2/k+2/k^2=:u, u<=24/121. (9) + +Since m=(k+5)/8, + + m*u=(1+6/k+5/k^2)/4 <=48/121. (10) + +All these inequalities use transverse operator norms; there is no hidden dimension-dependent coordinate sum. + +## 4. The correct ridge derivative and all cap boundary faces + +Set g(x)=f(x,h(x)), F=g'=f_x(x,h(x)). With v=(1,h'), differentiating the transverse critical equation gives (H_f v)_y=0. In the third derivative of g, every term involving h'' is therefore zero. The exact identity is + + F''=f_xxx +3 f_xxy[h'] +3 f_xyy[h',h'] + + f_yyy[h',h',h']. (11) + +This is valid for a vector h. It does not assert that the ridge is an integral curve of the gradient. + +Using (9),(10), the adverse part is at most + + (48/121)[3+3*(24/121)+(24/121)^2] + =2554128/1771561. + +Consequently + + F'' > 7/4-2554128/1771561 + =2184415/7086244 >1/4. (12) + +The bound is weaker than #58's F''>1, but it is already sufficient for an older connecting endpoint. This is the second source of the improved depth condition. + +F has the prescribed zeros a=-r/2,c=r/2. Strict convexity makes them its only zeros, with F negative between and positive outside. Every critical point in D lies on the ridge, hence D contains precisely M and S. The Schur complement of D_y^2 f at these points is F'(a)<0 and F'(c)>0, proving that M is a maximum and S has exactly one positive Hessian direction. + +Define + + C=[-2r,r/2] x closed_ball(0,2r). + +Strong concavity gives f(x,y)<=g(x) and g(x)<=b on C. To control the longitudinal faces, subtract (x-a)(x-c)/8 from F. The difference is convex with zero values at a,c, hence nonnegative outside [a,c]. Integrating on either exterior interval gives + + g(-2r) <= b-(9/32)r^3 = s-(11/96)r^3, + g( 2r) >= s+(9/32)r^3 = b+(11/96)r^3, (13) + +where s=b-r^3/6. These are lower/upper inequalities at the actual ridge endpoints, not Taylor fits. + +For a transverse boundary point ||y||=2r, (5),(8) imply + + f(x,y) <=g(x)-(delta/2)||y-h(x)||^2 + rm(8m-5)>=22r and ||y-h||>20r/11. This covers the entire curved side of the cylinder, including its intersections with the end faces; in dimension two it covers both horizontal edges and their corners. + +On the right cap face x=c, h(c)=0, so + + f(c,y) <= s-(delta/2)||y||^2, + +with equality at S only. On the left face use f<=g and (13). Thus every boundary exit from C has value <=s. + +Finally, the ridge segment a<=x<=2r starts at M, passes through S and ends at z=(2r,h(2r)), where f(z)>b by (13). Its minimum is exactly s. A path through S at level s is not a preemption path staying strictly above s. + +## 5. Global elder pairing, actual branches, and mark scaling + +Every point with value >b lies outside C. Every continuous path from M to such a point must first intersect the boundary of C, so its minimum is <=s regardless of later remote excursions or reentry. The preceding ridge path has minimum exactly s and endpoint >b. Hence the maximin connection level to an older point is s. + +For a compact Morse function with distinct critical values, ordinary superlevel-component persistence identifies this maximin value with M's elder death level; the older endpoint excludes the essential/global-maximum case. The unique critical value s identifies S. This is the same separating-cap criterion established in #58, now with all its boundary premises re-proved under the weaker event. + +At S the Hessian is negative definite on the transverse hyperplane. The unstable eigenvector for gradient ascent has nonzero x component: its Hessian quadratic form is positive, whereas that hyperplane is strictly negative. This argument also holds for a smooth positive-definite Riemannian metric. One half-branch enters the cap at height >s; the other enters outside. The first cannot exit because its height increases and every boundary value is <=s. Its omega-limit is a critical point in the compact cap. Gradient monotonicity and finiteness of the critical set make this limit a single point; it cannot be S, so it is M. The other branch cannot enter C or tend to its interior point M. Exactly one branch ends at M. + +For general kappa>0 apply the normalized theorem to f/(6*kappa). Its pins have gap r^3/6 and arbitrary birth b/(6*kappa). Its derivative norms and transverse curvature are divided by 6*kappa. Condition (4) becomes exactly (1). The geometric ridge is unchanged. The reduced third derivative is >3*kappa/2, the longitudinal drop/rise is at least (27/16)*kappa*r^3, and the excess over the specified gap is (11/16)*kappa*r^3. The radial drop exceeds (26400/121)*kappa*r^3. + +An arbitrary orthonormal frame can be used in this pathwise argument as long as its product chart is embedded. Scaling or rotating the function here is not a proof that SIDE24's conditional covariance, pin energy or normalizer are invariant under that operation. + +## 6. What is imported for the 2D probability calculation + +Use the fixed-axis Q,Q^W law from Section 1 and the same random-variable coupling as #57 Sections 5 and 7. The following are retained premises, not newly rerun numerical programs: + +* Z>=(17/10)r^2, six-pin regression energy<8, and ||det H_M det H_S||_2/Z<23/5. +* q=f_yy(M) has density <=1/3 and ||q||_8<5. On typed support q<0. +* There is T>=1, JOINTLY independent of q, with ||T||_8<320 and M_3<=T+8|q|; also ||M_4||_8<340. +* In the SAME coupling, at q=-ru, the full typed weight satisfies the pointwise bound + + W<=r^4[T^2*u^2+3*T^3*u], u>=0. (15) + + Internal correlations among the residual field, axial/mixed variables and transverse innovation are retained. Independence is only from q. The coefficient 3 includes the saddle's mixed-square contribution. +* The pinned-genericity candidate #49 supplies the full-probability Morse/distinct-value locus for each fixed r. No simultaneous null-set statement over all parameters is imported. + +These facts are read from exact source bytes and their explicit chain. Hash verification does not establish their truth; H3 and LPW interval programs were not rerun by this delivery. The stronger geometry does not depend on #56's endpoint spectral candidate. + +## 7. The smaller exceptional layer and its retained far branch + +Set G_new={-q>8r M_3^2, rM_4<=1/20}. Section 2-5 give global pairing on G_new. Unlike an inference from a local-event probability, this uses a direct bound on G_new's complement. + +Put lambda=-q>0 on typed support. Failure of the depth condition implies + + lambda<=8r(T+8lambda)^2 + <=16rT^2+1024r lambda^2. + +Thus the failure lies in + + {01/(2048r)}. (16) + +The large-lambda branch is essential to the quadratic inequality and has NOT been discarded. + +For the near event, disintegrate on q independent of T. Use its density cap 1/3, dq=r du, and (15): + + E[W 1_near] <= (r^5/3) E integral_0^(32T^2) + [T^2 u^2+3T^3 u]du + = (r^5/3)[(32^3/3)E T^8+(3*32^2/2)E T^7]. (17) + +Division by the full Z and the moment bounds gives C3_new*r^3. Weighted Cauchy-Schwarz, INCLUDING its square root, and eighth-moment Markov give + + Q^W{lambda>1/(2048r)} < (23/5)(10240r)^4, + Q^W{M_4>1/(20r)} < (23/5)(6800r)^4. (18) + +Together (17),(18) prove (2),(3) at the imported premises. The same single complement controls nonadjacency and the event that both unstable branches end at M; no independence or equality of these events off G_new is asserted. + +The earlier LPW lower premise, when separately consumed, is unaffected: c_LPW=13/468574870385996070912000 and r<=1/356352 still compose with this upper bound for two-sided cubic order in the one fixed-axis law. This delivery does not re-establish that lower premise or give a limiting coefficient. + +## 8. Exact comparison and remaining work + +The predecessor constants from #57/#58 are + + C3_old=(10/51)[(256^3/3)320^8+(3*256^2/2)320^7], + C4_old=(23/5)[81920^4+6800^4]. + +Exact arithmetic checks C3_old>500*C3_new, C4_old>500*C4_new and + + C3_new+C4_new/20 <2.4*10^23. + +Their absorbed-constant ratio is about 511.803 (display only; the comparison >500 is rational). The tighter good event is strictly weaker than the old sufficient event; neither claims to characterize all successful pairs. + +For the three-dimensional probability program the deterministic matrix/ridge obstacle now has a concrete candidate solution, but the probability of a small transverse eigenvalue and intersections of matrix boundary strata remains to be proved under the correct eight-pin law. Full-annulus expected counts, 24-jet modulus certificates, all-angle/all-mark estimates and lifetime integration remain distinct targets. Small failure probability alone does not bound a count on the failure event. + +Source identities and external reconnaissance are in SOURCE_OBSERVATIONS.json and RECONNAISSANCE.md. Tests check exact algebra, finite examples and deliberate mutations, not arbitrary continuous fields or the analytic imported chain. Review should focus on the vector average in (7), all partial-block norms, the h'' cancellation, entire radial side, marked scaling, and the independence/density/normalizer powers in (17). diff --git a/experiments/periodic_h0/CONFIRMATION_READINESS.md b/experiments/periodic_h0/CONFIRMATION_READINESS.md index a135bb3a1..325ca0917 100644 --- a/experiments/periodic_h0/CONFIRMATION_READINESS.md +++ b/experiments/periodic_h0/CONFIRMATION_READINESS.md @@ -13,6 +13,7 @@ paired differences, finite-sample error, and the last refinement remain relevant | Certified finite-polynomial derivative input | [Exact rational certificate](FINITE_CERTIFICATE.md) for the stored rounded coefficients of eight fields | Derivative majorants and spatial interpolation budget evaluated; this defines a finite polynomial, not an ideal Gaussian realization | | 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 | | Infinite-field truncation | Variance diagnostics through mode64 in pilot32 | No uniform realized or probabilistic tail enclosure | | Lifetime range | Larger bins exhibit numerical stability; shortest bins still drift | No certified finite-lifetime range for the leading law | | Remainder | Source-bound qualitative O(1) theorem with its hypotheses | No applicable numerical remainder constant or cutoff supplied here | @@ -36,8 +37,10 @@ term still prevents use in the short-lifetime window. The [Hessian/grid result](results/hessian1/RESULTS.md) improves the derivative bound and supplies a much smaller abstract-filtration budget on a new 1024² dyadic grid. The result table checks the strict endpoint conditions for the -existing expanded/contracted-bin inequalities. It supplies neither bar counts -nor an asymptotic window. The new samples are defined by exact integer replay, +existing expanded/contracted-bin inequalities. C38 itself supplies neither bar counts +nor an asymptotic window. Its [exact-barcode successor](results/exact_h0_1/RESULTS.md) +now supplies grid counts and deterministic smooth finite-field bin bounds, while +retaining the Gaussian-law and asymptotic-window gaps. The new samples are defined by exact integer replay, so this bound cannot be attached to historical NumPy histogram counts. A later held-out design should be frozen **after** these analytic inputs are @@ -55,9 +58,9 @@ available and **before** its fields are observed. Its specification must record: numerical certificates; retain all outcomes and never rebind failed receipts. No held-out seeds have been consumed by this delivery. Assigning a sample size -or a pass threshold now would conceal missing analytic inputs. The next useful -calculation independently checks the barcode computation on the now-certified -fine dyadic grid, followed by a justified model, -tail and remainder budget. +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. The next scientific inputs are a +justified model, tail and remainder budget. The finite-polynomial derivative input is now available. The source-bound manuscript and literature work can advance in parallel without waiting for that budget. diff --git a/experiments/periodic_h0/EXACT_H0.md b/experiments/periodic_h0/EXACT_H0.md new file mode 100644 index 000000000..026d61fef --- /dev/null +++ b/experiments/periodic_h0/EXACT_H0.md @@ -0,0 +1,263 @@ +# Exact H0 endpoints from the dyadic samples + +[Experiment](README.md) · [Spatial certificate](HESSIAN_GRID.md) · +[Interpolation and bin comparison](APPROXIMATION.md) + +This note justifies the integer algorithm in `exact_h0.py` and its independent +connectivity checker. It computes ordinary H0 of a specified finite periodic +vertex cubical filtration. Applied to the regenerated samples identified by +`hessian1`, it supplies the previously missing identification of computed +endpoints with that abstract filtration. It does not change any historical +NumPy or GUDHI result, the frozen C38 receipt, or a Gaussian or infinite-field +acceptance condition. The claim is deterministic and uses no sampling law. + +## Object, units and graph + +Let `n >= 3`, `V = (Z/nZ)^2`, and let each supplied `a_v` be a strict Python +integer. The layout is `v = x*n+y`, with both coordinates ranging from zero +through `n-1`. Let `S` be a specified positive integer and set `s_v = a_v/S`. +For C38, `S = 2^96`; the integers are the real centers of the unchanged +`nodal_core.evaluate` computation, bound to the ordered digest, stage records +and nodal error in the frozen `hessian1` certificate. + +The mathematical superlevel cubical complex `C_t` contains a grid cell if +every one of its vertices has supplied value at least `t`. Vertices and +edges are cells too. Its H0 is exactly that of the graph whose vertices have +`s_v >= t` and whose edges are the four periodic axis neighbors, with an edge +present when both endpoints are present. Indeed, each included square has +its connected boundary already in the graph. Attaching the square cannot +join two graph components or split one. This identification respects the +inclusions as thresholds decrease, so it identifies H0 persistence modules. + +There are no diagonal edges in this graph. A fixed-diagonal PL interpolant +generally gives a different H0 module and is not computed here. The adaptive +minimum-corner triangulation in `APPROXIMATION.md` identifies this cubical +module with a suitable PL module for the existing approximation theorem; +the algorithm does not need to construct that triangulation. Periodic seams +are graph edges, with no duplicate boundary vertices or extra boundary strip. + +We work over any one fixed field. A reported finite pair `(b,d)` consists of +integer numerators with `b > d`; it represents the superlevel interval + +```text +(d/S, b/S], +``` + +or the ordinary sublevel interval `[-b/S,-d/S)` of `-s`. At the death level +the dying class has already merged. Its exact lifetime is `(b-d)/S`. Zero +pairs are omitted from the diagram. The connected torus graph has one +essential class with birth `max_v a_v/S`, representing `(-infinity,b/S]` +in superlevel coordinates. No longest finite interval is removed. + +## Descending integer sweep + +Give each vertex the elder priority `(a_v,-v)`: larger values are older, and +among equal values the smaller row-major vertex id is older. Process vertices +in descending value, with increasing vertex id within a tie. When activating +a vertex, inspect all its already active axis neighbors. Join different +components; retain their older elder and pair their younger elder's birth +with the current integer value. Keep a pair only when birth exceeds death. + +The disjoint-set data structure has two separate roles. Its parent and size +arrays implement union by size and path compression. A separate elder array +stores the mathematical elder of each component. A large data-structure tree +is not allowed to overrule the older birth. An inactive parent is marked -1; +all active vertices, including negative-valued ones, are processed. + +After each whole equal-value block at level `c`, the active vertices are +exactly `{v:a_v>=c}`. Each edge of their induced graph was inspected when its +later endpoint activated, and unions connected exactly its components. The +elder metadata is the maximum priority in each component, by induction on +the unions. Cyclic edges whose endpoints already share a root cause no merge. + +To justify the persistence pairs, refine the finite filtration by its actual +vertex and edge insertion order. Each new vertex initially creates one H0 +basis vector. Adding an edge within a component acts identically on H0. An +edge joining two components identifies their two H0 vectors. If their elder +births are `b_old >= b_young`, the older class already exists at the younger +birth. From that birth until the merge, replace the younger generator by the +younger vector minus the older vector, transported by the inclusions. At the +merge this difference becomes zero, while the older generator continues. +Thus this change of basis splits off an interval from `b_young` to the merge +level. Inducting over all insertions proves the elder pairing; subtraction +also works in characteristic two. + +This refined insertion order is only a way of computing the original +filtration: every insertion within a block has the same real parameter. +Restricting to the states after complete blocks identifies those equal +parameters. Pairs with identical birth and death become zero modules and +are discarded; positive pairs retain their exact endpoints. This explains +why equality comparisons are exact and why no generic-position assumption +or artificial value perturbation is needed. Other tie orders may choose +different representative labels but cannot change the positive interval +multiset of this module. The declared priority fixes the labels used here. + +There are `N=n^2` vertex insertions and exactly `N-1` successful component +unions, since the final periodic graph is connected. Consequently + +```text +positive_pair_count + zero_count + 1 = N. +``` + +The final elder is the smallest vertex id attaining the largest value. +Every finite endpoint is an input integer; division by `S` is exact rational +arithmetic. Hence this computation contributes zero endpoint rounding error +relative to the supplied cubical filtration. It does not set the separate +nodal or spatial approximation error to zero. + +## Independent verification by connectivity + +`verify_by_connectivity` does not rerun the union-find sweep. It first finds +all connected equal-value plateaus by graph searches. A plateau is a regional +maximum if it has no neighbor with greater value. Its representative is its +smallest vertex id. At a threshold equal to a plateau's value, a plateau with +a higher neighbor is attached to an already present component; a regional +maximum plateau creates one new component. Thus the positive and essential +births, counted with multiplicity, are exactly the regional maximum plateaus. + +Order those representatives by the same elder priority. The oldest one is +essential. For every other representative `p` of birth value `b=a_p`, define + +```text +d_p = max over paths from p to an older regional maximum + of (the minimum vertex value along the path). +``` + +There is at least one such path because the full periodic graph is connected. +Only finitely many vertex values can be a path minimum, so the maximum is +attained. At any threshold `t`, the component of `p` contains an older +maximum exactly when a qualifying path has minimum at least `t`. The elder +invariant above therefore makes `d_p` the first merge level at which `p` +dies. Distinct regional maximum plateaus are separate at their common birth +level, and a regional maximum has no higher neighbor; hence `d_p < b`. + +For a BFS started at `p`, testing for an older regional maximum can be +replaced by testing whether it reaches any vertex `u` with + +```text +a_u > b, or (a_u = b and u < p). +``` + +An older maximum representative itself satisfies this condition. Conversely, +a reached vertex above `b` has a nondecreasing path to a regional maximum +above `b`: traverse its equal plateau, move to a higher neighbor if one +exists, and repeat; the finite graph makes this process terminate. This path +stays above the current threshold. A reached vertex at value `b` with id +smaller than `p` cannot be in `p`'s plateau, since `p` is its minimum id. +Its own plateau either leads to a higher maximum by the same argument or is +a maximum with an even smaller representative. In either case an older +maximum is connected. This proves the equivalence used by the checker. + +For each proposed finite pair `(b,d)` labelled by `p`, the checker proves: + +1. `p` is the representative of the asserted regional maximum and `b=a_p`. +2. At the inclusive threshold `d`, a BFS from `p` reaches an older vertex. +3. At the threshold `d+1`, a complete BFS from `p` reaches no older vertex. + +All vertex values are integers, so the graph at `d+1` is exactly the graph +with values strictly greater than `d`. The last two conditions establish +`d_p >= d` and `d_p < d+1`, respectively, and the integer-valued `d_p` must +therefore equal `d`. They test both sides of the endpoint, rather than +checking only one nearby threshold or using a rounded value. + +The checker also requires that finite labels exhaust every nonessential +regional maximum exactly once, the one essential value and label are +correct, the zero count satisfies the conservation equation, and the entire +output has the declared strict types and canonical order. Thus a missing bar +cannot hide between the tested endpoint levels. This completeness step is +essential: checking only the Betti numbers at selected thresholds would not +exclude a missing bar born and killed between them. + +## Exact bin transfer to the finite polynomial + +Let `Q` be this exact sample diagram, and let `P` be a target diagram with an +independently justified epsilon-matching to `Q`. For the specified finite +rounded-coefficient polynomial and the C38 samples, the existing theorem +supplies `epsilon=eta+B`, with its exact rational value from `hessian1`. +This paragraph invokes that existing matching and does not infer it from +the graph computation or a hash. + +Set `delta=2*epsilon`, and let `N` count only finite positive bars. Matched +finite lifetimes differ by at most `delta`. A bar matched to the diagonal +has lifetime at most `delta`, including equality. For a half-open bin +`[a,b)`, `0 delta. +``` + +For the lower inequality, a counted sample lifetime is strictly above +`delta` and therefore has a finite partner. Its partner is at least `a` +and strictly less than `b`. Injectivity of the matching proves the count +bound. For the upper inequality, `a>delta` ensures every counted target bar +has a finite sample partner; its lifetime is at least `a-delta` and strictly +less than `b+delta`. This proves the other injection. Essential classes and +diagonal points are never counted. If the contracted lower endpoint is not +less than its upper endpoint, its count is zero. + +The clean upper bound is deliberately absent (`None`) when `a<=delta`. +At equality, a target bar of lifetime exactly `delta>0` can be matched to +the diagonal in an empty sample diagram, so a clean upper bound zero would +be false. The contraction is nonempty exactly when `b-a>2*delta`; equality +leaves an empty half-open interval. All comparisons use `Fraction`, so bars +on the lower endpoint are included and bars on the upper endpoint excluded +even at an exact rational equality. Dividing endpoints or lifetimes through +float64 would not supply this guarantee. + +These bounds concern the specified finite polynomial's realization counts. +They do not supply a confidence interval, an ensemble expectation, an +asymptotic lifetime range, a remainder constant, or a uniform spectral tail. + +## Interfaces, cost and checks + +`compute(values,n)` accepts a flat list or tuple of strict integers. It returns +integer `intervals`, aligned `birth_vertices`, the one-entry `essential` +and `essential_vertices` lists, and `zero_count`. Finite triples are sorted +by birth, then death, then vertex id. Boolean or floating-point values and +dimensions are rejected. The grid has no numerical-resolution limit beyond +the signed index capacity of the array implementation and available memory. + +`verify_by_connectivity(values,n,result)` returns `True` only after all the +checks above, otherwise raises `ValueError`. Its topology is implemented +with explicit boundary branches rather than the sweep's modular neighbor +expressions. The tests use a third construction: undirected edges generated +in the two positive coordinate directions. + +`bin_transfer(barcode,scale,epsilon,edges)` requires a positive strict integer +scale and exact rational error and bin edges. It returns the supplied bin, +the exact sample count, the target lower count, the conditional target upper +count, and the two strict-condition flags. It validates the diagram schema +but cannot establish its provenance or the caller's claimed matching. + +For `N=n^2`, sorting costs `O(N log N)`. Four neighbor probes per vertex and +union by size with path compression cost `O(N alpha(N))`; integer comparison +and arithmetic have their ordinary bit costs. Storage is `O(N)` plus the +input integers and returned positive pairs. No floating point, numerical +package, simplex list or list of all edges is needed. On a million nodes the +three disjoint-set arrays occupy about 12 MiB with 32-bit array entries; +the Python integer samples and sorted index list are additional storage. + +The independent verifier uses `O(N)` storage and at most `O(N M)` work for +`M` regional maxima. Searches often finish much sooner, but this is not +assumed for correctness. The wrapper records actual reproduction and +verification evidence; algorithmic feasibility is not a substitute for +executing that check on the identified input. + +The focused tests compare every source-to-target H0 rank at all sample levels +on all 512 binary 3-by-3 grids and seeded tied grids. At thresholds `p>=q`, an +independent BFS counts components of the graph at `q` that meet a vertex of +value at least `p`. A proposed barcode must give that same rank: + +```text +number of finite (b,d) with b>=p and d=p. +``` + +Literal controls distinguish periodic seams, fixed diagonals, wrong elders, +plateau ties, the essential class and finite lifetimes of one integer unit +above a `2^96` offset. Deliberately omitted, shifted and mislabelled bars are +rejected by connectivity verification. Exact bin-boundary and malformed-type +controls cover the transfer calculation. These are engineering and finite +mathematical checks; review lineage, scientific acceptance and any formal +verification remain separate evidence. diff --git a/experiments/periodic_h0/README.md b/experiments/periodic_h0/README.md index de71ebd6e..6781e5740 100644 --- a/experiments/periodic_h0/README.md +++ b/experiments/periodic_h0/README.md @@ -98,8 +98,9 @@ The deterministic spatial interpolation/filtration bound and exact derivative majorants for the specified rounded finite polynomials are supplied. One new 128² NumPy sample snapshot and a separate deterministic 1024² dyadic sample grid have certified nodal bounds. The latter has a sharper spatial bound; -computed barcode endpoints, the relation to ideal Gaussian -coefficients, an enclosed infinite-field spectral tail, a justified finite-lifetime +its [exact barcode and finite-field bin bounds](results/exact_h0_1/RESULTS.md) +are now supplied by an integer sweep and independent connectivity verification. +The relation to ideal Gaussian coefficients, an enclosed infinite-field spectral tail, a justified finite-lifetime asymptotic window and numerical remainder constants remain open. Marginal one-standard-error bars do not include these errors. The coefficient is a float64 comparison value from a separate exact enclosure. This experiment does not diff --git a/experiments/periodic_h0/exact_barcode_certificate.py b/experiments/periodic_h0/exact_barcode_certificate.py new file mode 100644 index 000000000..353a8aabf --- /dev/null +++ b/experiments/periodic_h0/exact_barcode_certificate.py @@ -0,0 +1,190 @@ +"""Exact H0 endpoints and finite-field bin bounds for the frozen C38 grid.""" +import argparse +import hashlib +import platform +import re +import sys +from datetime import datetime, timezone +from fractions import Fraction as Q +from pathlib import Path +import finite_certificate as fc +import nodal_core as nc +import hessian_grid_certificate as upstream +import exact_h0 as h0 + +BASE = Path(__file__).resolve().parent +UPSTREAM_CERT = 'results/hessian1/CERTIFICATE.json' +UPSTREAM_RUN = 'results/hessian1/RUN.json' +UPSTREAM_SHA256 = 'c46cfc061465b951968f675270b649cd6b61c1dc4989635a1c3c7a3f7a564519' +UPSTREAM_RUN_SHA256 = '3bea8119b5fc3b8aadf887b439d3032f7d88377771c338db44e320dfc60979e1' +SOURCE_PATHS = tuple(sorted(set(upstream.SOURCE_PATHS) | { + 'exact_h0.py', 'EXACT_H0.md', 'exact_barcode_certificate.py', + UPSTREAM_CERT, UPSTREAM_RUN, 'results/hessian1/RUN.sha256'})) +SCOPE = ('Exact periodic vertex-cubical H0 barcode of the C38 dyadic grid and ' + 'deterministic bin bounds for its one frozen finite polynomial. ' + 'No historical FFT, ideal Gaussian ensemble, infinite-field, lifetime-law ' + 'or held-out confirmation certificate.') + + +def identity(path): + raw = Path(path).read_bytes() + return {'bytes': len(raw), 'sha256': hashlib.sha256(raw).hexdigest()} + + +def load_upstream(base=BASE): + """Consume unchanged reviewed C38 bytes; do not re-author its certificate.""" + base = Path(base) + fc.require(identity(base/UPSTREAM_CERT)['sha256'] == UPSTREAM_SHA256, + 'Not the frozen C38 certificate') + fc.require(identity(base/UPSTREAM_RUN)['sha256'] == UPSTREAM_RUN_SHA256, + 'Not the frozen C38 receipt') + receipt = fc.load_json(base/UPSTREAM_RUN) + upstream.validate_receipt(receipt) + fc.require((base/'results/hessian1/RUN.sha256').read_bytes() == + (UPSTREAM_RUN_SHA256+'\n').encode(), 'C38 receipt binding mismatch') + for name, expected in receipt['sources'].items(): + fc.require(identity(base/name) == expected, 'Changed C38 dependency: '+name) + fc.require(identity(base/UPSTREAM_CERT) == receipt['outputs']['CERTIFICATE.json'], + 'C38 output binding mismatch') + return fc.load_json(base/UPSTREAM_CERT) + + +def analyze(values, n, scale, epsilon, edges): + barcode = h0.compute(values, n) + checked = h0.verify_by_connectivity(values, n, barcode) + fc.require(checked is not False, 'Independent connectivity verification failed') + bins = h0.bin_transfer(barcode, scale, epsilon, edges) + # Endpoint integers are strings to preserve them in JSON consumers whose + # number type cannot exactly represent 96-bit fixed-point samples. + 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 {'barcode': encoded, + 'bins': [{k: str(v) if type(v) is Q else v for k,v in row.items()} for row in bins]} + + +def certify(): + old = load_upstream() + data = fc.load_json(BASE/upstream.COEFFICIENT_PATH) + fc.validate(data) + fc.require(fc.digest(data) == old['coefficient_object_sha256'], 'C38 coefficient object mismatch') + record = next(r for r in data['records'] if r['seed'] == old['seed']) + n = old['samples']['grid'] + centers, stages, error = nc.evaluate(record, n) + fc.require(upstream.real_center_digest(centers) == old['samples']['real_integer_sha256'], + 'C38 real sample digest mismatch') + fc.require(stages == old['samples']['stages'] and str(error) == old['samples']['nodal_error'], + 'C38 nodal replay mismatch') + values = [v for v, _ in centers] + del centers + epsilon = Q(old['abstract_diagram_bound']) + result = analyze(values, n, nc.SCALE, epsilon, [Q(2**j,1000) for j in range(9)]) + return dict(result, schema_version=1, seed=old['seed'], grid=n, + fixed_point_scale=str(nc.SCALE), sample_count=len(values), + sample_sha256=old['samples']['real_integer_sha256'], + upstream_sha256=UPSTREAM_SHA256, computed_barcode_error='0', + finite_polynomial_diagram_bound=str(epsilon), + finite_polynomial_diagram_bound_decimal_up=fc.decimal_up(epsilon,24), + independent_connectivity_check=True, historical_fft_certified=False, + gaussian_law_certified=False, infinite_field_certified=False, + lifetime_law_certified=False, scope=SCOPE) + + +def render_report(cert): + lines = ['# Exact barcode and certified finite-field counts', '', + f"One frozen finite polynomial (seed label {cert['seed']}), on the C38 **{cert['grid']}² exact dyadic grid**.", '', + f"The integer-only sweep gives **{len(cert['barcode']['intervals'])} positive finite H₀ bars** and one essential class.", + 'A separate plateau and breadth-first connectivity check verifies the birth and death witnesses.', + 'Zero-lifetime pairs are omitted; the longest finite interval is retained.', '', + f"The barcode endpoints have **zero arithmetic error** relative to these exact samples. The diagram bound", + f"against the frozen smooth finite polynomial is at most **{cert['finite_polynomial_diagram_bound_decimal_up']}**", + '(the unchanged C38 interpolation/stability bound).', '', + '| Lifetime bin | Exact grid count | Smooth finite-field lower bound | Smooth finite-field upper bound |', + '|---|---:|---:|---:|'] + for row in cert['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 by this argument'} |") + lines += ['', 'Bounds use contracted and expanded bins with exact rational endpoints.', + 'They are counts for one deterministic smooth finite field, not expected intensities,', + 'a Gaussian-law fit, a tail enclosure, a remainder estimate or a held-out test.', '', + '[Algorithm and proof](../../EXACT_H0.md) · [Exact endpoints and counts](CERTIFICATE.json)', + '· [Source and execution receipt](RUN.json) · [C38 spatial bound](../hessian1/RESULTS.md)', '', + '```sh', 'python -B -S experiments/periodic_h0/exact_barcode_certificate.py --verify experiments/periodic_h0/results/exact_h0_1', + '```', '', SCOPE, ''] + return '\n'.join(lines) + + +def validate_directory(directory): + """Check custody only; verify_directory additionally reruns the computation.""" + directory = Path(directory) + receipt = fc.load_json(directory/'RUN.json') + fc.require(type(receipt) is dict and set(receipt) == + {'schema_version','utc','python','platform','sources','outputs','scope'}, 'Invalid receipt fields') + fc.require(type(receipt['schema_version']) is int and receipt['schema_version'] == 1 + and receipt['scope'] == SCOPE, 'Invalid receipt version or scope') + fc.require(type(receipt['utc']) is str and re.fullmatch( + r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}\+00:00',receipt['utc']) is not None, + 'Invalid receipt timestamp') + stamp = datetime.fromisoformat(receipt['utc']) + fc.require(stamp.tzinfo == timezone.utc and stamp.isoformat(timespec='microseconds') == receipt['utc'], + 'Invalid receipt timestamp') + for key in ('python','platform'): + fc.require(type(receipt[key]) is str and 0 < len(receipt[key]) <= 4096 + and '\x00' not in receipt[key], 'Invalid environment metadata') + fc.require(type(receipt['sources']) is dict and set(receipt['sources']) == set(SOURCE_PATHS), + 'Invalid source roles') + fc.require(type(receipt['outputs']) is dict and set(receipt['outputs']) == {'CERTIFICATE.json'}, + 'Invalid output roles') + for item in [*receipt['sources'].values(),*receipt['outputs'].values()]: + fc.require(type(item) is dict and set(item) == {'bytes','sha256'}, 'Invalid identity fields') + fc.require(type(item['bytes']) is int and item['bytes'] > 0, 'Invalid byte count') + fc.require(type(item['sha256']) is str and re.fullmatch('[0-9a-f]{64}',item['sha256']) is not None, + 'Invalid SHA256') + 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) == receipt['sources'][name], 'Source binding mismatch: '+name) + fc.require(identity(directory/'CERTIFICATE.json') == receipt['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 binding mismatch') + return cert + + +def verify_directory(directory): + cert = validate_directory(directory) + fc.require(fc.canonical_bytes(cert) == fc.canonical_bytes(certify()), 'Exact barcode replay mismatch') + return True + + +def produce(directory): + directory = Path(directory) + fc.require(not directory.exists(), 'Output must be a new directory') + cert = certify() + directory.mkdir(parents=True) + (directory/'CERTIFICATE.json').write_bytes(fc.canonical_bytes(cert)) + receipt = {'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(receipt) + (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(): + parser = argparse.ArgumentParser(description=__doc__) + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument('--produce',type=Path); group.add_argument('--verify',type=Path) + args = parser.parse_args() + if args.verify: + verify_directory(args.verify) + print('Exact dyadic H0 replay and connectivity verification passed; Gaussian-law gates remain open.') + else: + result = produce(args.produce) + print(len(result['barcode']['intervals']), 'positive finite bars; finite-field scope only.') + + +if __name__ == '__main__': main() diff --git a/experiments/periodic_h0/exact_h0.py b/experiments/periodic_h0/exact_h0.py new file mode 100644 index 000000000..ffbfe6a3c --- /dev/null +++ b/experiments/periodic_h0/exact_h0.py @@ -0,0 +1,201 @@ +"""Exact ordinary H0 for integer-valued periodic vertex cubical filtrations. + +All endpoints stay in input integer units. See EXACT_H0.md for the graph, +elder, tie, independent connectivity-verification and bin-transfer proofs. +This module does not evaluate Fourier fields or certify their sampling law. +""" +from array import array +from collections import deque +from fractions import Fraction as Q + + +def _require(condition, message): + if not condition: + raise ValueError(message) + + +def _grid(values, n): + _require(type(n) is int and n >= 3, 'Integer grid side at least three required') + _require(type(values) in (list, tuple) and len(values) == n*n, + 'Flat square list or tuple required') + _require(all(type(value) is int for value in values), 'Strict integer samples required') + _require(n*n < 2**31, 'Grid exceeds signed array-index capacity') + + +def _result(result): + keys = {'intervals', 'birth_vertices', 'essential', 'essential_vertices', 'zero_count'} + _require(type(result) is dict and set(result) == keys, 'Unexpected barcode schema') + bars, vertices = result['intervals'], result['birth_vertices'] + _require(type(bars) is list and type(vertices) is list and len(bars) == len(vertices), + 'Invalid finite-bar arrays') + _require(all(type(pair) is list and len(pair) == 2 + and all(type(value) is int for value in pair) and pair[0] > pair[1] + for pair in bars), 'Finite bars require strict integer birth greater than death') + _require(all(type(v) is int and v >= 0 for v in vertices) + and len(set(vertices)) == len(vertices), 'Invalid or duplicate birth vertices') + for key in ('essential', 'essential_vertices'): + _require(type(result[key]) is list and len(result[key]) == 1 + and type(result[key][0]) is int, 'Exactly one essential class required') + _require(result['essential_vertices'][0] >= 0 + and result['essential_vertices'][0] not in vertices, 'Invalid essential vertex') + _require(type(result['zero_count']) is int and result['zero_count'] >= 0, + 'Nonnegative integer zero count required') + records = [(b, d, v) for (b, d), v in zip(bars, vertices)] + _require(records == sorted(records), 'Finite bars must be canonically ordered') + + +def compute(values, n): + """Return exact positive finite pairs and the one essential birth. + + ``values[x*n+y]`` is an integer sample. Axis edges wrap in both directions. + Larger birth survives a merge; equal births prefer the smaller vertex id. + Endpoint units are unchanged. Zero pairs are counted but not diagram points. + """ + _grid(values, n) + count = len(values) + parent = array('i', [-1])*count + sizes = array('I', [0])*count + eldest = array('I', [0])*count + # Python's stable sort retains increasing vertex ids within equal values. + order = sorted(range(count), key=values.__getitem__, reverse=True) + records, zero = [], 0 + + def root(i): + while parent[i] != i: + parent[i] = parent[parent[i]] + i = parent[i] + return i + + for vertex in order: + parent[vertex] = vertex + sizes[vertex] = 1 + eldest[vertex] = vertex + x, y = divmod(vertex, n) + neighbors = (((x-1) % n)*n+y, ((x+1) % n)*n+y, + x*n+(y-1) % n, x*n+(y+1) % n) + for neighbor in neighbors: + if parent[neighbor] < 0: + continue + u, v = root(vertex), root(neighbor) + if u == v: + continue + survivor, dying = eldest[u], eldest[v] + if (values[survivor] < values[dying] + or (values[survivor] == values[dying] and survivor > dying)): + survivor, dying = dying, survivor + birth, death = values[dying], values[vertex] + if birth > death: + records.append((birth, death, dying)) + else: + zero += 1 + # Balance the data structure independently of the mathematical elder. + if sizes[u] < sizes[v]: + u, v = v, u + parent[v] = u + sizes[u] += sizes[v] + eldest[u] = survivor + records.sort() + essential = eldest[root(0)] + return {'intervals': [[b, d] for b, d, _ in records], + 'birth_vertices': [v for _, _, v in records], + 'essential': [values[essential]], 'essential_vertices': [essential], + 'zero_count': zero} + + +def verify_by_connectivity(values, n, result): + """Independently check every positive birth and exact elder death by BFS. + + No union-find or sweep replay is used. Every regional maximum plateau is + found; each nonessential representative must reach an older vertex at d, + and fail to do so at d+1. Integer levels make these two tests sufficient. + Worst-case cost is O(N times the number of regional maxima), O(N) memory. + """ + _grid(values, n) + _result(result) + count = len(values) + _require(all(v < count for v in result['birth_vertices']+result['essential_vertices']), + 'Barcode vertex outside grid') + _require(len(result['intervals'])+result['zero_count']+1 == count, + 'Finite, zero and essential counts do not sum to the vertex count') + + # Branch-based seam handling is deliberately separate from compute's + # modular neighbor expression; the tiny test oracle builds undirected edges. + def neighbors(vertex): + row, column = divmod(vertex, n) + return (vertex-n if row else vertex+n*(n-1), + vertex+n if row+1 < n else vertex-n*(n-1), + vertex-1 if column else vertex+n-1, + vertex+1 if column+1 < n else vertex-n+1) + + seen = bytearray(count) + maxima = [] + for vertex, level in enumerate(values): + if seen[vertex]: + continue + seen[vertex] = 1 + queue = deque([vertex]) + has_higher_neighbor = False + while queue: + u = queue.popleft() + for v in neighbors(u): + if values[v] > level: + has_higher_neighbor = True + elif values[v] == level and not seen[v]: + seen[v] = 1 + queue.append(v) + # The outer scan encounters the smallest plateau id first. + if not has_higher_neighbor: + maxima.append(vertex) + essential = max(maxima, key=lambda v: (values[v], -v)) + _require(result['essential'] == [values[essential]] + and result['essential_vertices'] == [essential], 'Incorrect essential elder') + _require(set(result['birth_vertices']) == set(maxima)-{essential}, + 'Finite births do not exhaust the nonessential regional maximum plateaus') + + visits = array('I', [0])*count + generation = 0 + for (birth, death), vertex in zip(result['intervals'], result['birth_vertices']): + _require(birth == values[vertex], 'Birth endpoint differs from its maximum plateau') + for threshold, expected in ((death+1, False), (death, True)): + generation += 1 + visits[vertex] = generation + queue = deque([vertex]) + reached_older = False + while queue: + u = queue.popleft() + if values[u] > birth or (values[u] == birth and u < vertex): + reached_older = True + break + for v in neighbors(u): + if values[v] >= threshold and visits[v] != generation: + visits[v] = generation + queue.append(v) + _require(reached_older == expected, 'Incorrect exact elder death level') + return True + + +def bin_transfer(barcode, scale, epsilon, edges): + """Apply the exact lifetime-bin sandwich, conditional on a diagram matching. + + The caller supplies the separate proof of an epsilon-matching to its target. + No upper count is asserted for a bin starting at or below 2*epsilon. + Input endpoints are integers divided by ``scale``; all bins are half open. + """ + _result(barcode) + _require(type(scale) is int and scale > 0, 'Positive strict integer scale required') + _require(type(epsilon) is Q and epsilon >= 0, 'Nonnegative exact rational epsilon required') + _require(type(edges) in (list, tuple) and len(edges) >= 2 + and all(type(edge) is Q and edge > 0 for edge in edges) + and all(a < b for a, b in zip(edges, edges[1:])), + 'Strictly increasing positive exact rational bin edges required') + lengths = [Q(b-d, scale) for b, d in barcode['intervals']] + delta = 2*epsilon + + def count(lower, upper): + return sum(lower <= length < upper for length in lengths) + + return [{'lower': a, 'upper': b, 'sample_count': count(a, b), + 'target_lower_count': count(a+delta, b-delta), + 'target_upper_count': count(a-delta, b+delta) if a > delta else None, + 'clean_upper': a > delta, 'nonempty_contraction': b-a > 2*delta} + for a, b in zip(edges, edges[1:])] diff --git a/experiments/periodic_h0/results/exact_h0_1/CERTIFICATE.json b/experiments/periodic_h0/results/exact_h0_1/CERTIFICATE.json new file mode 100644 index 000000000..adbf8d872 --- /dev/null +++ b/experiments/periodic_h0/results/exact_h0_1/CERTIFICATE.json @@ -0,0 +1 @@ +{"barcode":{"birth_vertices":[336128,539411,12500,614074,159658,260109,219808,115317,704690,703665,702640,700589,692386,693411,392808,391783,498256,546195,73369,572261,573284,467401,270209,95988,849177,81394,350214,252678,695047,694024,142584,617736,890451,655701,654678,69566,230981,229956,232006,235080,339083,941845,84785,191026,166452,199080,539752,538727,867709,831235,180365,66663,317931,594437,595462,454495,578531,710680,299371,449858,1038189,1012171,149839,148816,931506,454821,748007,923102,441018],"essential":["216138597245998201122848797052"],"essential_vertices":[953389],"intervals":[["-25794937774915735715518697499","-43758175710111965126544083706"],["-14627371097203733129939477268","-14628879053016912730710350932"],["6482743719576422083825066269","-9530282891746278257168312405"],["13501947469473794122428934518","-17986930268462546307408670696"],["14719097466260620201442997590","10844589163190359757087353650"],["16051721928446166993012567307","8046576004803341279570142685"],["19670260715909992478156938741","16826979147584038033503375549"],["23733130969104691027207194399","23723825364965484756774420853"],["24402095026518287004421919471","24396233094369604563315180861"],["24435050271028355401133757230","24417766741010992890921597676"],["24465545157484151884327852955","24464212374066981024784143317"],["24565378580138637762796558984","24562538993824492797853638614"],["25092528824595197397176121855","25078629219416364864744585030"],["25093616549886910550355176413","5289180889648949474454646749"],["33667925207106610381286222239","33661372861897819661519338243"],["33670171557053867524314228302","32986876762679071580099294672"],["34794929698883366870749147983","20892488738142505932371120903"],["35841426694045589806281998536","33152196556963060146450961883"],["42868403920068424188003868394","23713260186663800241665037912"],["44529310309295720972017932907","44522850956887309621927122826"],["44539668989925187433937343028","40669303788242577208384907177"],["44883603621170399669764368257","4877085731487523928875034655"],["47391480384693709451492479198","17815499706001225814716744143"],["61110762524547706644665682197","58689843052186738055120589977"],["61259221102732194486259439472","25111391545539211705435326130"],["66230118875314224330980821846","30811537283065006378921808244"],["70922522975615427228805540431","-12120790422655370259430516815"],["71486626985737594733692475733","10007583246751205646534845765"],["72062463808588971140115294315","72059262119267624986589868283"],["72088226660388540656700905773","25295221651216788660525820879"],["73913811221786728574570284373","68453996644583945973371332640"],["74945974899585113611928851238","38750199968703049500273898021"],["76742154089309978340040756242","73038309354179833610960325944"],["77066986056875202742454184327","77056527234597839562409033817"],["77103102360321843525990451444","-11758463765903183231895678992"],["77503882289783776023258175133","46455043253984453400060966023"],["81138476139304314925896238649","81124840223232275104631744537"],["81146451594379210807259719168","81125493947164165461978949452"],["81148732984014957301511781552","81148127893239314140542388233"],["81188699465748373462330568797","81114178126167292807596843963"],["81992698536860372148000781467","53557153221360139814600524469"],["83558597358654766865875276292","76649799684196299638349028459"],["85097052431071249597923125170","29843656989123793354374916253"],["89715473851538266370092236022","89710397551124764793551543407"],["90586156448967492653112442894","32355446404323480266435059289"],["99742905281218267828708230127","48424259824071777726518166499"],["105182820348587706353507597356","105182368948065871796731166206"],["105195122837011042370809549182","72556217016624161706013951462"],["106402291357719247695873130601","64271593425191702875220469034"],["113262929115541217699971843681","85420607373489165934433554179"],["114210517724830389887280315419","37527190186129327107609981091"],["114339332696320234425726228872","33333024213656558312408692628"],["117639049443462930264521929828","13106058385981255749850207669"],["121941692738149426127532186477","121939280053457148824709353590"],["121984313363057636514943162315","17252490081463356644851704339"],["122577674933809288658133348345","28549177289260360316608716923"],["123298317519163427973451175684","37332622639327222660564403686"],["129390715809982232033479287646","95011900418697076324606637360"],["132203267459733234400673122198","46798886885778464455724272053"],["142997967168154175409239383013","-37222209203332118450812155308"],["145405458806856939562021045072","39276088127526018705737734342"],["148766362996930174499867665167","111782086963834386229331004687"],["151959303747828901272082649054","151953548613134114757858153534"],["151961715147356234357320690119","19830463549640568068481689296"],["170243647482100464979522323030","52604510503353503781932281902"],["174241023802434360720213029833","16341322697510324524182193939"],["175603131216313970836144001083","-8286879333236572886769400005"],["180959507426049849374753442953","38142439154216254957890098262"],["202230959947084831038389381559","-4434604150160921872168965345"]],"zero_count":1048506},"bins":[{"clean_upper":false,"lower":"1/1000","nonempty_contraction":false,"sample_count":0,"target_lower_count":0,"target_upper_count":null,"upper":"1/500"},{"clean_upper":false,"lower":"1/500","nonempty_contraction":false,"sample_count":0,"target_lower_count":0,"target_upper_count":null,"upper":"1/250"},{"clean_upper":true,"lower":"1/250","nonempty_contraction":false,"sample_count":0,"target_lower_count":0,"target_upper_count":1,"upper":"1/125"},{"clean_upper":true,"lower":"1/125","nonempty_contraction":true,"sample_count":1,"target_lower_count":0,"target_upper_count":1,"upper":"2/125"},{"clean_upper":true,"lower":"2/125","nonempty_contraction":true,"sample_count":1,"target_lower_count":0,"target_upper_count":2,"upper":"4/125"},{"clean_upper":true,"lower":"4/125","nonempty_contraction":true,"sample_count":5,"target_lower_count":4,"target_upper_count":6,"upper":"8/125"},{"clean_upper":true,"lower":"8/125","nonempty_contraction":true,"sample_count":3,"target_lower_count":3,"target_upper_count":3,"upper":"16/125"},{"clean_upper":true,"lower":"16/125","nonempty_contraction":true,"sample_count":5,"target_lower_count":5,"target_upper_count":5,"upper":"32/125"}],"computed_barcode_error":"0","finite_polynomial_diagram_bound":"665473173472810196317045055624393869657279516680804628048808122397019836469590187643850197457025387056734910895985785064585440724942132613915359133544554422505902608754010903814479448184410923565832007/627057063764139831929324851379409869378845668175598843037877190478889006888518431438644711527536922839520331484815861906173161536477065546885468336421475511783984145060592245840032548652210559519683510272","finite_polynomial_diagram_bound_decimal_up":"0.001061264136756651120320","fixed_point_scale":"79228162514264337593543950336","gaussian_law_certified":false,"grid":1024,"historical_fft_certified":false,"independent_connectivity_check":true,"infinite_field_certified":false,"lifetime_law_certified":false,"sample_count":1048576,"sample_sha256":"f549a5db7215213ff36b4704da4aef5b37472ae2dd3371d77ff38fe8a8d4d410","schema_version":1,"scope":"Exact periodic vertex-cubical H0 barcode of the C38 dyadic grid and deterministic bin bounds for its one frozen finite polynomial. No historical FFT, ideal Gaussian ensemble, infinite-field, lifetime-law or held-out confirmation certificate.","seed":34000,"upstream_sha256":"c46cfc061465b951968f675270b649cd6b61c1dc4989635a1c3c7a3f7a564519"} diff --git a/experiments/periodic_h0/results/exact_h0_1/RESULTS.md b/experiments/periodic_h0/results/exact_h0_1/RESULTS.md new file mode 100644 index 000000000..0a3df629d --- /dev/null +++ b/experiments/periodic_h0/results/exact_h0_1/RESULTS.md @@ -0,0 +1,35 @@ +# Exact barcode and certified finite-field counts + +One frozen finite polynomial (seed label 34000), on the C38 **1024² exact dyadic grid**. + +The integer-only sweep gives **69 positive finite H₀ bars** and one essential class. +A separate plateau and breadth-first connectivity check verifies the birth and death witnesses. +Zero-lifetime pairs are omitted; the longest finite interval is retained. + +The barcode endpoints have **zero arithmetic error** relative to these exact samples. The diagram bound +against the frozen smooth finite polynomial is at most **0.001061264136756651120320** +(the unchanged C38 interpolation/stability bound). + +| Lifetime bin | Exact grid count | Smooth finite-field lower bound | Smooth finite-field upper bound | +|---|---:|---:|---:| +| [1/1000, 1/500) | 0 | 0 | not bounded by this argument | +| [1/500, 1/250) | 0 | 0 | not bounded by this argument | +| [1/250, 1/125) | 0 | 0 | 1 | +| [1/125, 2/125) | 1 | 0 | 1 | +| [2/125, 4/125) | 1 | 0 | 2 | +| [4/125, 8/125) | 5 | 4 | 6 | +| [8/125, 16/125) | 3 | 3 | 3 | +| [16/125, 32/125) | 5 | 5 | 5 | + +Bounds use contracted and expanded bins with exact rational endpoints. +They are counts for one deterministic smooth finite field, not expected intensities, +a Gaussian-law fit, a tail enclosure, a remainder estimate or a held-out test. + +[Algorithm and proof](../../EXACT_H0.md) · [Exact endpoints and counts](CERTIFICATE.json) +· [Source and execution receipt](RUN.json) · [C38 spatial bound](../hessian1/RESULTS.md) + +```sh +python -B -S experiments/periodic_h0/exact_barcode_certificate.py --verify experiments/periodic_h0/results/exact_h0_1 +``` + +Exact periodic vertex-cubical H0 barcode of the C38 dyadic grid and deterministic bin bounds for its one frozen finite polynomial. No historical FFT, ideal Gaussian ensemble, infinite-field, lifetime-law or held-out confirmation certificate. diff --git a/experiments/periodic_h0/results/exact_h0_1/RUN.json b/experiments/periodic_h0/results/exact_h0_1/RUN.json new file mode 100644 index 000000000..65a1c7ca0 --- /dev/null +++ b/experiments/periodic_h0/results/exact_h0_1/RUN.json @@ -0,0 +1 @@ +{"outputs":{"CERTIFICATE.json":{"bytes":7635,"sha256":"845dc940e1781e570d4a6614a00889f33b239274c00e367dc2af1e3b86906fb8"}},"platform":"macOS-15.7.4-arm64-arm-64bit","python":"3.11.16 (main, Sep 1 2026, 14:08:22) [Clang 22.1.3 ]","schema_version":1,"scope":"Exact periodic vertex-cubical H0 barcode of the C38 dyadic grid and deterministic bin bounds for its one frozen finite polynomial. No historical FFT, ideal Gaussian ensemble, infinite-field, lifetime-law or held-out confirmation certificate.","sources":{"APPROXIMATION.md":{"bytes":17970,"sha256":"dae4e01b35602077442796a1150294cce3eb544f2d0c2297f8fa7aa6ab16caef"},"EXACT_H0.md":{"bytes":14491,"sha256":"a788b46b1ea5640661e2692b84816bb3acfd1bae5a1fd3083dd18d5d8ba19fff"},"FINITE_CERTIFICATE.md":{"bytes":9966,"sha256":"4c9991db82a94725a893526cf310bd84221b7787e704b649a94e161591efa7aa"},"HESSIAN_GRID.md":{"bytes":8683,"sha256":"a6e7053da42e10f7fdf637c66e4948e62136e26e80a2d0d80bde9b822d052225"},"NODAL_CERTIFICATE.md":{"bytes":8477,"sha256":"6b39f935c66a129dc3661f464586912bc034bd46a47a8f96a9a3167c26601940"},"exact_barcode_certificate.py":{"bytes":10590,"sha256":"986da88dd703b4598ebf7782f874854124272ef6dbf67d7deb130972a86a217b"},"exact_h0.py":{"bytes":9089,"sha256":"48ee16f2316cb1a233594ed10466340aa321d553c2b888198fe86b4bd9052970"},"finite_certificate.py":{"bytes":14843,"sha256":"0674a2621dff6c040cbb24cc0b6e6df7847541ebc171ebdb28070afa05e04e6b"},"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/hessian1/CERTIFICATE.json":{"bytes":25301,"sha256":"c46cfc061465b951968f675270b649cd6b61c1dc4989635a1c3c7a3f7a564519"},"results/hessian1/RUN.json":{"bytes":1573,"sha256":"3bea8119b5fc3b8aadf887b439d3032f7d88377771c338db44e320dfc60979e1"},"results/hessian1/RUN.sha256":{"bytes":65,"sha256":"ad4536f2bcfc15863af27f7f26176c30973beb4a87efaee95ca34410a0e7bb4b"}},"utc":"2026-09-30T23:17:33.835050+00:00"} diff --git a/experiments/periodic_h0/results/exact_h0_1/RUN.sha256 b/experiments/periodic_h0/results/exact_h0_1/RUN.sha256 new file mode 100644 index 000000000..4285ced81 --- /dev/null +++ b/experiments/periodic_h0/results/exact_h0_1/RUN.sha256 @@ -0,0 +1 @@ +e51fba013218e746c6845283312cd9ac1e688a8b960e9a2c577a097be5b54c45 diff --git a/experiments/periodic_h0/test_exact_barcode_certificate.py b/experiments/periodic_h0/test_exact_barcode_certificate.py new file mode 100644 index 000000000..c8f824844 --- /dev/null +++ b/experiments/periodic_h0/test_exact_barcode_certificate.py @@ -0,0 +1,70 @@ +"""Custody and promotion controls for the C38 exact-grid barcode successor.""" +import copy +import hashlib +import importlib +import importlib.util +import tempfile +import unittest +from fractions import Fraction as Q +from pathlib import Path +import finite_certificate as fc + + +class ExactBarcodeCertificateTests(unittest.TestCase): + def setUp(self): + self.assertIsNotNone(importlib.util.find_spec('exact_barcode_certificate'), + 'Exact barcode certificate is not implemented') + self.mod = importlib.import_module('exact_barcode_certificate') + + def test_upstream_certificate_is_a_fixed_reviewed_object(self): + # Rebinding an edited bound to a new digest cannot turn it into C38. + upstream = self.mod.load_upstream() + self.assertEqual(upstream['seed'], 34000) + raw = (self.mod.BASE/self.mod.UPSTREAM_CERT).read_bytes() + with tempfile.TemporaryDirectory() as tmp: + path = Path(tmp)/self.mod.UPSTREAM_CERT + path.parent.mkdir(parents=True) + edited = fc.load_json(self.mod.BASE/self.mod.UPSTREAM_CERT) + edited['abstract_diagram_bound'] = '0' + path.write_bytes(fc.canonical_bytes(edited)) + with self.assertRaises(ValueError): self.mod.load_upstream(Path(tmp)) + self.assertEqual(hashlib.sha256(raw).hexdigest(), self.mod.UPSTREAM_SHA256) + + def test_tiny_exact_report_keeps_unbounded_short_bin_and_large_integers(self): + # Hand-derived 3x3 torus: every row/column wraps; two maxima merge at 0. + values = [2**96, 0, 0, 0, 2**95, 0, 0, 0, 0] + result = self.mod.analyze(values, 3, 2**96, Q(1, 1000), [Q(1,1000),Q(1,2),Q(1)]) + self.assertEqual(result['barcode']['intervals'], [[str(2**95), '0']]) + self.assertEqual(result['barcode']['essential'], [str(2**96)]) + self.assertIsNone(result['bins'][0]['target_upper_count']) + self.assertEqual(result['bins'][1]['sample_count'], 1) + self.assertEqual(result['bins'][1]['target_upper_count'], 1) + self.assertEqual(result['bins'][1]['target_lower_count'], 0) + + def test_stored_successor_rejects_rebound_counts_and_claims(self): + # Exercise real publication bytes without rerunning million-node work + # for each mutation: identity validation must reject the output first. + original = self.mod.BASE/'results/exact_h0_1' + if not original.exists(): self.skipTest('Production snapshot generated after implementation') + with tempfile.TemporaryDirectory() as tmp: + target = Path(tmp)/'copy'; target.mkdir() + for name in ('CERTIFICATE.json','RUN.json','RUN.sha256','RESULTS.md'): + (target/name).write_bytes((original/name).read_bytes()) + cert = fc.load_json(target/'CERTIFICATE.json') + for key, value in [('gaussian_law_certified', True), ('upstream_sha256','0'*64), + ('computed_barcode_error','1/100'), ('infinite_field_certified',True)]: + altered = copy.deepcopy(cert); altered[key] = value + (target/'CERTIFICATE.json').write_bytes(fc.canonical_bytes(altered)) + with self.subTest(key=key), self.assertRaises(ValueError): + self.mod.validate_directory(target) + (target/'CERTIFICATE.json').write_bytes((original/'CERTIFICATE.json').read_bytes()) + receipt = fc.load_json(target/'RUN.json') + role = next(iter(receipt['sources'])) + receipt['sources'][role]['bytes'] = float(receipt['sources'][role]['bytes']) + raw = fc.canonical_bytes(receipt); (target/'RUN.json').write_bytes(raw) + (target/'RUN.sha256').write_text(hashlib.sha256(raw).hexdigest()+'\n') + with self.assertRaises(ValueError): self.mod.validate_directory(target) + with self.assertRaises(ValueError): self.mod.produce(original) + + +if __name__ == '__main__': unittest.main() diff --git a/experiments/periodic_h0/test_exact_h0.py b/experiments/periodic_h0/test_exact_h0.py new file mode 100644 index 000000000..d5ab63cad --- /dev/null +++ b/experiments/periodic_h0/test_exact_h0.py @@ -0,0 +1,177 @@ +"""Exact graph controls, including an independent all-threshold rank oracle.""" +import copy +import importlib +import importlib.util +import itertools +import random +import unittest +from fractions import Fraction as Q + + +def axis_graph(n): + """Build undirected edges independently of the production neighbor code.""" + graph = [set() for _ in range(n*n)] + for x in range(n): + for y in range(n): + u = x*n+y + for v in (((x+1) % n)*n+y, x*n+(y+1) % n): + graph[u].add(v) + graph[v].add(u) + return graph + + +def component_labels(values, graph, threshold): + labels = [-1]*len(values) + next_label = 0 + for vertex, value in enumerate(values): + if value < threshold or labels[vertex] >= 0: + continue + labels[vertex] = next_label + stack = [vertex] + while stack: + u = stack.pop() + for v in graph[u]: + if values[v] >= threshold and labels[v] < 0: + labels[v] = next_label + stack.append(v) + next_label += 1 + return labels + + +class ExactH0Tests(unittest.TestCase): + def setUp(self): + self.assertIsNotNone(importlib.util.find_spec('exact_h0'), + 'Exact integer H0 engine is not implemented') + self.h0 = importlib.import_module('exact_h0') + + def check_ranks(self, values, n): + result = self.h0.compute(values, n) + graph = axis_graph(n) + thresholds = sorted({max(values)+1, min(values)-1, *values}, reverse=True) + labels = {t: component_labels(values, graph, t) for t in thresholds} + for i, high in enumerate(thresholds): + for low in thresholds[i:]: + # Rank is the number of low components meeting a high vertex. + rank = len({labels[low][v] for v, a in enumerate(values) if a >= high}) + barcode_rank = sum(b >= high and d < low for b, d in result['intervals']) + barcode_rank += sum(b >= high for b in result['essential']) + self.assertEqual(barcode_rank, rank, (values, high, low, result)) + self.assertTrue(self.h0.verify_by_connectivity(values, n, result)) + + def test_unequal_peaks_preserve_elder_and_longest_finite_bar(self): + values = [5, 1, 4, 2, 3, 0]*6 + result = self.h0.compute(values, 6) + self.assertEqual(result, {'intervals': [[3, 2], [4, 1]], + 'birth_vertices': [4, 2], 'essential': [5], + 'essential_vertices': [0], 'zero_count': 33}) + self.check_ranks(values, 6) + + def test_seams_and_diagonals_change_the_observable(self): + # The seam joins the peaks at birth; forgetting it creates [4,0]. + self.assertEqual(self.h0.compute([5, 0, 1, 4]*4, 4)['intervals'], []) + # These opposite square corners are not joined by an axis edge. + values = [0]*16 + values[0] = values[5] = 5 + self.assertEqual(self.h0.compute(values, 4)['intervals'], [[5, 0]]) + self.check_ranks(values, 4) + + def test_plateaus_ties_and_constant_essential(self): + result = self.h0.compute([5, 1, 5, 1]*4, 4) + self.assertEqual(result['intervals'], [[5, 1]]) + self.assertEqual(result['birth_vertices'], [2]) + self.assertEqual(result['essential_vertices'], [0]) + constant = self.h0.compute([-7]*9, 3) + self.assertEqual(constant, {'intervals': [], 'birth_vertices': [], + 'essential': [-7], 'essential_vertices': [0], + 'zero_count': 8}) + self.assertTrue(self.h0.verify_by_connectivity([-7]*9, 3, constant)) + + def test_integer_precision_translation_and_positive_scaling(self): + offset = 1 << 96 + values = [offset+v for v in [5, 1, 4, 2, 3, 0]*6] + result = self.h0.compute(values, 6) + self.assertEqual(result['intervals'], [[offset+3, offset+2], [offset+4, offset+1]]) + self.assertEqual([b-d for b, d in result['intervals']], [1, 3]) + scaled = self.h0.compute([11*v for v in values], 6) + self.assertEqual([b-d for b, d in scaled['intervals']], [11, 33]) + self.assertTrue(self.h0.verify_by_connectivity(values, 6, result)) + + def test_exhaustive_binary_and_seeded_tied_ranks(self): + for values in itertools.product((0, 1), repeat=9): + self.check_ranks(values, 3) + rng = random.Random(3934000) + for n in (3, 4, 5): + for _ in range(25): + self.check_ranks([rng.randrange(-3, 4) for _ in range(n*n)], n) + + def test_connectivity_rejects_missing_shifted_or_misattributed_bars(self): + values = [5, 1, 4, 2, 3, 0]*6 + result = self.h0.compute(values, 6) + mutations = [] + for death in (0, 2): + other = copy.deepcopy(result) + other['intervals'][1][1] = death + mutations.append(other) + other = copy.deepcopy(result) + other['intervals'].pop(); other['birth_vertices'].pop(); other['zero_count'] += 1 + mutations.append(other) + for key, value in [('birth_vertices', [2, 4]), ('essential', [4]), + ('essential_vertices', [2]), ('zero_count', 0), + ('zero_count', True)]: + other = copy.deepcopy(result); other[key] = value; mutations.append(other) + other = copy.deepcopy(result); other['intervals'][0][0] = 3.0; mutations.append(other) + other = copy.deepcopy(result); other['extra'] = True; mutations.append(other) + for other in mutations: + with self.subTest(result=other), self.assertRaises(ValueError): + self.h0.verify_by_connectivity(values, 6, other) + + def test_strict_grid_and_value_types_reject_bool_float_and_bad_shape(self): + cases = [([0]*9, True), ([0]*9, 3.0), ([0]*4, 2), ([0]*8, 3), + ([0]*8+[True], 3), ([0]*8+[Q(1)], 3), ([0]*8+[1.0], 3), + ('0'*9, 3), (iter([0]*9), 3)] + for values, n in cases: + with self.subTest(n=n), self.assertRaises(ValueError): + self.h0.compute(values, n) + + +class BinTransferTests(unittest.TestCase): + def setUp(self): + self.assertIsNotNone(importlib.util.find_spec('exact_h0'), + 'Exact integer H0 engine is not implemented') + self.h0 = importlib.import_module('exact_h0') + + def test_exact_half_open_boundaries_and_diagonal_equalities(self): + # The diagram is synthetic: no grid provenance is asserted by this utility. + diagram = {'intervals': [[2, 0], [3, 0], [4, 0], [5, 0], [6, 0]], + 'birth_vertices': [0, 1, 2, 3, 4], 'essential': [7], + 'essential_vertices': [5], 'zero_count': 0} + rows = self.h0.bin_transfer(diagram, 10, Q(1, 20), [Q(1, 10), Q(1, 5), Q(2, 5), Q(3, 5)]) + self.assertEqual([r['sample_count'] for r in rows], [0, 2, 2]) + self.assertEqual([r['target_lower_count'] for r in rows], [0, 0, 0]) + self.assertEqual([r['target_upper_count'] for r in rows], [None, 3, 4]) + self.assertEqual([r['clean_upper'] for r in rows], [False, True, True]) + self.assertEqual([r['nonempty_contraction'] for r in rows], [False, False, False]) + self.assertEqual(rows[0]['lower'], Q(1, 10)) + exact = self.h0.bin_transfer(diagram, 10, Q(0), [Q(1, 5), Q(2, 5), Q(3, 5)]) + self.assertEqual([(r['target_lower_count'], r['target_upper_count']) for r in exact], [(2, 2), (2, 2)]) + + def test_transfer_rejects_inexact_inputs_and_zero_or_inverted_bars(self): + result = self.h0.compute([0]*9, 3) + for scale, error, edges in [(True, Q(0), [Q(1), Q(2)]), + (0, Q(0), [Q(1), Q(2)]), + (1, 0.0, [Q(1), Q(2)]), + (1, Q(-1), [Q(1), Q(2)]), + (1, Q(0), [1, 2]), + (1, Q(0), [Q(0), Q(2)]), + (1, Q(0), [Q(2), Q(1)])]: + with self.subTest(scale=scale, error=error, edges=edges), self.assertRaises(ValueError): + self.h0.bin_transfer(result, scale, error, edges) + for pair in ([0, 0], [0, 1], [True, 0]): + other = copy.deepcopy(result) + other['intervals'] = [pair]; other['birth_vertices'] = [1] + with self.assertRaises(ValueError): + self.h0.bin_transfer(other, 1, Q(0), [Q(1), Q(2)]) + + +if __name__ == '__main__': + unittest.main()