diff --git a/registers/CONSUMERS.json b/registers/CONSUMERS.json index 38a4330cd..75f224666 100644 --- a/registers/CONSUMERS.json +++ b/registers/CONSUMERS.json @@ -433,6 +433,7 @@ "governance/GIT_ADAPTATION.md", "governance/README.md", "reviews/SCHEMA.md", + "reviews/independent/h3_20260921/README.md", "reviews/records/REV-P15-A.md" ] }, diff --git a/reviews/independent/h3_20260921/PENDING_REV-H3-SOLVER-20260921.json b/reviews/independent/h3_20260921/PENDING_REV-H3-SOLVER-20260921.json new file mode 100644 index 000000000..e9d7533e3 --- /dev/null +++ b/reviews/independent/h3_20260921/PENDING_REV-H3-SOLVER-20260921.json @@ -0,0 +1,114 @@ +{ + "schema_version": "1.0.0", + "review_id": "REV-H3-SOLVER-20260921", + "route_key": "RV-H3-SOLVER-20260921-01", + "review_utc": "2026-09-22T00:05:00Z", + "object_id": "engine/solver_pilots/h3_20260921/PROOF.md @ 2371f660d90963e558a0d08921c634a36b3be016", + "object_title": "H3 scalar optimization: a whole-band lower coefficient of 1747/1000", + "object_bytes": 8469, + "object_sha256": "0d5fc5ece05df2f5717e0c8fc61c041b8663997933e8ec92c58c8cdf4b4f192d", + "extraction_rule": "git blob read at commit 2371f660d90963e558a0d08921c634a36b3be016 via `git show :`, no re-encoding, no normalization; byte count and SHA-256 taken on the extracted bytes. The Drive copy of the sibling module h3_scalar_arithmetic.py (file id 1Df7rISYgD9ja3zatyj9vlMwMrrfJehhM) was downloaded and hashed separately to confirm the Drive and git bodies are the same bytes.", + "obtained": true, + "obtained_how": "Cloned repository checkout at the candidate commit; PROOF.md, h3_scalar_arithmetic.py and h3_scalar_certificate.py read in full from the working tree, and the corresponding Drive object downloaded through the Drive integration for an independent byte comparison.", + "reviewer_family": "anthropic", + "reviewer_session": "claude-code session_01Fij9F1cYrAUDW7PhWQze1G, branch claude/github-chatgpt-xxw5kp", + "author_family": "openai", + "author_family_determination": "Branch namespace chatgpt/h3-solver-pilot-20260921 and the authorship of PR #5 and its handoff comments; the object's own header describes it as an author-side proved candidate produced by that lineage.", + "exposure_disclosure": "Before beginning I had read the PR #5 body, both handoff comments on PR #3, the PR #5 delivery comment, CLAUDE.md, reviews/README.md and reviews/SCHEMA.md, and then the complete text of PROOF.md, h3_scalar_arithmetic.py and h3_scalar_certificate.py at the candidate commit. I had not seen the Drive delivery report, the machine report, the 31-entry portable package, or the frozen source proof b48d8baa39b80be9a15af9833234d9339ea0afa4cdff2e1c60ae9ef79f5cb4fa, and I did not verify the source archive hash 73b9e63800f77c677c504f3097fe0bb2459ff6c94cdee5772b56062320aefc21; the declared source identity is taken on trust and is listed below as an unresolved dependency. The specific bias risk I carry is that I read the author's certificate implementation before writing my own reconstruction, which makes convergent structure less informative than it would otherwise be. I compensated by adding a check aimed at the quantity rather than the arithmetic: direct sampling of the conditional law, whose construction depends on the geometry description and not on the author's code path.", + "hypotheses": [ + "The field is the centered stationary Gaussian field with covariance K(x,y)=k(x)k(y) for the normalized periodized SIDE24 kernel k.", + "The two points are the fixed x-axis pair M=(-r/2,0) and S=(r/2,0), with no rotation and no all-angle quantifier.", + "Conditioning is the canonical six-pin Gaussian law: f(M)=6/5, f(S)=6/5-r^3/6, and both gradients zero.", + "Z(r) is the conditional expectation of |det H_M det H_S| times the indicator that M is a maximum and S is a saddle.", + "The radius band is 0 (3/80)I and the transport budget gives sqrt(c^T G(r) c) >= sqrt(c^T G(0) c) (1 - delta) with delta = (31/20)R/(193/1000). That is a multiplicative Loewner statement, G(r) >= (1-delta)^2 G(0) as quadratic forms, so G(r)^-1 <= G(0)^-1/(1-delta)^2 and Q(r) <= Q(0)/(1-delta)^2 = Q*. I recomputed each ingredient from independently derived moments: the six-term transport budget is 2.40063476562 against (31/20)^2 = 2.4025; Q(0) = 36 m4/[25(m4-m2^2)] + 4 m2/(m2 m6 - m4^2) = 2.82666666667 against 17/6, which is the correct two-block quadratic form for v = (6/5,0,0,0,0,-1/6); (193/1000)^2 < 3/80; and Q* = 1266466/160083 = 7.91130850871 < 8. Section 2 uses the separability and parity of the kernel to split the line processes X, Y and E = f_yy + m2 f, which are mutually independent; the pins fix X and Y and leave E alone, and since f(M) and f(S) are pinned the transverse entries q_M and q_S are pure E-sector quantities. Peano kernels of mass 1/12 bound each axial residual variance by r^2 m8/144, and the regression bound on the conditional mean gives the stated two-tail floor for P(A). Section 3 splits the transverse pair into midpoint and difference, which are uncorrelated hence independent Gaussians, and interval-evaluates the positive-part moments of T = (-Qbar - d)_+ across the whole parameter box. Section 4 bounds the typed integrand pointwise below by 1_A 1_D a T (a T - r B_M^2)_+, drops the positive part using x_+ >= x, and factorizes using the sector independence, giving Z(r)/r^2 >= P(A) P(D) [a^2 M_2 - a r beta M_1]. Taking M_2 low, M_1 high and r = R in the negative term is conservative in the correct direction, and the implementation checks the bracket is positive before the probability lower bounds multiply it.", + "negative_controls_executed": [ + { + "control": "Reimplemented the entire section 1 to 4 chain in mpmath at 120 dps from the prose alone, importing nothing from engine/solver_pilots, and compared the endpoint against the author-side rational enclosure.", + "would_have_caught": "A transcription error, a dropped factor, or a step present in the certificate code but absent from or contradicted by the written argument.", + "fired": false, + "detail": "Independent value 1.7472485483566 lies inside the stated enclosure [1.747106129274, 1.747994749902] and above 1747/1000." + }, + { + "control": "Sampled the conditional law directly through the sector decomposition, forming conditional moments in mpmath and drawing 8e6 samples, to estimate the true Z(r)/r^2 at r=1/20 rather than to re-derive the bound.", + "would_have_caught": "A misread of the geometry or conditioning, or a claimed inequality that is simply false for the quantity it names, neither of which reproducing the author's arithmetic could detect.", + "fired": false, + "detail": "Estimate 3.224 +/- 0.005 at three sigma, typed-event rate 0.7938; no counterexample at this radius, and the roughly 1.85x gap matches the event and truncation losses the argument takes." + }, + { + "control": "Compared the sampled conditional second moments against each majorant the proof relies on.", + "would_have_caught": "A majorant stated on the wrong side, which would invalidate the bound while leaving the arithmetic self-consistent.", + "fired": false, + "detail": "Conditional sd(A_M)=0.0204 <= s(R)=0.0427; |E[R_M|pins]|=0.0146 <= sqrt(Q*)s(R)=0.120; Var(B_M)=0.4998 <= beta=3/4; Var(Qbar)=1.99875 at the low end of [1.99875, 2]." + }, + { + "control": "Audited h3_scalar_arithmetic.py for enclosure soundness: outward 2^-256 rounding, isqrt-bracketed roots, alternating-series remainders and the monotonicity domain they require, monotone CDF endpoints, the even-power branch of pdf on a straddling interval, and the refusal domains.", + "would_have_caught": "An unsound rounding direction or a series remainder claimed outside the range where its monotonicity argument holds, either of which would void every enclosure built on it.", + "fired": false + }, + { + "control": "Recomputed the periodization tail argument and the normalized moments from the kernel definition, independently of the author's Hermite envelope code.", + "would_have_caught": "An understated image tail or a moment perturbation larger than claimed.", + "fired": false, + "detail": "Deviations from (1,3,15,105) are below 1e-114, consistent with the stated 1e-100 budget." + }, + { + "control": "Downloaded the Drive copy of the sibling module and compared bytes against the git blob.", + "would_have_caught": "A reviewed object that differs from the delivered object, or a title match standing in for an identity match.", + "fired": false, + "detail": "Both 5312 bytes, sha256 c0dc51bb27a8de1dbc7c6102d36cf4f685c202e6317b62dce82c291be4ecb8b2." + } + ], + "execution_performed": "Ran the object's own suite at the candidate commit: 57 tests pass in normal mode and 57 under python3 -O, no skips, about 20.4s each. Ran the full repository suite at this head and at each other head in the stack. Executed both reviewer cross-check scripts in reviews/independent/h3_20260921/.", + "findings": [ + { + "criterion": "exact object correctness", + "severity": "INFO", + "statement": "The section 1 to 4 chain reproduces independently and the stated enclosure contains the independently computed endpoint; no soundness defect was found in the rational interval module.", + "evidence": "reviews/independent/h3_20260921/reconstruct_bound.py" + }, + { + "criterion": "margin", + "severity": "MINOR", + "statement": "The certified margin is thin: the enclosure's lower endpoint exceeds 1747/1000 by 1.06e-4 while the enclosure itself is 8.9e-4 wide, so the headline coefficient sits near the edge of what this parameter choice certifies under this interval implementation.", + "evidence": "Independent point value 1.74724855 leaves 2.49e-4." + }, + { + "criterion": "transport budget", + "severity": "MINOR", + "statement": "The six-term transport budget clears its 31/20 rounding by about 0.08 percent, so a future change to any coefficient would break section 1 before anything downstream registered it.", + "evidence": "2.400634766 against 2.4025." + }, + { + "criterion": "scope discipline", + "severity": "INFO", + "statement": "The declared limits match what the arithmetic supports, and the load-bearing statement that the interval encloses the sufficient-bound formula rather than the true value of Z(r)/r^2 is made in both the prose and the implementation's limits list.", + "evidence": "PROOF.md section 4 and the limits list in prove()." + } + ], + "unresolved_dependencies": [ + "Frozen source proof b48d8baa39b80be9a15af9833234d9339ea0afa4cdff2e1c60ae9ef79f5cb4fa, not read by this reviewer.", + "Source archive 73b9e63800f77c677c504f3097fe0bb2459ff6c94cdee5772b56062320aefc21, not verified by this reviewer.", + "The imported fixed-axis H3 argument that this work extends, which is taken as given.", + "A second rigorous implementation, and an Arb run, neither of which has been performed.", + "The organizationally distinct reviewer that the independence-requiring predicate calls for, which remains OPEN.", + "All-angle, 3D, full-annulus, elder-selection, q0 and prize obligations, none of which this object addresses." + ], + "technical_verdict": "PASS_TECHNICAL", + "scope_dependency_verdict": "The statement's declared scope (fixed x-axis, b=6/5, gap r^3/6, canonical six-pin law, 0 \ + --schema reviews/review_record.schema.json \ + --queue registers/json/review_queue.json +PROBLEM REV-H3-SOLVER-20260921.json: route_key 'RV-H3-SOLVER-20260921-01' is not + a Review key in registers/json/review_queue.json +reviews_check: 1 record(s), 1 problem(s). +``` + +One problem, and it is the register's staleness rather than the record's form: +schema, the anti-boilerplate floors on `exposure_disclosure` and +`does_not_establish`, the promotion-language and confidence-voting scans, the +independence rules and the gate rule all pass. Once the register export is +refreshed from its source, this file moves to +`reviews/records/REV-H3-SOLVER-20260921.json` unchanged. + +Both guard their imports: `mpmath` and `numpy` are not guaranteed present, and +each script exits 0 with a message when its dependency is missing. + +## What was observed + +`reconstruct_bound.py` reproduces the four section-1 inequalities +(`transport^2 = 2.40063476562 < 2.4025`, `Q(0) = 2.82666666667 < 17/6`, +`(193/1000)^2 < 3/80`, `Q* = 7.91130850871 < 8`) and arrives at +`1.7472485483566`, inside the author-side enclosure +`[1.747106129274, 1.747994749902]` and above `1747/1000` by `2.49e-4`. + +`sample_true_value.py` estimates the true `Z(r)/r^2` at `r=1/20` as +`3.224 +/- 0.005` (3 sigma, 8e6 samples, typed-event rate `0.7938`), roughly +`1.85x` the candidate coefficient — the margin the proof's event and +positive-part truncation losses would predict. + +## What these scripts do not establish + +They are mpmath and float paths. CLAUDE.md rule 3 names both a high-precision +computation and a Monte Carlo estimate as things that are not certificates, and +that is exactly what these are. Agreement between two implementations is +evidence that both read the same prose the same way; it is not evidence that +the prose is correct, and the sampling found no counterexample at one radius +rather than showing there is none. Neither script bounds anything, verifies a +register, reclassifies a claim, or supplies the organizationally distinct +reviewer any independence-requiring predicate still calls for. The sharper +fixed-radius RN floor `0.0077592917375327855` is untouched by both, and the +pilot they cross-check is NOT DEPLOYED. diff --git a/reviews/independent/h3_20260921/reconstruct_bound.py b/reviews/independent/h3_20260921/reconstruct_bound.py new file mode 100644 index 000000000..17e5cc5da --- /dev/null +++ b/reviews/independent/h3_20260921/reconstruct_bound.py @@ -0,0 +1,140 @@ +"""Independent reconstruction of the H3 scalar sufficient bound. NON-CERTIFYING. + +Rebuilds the numeric chain of `engine/solver_pilots/h3_20260921/PROOF.md` +(sections 1-4) from the prose alone, in mpmath floating point, importing +nothing from `engine/solver_pilots/`. Its purpose is to answer one question: +does an independently written implementation land inside the enclosure the +author-side rational certificate reports? + +WHAT THIS DOES NOT ESTABLISH. This is mpmath arithmetic at finite precision, +so under CLAUDE.md rule 3 it is NON-CERTIFYING and is not a certificate, not a +replacement for the rational certificate in `h3_scalar_certificate.py`, and not +a bound of any kind. Agreement here is evidence that two implementations read +the same prose the same way; it is not evidence that the prose is correct. +It verifies no register, moves no gate, discharges no premise and awards zero +organizational independence credit. The pilot it cross-checks is NOT DEPLOYED +and no scientific status depends on this file. + +Run: python3 reviews/independent/h3_20260921/reconstruct_bound.py +""" +from __future__ import annotations + +import sys + +try: + from mpmath import mp, mpf, sqrt, exp, pi, erfc, nsum, inf +except ImportError: # pragma: no cover - mpmath is not a guaranteed dependency + print("reconstruct_bound: mpmath absent; NON-CERTIFYING cross-check skipped.") + sys.exit(0) + +mp.dps = 120 + +R = mpf(1) / 20 +EPSILON = mpf(103) / 500 +GAP_HALF = mpf(9) / 100 +TARGET = mpf(1747) / 1000 + + +def he(n, x): + """Probabilists' Hermite He_n(x).""" + p, q = mpf(1), x + if n == 0: + return p + for k in range(1, n): + p, q = q, x * q - k * p + return q + + +def moments(): + """m_{2n} = (-1)^n k^{(2n)}(0) for the periodized SIDE24 kernel.""" + norm = nsum(lambda j: exp(-((24 * j) ** 2) / 2), [-inf, inf]) + out = {} + for n2 in (2, 4, 6, 8): + num = nsum(lambda j: he(n2, 24 * j) * exp(-((24 * j) ** 2) / 2), [-inf, inf]) + out[n2] = (-1) ** (n2 // 2) * num / norm + return out + + +def normal(): + return (lambda x: erfc(-x / sqrt(2)) / 2, + lambda x: erfc(x / sqrt(2)) / 2, + lambda x: exp(-x ** 2 / 2) / sqrt(2 * pi)) + + +def reconstruct(): + cdf, sf, pdf = normal() + m = moments() + m2, m4, m6, m8 = m[2], m[4], m[6], m[8] + sigma_e2 = m4 - m2 ** 2 + beta = m4 * m2 / 4 + a = 1 - EPSILON + + checks = [] + + # Section 1: transport budget and the uniform pin-energy bound Q*. + transport2 = (m2 / 4 + m4 / 4 + m2 ** 2 / 4 + + m6 / 16 + m4 * m2 / 16 + m8 / 4096) + checks.append(("transport^2 < (31/20)^2", transport2 < (mpf(31) / 20) ** 2, transport2)) + q_zero = mpf(36) / 25 * m4 / (m4 - m2 ** 2) + 4 * m2 / (m2 * m6 - m4 ** 2) + checks.append(("Q(0) < 17/6", q_zero < mpf(17) / 6, q_zero)) + checks.append(("(193/1000)^2 < 3/80", (mpf(193) / 1000) ** 2 < mpf(3) / 80, + (mpf(193) / 1000) ** 2)) + gap = 1 - (mpf(31) / 20) * R / (mpf(193) / 1000) + q_star = (mpf(17) / 6) / gap ** 2 + checks.append(("Q* < 8", q_star < 8, q_star)) + + # Section 2: axial event. + axial = EPSILON / (R * sqrt(m8) / 12) - sqrt(q_star) + p_axial = 1 - 2 * sf(axial) + + # Section 3: transverse event and positive-part moments over the whole band. + delta = (2 * GAP_HALF - m2 * R ** 3 / 6) / (R * sqrt(sigma_e2 * m2)) + p_delta = 1 - 2 * sf(delta) + + def positive_part(mu, var): + sd = sqrt(var) + t = mu / sd + return sd * pdf(t) + mu * cdf(t), (var + mu ** 2) * cdf(t) + mu * sd * pdf(t) + + corners = [(mu, var) + for mu in (m2 * (mpf(6) / 5 - R ** 3 / 12) - GAP_HALF, + m2 * mpf(6) / 5 - GAP_HALF) + for var in (sigma_e2 * (1 - m2 * R ** 2 / 4), sigma_e2)] + m1_hi = max(positive_part(*c)[0] for c in corners) + m2_lo = min(positive_part(*c)[1] for c in corners) + + # Section 4: typed determinant bracket, negative term at r = R. + bracket = a * a * m2_lo - a * R * beta * m1_hi + lower = p_axial * p_delta * bracket + return checks, {"Q*": q_star, "p_axial": p_axial, "p_delta": p_delta, + "M1_hi": m1_hi, "M2_lo": m2_lo, "bracket": bracket, + "lower": lower} + + +def main(): + checks, v = reconstruct() + problems = 0 + for name, ok, value in checks: + if not ok: + problems += 1 + print(f" [{'ok' if ok else 'FAIL'}] {name:24s} value={mp.nstr(value, 12)}") + for key in ("Q*", "p_axial", "p_delta", "M1_hi", "M2_lo", "bracket", "lower"): + print(f" {key:9s} = {mp.nstr(v[key], 14)}") + # The author-side rational enclosure this reconstruction is compared against. + enclosure = (mpf("1.747106129274"), mpf("1.747994749902")) + inside = enclosure[0] <= v["lower"] <= enclosure[1] + above = v["lower"] > TARGET + if not inside: + problems += 1 + if not above: + problems += 1 + print(f" inside author-side enclosure {enclosure}: {inside}") + print(f" exceeds 1747/1000: {above} (margin {mp.nstr(v['lower'] - TARGET, 6)})") + print(f"reconstruct_bound: problems={problems}") + print("NON-CERTIFYING mpmath cross-check. No certificate, no status change, " + "no independence credit.") + return 1 if problems else 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/reviews/independent/h3_20260921/sample_true_value.py b/reviews/independent/h3_20260921/sample_true_value.py new file mode 100644 index 000000000..c4c894dbe --- /dev/null +++ b/reviews/independent/h3_20260921/sample_true_value.py @@ -0,0 +1,148 @@ +"""Float Monte Carlo of the true Z(r)/r^2 at r=1/20. NON-CERTIFYING. + +Samples the conditional law described in `engine/solver_pilots/h3_20260921/PROOF.md` +directly, via the sector decomposition the proof itself uses (X = f(x,0), +Y = f_y(x,0), E = f_yy(x,0) + m2 f(x,0) mutually independent), and reports the +sample mean of the typed integrand. It exists to answer a different question +from `reconstruct_bound.py`: not "is the arithmetic reproducible" but "is the +claimed inequality consistent with the quantity it is about". + +The conditional means and covariances are formed in mpmath and only then cast +to float for sampling, because the X-sector conditional covariance is nearly +degenerate at small r. + +WHAT THIS DOES NOT ESTABLISH. A Monte Carlo estimate is explicitly named in +CLAUDE.md rule 3 as NOT a certificate, and this path is float throughout, so it +is NON-CERTIFYING in both respects. A sample mean above the candidate +coefficient is not a proof of the candidate, and could not become one by adding +samples; it only means no counterexample to the claimed inequality was found at +the sampled radius. It bounds nothing, verifies no register, moves no gate, +discharges no premise and awards zero organizational independence credit. The +pilot it cross-checks is NOT DEPLOYED. + +Run: python3 reviews/independent/h3_20260921/sample_true_value.py +""" +from __future__ import annotations + +import sys + +try: + from mpmath import mp, mpf, exp, matrix, lu_solve + import numpy as np +except ImportError: # pragma: no cover - neither dependency is guaranteed + print("sample_true_value: mpmath/numpy absent; NON-CERTIFYING sampling skipped.") + sys.exit(0) + +mp.dps = 60 + +R = mpf(1) / 20 +BATCHES = 8 +PER_BATCH = 1_000_000 +SEED = 20260921 +CANDIDATE = 1.747 + + +def he(n, x): + p, q = mpf(1), x + if n == 0: + return p + for k in range(1, n): + p, q = q, x * q - k * p + return q + + +def kd(n, s): + """n-th derivative of k(s) = exp(-s^2/2); the |j|>=1 images are below 1e-120.""" + return (-1) ** n * he(n, s) * exp(-s ** 2 / 2) + + +def conditional(sigma, observed_idx, target_idx, observed): + """Gaussian conditional mean and covariance of target given observed.""" + n_obs, n_tar = len(observed_idx), len(target_idx) + a = matrix(n_obs, n_obs) + for i, p in enumerate(observed_idx): + for j, q in enumerate(observed_idx): + a[i, j] = sigma[p][q] + b = matrix(n_tar, n_obs) + for i, p in enumerate(target_idx): + for j, q in enumerate(observed_idx): + b[i, j] = sigma[p][q] + c = matrix(n_tar, n_tar) + for i, p in enumerate(target_idx): + for j, q in enumerate(target_idx): + c[i, j] = sigma[p][q] + w = matrix(n_tar, n_obs) + for i in range(n_tar): + row = lu_solve(a.T, matrix([b[i, j] for j in range(n_obs)])) + for j in range(n_obs): + w[i, j] = row[j] + return w * matrix(observed), c - w * b.T + + +def law(r): + """Conditional laws of (f_xx, f_xy, f_yy) at M and S under the six pins.""" + h = r / 2 + m2 = mpf(1) + sigma_e2 = mpf(2) + + # X sector: (X(-h), X(h), X'(-h), X'(h), X''(-h), X''(h)). + pts = [(-h, 0), (h, 0), (-h, 1), (h, 1), (-h, 2), (h, 2)] + sig_x = [[(-1) ** b * kd(a + b, u - v) for (v, b) in pts] for (u, a) in pts] + mu_x, cov_x = conditional(sig_x, [0, 1, 2, 3], [4, 5], + [mpf(6) / 5, mpf(6) / 5 - r ** 3 / 6, 0, 0]) + + # Y sector: (Y(-h), Y(h), Y'(-h), Y'(h)) with covariance m2 * k structure. + pts_y = [(-h, 0), (h, 0), (-h, 1), (h, 1)] + sig_y = [[m2 * (-1) ** b * kd(a + b, u - v) for (v, b) in pts_y] for (u, a) in pts_y] + mu_y, cov_y = conditional(sig_y, [0, 1], [2, 3], [0, 0]) + + # E sector is untouched by the pins; f_yy = E - m2 * (pinned f). + kr = exp(-r ** 2 / 2) + cov_e = [[sigma_e2, sigma_e2 * kr], [sigma_e2 * kr, sigma_e2]] + shift = [m2 * mpf(6) / 5, m2 * (mpf(6) / 5 - r ** 3 / 6)] + return mu_x, cov_x, mu_y, cov_y, cov_e, shift + + +def factor(cov): + w, v = np.linalg.eigh(cov) + return v * np.sqrt(np.clip(w, 0, None)) + + +def main(): + mu_x, cov_x, mu_y, cov_y, cov_e, shift = law(R) + to_m = lambda m: np.array([[float(m[i, j]) for j in range(2)] for i in range(2)]) + to_l = lambda m: np.array([float(m[i]) for i in range(2)]) + lx, ly = factor(to_m(cov_x)), factor(to_m(cov_y)) + le = factor(np.array([[float(cov_e[i][j]) for j in range(2)] for i in range(2)])) + mx, sh = to_l(mu_x), np.array([float(s) for s in shift]) + r = float(R) + + rng = np.random.default_rng(SEED) + total = sq = 0.0 + n = typed_n = 0 + for _ in range(BATCHES): + fxx = mx + rng.standard_normal((PER_BATCH, 2)) @ lx.T + fxy = rng.standard_normal((PER_BATCH, 2)) @ ly.T + fyy = rng.standard_normal((PER_BATCH, 2)) @ le.T - sh + det_m = fxx[:, 0] * fyy[:, 0] - fxy[:, 0] ** 2 + det_s = fxx[:, 1] * fyy[:, 1] - fxy[:, 1] ** 2 + typed = (det_m > 0) & (fxx[:, 0] + fyy[:, 0] < 0) & (det_s < 0) + val = np.where(typed, np.abs(det_m * det_s), 0.0) / r ** 2 + total += val.sum() + sq += (val ** 2).sum() + n += PER_BATCH + typed_n += int(typed.sum()) + + mean = total / n + sd = float(np.sqrt(max(sq / n - mean ** 2, 0.0) / n)) + print(f" samples={n:,} typed_rate={typed_n / n:.6f}") + print(f" sample mean Z(r)/r^2 = {mean:.6f} +/- {3 * sd:.6f} (3 sigma, r=1/20)") + print(f" candidate coefficient = {CANDIDATE}") + print(f" no counterexample at this radius: {mean - 3 * sd > CANDIDATE}") + print("sample_true_value: NON-CERTIFYING float Monte Carlo. Not a bound, not a " + "certificate, no status change, no independence credit.") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())