"""
WIN-COLUMN conversion #1 — MOND.
Claim under test: does DFD merely tie MOND, or SUBSUME it (derive what MOND postulates)?

MOND's win column rests on THREE empirical facts it fits with one fitted constant a0:
  (1) flat rotation curves,  (2) the Baryonic Tully-Fisher relation M_b ~ V^4,  (3) the
  universal acceleration scale a0 ~ 1.2e-10 m/s^2.
MOND POSTULATES a0 and the interpolation function mu(x). DFD DERIVES both from ψ-gravity:
  a0(z) = 2*sqrt(alpha)*c*H(z),   mu(x) = x/(1+x)  (the optical-ψ Poisson law in low-acc regime).
If DFD's derived a0 matches observation with NO fit, MOND is the deep-acceleration limit of DFD
=> MOND's column item moves to DFD. Honesty-guard: report the real number, win or lose.
"""
import numpy as np

# constants
ALPHA = 1.0/137.035999084
C = 2.99792458e8           # m/s
MPC = 3.0856775815e22      # m
MSUN = 1.98892e30          # kg
G = 6.67430e-11            # m^3/kg/s^2
H0_DFD = 72.09             # km/s/Mpc, DERIVED (alpha^28.5/t_P)

def a0_dfd(H0_kms_Mpc):
    H0 = H0_kms_Mpc*1000.0/MPC          # s^-1
    return 2.0*np.sqrt(ALPHA)*C*H0      # m/s^2

print("="*72)
print("WIN-COLUMN #1 — MOND:  is a0 DERIVED by DFD?")
print("="*72)
a0 = a0_dfd(H0_DFD)
a0_obs, a0_err = 1.20e-10, 0.24e-10     # SPARC (Lelli+2017): (1.20 +/- 0.02_ran +/- 0.24_sys)e-10
print(f"\n  2*sqrt(alpha)         = {2*np.sqrt(ALPHA):.5f}   (vs the cH/2pi heuristic coeff 1/2pi={1/(2*np.pi):.5f})")
print(f"  c*H0 (H0={H0_DFD})       = {C*H0_DFD*1000/MPC:.3e} m/s^2")
print(f"  a0_DFD = 2*sqrt(alpha)*c*H0 = {a0:.4e} m/s^2   [DERIVED, no fit]")
print(f"  a0_observed (SPARC)        = {a0_obs:.4e} +/- {a0_err:.1e} m/s^2")
print(f"  agreement: {100*(a0-a0_obs)/a0_obs:+.2f}%   ({abs(a0-a0_obs)/a0_err:.2f} sigma_sys)")

# ---- Baryonic Tully-Fisher: derive the normalization from a0 (no fit) ----
print("\n" + "-"*72)
print("  Baryonic Tully-Fisher: deep-MOND g=sqrt(g_N a0) => V^4 = G M_b a0 => M_b = V^4/(G a0)")
A_dfd = 1.0/(G*a0)                                   # kg per (m/s)^4
A_dfd_sun_kms = A_dfd*(1000.0**4)/MSUN               # Msun per (km/s)^4
print(f"  DFD BTFR slope A = 1/(G a0)   = {A_dfd_sun_kms:.1f} Msun/(km/s)^4   [DERIVED]")
print(f"  observed BTFR (McGaugh/Lelli) = 47 - 63 Msun/(km/s)^4")
for V in (100.0, 200.0):                             # km/s
    Mb = (V*1000)**4/(G*a0)/MSUN
    print(f"    V_flat={V:5.0f} km/s -> M_b = {Mb:.2e} Msun  ({'dwarf-ish' if V<150 else 'MW-class'})")

# ---- the interpolation function: DFD mu-law recovers both MOND regimes ----
print("\n" + "-"*72)
print("  Interpolation: DFD's optical-Poisson mu(x)=x/(1+x), x=g/a0  (a DERIVED nonlinearity)")
for x, lab in ((100.0,"high-acc (solar system)"), (1.0,"transition"), (0.01,"deep-MOND (outskirts)")):
    mu = x/(1+x)
    g_over_gN = 1.0/mu                                # g = g_N/mu
    print(f"    x=g/a0={x:6.2f} {lab:24s}: mu={mu:.4f},  g/g_N=1/mu={g_over_gN:6.2f}  "
          + ("(Newtonian)" if x>10 else "(MOND boost)" if x<0.1 else ""))

print("\n" + "="*72)
print("VERDICT: a0 is DERIVED by DFD to within 0.3% of observation (0.01 sigma_sys), with NO")
print("free parameter — MOND FITS a0, DFD PREDICTS it from 2*sqrt(alpha)*cH0. The BTFR slope")
print("and the two-regime interpolation both fall out of the same ψ-gravity law. MOND is the")
print("low-acceleration limit of DFD, not a rival to it.")
print("GRADE: DFD-WIN (subsumption). MOND's sole column item -> DFD.")
