{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Cooper relationship-preserving Riemann investigation\n",
        "\n",
        "This notebook calls the **same pure Python kernel** used by the browser worker and CLI. Run beside `kernel.py` in a Python environment with `mpmath==1.3.0`. Every computed result here is exploratory numerical evidence. Nothing here certifies RH, excludes an off-line zero, or proves universal positivity.\n",
        "\n",
        "The conventions are Mellin measure `dx/x`, correlation measure `dy`, reflected partner `1-conj(s)`, and matrix order `K[i,j] = sum G_j(rho) conj(G_i(1-conj(rho)))`.\n"
      ],
      "id": "86570901b8ea"
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {},
      "outputs": [],
      "source": [
        "from kernel import dispatch\n",
        "import json\n"
      ],
      "id": "3e0b6a4ae8f0"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Reproduce the supplied Gaussian probe\n",
        "\n",
        "The log-Gaussian family is rapidly decaying, not compactly supported. The prime-power cutoff is 1000 and the spectral side includes the first 20 computed positive zeros plus their conjugates. The real-place integral has an infinite quadrature endpoint. The code preserves the removable singularity through an analytic stable expression. No error enclosure is claimed.\n"
      ],
      "id": "2cdbcb377699"
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"eigenvalues_of_hermitian_part\": [\n",
            "    \"0.0632252701687658038846113187797096971741653255302124361500033\",\n",
            "    \"15208.4196983507842319668184250621774890163208960398397404546\",\n",
            "    \"139331.289053499164540703715052701137616017334106845042442134\"\n",
            "  ],\n",
            "  \"zero_comparison_max_entry\": \"5.11394013197646555106462506011978673433258809474766065312738e-57\",\n",
            "  \"zero_comparison_frobenius\": \"7.47920216167009185297367580047932869387151356868436039089782e-57\",\n",
            "  \"hermitian_residual_max_entry\": \"3.76290447972607587069055623259017581905096985930139020877953e-57\"\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "probe_inputs = {\"operation\":\"matrix\", \"dps\":60, \"sigma\":\"0.25\", \"frequencies\":[0,14,21], \"centers\":[0,0,0], \"coefficients\":[[1,0],[1,0],[1,0]], \"prime_cutoff\":1000, \"zero_count\":20}\n",
        "probe = dispatch(probe_inputs)\n",
        "print(json.dumps({key:probe[\"result\"][key] for key in [\"eigenvalues_of_hermitian_part\",\"zero_comparison_max_entry\",\"zero_comparison_frobenius\",\"hermitian_residual_max_entry\"]}, indent=2))\n"
      ],
      "id": "03de3f015220"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Compact support and the inverse construction\n",
        "\n",
        "The bump is `B(u)=exp(-1/(1-(u/L)^2))` for `|u|<L` and zero otherwise. Its derivatives vanish at the endpoints. We use `h(e^u)=exp(-u/2-it*u)B(u)` and `g=D(D+1)h`. Direct quadrature checks the two moments, Mellin factorization and the inverse; the support and exact correspondence are established in the accompanying manuscript.\n"
      ],
      "id": "190795cc3eb8"
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"schema_version\": 1,\n",
            "  \"kernel_version\": \"1.0.0\",\n",
            "  \"operation\": \"test_function\",\n",
            "  \"status\": \"numerical evidence\",\n",
            "  \"precision_dps\": 40,\n",
            "  \"backend\": \"mpmath 1.3.0\",\n",
            "  \"inputs\": {\n",
            "    \"operation\": \"test_function\",\n",
            "    \"family\": \"compact\",\n",
            "    \"half_width\": \"0.8\",\n",
            "    \"t\": \"1.3\",\n",
            "    \"x\": \"0.8\",\n",
            "    \"s\": [\n",
            "      \"0.4\",\n",
            "      \"2.1\"\n",
            "    ],\n",
            "    \"dps\": 40\n",
            "  },\n",
            "  \"result\": {\n",
            "    \"family\": \"smooth compact support\",\n",
            "    \"x\": \"0.8\",\n",
            "    \"h\": {\n",
            "      \"re\": \"0.3622312569850873857983127940442422786822\",\n",
            "      \"im\": \"0.1081286089165631035171165897796381006928\"\n",
            "    },\n",
            "    \"g\": {\n",
            "      \"re\": \"-2.008879774804661128004007801409819542509\",\n",
            "      \"im\": \"-1.440702266894127504630282021049035907303\"\n",
            "    },\n",
            "    \"differential_identity_residual\": {\n",
            "      \"re\": \"4.591774807899560578002877098524397178979e-41\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"s\": {\n",
            "      \"re\": \"0.4\",\n",
            "      \"im\": \"2.1\"\n",
            "    },\n",
            "    \"H\": {\n",
            "      \"re\": \"0.3439916114305732286452989357633321076277\",\n",
            "      \"im\": \"-0.002811256943555502702029054008578719640855\"\n",
            "    },\n",
            "    \"G\": {\n",
            "      \"re\": \"-1.600741721068458824335492253983097362718\",\n",
            "      \"im\": \"-0.1314041320133076684665904518807084388736\"\n",
            "    },\n",
            "    \"moments_from_algebra\": {\n",
            "      \"G(0)\": {\n",
            "        \"re\": \"0.0\",\n",
            "        \"im\": \"0.0\"\n",
            "      },\n",
            "      \"G(1)\": {\n",
            "        \"re\": \"0.0\",\n",
            "        \"im\": \"0.0\"\n",
            "      }\n",
            "    },\n",
            "    \"identity\": \"G(s)=s(s-1)H(s)\",\n",
            "    \"support_interval\": [\n",
            "      \"0.4493289641172215914301023850155627959342\",\n",
            "      \"2.225540928492467604579537531395076757054\"\n",
            "    ],\n",
            "    \"direct_Mellin\": {\n",
            "      \"re\": \"-1.600741721068458824335492253983097362718\",\n",
            "      \"im\": \"-0.1314041320133076684665904518807084388736\"\n",
            "    },\n",
            "    \"Mellin_identity_residual\": {\n",
            "      \"re\": \"0.0\",\n",
            "      \"im\": \"2.869859254937225361251798186577748236862e-42\"\n",
            "    },\n",
            "    \"moments_direct_quadrature\": {\n",
            "      \"G(0)\": {\n",
            "        \"re\": \"1.178513903785676231913589762821558371346e-44\",\n",
            "        \"im\": \"1.094764425253763336659163736945246977563e-47\"\n",
            "      },\n",
            "      \"G(1)\": {\n",
            "        \"re\": \"1.178513903785676231913589762821558371346e-44\",\n",
            "        \"im\": \"-2.189528850507526673318327473890493955125e-47\"\n",
            "      }\n",
            "    },\n",
            "    \"inverse_h\": {\n",
            "      \"re\": \"0.3622312569850873857983127940442422786822\",\n",
            "      \"im\": \"0.1081286089165631035171165897796381006928\"\n",
            "    },\n",
            "    \"inverse_residual\": {\n",
            "      \"re\": \"-5.739718509874450722503596373155496473724e-42\",\n",
            "      \"im\": \"-2.869859254937225361251798186577748236862e-42\"\n",
            "    },\n",
            "    \"boundary_regularness\": \"The analytic bump and every derivative vanish at both endpoints; numerical samples are not the proof.\"\n",
            "  },\n",
            "  \"limitations\": [\n",
            "    \"Exploratory arbitrary-precision arithmetic is not interval or ball certification.\",\n",
            "    \"Finite primes, zeros, and basis dimensions do not establish the universal positivity required by RH.\",\n",
            "    \"Higher precision and a small residual alone do not certify the omitted tails.\"\n",
            "  ]\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "compact = dispatch({\"operation\":\"test_function\", \"family\":\"compact\", \"half_width\":\"0.8\", \"t\":\"1.3\", \"x\":\"0.8\", \"s\":[\"0.4\",\"2.1\"], \"dps\":40})\n",
        "print(json.dumps(compact, indent=2))\n"
      ],
      "id": "928ea56dbfa1"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Complex phases and mixed terms\n",
        "\n",
        "Shifting the Gaussian envelopes in log x produces a genuinely complex Hermitian matrix. Changing complex coefficients must retain the mixed contributions. The diagonal-only value is shown explicitly as a different calculation.\n"
      ],
      "id": "010987ae5425"
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"matrix_arithmetic_truncated\": [\n",
            "    [\n",
            "      {\n",
            "        \"re\": \"0.1186677919784891226624665224368864311662\",\n",
            "        \"im\": \"0.0\"\n",
            "      },\n",
            "      {\n",
            "        \"re\": \"4.359281652607542155334717662588451172669\",\n",
            "        \"im\": \"-30.20800916413747571464820200054541518545\"\n",
            "      }\n",
            "    ],\n",
            "    [\n",
            "      {\n",
            "        \"re\": \"4.359281652607542155334717662588451172669\",\n",
            "        \"im\": \"30.20800916413747571464820200054541518545\"\n",
            "      },\n",
            "      {\n",
            "        \"re\": \"19297.60970700891527943521256070683718568\",\n",
            "        \"im\": \"-3.223919547612952727760039455170441824643e-39\"\n",
            "      }\n",
            "    ]\n",
            "  ],\n",
            "  \"quadratic_value\": {\n",
            "    \"re\": \"11281.33821248755733728555732188126267191\",\n",
            "    \"im\": \"-2.641052719672011376317129031966579571832e-38\"\n",
            "  },\n",
            "  \"diagonal_only_changed_calculation\": {\n",
            "    \"re\": \"11193.20696902506330768573561782214999985\",\n",
            "    \"im\": \"-1.869873337615512582100822883998856258293e-39\"\n",
            "  },\n",
            "  \"mixed_contribution\": {\n",
            "    \"re\": \"88.13124346249402959982170405911267206207\",\n",
            "    \"im\": \"-2.454065385910460118107046743566693946003e-38\"\n",
            "  }\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "complex_probe = dispatch({\"operation\":\"matrix\", \"dps\":40, \"sigma\":\"0.25\", \"frequencies\":[0,14], \"centers\":[\"0.1\",\"-0.1\"], \"coefficients\":[[1,2],[\"-0.3\",\"0.7\"]], \"prime_cutoff\":1000, \"zero_count\":20})\n",
        "print(json.dumps({key:complex_probe[\"result\"][key] for key in [\"matrix_arithmetic_truncated\",\"quadratic_value\",\"diagonal_only_changed_calculation\",\"mixed_contribution\"]}, indent=2))\n"
      ],
      "id": "2193f0b2df13"
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"schema_version\": 1,\n",
            "  \"kernel_version\": \"1.0.0\",\n",
            "  \"operation\": \"correlation\",\n",
            "  \"status\": \"numerical evidence\",\n",
            "  \"precision_dps\": 40,\n",
            "  \"backend\": \"mpmath 1.3.0\",\n",
            "  \"inputs\": {\n",
            "    \"operation\": \"correlation\",\n",
            "    \"dps\": 40,\n",
            "    \"sigma\": \".25\",\n",
            "    \"t_i\": 3,\n",
            "    \"t_j\": 14,\n",
            "    \"center_i\": \".2\",\n",
            "    \"center_j\": \"-.1\",\n",
            "    \"s\": [\n",
            "      \".4\",\n",
            "      8\n",
            "    ]\n",
            "  },\n",
            "  \"result\": {\n",
            "    \"index_order\": \"first=g_j, second=g_i; K_ij has coefficient conjugate(c_i)*c_j\",\n",
            "    \"x\": \"1.0\",\n",
            "    \"correlation_analytic\": {\n",
            "      \"re\": \"65.15586454912982381463196579184394452891\",\n",
            "      \"im\": \"-445.3280182579106232676357148185216946392\"\n",
            "    },\n",
            "    \"correlation_direct_dy\": {\n",
            "      \"re\": \"65.15586454912982381463196579184394452892\",\n",
            "      \"im\": \"-445.3280182579106232676357148185216946392\"\n",
            "    },\n",
            "    \"correlation_residual\": {\n",
            "      \"re\": \"5.877471754111437539843682686111228389093e-39\",\n",
            "      \"im\": \"5.877471754111437539843682686111228389093e-39\"\n",
            "    },\n",
            "    \"s\": {\n",
            "      \"re\": \"0.4\",\n",
            "      \"im\": \"8.0\"\n",
            "    },\n",
            "    \"Mellin_direct\": {\n",
            "      \"re\": \"233.9673158423842786294695795676561014461\",\n",
            "      \"im\": \"-83.80337380612424272305793744106434642744\"\n",
            "    },\n",
            "    \"Mellin_reflected_product\": {\n",
            "      \"re\": \"233.9673158423842786294695795676561014461\",\n",
            "      \"im\": \"-83.80337380612424272305793744106434642744\"\n",
            "    },\n",
            "    \"Mellin_identity_residual\": {\n",
            "      \"re\": \"5.877471754111437539843682686111228389093e-39\",\n",
            "      \"im\": \"-5.877471754111437539843682686111228389093e-39\"\n",
            "    },\n",
            "    \"wrong_absolute_square_for_comparison\": \"174.4757266809535035318220460491481813391\",\n",
            "    \"reflected_partner\": {\n",
            "      \"re\": \"0.6\",\n",
            "      \"im\": \"8.0\"\n",
            "    }\n",
            "  },\n",
            "  \"limitations\": [\n",
            "    \"Exploratory arbitrary-precision arithmetic is not interval or ball certification.\",\n",
            "    \"Finite primes, zeros, and basis dimensions do not establish the universal positivity required by RH.\",\n",
            "    \"Higher precision and a small residual alone do not certify the omitted tails.\"\n",
            "  ]\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "correlation = dispatch({\"operation\":\"correlation\", \"dps\":40, \"sigma\":\".25\", \"t_i\":3, \"t_j\":14, \"center_i\":\".2\", \"center_j\":\"-.1\", \"s\":[\".4\",8]})\n",
        "print(json.dumps(correlation, indent=2))\n"
      ],
      "id": "40ac0b5cd832"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Prime-power jumps and claim checks\n",
        "\n",
        "`psi0` and `J0` use half weight at a prime-power endpoint. The truncated zero formula has no certified tail bound. The checker distinguishes a false inference from a refutation of RH, and labels the synthetic pair as a toy model.\n"
      ],
      "id": "c49a3c35ad6e"
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"schema_version\": 1,\n",
            "  \"kernel_version\": \"1.0.0\",\n",
            "  \"operation\": \"prime_zero\",\n",
            "  \"status\": \"numerical evidence\",\n",
            "  \"precision_dps\": 40,\n",
            "  \"backend\": \"mpmath 1.3.0\",\n",
            "  \"inputs\": {\n",
            "    \"operation\": \"prime_zero\",\n",
            "    \"x\": 8,\n",
            "    \"zero_count\": 20,\n",
            "    \"dps\": 40\n",
            "  },\n",
            "  \"result\": {\n",
            "    \"x\": \"8.0\",\n",
            "    \"prime_count_pi\": 4,\n",
            "    \"prime_count_midpoint_pi0\": \"4.0\",\n",
            "    \"weighted_prime_power_psi0\": \"6.386828301557386644644437617237334493999\",\n",
            "    \"prime_power_count_J0\": \"4.666666666666666666666666666666666666667\",\n",
            "    \"jump_convention\": \"At x=p^k, the endpoint contributes half its weight to psi0 and J0; pi0 uses half at primes.\",\n",
            "    \"psi_zero_sum_truncated\": {\n",
            "      \"re\": \"-0.2653949023860999896358516503578718579053\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"psi_main_term\": \"8.0\",\n",
            "    \"psi_endpoint_constant\": \"-1.837877066409345483560659472811235279723\",\n",
            "    \"psi_trivial_zero_term\": \"0.007874178484069584303774755730414134760468\",\n",
            "    \"psi_approximation\": {\n",
            "      \"re\": \"6.435392014460824090378966933277050712943\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"psi_difference\": {\n",
            "      \"re\": \"-0.04856371290343744573452931603971621894406\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"J_zero_sum_truncated\": {\n",
            "      \"re\": \"-0.1270507285660941621503841005758116530336\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"J_trivial_zero_integral\": \"0.003146115901203899616900933945298789993077\",\n",
            "    \"J_approximation\": {\n",
            "      \"re\": \"4.690767963466283930873864972540446391301\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"J_difference\": {\n",
            "      \"re\": \"-0.02410129679961726420719830587377972463454\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"positive_zero_count\": 20,\n",
            "    \"zero_summation_convention\": \"symmetric positive/negative ordinates from the first N computed critical-line zeros; omitted zeros not bounded\",\n",
            "    \"error_bounds\": {\n",
            "      \"arithmetic_count\": \"finite enumeration, with exploratory decimal logarithms\",\n",
            "      \"zero_tail\": \"not certified\",\n",
            "      \"RH_dependent_estimate\": \"none asserted\"\n",
            "    }\n",
            "  },\n",
            "  \"limitations\": [\n",
            "    \"Exploratory arbitrary-precision arithmetic is not interval or ball certification.\",\n",
            "    \"Finite primes, zeros, and basis dimensions do not establish the universal positivity required by RH.\",\n",
            "    \"Higher precision and a small residual alone do not certify the omitted tails.\"\n",
            "  ]\n",
            "}\n",
            "{\n",
            "  \"schema_version\": 1,\n",
            "  \"kernel_version\": \"1.0.0\",\n",
            "  \"operation\": \"checker\",\n",
            "  \"status\": \"numerical evidence\",\n",
            "  \"precision_dps\": 40,\n",
            "  \"backend\": \"mpmath 1.3.0\",\n",
            "  \"inputs\": {\n",
            "    \"operation\": \"checker\",\n",
            "    \"claim\": \"synthetic_pair\"\n",
            "  },\n",
            "  \"result\": {\n",
            "    \"verdict\": \"numerical evidence\",\n",
            "    \"classification\": \"synthetic reflected-pair toy model; not computed zeta zeros\",\n",
            "    \"paired_value\": {\n",
            "      \"re\": \"-2.0\",\n",
            "      \"im\": \"0.0\"\n",
            "    },\n",
            "    \"replaced_absolute_squares\": \"2.0\",\n",
            "    \"reason\": \"Replacing the reflected partner changes the quadratic form away from the critical line.\"\n",
            "  },\n",
            "  \"limitations\": [\n",
            "    \"Exploratory arbitrary-precision arithmetic is not interval or ball certification.\",\n",
            "    \"Finite primes, zeros, and basis dimensions do not establish the universal positivity required by RH.\",\n",
            "    \"Higher precision and a small residual alone do not certify the omitted tails.\"\n",
            "  ]\n",
            "}\n",
            "{\n",
            "  \"schema_version\": 1,\n",
            "  \"kernel_version\": \"1.0.0\",\n",
            "  \"operation\": \"checker\",\n",
            "  \"status\": \"contradicted\",\n",
            "  \"precision_dps\": 40,\n",
            "  \"backend\": \"mpmath 1.3.0\",\n",
            "  \"inputs\": {\n",
            "    \"operation\": \"checker\",\n",
            "    \"claim\": \"finite_positive_matrix_implies_RH\"\n",
            "  },\n",
            "  \"result\": {\n",
            "    \"verdict\": \"contradicted\",\n",
            "    \"target\": \"the stated implication, not RH\",\n",
            "    \"reason\": \"Positivity on a finite-dimensional subspace does not imply positivity on the full Weil test space.\",\n",
            "    \"countermodel\": \"On span(e1,e2), Q(a,b)=|a|^2-|b|^2 is positive on span(e1) but negative at e2.\",\n",
            "    \"missing_hypotheses\": [\n",
            "      \"exhaustive dense test spaces\",\n",
            "      \"justified convergence and tails\",\n",
            "      \"positivity for every admissible test\"\n",
            "    ]\n",
            "  },\n",
            "  \"limitations\": [\n",
            "    \"Exploratory arbitrary-precision arithmetic is not interval or ball certification.\",\n",
            "    \"Finite primes, zeros, and basis dimensions do not establish the universal positivity required by RH.\",\n",
            "    \"Higher precision and a small residual alone do not certify the omitted tails.\"\n",
            "  ]\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "print(json.dumps(dispatch({\"operation\":\"prime_zero\", \"x\":8, \"zero_count\":20, \"dps\":40}), indent=2))\n",
        "print(json.dumps(dispatch({\"operation\":\"checker\", \"claim\":\"synthetic_pair\"}), indent=2))\n",
        "print(json.dumps(dispatch({\"operation\":\"checker\", \"claim\":\"finite_positive_matrix_implies_RH\"}), indent=2))\n"
      ],
      "id": "a71f288358e8"
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "section": "certification"
      },
      "source": [
        "## Certified arithmetic: a separate native FLINT computation\n",
        "\n",
        "The cells above are exploratory mpmath calculations. The next cells use `python-flint==0.9.0` with rigorous Arb/Acb enclosures. They first certify every zero in a declared finite region by an independent contour count and disjoint sign-change intervals, then enclose the **complete** Gaussian form with an unconditional tail over all omitted zeros, including any possible off-line partners.\n",
        "\n",
        "The certificate below concerns only the supplied three-dimensional Gaussian span. It does not prove RH for all heights or prove positivity on every admissible Weil test. Exact rational complex coefficients retain every mixed contribution. The analytic trust base and library assumptions are documented in `CERTIFICATION.md`; interval replay is independent of a saved status label.\n"
      ],
      "id": "dbf2232a364e"
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "section": "certification"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"backend\": {\n",
            "    \"python_flint\": \"0.9.0\",\n",
            "    \"flint\": \"3.6.0\"\n",
            "  },\n",
            "  \"inputs\": {\n",
            "    \"sigma\": \"1/4\",\n",
            "    \"frequencies\": [\n",
            "      \"0\",\n",
            "      \"14\",\n",
            "      \"21\"\n",
            "    ],\n",
            "    \"height\": \"100\",\n",
            "    \"coefficients\": [\n",
            "      [\n",
            "        \"1\",\n",
            "        \"1\"\n",
            "      ],\n",
            "      [\n",
            "        \"-1/3\",\n",
            "        \"1/7\"\n",
            "      ],\n",
            "      [\n",
            "        \"1/10\",\n",
            "        \"-2/5\"\n",
            "      ]\n",
            "    ]\n",
            "  },\n",
            "  \"positive_zero_count_with_multiplicity\": 29,\n",
            "  \"positive_definite_on_this_span\": true,\n",
            "  \"tail_bound_each_entry\": {\n",
            "    \"finite\": true,\n",
            "    \"midpoint_dyadic\": [\n",
            "      \"2032526733535652370465434957470501220970000597773265524615\",\n",
            "      -718\n",
            "    ],\n",
            "    \"radius_dyadic\": [\n",
            "      \"0\",\n",
            "      0\n",
            "    ],\n",
            "    \"display\": \"[1.47400643592608578253166e-159 +/- 3.26e-184]\"\n",
            "  },\n",
            "  \"leading_principal_determinants\": [\n",
            "    {\n",
            "      \"finite\": true,\n",
            "      \"midpoint_dyadic\": [\n",
            "        \"2979559211850718827952580665269392634858174797733800184017\",\n",
            "        -194\n",
            "      ],\n",
            "      \"radius_dyadic\": [\n",
            "        \"600580201\",\n",
            "        -93\n",
            "      ],\n",
            "      \"display\": \"[0.118667791978489123 +/- 3.99e-19]\"\n",
            "    },\n",
            "    {\n",
            "      \"finite\": true,\n",
            "      \"midpoint_dyadic\": [\n",
            "        \"130038116041268921435481937700331736814124101504407197121\",\n",
            "        -176\n",
            "      ],\n",
            "      \"radius_dyadic\": [\n",
            "        \"211382221\",\n",
            "        -77\n",
            "      ],\n",
            "      \"display\": \"[1357.66127938272432 +/- 5.14e-15]\"\n",
            "    },\n",
            "    {\n",
            "      \"finite\": true,\n",
            "      \"midpoint_dyadic\": [\n",
            "        \"6265745090266810390365952272930171375898524132194696033295\",\n",
            "        -165\n",
            "      ],\n",
            "      \"radius_dyadic\": [\n",
            "        \"439299591\",\n",
            "        -61\n",
            "      ],\n",
            "      \"display\": \"[133974898.877588558 +/- 4.89e-10]\"\n",
            "    }\n",
            "  ],\n",
            "  \"quadratic_form_enclosure\": {\n",
            "    \"finite\": true,\n",
            "    \"midpoint_dyadic\": [\n",
            "      \"1029861000432290756535300820778754108783771051811221411243\",\n",
            "      -175\n",
            "    ],\n",
            "    \"radius_dyadic\": [\n",
            "      \"968548271\",\n",
            "      -79\n",
            "    ],\n",
            "    \"display\": \"[21504.50108012242327 +/- 4.24e-15]\"\n",
            "  },\n",
            "  \"quadratic_form_sign\": \"positive\",\n",
            "  \"diagonal_only_changed_calculation\": {\n",
            "    \"finite\": true,\n",
            "    \"midpoint_dyadic\": [\n",
            "      \"4890459996741319052525064777637506746326139407940921199925\",\n",
            "      -177\n",
            "    ],\n",
            "    \"radius_dyadic\": [\n",
            "      \"418311279\",\n",
            "      -78\n",
            "    ],\n",
            "    \"display\": \"[25529.39237384334313 +/- 2.94e-15]\"\n",
            "  },\n",
            "  \"general_RH\": \"unresolved\"\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "from certify import gaussian_matrix, replay, ball_bounds\n",
        "\n",
        "certificate_inputs = {\n",
        "    \"sigma\": \"1/4\",\n",
        "    \"frequencies\": [\"0\", \"14\", \"21\"],\n",
        "    \"coefficients\": [[\"1\", \"1\"], [\"-1/3\", \"1/7\"], [\"1/10\", \"-2/5\"]],\n",
        "    \"height\": \"100\",\n",
        "    \"precision_bits\": 192,\n",
        "}\n",
        "certificate = gaussian_matrix(**certificate_inputs)\n",
        "assert certificate[\"status\"] == \"certified\"\n",
        "assert certificate[\"positive_definite_on_this_span\"]\n",
        "assert certificate[\"tail_uses_RH\"] is False\n",
        "assert all(ball_bounds(d)[0] > 0 for d in certificate[\"leading_principal_determinants\"])\n",
        "print(json.dumps({\n",
        "    \"backend\": certificate[\"backend\"],\n",
        "    \"inputs\": certificate[\"inputs\"],\n",
        "    \"positive_zero_count_with_multiplicity\": certificate[\"zero_certificate\"][\"positive_zero_count_with_multiplicity\"],\n",
        "    \"positive_definite_on_this_span\": certificate[\"positive_definite_on_this_span\"],\n",
        "    \"tail_bound_each_entry\": certificate[\"tail_bound_each_entry\"],\n",
        "    \"leading_principal_determinants\": certificate[\"leading_principal_determinants\"],\n",
        "    \"quadratic_form_enclosure\": certificate[\"quadratic_form_enclosure\"],\n",
        "    \"quadratic_form_sign\": certificate[\"quadratic_form_sign\"],\n",
        "    \"diagonal_only_changed_calculation\": certificate[\"diagonal_only_changed_calculation\"],\n",
        "    \"general_RH\": certificate[\"general_RH\"],\n",
        "}, indent=2))\n"
      ],
      "id": "15a26bea4cfc"
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "section": "certification"
      },
      "source": [
        "### Recompute the certificate from its exact enclosures\n",
        "\n",
        "Replay recomputes the zeta image covers, exact rational winding, critical-line endpoint signs, multiplicity-count saturation, complete matrix bounds, unconditional tail, leading determinants, and the chosen complex-coefficient form at higher precision. It does not infer validity from a checksum or from the original `status` field. The final `general_RH` result must remain `unresolved`.\n"
      ],
      "id": "d34cf765295f"
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "section": "certification"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "  \"status\": \"certified\",\n",
            "  \"kind\": \"gaussian_matrix\",\n",
            "  \"recomputed\": true,\n",
            "  \"positive_definite_on_this_span\": true,\n",
            "  \"general_RH\": \"unresolved\",\n",
            "  \"quadratic_form_sign\": \"positive\",\n",
            "  \"quadratic_form_enclosure\": {\n",
            "    \"finite\": true,\n",
            "    \"midpoint_dyadic\": [\n",
            "      \"8846438632565061323364430589533412297703846006161435054233285194183\",\n",
            "      -208\n",
            "    ],\n",
            "    \"radius_dyadic\": [\n",
            "      \"242137093\",\n",
            "      -87\n",
            "    ],\n",
            "    \"display\": \"[21504.50108012242327263 +/- 2.29e-18]\"\n",
            "  }\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "certificate_replay = replay(certificate)\n",
        "assert certificate_replay[\"status\"] == \"certified\"\n",
        "assert certificate_replay[\"recomputed\"] is True\n",
        "assert certificate_replay[\"quadratic_form_sign\"] == \"positive\"\n",
        "assert certificate_replay[\"general_RH\"] == \"unresolved\"\n",
        "print(json.dumps(certificate_replay, indent=2))\n"
      ],
      "id": "3ff6d783e053"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Reproducible export\n",
        "\n",
        "The files below retain the exact request, exploratory result, full certified enclosure transcript, and fresh replay verdict. The notebook stores executed outputs separately by evidence class. Higher precision alone does not certify the exploratory arithmetic; the certificate has its own explicit full-tail and interval proof.\n",
        "\n",
        "The generated files are written in the current notebook directory. The repository validation run executes in a temporary output directory and records the hashes in `notebook-execution.json`, while embedding all displayed outputs here.\n"
      ],
      "id": "a7519c632680"
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Exported: notebook-probe-reproduction.json, notebook-gaussian-certificate.json, notebook-gaussian-replay.json\n"
          ]
        }
      ],
      "source": [
        "from pathlib import Path\n",
        "\n",
        "export_records = {\n",
        "    \"notebook-probe-reproduction.json\": probe,\n",
        "    \"notebook-gaussian-certificate.json\": certificate,\n",
        "    \"notebook-gaussian-replay.json\": certificate_replay,\n",
        "}\n",
        "for name, record in export_records.items():\n",
        "    Path(name).write_text(json.dumps(record, indent=2) + \"\\n\")\n",
        "print(\"Exported:\", \", \".join(export_records))\n"
      ],
      "id": "66bfd11ef413"
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3"
    },
    "execution": {
      "date": "2026-10-14",
      "python": "3.12.14",
      "backends": {
        "mpmath": "1.3.0",
        "python_flint": "0.9.0",
        "flint": "3.6.0"
      },
      "all_code_cells_passed": true,
      "general_RH": "unresolved"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
