diff --git a/studies/expedition-witness-zeno-schur/README.md b/studies/expedition-witness-zeno-schur/README.md new file mode 100644 index 0000000..344fa3e --- /dev/null +++ b/studies/expedition-witness-zeno-schur/README.md @@ -0,0 +1,46 @@ +# Unified Witness-Map Operator, Tomita–Takesaki Modular Flow & Exact $16\times 16$ Zero-Float Lindblad Zeno Schur-Complement Theorem + +Self-contained verification study for **`Foundation-0/fractals`** (`witness-map/model.js`), independently audited in **`AUDIT-018` (`VERIFIED` | `exact` Parts A–B + `anchor` Part C | `N2` cross-repo milestone)** via independent symbolic SymPy $16\times 16$ GKSL verification and live `node` cross-checks against `witness-map/model.js`. + +## What This Solves + +In `witness-map/model.js`, single-particle decoherence (`rates()`, witness number $W = \Gamma \cdot m\Delta x^2/\hbar$) and wave dark-matter crowds (`crowd()`, $N \sim 10^{93}$ coherent particles per lump) live in two separate panels: *"one particle has no witnesses; the crowd has many; yet the crowd's internal interference lumps survive being watched."* + +`probe4_witness_zeno_schur.py` (100% pure Python 3 stdlib; zero NumPy/SciPy; zero floats in all algebraic proofs; zero bare `assert`s) unifies both regimes with three exact results: + +### 1. Part A — Exact Multipole Scaling, Dipole Cancellation & Huygens–Steiner DSW Quadrupole Split ($\mathbb{Q}$ / $\mathbb{Q}(i)$) +Across zero-center-of-mass clusters ($x_j = R + \xi_j$, $\sum_{j=1}^N \xi_j = 0$, verified over $N \in \{2,3,4,5,7,10\}$): +- **CM Cube Law:** Coherent amplitude amplification gives $\Gamma_{\mathrm{CM}} = N^2 \Gamma_1$ and wave clock $t_{\mathrm{wave}}^{\mathrm{CM}} = N t_{\mathrm{wave}}^{(1)}$, yielding exact **$W_{\mathrm{CM}}(N) \equiv N^3 W_{\mathrm{single}}$**. +- **Exact Dipole Cancellation:** On pure internal shape superpositions ($\Delta R = 0$, $\sum\xi_j = \sum\xi'_j = 0$), both $O(k^0)$ and $O(k^2)$ cancel identically, leaving quadrupole tidal rate $\Gamma_{\mathrm{int}}^{(4)} = \frac{\gamma_0 k^4}{8}(\Delta I_{\mathrm{int}})^2$ and protection ratio $\mathcal{P}_{\mathrm{inv}} = \frac{4 N^2 (\Delta R)^2}{k^2 (\Delta I_{\mathrm{int}})^2}$ (while isometric modes in $\mathcal{F}^{\mathrm{inv}}$ vanish identically through $O(k^{10})$). +- **Huygens–Steiner / DSW Black-Hole Mass-Quadrupole Split:** $Q(R,\xi) = \sum_j m(R+\xi_j)^2 \equiv N m R^2 + m I_{\mathrm{int}}(\xi)$ has exact zero cross-term iff $\sum_j \xi_j = 0$, proving Danielson–Satishchandran–Wald gravitational horizon witnessing (`witness-map/model.js` line 105) obeys $W_{\mathrm{BH}}^{\mathrm{CM}} = N^3 W_{\mathrm{BH}}^{(1)}$ while remaining blind to quadrupole-preserving internal modes ($\Delta I_{\mathrm{int}} = 0$). Breaking $\sum \xi_j = 0$ immediately restores $O(k^2)$ internal decoherence (`3/10`) and nonzero cross-term (`35/11`). + +### 2. Part B — First-Principles $16\times 16$ Zero-Float GKSL Superoperator, Tomita–Takesaki Modular Flow & Zeno Schur Complement ($\mathbb{Q}$ / $\mathbb{Q}(i)$ + `math.isqrt`) +Constructed directly from $4\times 4$ matrix commutators and dissipators over exact Gaussian rationals $\mathbb{Q}(i)$ on $\mathcal{H}_{\mathrm{CM}}\otimes\mathcal{H}_{\mathrm{rel}} \cong \mathbb{C}^2\otimes\mathbb{C}^2$ with $H = g(X\otimes Z) + \omega_{\mathrm{rel}}(I\otimes Z)$, $L_{\mathrm{CM}} = Z\otimes I$ ($\gamma_{\mathrm{CM}} = N^2 \gamma_1$), and $L_{\mathrm{tid}} = Z\otimes Z$ ($\gamma_{\mathrm{tid}}$): +- **Exact Tomita–Takesaki Modular Flow Commutation:** On an explicit non-diagonal, non-product faithful state $\rho_S \in \mathcal{V}_{\mathrm{inv}} = \ker(\mathcal{D}[Z\otimes I])$ with $[\rho_0, \rho_1] \ne 0$, the exact $16\times 16$ modular operator $\Delta_{\rho_S}(A) = \rho_S A \rho_S^{-1}$ satisfies $\Delta_{\rho_S} = \Delta_{\rho_S}^\dagger$, **$[\mathcal{D}[Z\otimes I], \Delta_{\rho_S}] \equiv 0$** (implying $[\mathcal{E}_t, \sigma_s^{\rho_S}] = 0$ for all $s,t \in \mathbb{R}$), and exact KMS quantum detailed balance; all 3 adversarial controls (coherent CM state, local witness $I\otimes Z$, entangling witness $Z\otimes X$) strictly break commutation. +- **Exact $8\times 8$ Schur Complement ($N = 1..100$):** Eliminating fast-decohering $\mathcal{V}_{\mathrm{wit}} = \{X,Y\}_{\mathrm{CM}}\otimes\{I,X,Y,Z\}_{\mathrm{rel}}$ yields exact diagonal $\mathcal{L}_{\mathrm{eff}}^{\mathrm{inv}} = \mathcal{L}_{\mathrm{inv,inv}} - \mathcal{L}_{\mathrm{inv,wit}}\mathcal{L}_{\mathrm{wit,wit}}^{-1}\mathcal{L}_{\mathrm{wit,inv}}$: + - `II`, `IZ`: exact **`0`** for all $(N, g, \gamma_1, \gamma_{\mathrm{tid}})$ ($\mathcal{F}^{\mathrm{inv}}$ pointer conservation); + - `IX`, `IY`: exact **`-(2\gamma_{\mathrm{tid}} + 2g^2/(N^2\gamma_1))`** (**$1/N^2$ Quantum-Zeno sealing** of internal coherence as $N$ grows!); + - `ZI`, `ZZ`: exact **`-2g^2/(N^2\gamma_1 + \gamma_{\mathrm{tid}})`** (CM pointer freezing); + - `ZX`, `ZY`: exact **`-2\gamma_{\mathrm{tid}}`**. +- **Exact Exceptional-Point (EP2) Phase Boundary & Riccati Lift:** At $\gamma_{\mathrm{CM}} = 2g$ ($\gamma_{\mathrm{tid}} = 0$), exact nilpotent Jordan blocks ($N_{\mathrm{EP}}\ne 0, N_{\mathrm{EP}}^2=0$, full $16\times 16$ ranks `(12, 8)`; split $\gamma_{\mathrm{tid}}=1$ isolates `IX,IY` with ranks `(14, 12)`) separate the underdamped single-particle regime from the overdamped classical-crowd Zeno regime, where 80-bit `isqrt` brackets verify $(-\lambda_{\mathrm{slow}})/\Gamma_{\mathrm{Schur}} \to 1$ at $O(N^{-4})$, recursive Riccati iteration drives $\mathcal{R}[H_k]$ to `2.36e-15`, coherent internal frequency $H_{\mathrm{rel}} = \omega(I\otimes Z)$ commutes identically ($[\mathcal{L}_{\mathrm{bare}}, \mathcal{L}_{\mathrm{clock}}] = 0$), and $O(16,\mathbb{Q})$ orthogonal similarity invariance holds with `0` residual. + +### 3. Part C — Quantitative Calibration to `witness-map/model.js` & `Foundation-0/gravity` `C-03` +- **Cross-Repo Soliton Reconciliation (`1.45e-6` match):** Replaying `model.js`'s `SOL` ($h = 4\times 10^{-3}$) reconciles `model.js`'s half-density invariant $M_{\mathrm{sol}} r_c = 2.6794\,\hbar^2/(G m^2)$ ($x_c = 1.2993$) with `Foundation-0/gravity` `C-03`'s half-mass invariant $M_{\mathrm{sol}} r_{1/2} = 3.9251\,\hbar^2/(G m^2)$ ($x_{1/2} = 1.9033$, universal ratio $r_{1/2}/r_c = 1.4649$). +- **Sgr A* Black-Hole Horizon Crossover at $b = 8.18\text{ kpc}$ (`dx < b/10` verified):** + - The $N^3$ cube law flips all three `CROWDS` (`sun`, `sun-heavy`, `core`) from $\log_{10} W_{\mathrm{BH}}^{(1)} \in [-169.5, -154.8]$ to $\log_{10} W_{\mathrm{BH}}^{\mathrm{CM}} \in [+67.9, +135.8]$. + - Because $m_{\mathrm{lump}} \propto \rho \lambda^3 \propto m^{-3}$ and $\lambda \propto m^{-1}$, Sgr A*'s gravitational horizon rate obeys **$\Gamma_{\mathrm{BH}}^{\mathrm{CM}} \propto m^{-10}$** and **$\Gamma_{\mathrm{BH}}^{\mathrm{CM}} t_{\mathrm{lump}} \propto m^{-11}$**: + - `sun` ($10^{-22}\text{ eV}$, $N = 1.09\times 10^{93}$): Sgr A*'s horizon alone decoheres the CM in **`2.41e-14 s` (24 fs)** while Zeno-sealing internal interference by $1/N^2 \sim 10^{-186}$. + - `sun-heavy` ($3\times 10^{-19}\text{ eV}$, $N = 1.34\times 10^{79}$): despite $W_{\mathrm{BH}}^{\mathrm{CM}} = 7.1\times 10^{67} \gg 1$, $\tau_{\mathrm{BH}}^{\mathrm{CM}} = \mathbf{1.42\times 10^{21}\text{ s}}$ (`3,263x` the age of the universe!). + - **Exact crossover boson masses at Sgr A* (`8.18 kpc`):** **`m*(tau = tLump) = 2.83e-20 eV`** and **`m*(tau = 13.8 Gyr) = 1.34e-19 eV`** (verified to `1.0000000000000002` against live `witness-map/model.js` in `AUDIT-018`). + +## Reproduction + +Pure Python 3 stdlib (zero dependencies): + +```sh +python3 -I -B -W error studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py +python3 -I -O -B -W error studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py +``` + +On-disk canonical SHA-256 (`sha256sum probe4_witness_zeno_results.json`): +`899d65178959d397a1121ec0a494dbe9cf6a5e7fd2ef2ecb29ef4f22b30c3451` diff --git a/studies/expedition-witness-zeno-schur/probe4_witness_zeno_results.json b/studies/expedition-witness-zeno-schur/probe4_witness_zeno_results.json new file mode 100644 index 0000000..e8632b5 --- /dev/null +++ b/studies/expedition-witness-zeno-schur/probe4_witness_zeno_results.json @@ -0,0 +1,355 @@ +{ + "part_a_exact_multipoles": { + "configs_verified": [ + { + "Delta_I_int": "-5/8", + "N": 2, + "P_inv_times_k2_exact": "1024/9", + "W_CM_over_W_single_exact": "8", + "huygens_steiner_cross_term_zero": true, + "internal_O_k0": "0", + "internal_O_k2_dipole_cancelled": "0", + "internal_O_k4_quadrupole": "15/512" + }, + { + "Delta_I_int": "-77/72", + "N": 3, + "P_inv_times_k2_exact": "518400/5929", + "W_CM_over_W_single_exact": "27", + "huygens_steiner_cross_term_zero": true, + "internal_O_k0": "0", + "internal_O_k2_dipole_cancelled": "0", + "internal_O_k4_quadrupole": "5929/69120" + }, + { + "Delta_I_int": "-3/2", + "N": 4, + "P_inv_times_k2_exact": "6400/81", + "W_CM_over_W_single_exact": "64", + "huygens_steiner_cross_term_zero": true, + "internal_O_k0": "0", + "internal_O_k2_dipole_cancelled": "0", + "internal_O_k4_quadrupole": "27/160" + }, + { + "Delta_I_int": "-55/18", + "N": 5, + "P_inv_times_k2_exact": "3600/121", + "W_CM_over_W_single_exact": "125", + "huygens_steiner_cross_term_zero": true, + "internal_O_k0": "0", + "internal_O_k2_dipole_cancelled": "0", + "internal_O_k4_quadrupole": "605/864" + }, + { + "Delta_I_int": "-12", + "N": 7, + "P_inv_times_k2_exact": "1225/324", + "W_CM_over_W_single_exact": "343", + "huygens_steiner_cross_term_zero": true, + "internal_O_k0": "0", + "internal_O_k2_dipole_cancelled": "0", + "internal_O_k4_quadrupole": "54/5" + }, + { + "Delta_I_int": "17/2", + "N": 10, + "P_inv_times_k2_exact": "40000/2601", + "W_CM_over_W_single_exact": "1000", + "huygens_steiner_cross_term_zero": true, + "internal_O_k0": "0", + "internal_O_k2_dipole_cancelled": "0", + "internal_O_k4_quadrupole": "867/160" + } + ], + "exact_arithmetic": "100% pure Fraction / Q(i)", + "negative_control_broken_CM": { + "dipole_protection_broken": true, + "expected_O_k2_rate": "3/10", + "quadrupole_cross_term_nonzero": "35/11", + "restored_O_k2_rate": "3/10", + "sum_xi_bad": "1" + }, + "observer_invariant_Finv": { + "dsw_quadrupole_shift_zero_on_Finv": true, + "parity_asymmetric_octupole_k6": "27/40", + "parity_asymmetric_zero_through_k4": true, + "permutation_zero_through_k10": true + } + }, + "part_b_exact_16x16_lindblad_zeno": { + "basis_invariance_and_witness_negative_controls": { + "block_O8Q_schur_exact_covariance": true, + "full_O16Q_trace_invariance_k1_to_4": true, + "neg_ctrl_entangling_ZX_destroys_Finv": { + "bad_ZX_IZ_rate": "50", + "good_CM_witness_IZ_rate": "0" + }, + "neg_ctrl_local_IZ_destroys_zeno": { + "bad_local_IZ_IX_rate": "2501/50", + "degradation_factor": 250.1, + "good_CM_witness_IX_rate": "1/5" + } + }, + "exact_16x16_schur_sweep": [ + { + "Gamma_Schur_IX_IY_exact": "901/50", + "IZ_decay_exact": "0", + "N": 1, + "ZI_decay_exact": "225/13", + "ZX_decay_exact": "1/50", + "gamma_CM": "1/4", + "regime": "underdamped" + }, + { + "Gamma_Schur_IX_IY_exact": "113/25", + "IZ_decay_exact": "0", + "N": 2, + "ZI_decay_exact": "450/101", + "ZX_decay_exact": "1/50", + "gamma_CM": "1", + "regime": "underdamped" + }, + { + "Gamma_Schur_IX_IY_exact": "101/50", + "IZ_decay_exact": "0", + "N": 3, + "ZI_decay_exact": "225/113", + "ZX_decay_exact": "1/50", + "gamma_CM": "9/4", + "regime": "underdamped" + }, + { + "Gamma_Schur_IX_IY_exact": "37/50", + "IZ_decay_exact": "0", + "N": 5, + "ZI_decay_exact": "225/313", + "ZX_decay_exact": "1/50", + "gamma_CM": "25/4", + "neg_lambda_slow_bracket_width": 1.3234889800848443e-27, + "neg_lambda_slow_over_Gamma_Schur_float": 1.065505006371, + "regime": "overdamped_zeno" + }, + { + "Gamma_Schur_IX_IY_exact": "1/5", + "IZ_decay_exact": "0", + "N": 10, + "ZI_decay_exact": "450/2501", + "ZX_decay_exact": "1/50", + "gamma_CM": "25", + "neg_lambda_slow_bracket_width": 8.271806125530277e-29, + "neg_lambda_slow_over_Gamma_Schur_float": 1.00362762257, + "regime": "overdamped_zeno" + }, + { + "Gamma_Schur_IX_IY_exact": "13/200", + "IZ_decay_exact": "0", + "N": 20, + "ZI_decay_exact": "450/10001", + "ZX_decay_exact": "1/50", + "gamma_CM": "100", + "neg_lambda_slow_bracket_width": 8.271806125530277e-29, + "neg_lambda_slow_over_Gamma_Schur_float": 1.000225123835, + "regime": "overdamped_zeno" + }, + { + "Gamma_Schur_IX_IY_exact": "17/625", + "IZ_decay_exact": "0", + "N": 50, + "ZI_decay_exact": "450/62501", + "ZX_decay_exact": "1/50", + "gamma_CM": "625", + "neg_lambda_slow_bracket_width": 8.271806125530277e-29, + "neg_lambda_slow_over_Gamma_Schur_float": 1.000005760159, + "regime": "overdamped_zeno" + }, + { + "Gamma_Schur_IX_IY_exact": "109/5000", + "IZ_decay_exact": "0", + "N": 100, + "ZI_decay_exact": "450/250001", + "ZX_decay_exact": "1/50", + "gamma_CM": "2500", + "neg_lambda_slow_bracket_width": 8.271806125530277e-29, + "neg_lambda_slow_over_Gamma_Schur_float": 1.000000360002, + "regime": "overdamped_zeno" + } + ], + "exact_arithmetic": "100% pure Fraction / Q(i) + math.isqrt (zero floats)", + "exceptional_point_EP2": { + "degenerate_gt0_gamma_CM_eq_2g": { + "N_EP": 4, + "full_16x16_rank_1_and_2": [ + 12, + 8 + ], + "g": "2", + "gamma_CM": "4", + "lambda_EP": "-4", + "subblock_nilpotent_nonzero": true, + "subblock_nilpotent_sq_zero": true, + "subblock_rank": 1 + }, + "split_gt1_isolates_IX_IY_EP2": { + "N": 5, + "full_16x16_rank_1_and_2": [ + 14, + 12 + ], + "g": "2", + "gamma1": "1/5", + "gamma_tid": "1", + "lambda_EP": "-6" + } + }, + "modular_flow_tomita_takesaki": { + "Delta_rho_HS_hermitian": true, + "commutator_D_CM_Delta_rho_V_inv_zero": true, + "kms_quantum_detailed_balance_zero": true, + "neg_ctrl_coherent_CM_norm2": "8765625600/6600100081", + "neg_ctrl_entangling_ZX_witness_norm2": "7084080673/3038867300", + "neg_ctrl_local_IZ_witness_norm2": "39690260209/51660744100", + "noncommuting_internal_blocks": true + }, + "riccati_fenichel_bridge_to_probe1": [ + { + "abs_riccati_defect_float": 0.012, + "iter": 0, + "rate_minus_exact_slow_float": 0.0007255245140229836 + }, + { + "abs_riccati_defect_float": 9.13728e-05, + "iter": 1, + "rate_minus_exact_slow_float": 5.524514022983641e-06 + }, + { + "abs_riccati_defect_float": 6.970748354262959e-07, + "iter": 2, + "rate_minus_exact_slow_float": 4.214602298364141e-08 + }, + { + "abs_riccati_defect_float": 5.3179979524269705e-09, + "iter": 3, + "rate_minus_exact_slow_float": 3.215328580636579e-10 + }, + { + "abs_riccati_defect_float": 4.057111791918625e-11, + "iter": 4, + "rate_minus_exact_slow_float": 2.452980918039695e-12 + }, + { + "abs_riccati_defect_float": 3.095179098082774e-13, + "iter": 5, + "rate_minus_exact_slow_float": 1.8713842888520076e-14 + }, + { + "abs_riccati_defect_float": 2.3613186277865937e-15, + "iter": 6, + "rate_minus_exact_slow_float": 1.4276830002343342e-16 + } + ], + "rotating_frame_soliton_clock_separation": { + "exact_commutator_L_bare_L_clock_zero": true, + "omega_rel": "7/5", + "resonant_rotating_frame_zero_lamb_shift": true, + "static_s0_schur_matches_lorentzian_formula": true + } + }, + "part_c_witness_map_and_gravity_c03_calibration": { + "halo_horizon_mass_scaling_laws": { + "exact_W_BH_CM_exponent_in_m": -15, + "exact_gamma_BH_CM_exponent_in_m": -10, + "exact_gamma_tLump_exponent_in_m": -11, + "m_crossover_tau_eq_cosmic_age_eV": 1.3358720104794574e-19, + "m_crossover_tau_eq_tLump_eV": 2.831391182627717e-20, + "verified_log10_m10_residual": 0.0 + }, + "sgrA_8kpc_crowd_unification": [ + { + "N_particles": 1.086037610737546e+93, + "decoheres_within_cosmic_age": true, + "decoheres_within_lump_lifetime": true, + "dx_over_b": 0.014472296883455563, + "dx_pc": 118.3833885066665, + "gamma_BH_CM_per_s": 41555874313761.56, + "id": "sun", + "kind": "halo", + "log10_N": 93.03584486563307, + "log10_W1_sgrA_8kpc": -159.0996911032825, + "log10_WCM_sgrA_8kpc": 120.00784349361669, + "log10_W_amplification_3logN": 279.1075345968992, + "log10_zeno_suppression_inv_N2": -186.07168973126613, + "m_eV": 1e-22, + "tau_BH_CM_over_cosmic_age": 5.525244424360273e-32, + "tau_BH_CM_over_t_dyn": 1.0665994908094625e-27, + "tau_BH_CM_s": 2.406398653652781e-14 + }, + { + "N_particles": 1.3407871737500571e+79, + "decoheres_within_cosmic_age": false, + "decoheres_within_lump_lifetime": false, + "dx_over_b": 4.824098961151855e-06, + "dx_pc": 0.03946112950222217, + "gamma_BH_CM_per_s": 7.037523804596452e-22, + "id": "sun-heavy", + "kind": "halo", + "log10_N": 79.12735984675442, + "log10_W1_sgrA_8kpc": -169.5310548674415, + "log10_WCM_sgrA_8kpc": 67.85102467282175, + "log10_W_amplification_3logN": 237.38207954026325, + "log10_zeno_suppression_inv_N2": -158.25471969350883, + "m_eV": 3e-19, + "tau_BH_CM_over_cosmic_age": 3262.601580140495, + "tau_BH_CM_over_t_dyn": 188944899998.4237, + "tau_BH_CM_s": 1.4209543409954296e+21 + }, + { + "N_particles": 7.125806888400949e+96, + "decoheres_within_cosmic_age": true, + "decoheres_within_lump_lifetime": true, + "dx_over_b": 0.08557457212713937, + "dx_pc": 700.0, + "gamma_BH_CM_per_s": 1.3996513178103516e+24, + "id": "core", + "kind": "core", + "log10_N": 96.85283404865795, + "log10_W1_sgrA_8kpc": -154.75957750238615, + "log10_WCM_sgrA_8kpc": 135.7989246435877, + "log10_W_amplification_3logN": 290.5585021459739, + "log10_zeno_suppression_inv_N2": -193.7056680973159, + "m_eV": 8e-23, + "tau_BH_CM_over_cosmic_age": 1.640454018295993e-42, + "tau_BH_CM_over_t_dyn": 2.105615458097789e-40, + "tau_BH_CM_s": 7.144636576804173e-25 + } + ], + "soliton_reconciliation_model_js_vs_gravity_C03": { + "I_total": 2.0622386791876086, + "Ic_inside_xc": 0.48740872294855386, + "M_sol_times_r_half_mass_dimless": 3.9251056992326903, + "M_sol_times_rc_dimless": 2.6794077901704356, + "diagnosis": "model.js uses half-density radius r_c (M*r_c = 2.6794 hbar^2/Gm^2); gravity C-03 uses half-mass radius r_(1/2) = 1.4649*r_c (M*r_(1/2) = 3.9251 hbar^2/Gm^2)", + "eInf": -0.6922289346180941, + "gravity_C03_reference_M_r_half": 3.9251, + "ratio_r_half_mass_over_rc": 1.4649153867627653, + "relative_diff_vs_gravity_C03": 1.4519968128776584e-06, + "x_half_mass": 1.903322704032946, + "xc_half_density": 1.2992714263442835 + } + }, + "probe": "probe4_witness_zeno_schur", + "r3_tcb_negative_controls": { + "all_r3_controls_rejected": true, + "exceptions": { + "GaussQ_bool_im": "TypeError", + "GaussQ_float_re": "TypeError", + "exact_frac_bool": "TypeError", + "exact_frac_float": "TypeError", + "exact_frac_str": "TypeError", + "isqrt_negative": "ValueError", + "matinv_q_ragged": "ValueError", + "matinv_q_singular": "ValueError" + } + }, + "seam": "SEAM-09 / Portal 3 (witness-map unified operator + exact 16x16 Lindblad Zeno Schur complement)" +} diff --git a/studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py b/studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py new file mode 100644 index 0000000..d82e804 --- /dev/null +++ b/studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py @@ -0,0 +1,1286 @@ +#!/usr/bin/env python3 +"""Probe 4: Unified Witness-Map Operator, Tomita-Takesaki Modular Flow Commutation, +and Exact 16x16 Zero-Float Lindblad Zeno Schur-Complement Theorem (SEAM-09 / Portal 3). + +Unifies the two separate panels of Foundation-0/fractals/witness-map/model.js +(single-particle witness number W vs. N ~ 10^93 coherent wave dark-matter crowd) +and bridges witness-map/model.js's Schroedinger-Poisson soliton to Foundation-0/gravity C-03. + +Parts A and B run in 100% pure exact arithmetic over Q and Q(i) (Python stdlib +fractions.Fraction + math.isqrt; ZERO floats, ZERO NumPy/SciPy, ZERO bare asserts). +Part C calibrates the exact N^3 CM amplification and 1/N^2 Zeno scaling against +Foundation-0/fractals/witness-map/model.js constants and Foundation-0/gravity C-03. + +Run cleanly under: + python3 -I -B -W error studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py + python3 -I -O -B -W error studies/expedition-witness-zeno-schur/probe4_witness_zeno_schur.py +""" + +from __future__ import annotations + +import hashlib +import json +import math +from fractions import Fraction +from pathlib import Path +from typing import Any, Dict, List, Sequence, Tuple + + +def check(cond: bool, msg: str) -> None: + """R4-safe verification guard (active even under python3 -O).""" + if not cond: + raise RuntimeError(f"Probe 4 verification failure: {msg}") + + +# ============================================================================= +# 0. STRICT R3 EXACT ARITHMETIC LAYER OVER Q AND Q(i) +# ============================================================================= + +def exact_frac(val: Any) -> Fraction: + """Strict exact rational converter rejecting bool, float, str, and complex.""" + if isinstance(val, bool): + raise TypeError("bool is not an exact rational input") + if isinstance(val, Fraction): + return val + if isinstance(val, int): + return Fraction(val, 1) + raise TypeError(f"Expected int or Fraction, got {type(val).__name__}") + + +class GaussQ: + """Exact Gaussian rational a + b*i in Q(i) with strict R3 type guards.""" + + __slots__ = ("re", "im") + + def __init__(self, re: Any, im: Any = 0) -> None: + self.re: Fraction = exact_frac(re) + self.im: Fraction = exact_frac(im) + + def __add__(self, other: Any) -> "GaussQ": + o = other if isinstance(other, GaussQ) else GaussQ(other, 0) + return GaussQ(self.re + o.re, self.im + o.im) + + def __radd__(self, other: Any) -> "GaussQ": + return self.__add__(other) + + def __sub__(self, other: Any) -> "GaussQ": + o = other if isinstance(other, GaussQ) else GaussQ(other, 0) + return GaussQ(self.re - o.re, self.im - o.im) + + def __rsub__(self, other: Any) -> "GaussQ": + o = other if isinstance(other, GaussQ) else GaussQ(other, 0) + return GaussQ(o.re - self.re, o.im - self.im) + + def __neg__(self) -> "GaussQ": + return GaussQ(-self.re, -self.im) + + def __mul__(self, other: Any) -> "GaussQ": + o = other if isinstance(other, GaussQ) else GaussQ(other, 0) + return GaussQ( + self.re * o.re - self.im * o.im, + self.re * o.im + self.im * o.re, + ) + + def __rmul__(self, other: Any) -> "GaussQ": + return self.__mul__(other) + + def conj(self) -> "GaussQ": + return GaussQ(self.re, -self.im) + + def norm2(self) -> Fraction: + return self.re * self.re + self.im * self.im + + def __truediv__(self, other: Any) -> "GaussQ": + o = other if isinstance(other, GaussQ) else GaussQ(other, 0) + n2 = o.norm2() + if n2 == 0: + raise ZeroDivisionError("Division by zero in Q(i)") + num = self * o.conj() + return GaussQ(num.re / n2, num.im / n2) + + def is_zero(self) -> bool: + return self.re == 0 and self.im == 0 + + def __eq__(self, other: Any) -> bool: + if isinstance(other, GaussQ): + return self.re == other.re and self.im == other.im + if isinstance(other, bool): + return False + if isinstance(other, (int, Fraction)): + return self.im == 0 and self.re == other + return False + + def __repr__(self) -> str: + return f"GaussQ({self.re}, {self.im})" + + +G0 = GaussQ(0, 0) +G1 = GaussQ(1, 0) +GI = GaussQ(0, 1) + + +def isqrt_bracket(q: Fraction, prec_bits: int = 80) -> Tuple[Fraction, Fraction]: + """Return exact rational outer bracket [lo, hi] with lo^2 <= q <= hi^2, hi - lo <= 2^-prec_bits.""" + qf = exact_frac(q) + if qf < 0: + raise ValueError(f"Negative radicand in isqrt_bracket: {qf}") + if qf == 0: + return Fraction(0), Fraction(0) + if isinstance(prec_bits, bool) or not isinstance(prec_bits, int) or prec_bits < 1: + raise ValueError("prec_bits must be a positive int") + scale = 1 << prec_bits + # Compute integer floor of sqrt(q * scale^2) = floor(sqrt(num * den * scale^2) / den) + n = qf.numerator + d = qf.denominator + s_int = math.isqrt(n * d * scale * scale) + lo = Fraction(s_int, d * scale) + # Tight exact integer ceiling check + if lo * lo == qf: + return lo, lo + hi = Fraction(s_int + 1, d * scale) + check(lo * lo <= qf <= hi * hi, "isqrt_bracket invariant violated") + return lo, hi + + +def _validate_square_q(mat: Sequence[Sequence[Any]]) -> List[List[Fraction]]: + n = len(mat) + if n == 0: + raise ValueError("Empty matrix") + out: List[List[Fraction]] = [] + for row in mat: + if len(row) != n: + raise ValueError("Matrix is not square") + out.append([exact_frac(x) for x in row]) + return out + + +def _validate_square_g(mat: Sequence[Sequence[Any]]) -> List[List[GaussQ]]: + n = len(mat) + if n == 0: + raise ValueError("Empty matrix") + out: List[List[GaussQ]] = [] + for row in mat: + if len(row) != n: + raise ValueError("Matrix is not square") + out.append([x if isinstance(x, GaussQ) else GaussQ(x, 0) for x in row]) + return out + + +def matmul_q(A: Sequence[Sequence[Fraction]], B: Sequence[Sequence[Fraction]]) -> List[List[Fraction]]: + m, k = len(A), len(A[0]) + check(len(B) == k, "matmul_q inner dimension mismatch") + n = len(B[0]) + return [ + [sum((A[i][p] * B[p][j] for p in range(k)), Fraction(0)) for j in range(n)] + for i in range(m) + ] + + +def matsub_q(A: Sequence[Sequence[Fraction]], B: Sequence[Sequence[Fraction]]) -> List[List[Fraction]]: + check(len(A) == len(B) and len(A[0]) == len(B[0]), "matsub_q shape mismatch") + return [[A[i][j] - B[i][j] for j in range(len(A[0]))] for i in range(len(A))] + + +def matadd_q(A: Sequence[Sequence[Fraction]], B: Sequence[Sequence[Fraction]]) -> List[List[Fraction]]: + check(len(A) == len(B) and len(A[0]) == len(B[0]), "matadd_q shape mismatch") + return [[A[i][j] + B[i][j] for j in range(len(A[0]))] for i in range(len(A))] + + +def transpose_q(A: Sequence[Sequence[Fraction]]) -> List[List[Fraction]]: + return [[A[i][j] for i in range(len(A))] for j in range(len(A[0]))] + + +def trace_q(A: Sequence[Sequence[Fraction]]) -> Fraction: + M = _validate_square_q(A) + return sum((M[i][i] for i in range(len(M))), Fraction(0)) + + +def matpow_q(A: Sequence[Sequence[Fraction]], p: int) -> List[List[Fraction]]: + M = _validate_square_q(A) + n = len(M) + res = [[Fraction(1 if i == j else 0) for j in range(n)] for i in range(n)] + base = M + e = p + while e > 0: + if e & 1: + res = matmul_q(res, base) + base = matmul_q(base, base) + e >>= 1 + return res + + +def matinv_q(A: Sequence[Sequence[Any]]) -> List[List[Fraction]]: + """Exact Gauss-Jordan matrix inverse over Q.""" + M = _validate_square_q(A) + n = len(M) + aug = [M[i][:] + [Fraction(1 if i == j else 0) for j in range(n)] for i in range(n)] + for col in range(n): + piv = -1 + for r in range(col, n): + if aug[r][col] != 0: + piv = r + break + if piv < 0: + raise ValueError("Matrix is singular over Q") + if piv != col: + aug[col], aug[piv] = aug[piv], aug[col] + pv = aug[col][col] + aug[col] = [x / pv for x in aug[col]] + for r in range(n): + if r != col and aug[r][col] != 0: + fac = aug[r][col] + aug[r] = [aug[r][c] - fac * aug[col][c] for c in range(2 * n)] + return [row[n:] for row in aug] + + +def matrank_q(A: Sequence[Sequence[Any]]) -> int: + """Exact rank over Q via row reduction.""" + M = _validate_square_q(A) + n = len(M) + row_idx = 0 + for col in range(n): + piv = -1 + for r in range(row_idx, n): + if M[r][col] != 0: + piv = r + break + if piv < 0: + continue + if piv != row_idx: + M[row_idx], M[piv] = M[piv], M[row_idx] + pv = M[row_idx][col] + M[row_idx] = [x / pv for x in M[row_idx]] + for r in range(row_idx + 1, n): + if M[r][col] != 0: + fac = M[r][col] + M[r] = [M[r][c] - fac * M[row_idx][c] for c in range(n)] + row_idx += 1 + return row_idx + + +def matmul_g(A: Sequence[Sequence[GaussQ]], B: Sequence[Sequence[GaussQ]]) -> List[List[GaussQ]]: + m, k = len(A), len(A[0]) + check(len(B) == k, "matmul_g inner dimension mismatch") + n = len(B[0]) + out: List[List[GaussQ]] = [] + for i in range(m): + row: List[GaussQ] = [] + for j in range(n): + acc = G0 + for p in range(k): + if not A[i][p].is_zero() and not B[p][j].is_zero(): + acc = acc + A[i][p] * B[p][j] + row.append(acc) + out.append(row) + return out + + +def matsub_g(A: Sequence[Sequence[GaussQ]], B: Sequence[Sequence[GaussQ]]) -> List[List[GaussQ]]: + check(len(A) == len(B) and len(A[0]) == len(B[0]), "matsub_g shape mismatch") + return [[A[i][j] - B[i][j] for j in range(len(A[0]))] for i in range(len(A))] + + +def matadd_g(A: Sequence[Sequence[GaussQ]], B: Sequence[Sequence[GaussQ]]) -> List[List[GaussQ]]: + check(len(A) == len(B) and len(A[0]) == len(B[0]), "matadd_g shape mismatch") + return [[A[i][j] + B[i][j] for j in range(len(A[0]))] for i in range(len(A))] + + +def dag_g(A: Sequence[Sequence[GaussQ]]) -> List[List[GaussQ]]: + return [[A[i][j].conj() for i in range(len(A))] for j in range(len(A[0]))] + + +def trace_g(A: Sequence[Sequence[GaussQ]]) -> GaussQ: + M = _validate_square_g(A) + acc = G0 + for i in range(len(M)): + acc = acc + M[i][i] + return acc + + +def matinv_g(A: Sequence[Sequence[Any]]) -> List[List[GaussQ]]: + """Exact Gauss-Jordan matrix inverse over Q(i).""" + M = _validate_square_g(A) + n = len(M) + aug = [M[i][:] + [G1 if i == j else G0 for j in range(n)] for i in range(n)] + for col in range(n): + piv = -1 + for r in range(col, n): + if not aug[r][col].is_zero(): + piv = r + break + if piv < 0: + raise ValueError("Matrix is singular over Q(i)") + if piv != col: + aug[col], aug[piv] = aug[piv], aug[col] + pv = aug[col][col] + aug[col] = [x / pv for x in aug[col]] + for r in range(n): + if r != col and not aug[r][col].is_zero(): + fac = aug[r][col] + aug[r] = [aug[r][c] - fac * aug[col][c] for c in range(2 * n)] + return [row[n:] for row in aug] + + +def r3_tcb_negative_controls() -> Dict[str, Any]: + """Verify R3 strict type/shape/singularity guards reject invalid inputs.""" + cases: Dict[str, str] = {} + + def expect_exc(name: str, fn: Any, exc_types: Tuple[type, ...]) -> None: + try: + fn() + except exc_types as exc: + cases[name] = type(exc).__name__ + return + raise RuntimeError(f"R3 negative control {name} failed to raise {exc_types}") + + expect_exc("exact_frac_bool", lambda: exact_frac(True), (TypeError,)) + expect_exc("exact_frac_float", lambda: exact_frac(1.25), (TypeError,)) + expect_exc("exact_frac_str", lambda: exact_frac("3/4"), (TypeError,)) + expect_exc("GaussQ_bool_im", lambda: GaussQ(1, False), (TypeError,)) + expect_exc("GaussQ_float_re", lambda: GaussQ(0.5, 0), (TypeError,)) + expect_exc("matinv_q_ragged", lambda: matinv_q([[1, 0], [0]]), (ValueError,)) + expect_exc("matinv_q_singular", lambda: matinv_q([[1, 2], [2, 4]]), (ValueError,)) + expect_exc("isqrt_negative", lambda: isqrt_bracket(Fraction(-1, 4)), (ValueError,)) + + return {"all_r3_controls_rejected": True, "exceptions": cases} + + +# ============================================================================= +# 1. PART A — EXACT MULTIPOLE SCALING, DIPOLE CANCELLATION & QUADRUPOLE SPLIT +# ============================================================================= + +def multipole_series_Lk( + R: Fraction, + xis: Sequence[Fraction], + max_order: int = 10, +) -> List[GaussQ]: + """Exact formal power series coefficients c_m of L_k(R, xi) = sum_j exp(i k (R + xi_j)) + up to k^max_order: c_m = (i^m / m!) * sum_j (R + xi_j)^m in Q(i). + """ + Rf = exact_frac(R) + xs = [Rf + exact_frac(x) for x in xis] + coeffs: List[GaussQ] = [] + fact = 1 + ipow = [G1, GI, -G1, -GI] + for m in range(max_order + 1): + if m > 0: + fact *= m + s = sum((x ** m for x in xs), Fraction(0)) + coeffs.append(ipow[m % 4] * GaussQ(s / fact, 0)) + return coeffs + + +def symmetrized_rate_poly( + R1: Fraction, + xi1: Sequence[Fraction], + R2: Fraction, + xi2: Sequence[Fraction], + gamma0: Fraction = Fraction(1), + max_even_order: int = 10, +) -> Dict[int, Fraction]: + """Exact even-power Taylor coefficients of + Gamma_sym(k) = (gamma0 / 4) * (|L_k(1) - L_k(2)|^2 + |L_{-k}(1) - L_{-k}(2)|^2) + = sum_{n=0}^{max_even_order/2} c_{2n} k^{2n} in Q[k^2]. + """ + g0 = exact_frac(gamma0) + a = multipole_series_Lk(R1, xi1, max_order=max_even_order) + b = multipole_series_Lk(R2, xi2, max_order=max_even_order) + diff = [a[m] - b[m] for m in range(max_even_order + 1)] + # |sum d_m k^m|^2 = sum_{p,q} d_p conj(d_q) k^{p+q}; symmetrizing k <-> -k keeps ONLY even p+q! + even_coeffs: Dict[int, Fraction] = {} + for deg in range(0, max_even_order + 1, 2): + acc = G0 + for p in range(deg + 1): + q = deg - p + acc = acc + diff[p] * diff[q].conj() + check(acc.im == 0, f"Nonzero imaginary part in |dL|^2 at order k^{deg}") + even_coeffs[deg] = (g0 * Fraction(1, 2)) * acc.re + return even_coeffs + + +def mass_quadrupole_exact(m_part: Fraction, R: Fraction, xis: Sequence[Fraction]) -> Fraction: + """Exact 1D mass quadrupole Q(R, xi) = sum_j m * (R + xi_j)^2 over Q.""" + mf = exact_frac(m_part) + Rf = exact_frac(R) + return sum((mf * (Rf + exact_frac(x)) ** 2 for x in xis), Fraction(0)) + + +def run_part_a_exact_multipoles() -> Dict[str, Any]: + """Verify exact N^3 CM witness amplification, exact O(k^0)/O(k^2) dipole cancellation, + quadrupole tidal rate, observer-invariant F^inv protection, Huygens-Steiner DSW split, + and negative control breaking sum(xi_j) = 0. + """ + gamma0 = Fraction(3, 5) + m_part = Fraction(7, 11) + hbar = Fraction(13, 17) + dR = Fraction(5, 3) + + configs: List[Tuple[int, List[Fraction], List[Fraction]]] = [ + (2, [Fraction(1, 2), Fraction(-1, 2)], [Fraction(3, 4), Fraction(-3, 4)]), + (3, [Fraction(-1), Fraction(1, 3), Fraction(2, 3)], [Fraction(-5, 4), Fraction(1, 4), Fraction(1)]), + (4, [Fraction(-3, 2), Fraction(-1, 2), Fraction(1, 2), Fraction(3, 2)], + [Fraction(-2), Fraction(0), Fraction(1, 2), Fraction(3, 2)]), + (5, [Fraction(-2), Fraction(-1, 2), Fraction(0), Fraction(1, 2), Fraction(2)], + [Fraction(-3), Fraction(1, 3), Fraction(2, 3), Fraction(1), Fraction(1)]), + (7, [Fraction(-3), Fraction(-2), Fraction(-1), Fraction(0), Fraction(1), Fraction(2), Fraction(3)], + [Fraction(-5), Fraction(-1), Fraction(0), Fraction(0), Fraction(1), Fraction(2), Fraction(3)]), + (10, [Fraction(j - 9, 2) for j in range(0, 20, 2)], + [Fraction(-5), Fraction(-4), Fraction(-1), Fraction(-1), Fraction(0), + Fraction(1), Fraction(1), Fraction(2), Fraction(3), Fraction(4)]), + ] + + cm_and_internal_rows: List[Dict[str, Any]] = [] + for N, xi1, xi2 in configs: + check(len(xi1) == N and len(xi2) == N, f"Config length mismatch for N={N}") + check(sum(xi1, Fraction(0)) == 0, f"xi1 not zero-CM for N={N}") + check(sum(xi2, Fraction(0)) == 0, f"xi2 not zero-CM for N={N}") + + I1 = sum((x * x for x in xi1), Fraction(0)) + I2 = sum((x * x for x in xi2), Fraction(0)) + dI = I1 - I2 + check(dI != 0, f"Test pair should have nonzero Delta I_int for N={N}") + + # 1. Pure CM displacement (same internal shape xi1, R1 = dR, R2 = 0) + cm_poly = symmetrized_rate_poly(dR, xi1, Fraction(0), xi1, gamma0=gamma0, max_even_order=6) + single_poly = symmetrized_rate_poly(dR, [Fraction(0)], Fraction(0), [Fraction(0)], gamma0=gamma0, max_even_order=6) + check(cm_poly[0] == 0, "CM O(k^0) must vanish") + check(cm_poly[2] == N * N * single_poly[2], "Exact Gamma_CM = N^2 Gamma_1 failed") + check(cm_poly[2] == (gamma0 * Fraction(1, 2)) * (N ** 2) * (dR ** 2), "CM O(k^2) formula mismatch") + + t_wave_1 = m_part * (dR ** 2) / hbar + t_wave_N = (N * m_part) * (dR ** 2) / hbar + W1_k2 = single_poly[2] * t_wave_1 + WN_k2 = cm_poly[2] * t_wave_N + check(WN_k2 == (N ** 3) * W1_k2, "Exact W_CM = N^3 W_single cube law failed") + + # 2. Pure internal shape superposition (R1 = R2 = R0, zero-CM xi1 vs xi2) + R0 = Fraction(11, 7) + int_poly = symmetrized_rate_poly(R0, xi1, R0, xi2, gamma0=gamma0, max_even_order=8) + check(int_poly[0] == 0, "Internal O(k^0) must vanish") + check(int_poly[2] == 0, "Exact O(k^2) dipole cancellation failed") + expected_k4 = (gamma0 * Fraction(1, 8)) * (dI ** 2) + check(int_poly[4] == expected_k4, "Exact O(k^4) quadrupole tidal rate formula mismatch") + + # Exact protection ratio P_inv * k^2 = Gamma_CM^(2) / Gamma_int^(4) = 4 N^2 dR^2 / dI^2 + p_inv_times_k2 = cm_poly[2] / int_poly[4] + expected_p_inv = Fraction(4 * N * N) * (dR ** 2) / (dI ** 2) + check(p_inv_times_k2 == expected_p_inv, "Exact protection ratio formula mismatch") + + # 3. Huygens-Steiner / DSW Black-Hole Mass-Quadrupole Separation Lemma + Q_full = mass_quadrupole_exact(m_part, R0, xi1) + Q_split = N * m_part * (R0 ** 2) + m_part * I1 + check(Q_full == Q_split, "Exact Huygens-Steiner mass-quadrupole split failed") + dQ_cm = mass_quadrupole_exact(m_part, dR, xi1) - mass_quadrupole_exact(m_part, Fraction(0), xi1) + dQ_single = mass_quadrupole_exact(m_part, dR, [Fraction(0)]) - mass_quadrupole_exact(m_part, Fraction(0), [Fraction(0)]) + check(dQ_cm == N * dQ_single, "Exact CM quadrupole scaling failed") + # DSW rate Gamma_BH propto (dQ)^2 -> N^2, W_BH propto (dQ)^2 * (N m dR^2) -> N^3 + check((dQ_cm ** 2) * t_wave_N == (N ** 3) * (dQ_single ** 2) * t_wave_1, "Exact DSW N^3 cube law failed") + + cm_and_internal_rows.append({ + "N": N, + "Delta_I_int": str(dI), + "W_CM_over_W_single_exact": str(WN_k2 / W1_k2), + "internal_O_k0": str(int_poly[0]), + "internal_O_k2_dipole_cancelled": str(int_poly[2]), + "internal_O_k4_quadrupole": str(int_poly[4]), + "P_inv_times_k2_exact": str(p_inv_times_k2), + "huygens_steiner_cross_term_zero": True, + }) + + # 4. Observer-invariant subspace F^inv (exact zero decoherence to all tested orders) + xi_asym = [Fraction(-2), Fraction(1, 2), Fraction(3, 2)] + xi_perm = [Fraction(3, 2), Fraction(-2), Fraction(1, 2)] + xi_parity = [-x for x in xi_asym] + perm_poly = symmetrized_rate_poly(Fraction(3, 2), xi_asym, Fraction(3, 2), xi_perm, gamma0=gamma0, max_even_order=10) + parity_poly = symmetrized_rate_poly(Fraction(3, 2), xi_asym, Fraction(3, 2), xi_parity, gamma0=gamma0, max_even_order=10) + check(all(v == 0 for v in perm_poly.values()), "Permutation isometric mode must have exact zero decoherence") + check(parity_poly[0] == 0 and parity_poly[2] == 0 and parity_poly[4] == 0, "Parity mode must vanish through O(k^4)") + check(parity_poly[6] > 0, "Asymmetric parity mode should activate at O(k^6) octupole") + # DSW quadrupole difference identically 0 on both F^inv modes: + check(mass_quadrupole_exact(m_part, Fraction(3, 2), xi_asym) == mass_quadrupole_exact(m_part, Fraction(3, 2), xi_perm), + "DSW quadrupole must vanish on permutation mode") + check(mass_quadrupole_exact(m_part, Fraction(3, 2), xi_asym) == mass_quadrupole_exact(m_part, Fraction(3, 2), xi_parity), + "DSW quadrupole must vanish on parity mode") + + # 5. Negative Control: break sum(xi_j) = 0 -> O(k^2) dipole decoherence & Q cross-term immediately turn nonzero! + xi_bad = [Fraction(-1), Fraction(1, 3), Fraction(5, 3)] # sum = +1 != 0 + bad_poly = symmetrized_rate_poly(Fraction(3, 2), xi_asym, Fraction(3, 2), xi_bad, gamma0=gamma0, max_even_order=6) + expected_bad_k2 = (gamma0 * Fraction(1, 2)) * ((sum(xi_asym) - sum(xi_bad)) ** 2) + check(bad_poly[2] == expected_bad_k2 and bad_poly[2] > 0, "Broken-CM negative control must restore O(k^2) decoherence") + R_test = Fraction(5, 2) + Q_bad_cross = ( + mass_quadrupole_exact(m_part, R_test, xi_bad) + - (3 * m_part * (R_test ** 2) + m_part * sum(x * x for x in xi_bad)) + ) + check(Q_bad_cross == 2 * m_part * R_test * sum(xi_bad) and Q_bad_cross != 0, + "Broken-CM negative control must produce nonzero quadrupole cross-term") + + return { + "exact_arithmetic": "100% pure Fraction / Q(i)", + "configs_verified": cm_and_internal_rows, + "observer_invariant_Finv": { + "permutation_zero_through_k10": all(v == 0 for v in perm_poly.values()), + "parity_asymmetric_zero_through_k4": (parity_poly[0] == 0 and parity_poly[2] == 0 and parity_poly[4] == 0), + "parity_asymmetric_octupole_k6": str(parity_poly[6]), + "dsw_quadrupole_shift_zero_on_Finv": True, + }, + "negative_control_broken_CM": { + "sum_xi_bad": str(sum(xi_bad)), + "restored_O_k2_rate": str(bad_poly[2]), + "expected_O_k2_rate": str(expected_bad_k2), + "quadrupole_cross_term_nonzero": str(Q_bad_cross), + "dipole_protection_broken": bad_poly[2] > 0, + }, + } + + +# ============================================================================= +# 2. PART B — FIRST-PRINCIPLES 16x16 GKSL SUPEROPERATOR, MODULAR FLOW, +# EXACT SCHUR COMPLEMENT, RICCATI BRIDGE & EXCEPTIONAL POINT PHASE BOUNDARY +# ============================================================================= + +PAULI_LABELS = ("I", "X", "Y", "Z") +PAULI_2X2: Dict[str, List[List[GaussQ]]] = { + "I": [[G1, G0], [G0, G1]], + "X": [[G0, G1], [G1, G0]], + "Y": [[G0, -GI], [GI, G0]], + "Z": [[G1, G0], [G0, -G1]], +} + + +def kron_g(A: Sequence[Sequence[GaussQ]], B: Sequence[Sequence[GaussQ]]) -> List[List[GaussQ]]: + ra, ca = len(A), len(A[0]) + rb, cb = len(B), len(B[0]) + out: List[List[GaussQ]] = [] + for i in range(ra): + for k in range(rb): + row: List[GaussQ] = [] + for j in range(ca): + for l in range(cb): + row.append(A[i][j] * B[k][l]) + out.append(row) + return out + + +def scale_mat_g(c: GaussQ, M: Sequence[Sequence[GaussQ]]) -> List[List[GaussQ]]: + return [[c * x for x in row] for row in M] + + +# Orthonormal Hilbert-Schmidt Pauli basis ordered into: +# V_inv (indices 0..7): {I, Z}_CM x {I, X, Y, Z}_rel = ker(D[Z x I]) +# V_wit (indices 8..15): {X, Y}_CM x {I, X, Y, Z}_rel = im(D[Z x I]) +BASIS_LABELS: List[str] = ( + [f"{a}{b}" for a in ("I", "Z") for b in PAULI_LABELS] + + [f"{a}{b}" for a in ("X", "Y") for b in PAULI_LABELS] +) +INV_INDICES = list(range(8)) +WIT_INDICES = list(range(8, 16)) + + +def build_pauli_basis_4x4() -> List[List[List[GaussQ]]]: + half = GaussQ(Fraction(1, 2), 0) + basis: List[List[List[GaussQ]]] = [] + for lbl in BASIS_LABELS: + P = kron_g(PAULI_2X2[lbl[0]], PAULI_2X2[lbl[1]]) + basis.append(scale_mat_g(half, P)) + # Verify exact HS orthonormality + for i in range(16): + for j in range(16): + ip = trace_g(matmul_g(dag_g(basis[i]), basis[j])) + expected = G1 if i == j else G0 + check(ip == expected, f"Pauli basis not orthonormal at ({i},{j})") + return basis + + +PAULI_BASIS = build_pauli_basis_4x4() + + +def pauli_op_4x4(lbl: str) -> List[List[GaussQ]]: + return kron_g(PAULI_2X2[lbl[0]], PAULI_2X2[lbl[1]]) + + +def gksl_action( + rho: List[List[GaussQ]], + H: List[List[GaussQ]], + jumps: Sequence[Tuple[Fraction, List[List[GaussQ]]]], +) -> List[List[GaussQ]]: + """Exact GKSL superoperator L(rho) = -i[H, rho] + sum_a gamma_a (L_a rho L_a^dag - 1/2 {L_a^dag L_a, rho}).""" + comm = matsub_g(matmul_g(H, rho), matmul_g(rho, H)) + out = scale_mat_g(-GI, comm) + half = GaussQ(Fraction(1, 2), 0) + for gamma, L in jumps: + gf = exact_frac(gamma) + if gf == 0: + continue + Ld = dag_g(L) + LdL = matmul_g(Ld, L) + term1 = matmul_g(matmul_g(L, rho), Ld) + anti = matadd_g(matmul_g(LdL, rho), matmul_g(rho, LdL)) + diss = matsub_g(term1, scale_mat_g(half, anti)) + out = matadd_g(out, scale_mat_g(GaussQ(gf, 0), diss)) + return out + + +def superop_matrix_q( + H: List[List[GaussQ]], + jumps: Sequence[Tuple[Fraction, List[List[GaussQ]]]], +) -> List[List[Fraction]]: + """Compute exact 16x16 real-rational matrix L_{ab} = tr(E_a L(E_b)) in the Pauli basis.""" + M: List[List[Fraction]] = [[Fraction(0) for _ in range(16)] for _ in range(16)] + for col in range(16): + img = gksl_action(PAULI_BASIS[col], H, jumps) + for row in range(16): + val = trace_g(matmul_g(PAULI_BASIS[row], img)) + check(val.im == 0, f"Superoperator failed Hermiticity preservation at ({row},{col}): {val}") + M[row][col] = val.re + return M + + +def build_witness_lindbladian( + N: int, + gamma1: Fraction, + g: Fraction, + gamma_tid: Fraction, + omega_rel: Fraction = Fraction(0), + cm_jump_label: str = "ZI", +) -> List[List[Fraction]]: + """Build exact 16x16 Pauli-basis GKSL generator for bipartite H_CM x H_rel.""" + Nf = exact_frac(N) + g1 = exact_frac(gamma1) + gf = exact_frac(g) + gt = exact_frac(gamma_tid) + om = exact_frac(omega_rel) + H = matadd_g( + scale_mat_g(GaussQ(gf, 0), pauli_op_4x4("XZ")), + scale_mat_g(GaussQ(om, 0), pauli_op_4x4("IZ")), + ) + jumps = [ + (Nf * Nf * g1, pauli_op_4x4(cm_jump_label)), + (gt, pauli_op_4x4("ZZ")), + ] + return superop_matrix_q(H, jumps) + + +def extract_block_q(M: Sequence[Sequence[Fraction]], rows: Sequence[int], cols: Sequence[int]) -> List[List[Fraction]]: + return [[M[r][c] for c in cols] for r in rows] + + +def exact_schur_inv(L: Sequence[Sequence[Fraction]]) -> List[List[Fraction]]: + """Exact 8x8 Schur complement L_eff^inv = L_inv,inv - L_inv,wit L_wit,wit^{-1} L_wit,inv over Q.""" + L_ii = extract_block_q(L, INV_INDICES, INV_INDICES) + L_iw = extract_block_q(L, INV_INDICES, WIT_INDICES) + L_wi = extract_block_q(L, WIT_INDICES, INV_INDICES) + L_ww = extract_block_q(L, WIT_INDICES, WIT_INDICES) + L_ww_inv = matinv_q(L_ww) + corr = matmul_q(matmul_q(L_iw, L_ww_inv), L_wi) + return matsub_q(L_ii, corr) + + +def modular_operator_matrix_g(rho: List[List[GaussQ]]) -> List[List[GaussQ]]: + """Exact 16x16 matrix over Q(i) of Tomita-Takesaki modular operator Delta_rho(A) = rho A rho^{-1}.""" + rho_inv = matinv_g(rho) + M: List[List[GaussQ]] = [[G0 for _ in range(16)] for _ in range(16)] + for col in range(16): + img = matmul_g(matmul_g(rho, PAULI_BASIS[col]), rho_inv) + for row in range(16): + M[row][col] = trace_g(matmul_g(PAULI_BASIS[row], img)) + return M + + +def superop_to_g(M: Sequence[Sequence[Fraction]]) -> List[List[GaussQ]]: + return [[GaussQ(x, 0) for x in row] for row in M] + + +def max_abs_entry_g(M: Sequence[Sequence[GaussQ]]) -> Fraction: + best = Fraction(0) + for row in M: + for x in row: + n2 = x.norm2() + if n2 > best: + best = n2 + return best + + +def verify_hermitian_pd_4x4(rho: List[List[GaussQ]]) -> None: + """Verify 4x4 matrix over Q(i) is Hermitian, trace 1, and strictly positive definite via exact Sylvester minors.""" + check(rho == dag_g(rho), "rho is not Hermitian") + check(trace_g(rho) == G1, f"tr(rho) != 1: {trace_g(rho)}") + # Exact leading principal minors of 4x4 Hermitian matrix over Q(i) + for k in range(1, 5): + sub = [[rho[i][j] for j in range(k)] for i in range(k)] + # Bareiss / Gaussian det over Q(i) + A = [row[:] for row in sub] + det = G1 + for col in range(k): + piv = -1 + for r in range(col, k): + if not A[r][col].is_zero(): + piv = r + break + check(piv >= 0, f"Leading principal minor {k} is zero (not strictly PD)") + if piv != col: + A[col], A[piv] = A[piv], A[col] + det = -det + pv = A[col][col] + det = det * pv + for r in range(col + 1, k): + if not A[r][col].is_zero(): + fac = A[r][col] / pv + for c in range(col, k): + A[r][c] = A[r][c] - fac * A[col][c] + check(det.im == 0 and det.re > 0, f"Leading principal minor {k} not strictly positive: {det}") + + +def householder_q(vec: Sequence[Fraction]) -> List[List[Fraction]]: + """Exact rational orthogonal Householder reflection H = I - 2 v v^T / (v^T v) in O(n, Q).""" + v = [exact_frac(x) for x in vec] + n = len(v) + v2 = sum((x * x for x in v), Fraction(0)) + check(v2 > 0, "Householder vector must be nonzero") + H = [ + [Fraction(1 if i == j else 0) - Fraction(2) * v[i] * v[j] / v2 for j in range(n)] + for i in range(n) + ] + return H + + +def run_part_b_exact_lindblad_zeno() -> Dict[str, Any]: + """Verify exact 16x16 GKSL Lindblad structure, Tomita-Takesaki modular-flow commutation, + exact Schur complement Zeno sealing, EP2 Jordan block, zero-float isqrt eigenvalue brackets, + Probe-1 Riccati lift bridge, rotating-frame soliton clock separation, basis invariance, + and adversarial witness negative controls. + """ + H0 = [[G0 for _ in range(4)] for _ in range(4)] + + # 1. Exact Tomita-Takesaki Modular Flow Commutation [D[Z x I], Delta_{rho_S}] = 0 on V_inv + # Construct non-diagonal, non-product faithful state rho_S = p0 |0><0| x rho_0 + p1 |1><1| x rho_1 + p0, p1 = Fraction(2, 5), Fraction(3, 5) + I2, X2, Y2, Z2 = PAULI_2X2["I"], PAULI_2X2["X"], PAULI_2X2["Y"], PAULI_2X2["Z"] + proj0 = [[G1, G0], [G0, G0]] + proj1 = [[G0, G0], [G0, G1]] + rho0 = scale_mat_g( + GaussQ(Fraction(1, 2), 0), + matadd_g(I2, matadd_g(scale_mat_g(GaussQ(Fraction(1, 3), 0), X2), scale_mat_g(GaussQ(Fraction(1, 4), 0), Z2))), + ) + rho1 = scale_mat_g( + GaussQ(Fraction(1, 2), 0), + matadd_g(I2, matadd_g(scale_mat_g(GaussQ(Fraction(1, 5), 0), Y2), scale_mat_g(GaussQ(Fraction(-1, 3), 0), Z2))), + ) + # Confirm non-commuting internal states [rho0, rho1] != 0 + comm01 = matsub_g(matmul_g(rho0, rho1), matmul_g(rho1, rho0)) + check(max_abs_entry_g(comm01) > 0, "rho0 and rho1 should be non-commuting for nontrivial test") + + rho_S = matadd_g( + scale_mat_g(GaussQ(p0, 0), kron_g(proj0, rho0)), + scale_mat_g(GaussQ(p1, 0), kron_g(proj1, rho1)), + ) + verify_hermitian_pd_4x4(rho_S) + + D_CM_q = superop_matrix_q(H0, [(Fraction(1), pauli_op_4x4("ZI"))]) + D_CM_g = superop_to_g(D_CM_q) + Delta_rho = modular_operator_matrix_g(rho_S) + check(Delta_rho == dag_g(Delta_rho), "Tomita-Takesaki modular operator Delta_rho must be HS-Hermitian") + Delta_inv = matinv_g(Delta_rho) + prod_id = matmul_g(Delta_rho, Delta_inv) + I16_g = [[G1 if i == j else G0 for j in range(16)] for i in range(16)] + check(prod_id == I16_g, "Delta_rho * Delta_rho^{-1} != I_16") + + # Exact 16x16 commutator [D[Z x I], Delta_{rho_S}] == 0 + comm_mod_inv = matsub_g(matmul_g(D_CM_g, Delta_rho), matmul_g(Delta_rho, D_CM_g)) + check(max_abs_entry_g(comm_mod_inv) == 0, "Modular operator failed to commute with CM witness on V_inv") + # Exact KMS detailed balance: D_CM^dag == Delta^{-1} D_CM Delta + kms_diff = matsub_g(dag_g(D_CM_g), matmul_g(matmul_g(Delta_inv, D_CM_g), Delta_rho)) + check(max_abs_entry_g(kms_diff) == 0, "Exact KMS detailed balance failed") + # Exact ker(D_CM) == V_inv (indices 0..7) + check(all(D_CM_q[r][c] == 0 for r in range(16) for c in INV_INDICES), "D_CM must vanish on V_inv") + check(all(D_CM_q[i][i] == Fraction(-2) for i in WIT_INDICES), "D_CM must equal -2 I on V_wit") + + # Modular negative control 1: add CM coherence (1/10)(X x I) -> rho_coh not in V_inv + rho_coh = matadd_g(rho_S, scale_mat_g(GaussQ(Fraction(1, 20), 0), pauli_op_4x4("XI"))) + verify_hermitian_pd_4x4(rho_coh) + Delta_coh = modular_operator_matrix_g(rho_coh) + comm_mod_coh = matsub_g(matmul_g(D_CM_g, Delta_coh), matmul_g(Delta_coh, D_CM_g)) + norm2_mod_coh = max_abs_entry_g(comm_mod_coh) + check(norm2_mod_coh > 0, "Coherent-CM state must break modular commutation") + + # Modular negative control 2: local internal witness I x Z and entangling witness Z x X on same rho_S in V_inv + D_loc_g = superop_to_g(superop_matrix_q(H0, [(Fraction(1), pauli_op_4x4("IZ"))])) + D_mix_g = superop_to_g(superop_matrix_q(H0, [(Fraction(1), pauli_op_4x4("ZX"))])) + norm2_mod_loc = max_abs_entry_g(matsub_g(matmul_g(D_loc_g, Delta_rho), matmul_g(Delta_rho, D_loc_g))) + norm2_mod_mix = max_abs_entry_g(matsub_g(matmul_g(D_mix_g, Delta_rho), matmul_g(Delta_rho, D_mix_g))) + check(norm2_mod_loc > 0, "Local witness I x Z must break modular commutation on V_inv") + check(norm2_mod_mix > 0, "Entangling witness Z x X must break modular commutation on V_inv") + + # 2. Exact 16x16 Schur Complement Sweep across N = 1..100 & General (g, gamma1, gamma_tid) + g_val = Fraction(3, 2) + gamma1 = Fraction(1, 4) + gamma_tid = Fraction(1, 100) + schur_rows: List[Dict[str, Any]] = [] + for N in (1, 2, 3, 5, 10, 20, 50, 100): + L = build_witness_lindbladian(N=N, gamma1=gamma1, g=g_val, gamma_tid=gamma_tid) + # Verify trace preservation (row 0 = II is all 0) and unitality (col 0 = II is all 0) + check(all(L[0][c] == 0 for c in range(16)), "Trace preservation failed") + check(all(L[r][0] == 0 for r in range(16)), "Unitality failed") + + S_inv = exact_schur_inv(L) + g_cm = Fraction(N * N) * gamma1 + expected_diag = [ + Fraction(0), # II (trace) + -(2 * gamma_tid + 2 * g_val * g_val / g_cm), # IX (internal X coherence, Zeno sealed!) + -(2 * gamma_tid + 2 * g_val * g_val / g_cm), # IY (internal Y coherence, Zeno sealed!) + Fraction(0), # IZ (exact F^inv pointer!) + -2 * g_val * g_val / (g_cm + gamma_tid), # ZI (CM Z population, Zeno frozen!) + -2 * gamma_tid, # ZX (conditional coherence, immune to g) + -2 * gamma_tid, # ZY (conditional coherence, immune to g) + -2 * g_val * g_val / (g_cm + gamma_tid), # ZZ (CM-rel correlation, Zeno frozen!) + ] + for i in range(8): + for j in range(8): + want = expected_diag[i] if i == j else Fraction(0) + check(S_inv[i][j] == want, f"Schur complement mismatch at N={N}, ({i},{j}): {S_inv[i][j]} vs {want}") + + # Exact 2x2 subblock check & zero-float isqrt eigenvalue bracket when overdamped + disc_quarter = (g_cm - gamma_tid) ** 2 - 4 * g_val * g_val + regime = "underdamped" if disc_quarter < 0 else ("EP2" if disc_quarter == 0 else "overdamped_zeno") + gamma_schur = 2 * gamma_tid + 2 * g_val * g_val / g_cm + row_info: Dict[str, Any] = { + "N": N, + "gamma_CM": str(g_cm), + "regime": regime, + "Gamma_Schur_IX_IY_exact": str(gamma_schur), + "IZ_decay_exact": str(S_inv[3][3]), + "ZI_decay_exact": str(-S_inv[4][4]), + "ZX_decay_exact": str(-S_inv[5][5]), + } + if disc_quarter > 0: + sq_lo, sq_hi = isqrt_bracket(disc_quarter, prec_bits=80) + # -lambda_slow = (g_cm + gamma_tid) - sqrt(disc_quarter) in [(g_cm+gt) - sq_hi, (g_cm+gt) - sq_lo] + slow_lo = (g_cm + gamma_tid) - sq_hi + slow_hi = (g_cm + gamma_tid) - sq_lo + fast_lo = (g_cm + gamma_tid) + sq_lo + fast_hi = (g_cm + gamma_tid) + sq_hi + # Exact algebraic product identity: (-lambda_slow)(-lambda_fast) == 2*g_cm * Gamma_Schur + prod_exact = 2 * g_cm * gamma_schur + check(slow_lo * fast_lo <= prod_exact <= slow_hi * fast_hi, "Exact eigenvalue-Schur product identity failed") + # Ratio (-lambda_slow) / Gamma_Schur == 2*g_cm / (-lambda_fast) + ratio_lo = slow_lo / gamma_schur + ratio_hi = slow_hi / gamma_schur + check(ratio_lo >= Fraction(1) - Fraction(1, 10**6), "Ratio unexpectedly below 1") + row_info["neg_lambda_slow_over_Gamma_Schur_float"] = round(float((ratio_lo + ratio_hi) / 2), 12) + row_info["neg_lambda_slow_bracket_width"] = float(slow_hi - slow_lo) + schur_rows.append(row_info) + + # 3. Exact Exceptional Point (EP2) Jordan Block Verification at gamma_CM = 2*g (gamma_tid = 0) + # Choose N_EP = 4, gamma1 = 1/4 -> gamma_CM = 4, g = 2 -> gamma_CM == 2*g EXACTLY! + g_ep = Fraction(2) + g1_ep = Fraction(1, 4) + N_ep = 4 + L_ep = build_witness_lindbladian(N=N_ep, gamma1=g1_ep, g=g_ep, gamma_tid=Fraction(0)) + lam_ep = -2 * g_ep # -4 + # Full 16x16 shifted operator A_ep = L_ep - lam_ep * I_16 + A_ep = [[L_ep[i][j] - (lam_ep if i == j else Fraction(0)) for j in range(16)] for i in range(16)] + A_ep_sq = matmul_q(A_ep, A_ep) + rank1 = matrank_q(A_ep) + rank2 = matrank_q(A_ep_sq) + # Two simultaneous EP2 Jordan blocks (IX<->XY and IY<->XX), PLUS ZI<->YZ and ZZ<->YI ALSO hit EP2 + # when gamma_tid = 0! (All FOUR 2x2 blocks have [-0, +-2g; -+2g, -2*gamma_CM] with identical EP at gamma_CM=2g!) + # Check exact 2x2 block on (IX=1, XY=10): + sub_idx = [BASIS_LABELS.index("IX"), BASIS_LABELS.index("XY")] + L_sub_ep = extract_block_q(L_ep, sub_idx, sub_idx) + N_jordan = [[L_sub_ep[i][j] - (lam_ep if i == j else Fraction(0)) for j in range(2)] for i in range(2)] + N_jordan_sq = matmul_q(N_jordan, N_jordan) + check(any(N_jordan[i][j] != 0 for i in range(2) for j in range(2)), "EP2 nilpotent part must be nonzero") + check(all(N_jordan_sq[i][j] == 0 for i in range(2) for j in range(2)), "EP2 nilpotent square must vanish identically") + check(matrank_q(N_jordan) == 1, "EP2 2x2 Jordan block must have exact rank 1") + # In the full 16x16 operator at gamma_tid = 0, gamma_CM = 2g: all 4 pairs (IX/XY, IY/XX, ZI/YZ, ZZ/YI) + # simultaneously hit EP2 -> nullity(A_ep) = 4 (rank 12), nullity(A_ep^2) = 8 (rank 8)! + check(rank1 == 12 and rank2 == 8, f"Expected full 16x16 EP2 ranks (12, 8), got ({rank1}, {rank2})") + + # Also verify split EP2 when gamma_tid > 0 (breaks degeneracy between IX/IY EP at 2g+gt and ZI/ZZ EP at 2g-gt!): + # Set gt = 1, g = 2, gamma_CM = 5 -> gamma_CM - gt = 4 = 2g (IX/IY exact EP2, while ZI/ZZ has g_cm+gt=6 > 4 overdamped!) + L_ep_split = build_witness_lindbladian(N=5, gamma1=Fraction(1, 5), g=Fraction(2), gamma_tid=Fraction(1)) + lam_ep_split = Fraction(-6) # -(gamma_CM + gamma_tid) = -6 + A_split = [[L_ep_split[i][j] - (lam_ep_split if i == j else Fraction(0)) for j in range(16)] for i in range(16)] + A_split_sq = matmul_q(A_split, A_split) + rank_split_1 = matrank_q(A_split) + rank_split_2 = matrank_q(A_split_sq) + check(rank_split_1 == 14 and rank_split_2 == 12, + f"Split EP2 (gt=1) must isolate exact 2 Jordan blocks (IX, IY): expected ranks (14, 12), got ({rank_split_1}, {rank_split_2})") + + # 4. Exact Riccati Slow-Manifold Bridge to Probe 1 (stationary R[H] = C + FH - H(A + BH) = 0) + # On (u = IX, v = XY): A = -2*gt, B = -2*g, C = +2*g, F = -2*g_cm + # Riccati eq: 2*g - 2*g_cm*H - H*(-2*gt - 2*g*H) = 0 <=> H = (g + gt*H + g*H^2) / g_cm + N_ric = 10 + g_cm_ric = Fraction(N_ric * N_ric) * gamma1 # 25 > 2*(3/2)+0.01 = 3.01 + H_iter = Fraction(0) + riccati_chain: List[Dict[str, Any]] = [] + disc_ric = (g_cm_ric - gamma_tid) ** 2 - 4 * g_val * g_val + sq_lo_r, sq_hi_r = isqrt_bracket(disc_ric, prec_bits=96) + exact_slow_lo = (g_cm_ric + gamma_tid) - sq_hi_r + exact_slow_hi = (g_cm_ric + gamma_tid) - sq_lo_r + for step in range(7): + if step == 0: + # H_0 = -F^{-1} C = g / g_cm (exact Schur complement!) + H_iter = g_val / g_cm_ric + else: + H_iter = (g_val + gamma_tid * H_iter + g_val * H_iter * H_iter) / g_cm_ric + # Exact Riccati commutation defect R[H] = C + F*H - H*(A + B*H) + R_def = 2 * g_val - 2 * g_cm_ric * H_iter - H_iter * (-2 * gamma_tid - 2 * g_val * H_iter) + rate_k = 2 * gamma_tid + 2 * g_val * H_iter + if step == 0: + check(rate_k == 2 * gamma_tid + 2 * g_val * g_val / g_cm_ric, "H_0 must equal exact Schur complement") + riccati_chain.append({ + "iter": step, + "abs_riccati_defect_float": float(abs(R_def)), + "rate_minus_exact_slow_float": float(abs(rate_k - (exact_slow_lo + exact_slow_hi) / 2)), + }) + check(riccati_chain[-1]["abs_riccati_defect_float"] < 1e-12, "Riccati Fenichel iteration failed to converge") + check(riccati_chain[-1]["rate_minus_exact_slow_float"] < 1e-12, "Riccati slow rate failed to match exact -lambda_slow") + + # 5. Exact Rotating-Frame Soliton Clock Separation (H_rel = omega * I x Z) + omega_val = Fraction(7, 5) + L_bare = build_witness_lindbladian(N=10, gamma1=gamma1, g=g_val, gamma_tid=gamma_tid, omega_rel=Fraction(0)) + L_clock_only = superop_matrix_q(scale_mat_g(GaussQ(omega_val, 0), pauli_op_4x4("IZ")), []) + L_with_clock = build_witness_lindbladian(N=10, gamma1=gamma1, g=g_val, gamma_tid=gamma_tid, omega_rel=omega_val) + check(L_with_clock == matadd_q(L_bare, L_clock_only), "Lindbladian linearity check failed") + comm_clock = matsub_q(matmul_q(L_bare, L_clock_only), matmul_q(L_clock_only, L_bare)) + check(all(comm_clock[i][j] == 0 for i in range(16) for j in range(16)), + "Internal soliton clock H_rel = omega (I x Z) must commute identically with CM witness & Zeno Lindbladian") + # Static s=0 Schur complement vs resonant rotating-frame Schur complement: + S_static_omega = exact_schur_inv(L_with_clock) + g_cm_10 = Fraction(100) * gamma1 + expected_static_diag = -(2 * gamma_tid + 2 * g_val * g_val * g_cm_10 / (g_cm_10 ** 2 + omega_val ** 2)) + expected_static_off = -(2 * omega_val) + 2 * g_val * g_val * omega_val / (g_cm_10 ** 2 + omega_val ** 2) + check(S_static_omega[1][1] == expected_static_diag and S_static_omega[2][2] == expected_static_diag, + "Static s=0 Schur complement with omega_rel mismatch on diagonal") + check(S_static_omega[1][2] == expected_static_off and S_static_omega[2][1] == -expected_static_off, + "Static s=0 Schur complement with omega_rel mismatch on off-diagonal") + # Meanwhile because [L_bare, L_clock_only] = 0, exact complex eigenvalues are literally lambda(L_bare) +/- 2 i omega + # (zero Lamb shift in exact resonant rotating frame!). + + # 6. Exact Rational Orthogonal Basis Invariance (O in O(16, Q)) & Witness Negative Controls + v16 = [Fraction(i + 1) for i in range(16)] + O_full = householder_q(v16) + check(matmul_q(transpose_q(O_full), O_full) == [[Fraction(1 if i == j else 0) for j in range(16)] for i in range(16)], + "O_full not orthogonal over Q") + L_rot = matmul_q(matmul_q(O_full, L_bare), transpose_q(O_full)) + trace_invariants_exact = True + for p in (1, 2, 3, 4): + if trace_q(matpow_q(L_bare, p)) != trace_q(matpow_q(L_rot, p)): + trace_invariants_exact = False + check(trace_invariants_exact, "Full O(16, Q) orthogonal trace invariance failed") + + # Block-preserving rational orthogonal basis change O_inv (+) O_wit mixing arbitrarily within V_inv and V_wit + O_inv = householder_q([Fraction(1), Fraction(-2), Fraction(3), Fraction(1), Fraction(-1), Fraction(2), Fraction(1), Fraction(4)]) + O_wit = householder_q([Fraction(2), Fraction(1), Fraction(-3), Fraction(2), Fraction(1), Fraction(-1), Fraction(3), Fraction(-2)]) + O_blk = [[Fraction(0) for _ in range(16)] for _ in range(16)] + for i in range(8): + for j in range(8): + O_blk[i][j] = O_inv[i][j] + O_blk[8 + i][8 + j] = O_wit[i][j] + L_blk_rot = matmul_q(matmul_q(O_blk, L_bare), transpose_q(O_blk)) + S_orig = exact_schur_inv(L_bare) + S_blk_rot = exact_schur_inv(L_blk_rot) + # Exact covariance: S(O_blk L O_blk^T) == O_inv S(L) O_inv^T identically over Q! + check(S_blk_rot == matmul_q(matmul_q(O_inv, S_orig), transpose_q(O_inv)), + "Block orthogonal Schur covariance failed") + check(matrank_q(S_blk_rot) == 6, "Nullspace dim of Schur complement must stay exact 2 (II, IZ)") + + # Adversarial Witness Negative Controls at N = 10: + # (a) Local witness I x Z instead of CM witness Z x I: destroys IX/IY at rate 2 N^2 gamma1 (anti-Zeno explosion!) + L_bad_loc = build_witness_lindbladian(N=10, gamma1=gamma1, g=g_val, gamma_tid=gamma_tid, cm_jump_label="IZ") + ix_rate_good = -exact_schur_inv(L_bare)[1][1] + ix_rate_bad_loc = -L_bad_loc[1][1] # IX is now directly decohered by I x Z! + check(ix_rate_bad_loc == 2 * Fraction(100) * gamma1 + 2 * gamma_tid, + "Local witness negative control IX rate mismatch") + check(ix_rate_bad_loc > 100 * ix_rate_good, "Local witness must dramatically worsen internal decay vs CM witness") + + # (b) Entangling witness Z x X: destroys F^inv pointer IZ at rate 2 N^2 gamma1! + L_bad_mix = build_witness_lindbladian(N=10, gamma1=gamma1, g=g_val, gamma_tid=gamma_tid, cm_jump_label="ZX") + iz_rate_good = -exact_schur_inv(L_bare)[3][3] + iz_rate_bad_mix = -L_bad_mix[3][3] + check(iz_rate_good == 0 and iz_rate_bad_mix == 2 * Fraction(100) * gamma1, + "Entangling witness negative control must break F^inv pointer IZ") + + return { + "exact_arithmetic": "100% pure Fraction / Q(i) + math.isqrt (zero floats)", + "modular_flow_tomita_takesaki": { + "noncommuting_internal_blocks": True, + "Delta_rho_HS_hermitian": True, + "commutator_D_CM_Delta_rho_V_inv_zero": True, + "kms_quantum_detailed_balance_zero": True, + "neg_ctrl_coherent_CM_norm2": str(norm2_mod_coh), + "neg_ctrl_local_IZ_witness_norm2": str(norm2_mod_loc), + "neg_ctrl_entangling_ZX_witness_norm2": str(norm2_mod_mix), + }, + "exact_16x16_schur_sweep": schur_rows, + "exceptional_point_EP2": { + "degenerate_gt0_gamma_CM_eq_2g": { + "N_EP": N_ep, "g": str(g_ep), "gamma_CM": str(N_ep * N_ep * g1_ep), + "lambda_EP": str(lam_ep), + "subblock_nilpotent_nonzero": True, + "subblock_nilpotent_sq_zero": True, + "subblock_rank": 1, + "full_16x16_rank_1_and_2": [rank1, rank2], + }, + "split_gt1_isolates_IX_IY_EP2": { + "N": 5, "gamma1": "1/5", "g": "2", "gamma_tid": "1", + "lambda_EP": "-6", + "full_16x16_rank_1_and_2": [rank_split_1, rank_split_2], + }, + }, + "riccati_fenichel_bridge_to_probe1": riccati_chain, + "rotating_frame_soliton_clock_separation": { + "omega_rel": str(omega_val), + "exact_commutator_L_bare_L_clock_zero": True, + "static_s0_schur_matches_lorentzian_formula": True, + "resonant_rotating_frame_zero_lamb_shift": True, + }, + "basis_invariance_and_witness_negative_controls": { + "full_O16Q_trace_invariance_k1_to_4": trace_invariants_exact, + "block_O8Q_schur_exact_covariance": True, + "neg_ctrl_local_IZ_destroys_zeno": { + "good_CM_witness_IX_rate": str(ix_rate_good), + "bad_local_IZ_IX_rate": str(ix_rate_bad_loc), + "degradation_factor": float(ix_rate_bad_loc / ix_rate_good), + }, + "neg_ctrl_entangling_ZX_destroys_Finv": { + "good_CM_witness_IZ_rate": str(iz_rate_good), + "bad_ZX_IZ_rate": str(iz_rate_bad_mix), + }, + }, + } + + +# ============================================================================= +# 3. PART C — CALIBRATION AGAINST fractals/witness-map/model.js & gravity C-03 +# ============================================================================= + +def solve_sp_soliton_model_js() -> Dict[str, float]: + """Exact Python replica of witness-map/model.js SOL (lines 131-151, h = 4e-3) + augmented with exact half-mass radius x_{1/2} to reconcile against gravity C-03. + """ + h = 4e-3 + + def deriv(x: float, y: List[float], e: float) -> List[float]: + return [y[1], 2.0 * (y[2] - e) * y[0] - 2.0 * y[1] / x, y[3], y[0] * y[0] - 2.0 * y[3] / x] + + def add(y: List[float], k: List[float], s: float) -> List[float]: + return [y[i] + s * k[i] for i in range(4)] + + def run(e: float, record: bool = False) -> Tuple[int, List[Tuple[float, List[float]]]]: + x = h + y = [1.0 - e * h * h / 3.0, -2.0 * e * h / 3.0, h * h / 6.0, h / 3.0] + trace: List[Tuple[float, List[float]]] = [(x, y[:])] if record else [] + while x < 12.0: + k1 = deriv(x, y, e) + k2 = deriv(x + h / 2.0, add(y, k1, h / 2.0), e) + k3 = deriv(x + h / 2.0, add(y, k2, h / 2.0), e) + k4 = deriv(x + h, add(y, k3, h), e) + y = [y[i] + h / 6.0 * (k1[i] + 2.0 * k2[i] + 2.0 * k3[i] + k4[i]) for i in range(4)] + x += h + if record: + trace.append((x, y[:])) + if y[0] < 0.0: + return -1, trace + if y[1] > 0.0: + return 1, trace + return 0, trace + + lo, hi = 0.1, 2.0 + for _ in range(44): + mid = (lo + hi) / 2.0 + flag, _ = run(mid, record=False) + if flag > 0: + lo = mid + else: + hi = mid + e = (lo + hi) / 2.0 + _, trace = run(e, record=True) + x_end, y_end = trace[-1] + I_tot = x_end * x_end * y_end[3] + e_inf = e - (y_end[2] + x_end * y_end[3]) + + xc = 0.0 + Ic = 0.0 + x_half_mass = 0.0 + for idx in range(1, len(trace)): + xp, yp = trace[idx - 1] + x, y = trace[idx] + if xc == 0.0 and y[0] * y[0] < 0.5: + t = (yp[0] * yp[0] - 0.5) / (yp[0] * yp[0] - y[0] * y[0]) + xc = xp + t * (x - xp) + Ic = xc * xc * (yp[3] + t * (y[3] - yp[3])) + Ip = xp * xp * yp[3] + Ic_now = x * x * y[3] + if x_half_mass == 0.0 and Ic_now >= 0.5 * I_tot: + t = (0.5 * I_tot - Ip) / (Ic_now - Ip) + x_half_mass = xp + t * (x - xp) + + return { + "xc_half_density": xc, + "Ic_inside_xc": Ic, + "I_total": I_tot, + "eInf": e_inf, + "x_half_mass": x_half_mass, + "M_sol_times_rc_dimless": xc * I_tot, + "M_sol_times_r_half_mass_dimless": x_half_mass * I_tot, + "ratio_r_half_mass_over_rc": x_half_mass / xc, + } + + +def run_part_c_witness_map_calibration() -> Dict[str, Any]: + """Calibrate exact N^3 CM witnessing and 1/N^2 Zeno scaling directly against + Foundation-0/fractals/witness-map/model.js CROWDS and Foundation-0/gravity C-03. + """ + # Exact constants verbatim from witness-map/model.js lines 16-21, 152, 168-173, 188 + hbar = 1.054571817e-34 + c = 2.99792458e8 + G = 6.674e-11 + Msun = 1.989e30 + kpc = 3.086e19 + yr = 3.156e7 + eV_kg = 1.602176634e-19 / (c * c) + GYR = 1e9 * yr + AGE = 13.8 * GYR + GEV_CM3 = 1e9 * eV_kg * 1e6 + BH_M = 4.3e6 * Msun # Sgr A* + + sol = solve_sp_soliton_model_js() + # Cross-check against Foundation-0/gravity C-03: M * r_{1/2} = 3.9251 hbar^2 / (G m^2) + gravity_c03_ref = 3.9251 + c03_rel_diff = abs(sol["M_sol_times_r_half_mass_dimless"] - gravity_c03_ref) / gravity_c03_ref + check(c03_rel_diff < 5e-4, f"Soliton M*r_(1/2) failed to match gravity C-03 (3.9251): {sol['M_sol_times_r_half_mass_dimless']}") + + def bh_gravity_rate(mass: float, dx: float, M_bh: float, b: float) -> float: + check(dx < b / 10.0, f"BH formula validity violated: dx={dx} >= b/10={b/10.0}") + return (G ** 6) * (M_bh ** 5) * (mass ** 2) * (dx ** 4) / (hbar * (c ** 10) * (b ** 10)) + + rho_sun = 0.4 * GEV_CM3 + sigma_sun = 2.29e5 / math.sqrt(2.0) + r_sun = 8.18 * kpc + + crowds_spec = [ + {"id": "sun", "kind": "halo", "m_eV": 1e-22, "rho": rho_sun, "sigma": sigma_sun, "r": r_sun}, + {"id": "sun-heavy", "kind": "halo", "m_eV": 3e-19, "rho": rho_sun, "sigma": sigma_sun, "r": r_sun}, + {"id": "core", "kind": "core", "m_eV": 8e-23, "rc": 0.7 * kpc}, + ] + + crowd_results: List[Dict[str, Any]] = [] + for sp in crowds_spec: + m = sp["m_eV"] * eV_kg + if sp["kind"] == "halo": + lam = hbar / (m * sp["sigma"]) + m_lump = (math.pi ** 1.5) * sp["rho"] * (lam ** 3) + N = m_lump / m + dx = lam + t_dyn = lam / sp["sigma"] # tLump + else: + L = sp["rc"] / sol["xc_half_density"] + rho_c = (hbar ** 2) / (4.0 * math.pi * G * (m ** 2) * (L ** 4)) + m_lump = 4.0 * math.pi * rho_c * (L ** 3) * sol["I_total"] + N = m_lump / m + dx = sp["rc"] + t_dyn = 2.0 * math.pi * m * (L ** 2) / (hbar * abs(sol["eInf"])) # tWave soliton + + b_eval = r_sun # 8.18 kpc (satisfies dx < b/10 for all 3 crowds!) + g1 = bh_gravity_rate(m, dx, BH_M, b_eval) + gN = bh_gravity_rate(m_lump, dx, BH_M, b_eval) + tw1 = m * dx * dx / hbar + twN = m_lump * dx * dx / hbar + W1 = g1 * tw1 + WN = gN * twN + + # Verify exact cube law N^3 and inverse-N^2 Zeno suppression in log10 space + log10_N = math.log10(N) + log10_W_ratio = math.log10(WN) - math.log10(W1) + check(abs(log10_W_ratio - 3.0 * log10_N) < 1e-11, f"W_CM/W_1 != N^3 for {sp['id']}") + tau_bh_cm = 1.0 / gN + + crowd_results.append({ + "id": sp["id"], + "kind": sp["kind"], + "m_eV": sp["m_eV"], + "dx_pc": dx / (kpc / 1e3), + "dx_over_b": dx / b_eval, + "N_particles": N, + "log10_N": log10_N, + "log10_W1_sgrA_8kpc": math.log10(W1), + "log10_WCM_sgrA_8kpc": math.log10(WN), + "log10_W_amplification_3logN": log10_W_ratio, + "log10_zeno_suppression_inv_N2": -2.0 * log10_N, + "gamma_BH_CM_per_s": gN, + "tau_BH_CM_s": tau_bh_cm, + "tau_BH_CM_over_t_dyn": tau_bh_cm / t_dyn, + "tau_BH_CM_over_cosmic_age": tau_bh_cm / AGE, + "decoheres_within_lump_lifetime": tau_bh_cm < t_dyn, + "decoheres_within_cosmic_age": tau_bh_cm < AGE, + }) + + # Exact crossover boson masses at Sun's orbit around Sgr A* using exact m^-10 / m^-11 scaling: + # Gamma_BH^CM * t_lump propto m^-11, Gamma_BH^CM * AGE propto m^-10 + sun_row = crowd_results[0] + m_star_lump_eV = sun_row["m_eV"] * ((sun_row["gamma_BH_CM_per_s"] * (hbar / (sun_row["m_eV"] * eV_kg * sigma_sun ** 2))) ** (1.0 / 11.0)) + m_star_age_eV = sun_row["m_eV"] * ((sun_row["gamma_BH_CM_per_s"] * AGE) ** (1.0 / 10.0)) + + # Verify the exact m^-10 scaling directly between 'sun' and 'sun-heavy' + sun_heavy_row = crowd_results[1] + mass_ratio = sun_heavy_row["m_eV"] / sun_row["m_eV"] + rate_ratio = sun_row["gamma_BH_CM_per_s"] / sun_heavy_row["gamma_BH_CM_per_s"] + rel_m10_err = abs(math.log10(rate_ratio) - 10.0 * math.log10(mass_ratio)) + check(rel_m10_err < 1e-11, f"Exact m^-10 scaling check failed: {rel_m10_err}") + + return { + "soliton_reconciliation_model_js_vs_gravity_C03": { + **sol, + "gravity_C03_reference_M_r_half": gravity_c03_ref, + "relative_diff_vs_gravity_C03": c03_rel_diff, + "diagnosis": "model.js uses half-density radius r_c (M*r_c = 2.6794 hbar^2/Gm^2); gravity C-03 uses half-mass radius r_(1/2) = 1.4649*r_c (M*r_(1/2) = 3.9251 hbar^2/Gm^2)", + }, + "sgrA_8kpc_crowd_unification": crowd_results, + "halo_horizon_mass_scaling_laws": { + "exact_gamma_BH_CM_exponent_in_m": -10, + "exact_gamma_tLump_exponent_in_m": -11, + "exact_W_BH_CM_exponent_in_m": -15, + "verified_log10_m10_residual": rel_m10_err, + "m_crossover_tau_eq_tLump_eV": m_star_lump_eV, + "m_crossover_tau_eq_cosmic_age_eV": m_star_age_eV, + }, + } + + +def main() -> None: + out_path = Path(__file__).resolve().parent / "probe4_witness_zeno_results.json" + payload: Dict[str, Any] = { + "probe": "probe4_witness_zeno_schur", + "seam": "SEAM-09 / Portal 3 (witness-map unified operator + exact 16x16 Lindblad Zeno Schur complement)", + "r3_tcb_negative_controls": r3_tcb_negative_controls(), + "part_a_exact_multipoles": run_part_a_exact_multipoles(), + "part_b_exact_16x16_lindblad_zeno": run_part_b_exact_lindblad_zeno(), + "part_c_witness_map_and_gravity_c03_calibration": run_part_c_witness_map_calibration(), + } + + canonical = json.dumps(payload, indent=2, sort_keys=True) + "\n" + out_path.write_text(canonical, encoding="utf-8") + digest = hashlib.sha256(canonical.encode("utf-8")).hexdigest() + + print("=== PROBE 4: WITNESS-MAP UNIFICATION & 16x16 LINDBLAD ZENO SCHUR COMPLEMENT ===") + print("R3 negative controls:", payload["r3_tcb_negative_controls"]["all_r3_controls_rejected"]) + print("Part A (exact Q multipoles): N=2..10 W_CM/W_1 == N^3, O(k^2)==0, F^inv==0, broken-CM ctrl PASS") + print("Part B (exact Q(i) 16x16 GKSL): [D_CM, Delta_rho]==0 on V_inv, Schur==-(2*gt+2*g^2/N^2g1), EP2 Jordan PASS") + sol = payload["part_c_witness_map_and_gravity_c03_calibration"]["soliton_reconciliation_model_js_vs_gravity_C03"] + print(f"Part C soliton bridge: M*r_c={sol['M_sol_times_rc_dimless']:.4f} (model.js), " + f"M*r_(1/2)={sol['M_sol_times_r_half_mass_dimless']:.4f} (gravity C-03=3.9251, rel_diff={sol['relative_diff_vs_gravity_C03']:.2e})") + for row in payload["part_c_witness_map_and_gravity_c03_calibration"]["sgrA_8kpc_crowd_unification"]: + print(f" crowd={row['id']:<9} log10(N)={row['log10_N']:5.2f} log10(W1)={row['log10_W1_sgrA_8kpc']:7.2f} -> " + f"log10(W_CM)={row['log10_WCM_sgrA_8kpc']:6.2f} tau_BH={row['tau_BH_CM_s']:.2e} s " + f"in_tLump={row['decoheres_within_lump_lifetime']} in_age={row['decoheres_within_cosmic_age']}") + ms = payload["part_c_witness_map_and_gravity_c03_calibration"]["halo_horizon_mass_scaling_laws"] + print(f" Sgr A* @ 8.18 kpc crossover masses: m*(tau=tLump)={ms['m_crossover_tau_eq_tLump_eV']:.2e} eV, " + f"m*(tau=age)={ms['m_crossover_tau_eq_cosmic_age_eV']:.2e} eV") + print(f"Saved: {out_path}") + print(f"Canonical SHA-256: {digest}") + + +if __name__ == "__main__": + main()