#!/usr/bin/env python3
"""AP45 -- "The Blink" -- independent verification script.

Reproduces the two corpse figures on lucid.rodeo/prereg/ap45/ section 10.
AP45 predicts no new number. What it shows is what already died:

  additional-energy reading, hydrogen optical:  0.0992 eV / (h * 5 kHz) = 4.8e9
  additional-energy reading, bond-breaking:     0.0326 eV / 4.0e-8 eV  = 8.1e5

KS-NPP.1 (7.24 sigma, 2026-08-02) is the other corpse; that arithmetic lives
in verify_ap47.py and stays FIRED there.

No dependencies beyond the Python 3 standard library. No network access.

    python3 verify_ap45.py

Source: AP45_The_Blink_FINAL_v1_7.md section 10, anchored on
github.com/ajgreyling/the420code-proof (tag ap45-ap46-locked-2026-09-02).
Ceiling C-1 is h * 5 kHz from the hashed inventory (cb77b354...), carried
verbatim in WP-BUMP.9 section A.
"""
from __future__ import annotations

# SI exact
H = 6.62607015e-34          # Planck constant, J*s
EV_J = 1.602176634e-19      # joule per electronvolt

CANDIDATE_OPTICAL_EV = 0.0992
CANDIDATE_BOND_EV = 0.0326
CEILING_BOND_EV = 4.0e-8    # hashed inventory, bond-breaking ceiling


def main() -> int:
    ceiling_optical_ev = (H * 5000) / EV_J
    excess_optical = CANDIDATE_OPTICAL_EV / ceiling_optical_ev
    excess_bond = CANDIDATE_BOND_EV / CEILING_BOND_EV

    bar = "=" * 76
    print(bar)
    print("AP45 -- The Blink -- independent verification (SI exact, stdlib only)")
    print(bar)

    print("\nThis paper predicts no number. The corpses it shows:")
    print("\nSecond death -- additional-energy reading of 16 August 2026")
    print("  (ceilings hashed cb77b354... eighteen seconds before the candidate).")
    print(f"  C-1 ceiling = h * 5 kHz                 = {ceiling_optical_ev:.3e} eV")
    print("  paper                                  = ~2.1e-11 eV")
    print(f"  hydrogen optical candidate            = {CANDIDATE_OPTICAL_EV} eV")
    print(f"  excess                                = {excess_optical:.2e}   (paper 4.8e9)")
    print(f"  bond-breaking candidate               = {CANDIDATE_BOND_EV} eV")
    print(f"  against ceiling {CEILING_BOND_EV:.1e} eV          = {excess_bond:.2e}   (paper 8.1e5)")

    print("\nFirst death -- KS-NPP.1, fired 2026-08-02 at 7.24 sigma.")
    print("  Not recomputed here. See verify_ap47.py -- that script keeps it FIRED")
    print("  on purpose. AP45 does not repair it. Nothing does.")

    print(f"\n{bar}")
    print("Corpses reproduce. No new prediction is claimed. No repair is offered.")
    print(bar)

    optical_ok = abs(excess_optical / 4.8e9 - 1) < 0.02
    bond_ok = abs(excess_bond / 8.1e5 - 1) < 0.02
    return 0 if (optical_ok and bond_ok) else 1


if __name__ == "__main__":
    raise SystemExit(main())
