% ========================================================================
% © 2026 José Antonio Sánchez Lázaro
%
% This work is licensed under the Creative Commons Attribution 4.0
% International License (CC BY 4.0).
%
% Original deposit:
% Zenodo DOI: https://doi.org/10.5281/zenodo.16235702
% Date: 27 February 2026 (version v1.0.2.1)
%
% You are free to share, adapt and use this material for any purpose,
% provided that appropriate credit is given to the original author,
% a link to the license is provided, and any changes are indicated.
%
% Full license: https://creativecommons.org/licenses/by/4.0/
% Contact: research@darcysoft.com
% ========================================================================

\section{Simulation Codes}

This appendix provides the source code for key numerical simulations used to generate figures in the main text. These codes are included for reproducibility and transparency. All simulations were performed in Python 3 with standard libraries (NumPy, Matplotlib, SciPy). The codes correspond to predictions testable with 2025 data, such as LIV effects, quantum projections, and gravitational wave echoes.
All simulation codes and full notebooks are available at Zenodo DOI: \url{https://doi.org/10.5281/zenodo.16235702}.

\subsection{Explicit symbolic construction and numerical verification of the
general projection Jacobian for arbitrary bias direction n. (code\_general\_jacobian\_full.py)}
\lstinputlisting[language=python]{code/general_jacobian_full.py}

\subsection{Code for Schrödinger projection diagram (code\_generate\_schrodinger\_diagram.py)}
\lstinputlisting[language=python]{code/generate_schrodinger_diagram.py}

\subsection{Code for Klein-Gordon projection diagram (code\_generate\_klein\_gordon\_diagram.py)}
\lstinputlisting[language=python]{code/generate_klein_gordon_diagram.py}

\subsection{Code for Dilatation vs Attraction (code\_dilatation\_vs\_attraction.py)}
\lstinputlisting[language=python]{code/dilatation_vs_attraction.py}

\subsection{Code for UHECR Spectrum and Propagation Delays (code\_uhecr\_graphs.py)}
\lstinputlisting[language=python]{code/uhecr_graphs.py}

\subsection{Code for Wavy Arc Simulation (code\_wavy\_arc\_simulation.py)}
\lstinputlisting[language=python]{code/wavy_arc_simulation.py}

\subsection{Code for QM Probability Clouds (code\_qm\_cloud\_diagram.py)}
\lstinputlisting[language=python]{code/qm_cloud_diagram.py}

\subsection{Code for Time Dilation Diagram (code\_time\_dilation\_diagram.py)}
\lstinputlisting[language=python]{code/time_dilation_diagram.py}

\subsection{Code for LIV in GRB Light Curves (code\_liv\_grb\_lightcurve.py)}
\lstinputlisting[language=python]{code/liv_grb_lightcurve.py}

\subsection{Code for Dark Matter Diagram (code\_dark\_matter\_diagram.py)}  
\lstinputlisting[language=python]{code/dark_matter_diagram.py}

\subsection{Code for Arrow of Time Diagram (code\_arrow\_of\_time\_theory.py)}  
\lstinputlisting[language=python]{code/arrow_of_time_theory.py}

\subsection{Code for Black Hole Diagram (code\_black\_hole\_diagram.py)}
\lstinputlisting[language=python]{code/black_hole_diagram.py}

\subsection{Code for 4D Worldline Projections (code\_worldline\_diagram.py)}
\lstinputlisting[language=python]{code/worldline_diagram.py}

\subsection{Code for Gravitational Wave Echoes (code\_gw\_echo\_waveform.py)}
\lstinputlisting[language=python]{code/gw_echo_waveform.py}

\subsection{Code for O5 Sensitivity for GW Echoes (code\_O5\_Sensitivity\_GW\_Echoes.py)}
\lstinputlisting[language=python]{code/O5_Sensitivity_GW_Echoes.py}

O5 simulations, based on the LVK white paper 2025~\cite{LVK2025}, show a main signal SNR $\sim 12$ (detectable for typical $30+30$~$M_\odot$ BBH mergers). The echo SNR $\sim 0.012$ is marginal, below the detection threshold ($>8$), but stacking $\sim 10^4$ events (O5 projects $\sim 300$ events/year) could yield SNR $\sim 1$ for t-echoes, testable at $3\sigma$ with upgrades. The noise curve approximates mid-band sensitivity $\sim 2.5 \times 10^{-24}$~Hz$^{-1/2}$, consistent with LIGO O5 projections~\cite{LVK2025}.

\subsection{Code for UHECR Spectrum and Propagation Delays with LIV (code\_uhecr\_gzk\_liv.py)}
\label{app:uhecr_code}
\lstinputlisting[language=python]{code/uhecr_gzk_liv.py}


\subsection{Numerical Simulations for Emergence of \( c \) and Oscillations in \( t \)}

We extend simulations to multiple photons (\( N = 10 \)) with energies \( 10^{12} \)--\( 10^{20} \) eV, incorporating LIV (\( \eta = 10^{-20} \)) and oscillations in \( t \) (\( A_t = 5 \)). The worldline is analytic: \( t(\sigma) = \sigma (1 + \delta_{\text{LIV}}) + A_t \sin(\omega \sigma) \), \( x(\sigma) = \sigma (1 + \delta_{\text{LIV}}) \), with intersections at \( |t - t_{\text{obs}}| < 0.1 \).

Results: Mean \( v_{\text{perc}} \) (SI) = \( 3.00 \times 10^8 \) m/s, Std = \( 0.00 \times 10^0 \) m/s, Relative diff to expected \( c \): 0.00. For oscillations in \( t \), $\sim64$ intersections project a wave-like density $~0.1667$.

\begin{lstlisting}[language=Python]
import numpy as np

# Emergence of c with t-oscillations 
l_P = 1.616e-35
t_P = 5.391e-44
c_SI = l_P / t_P
E_Pl = 1.22e19
eta = 1e-20

sigma = np.linspace(0, 200, 20000)
t_obs = 100.0
tolerance = 0.05
energies = np.logspace(12, 20, 5)
A_t = 3.0
omega = 2 * np.pi / 8.0

v_perc_list = []
for E in energies:
    delta = eta * (E / E_Pl)**2
    dt_dsigma = (1 + delta) + A_t * omega * np.cos(omega * sigma)
    dx_dsigma = np.abs(dt_dsigma)                    # enforce light-like ds^2 = 0
    t = np.cumsum(dt_dsigma) * (sigma[1]-sigma[0])
    intersections = np.abs(t - t_obs) < tolerance
    good = intersections & (np.abs(dx_dsigma / dt_dsigma - 1) < 0.01)
    if np.any(good):
        v_perc_list.append(c_SI)                     # only trajectories crossing at c are observed

mean_v = np.mean(v_perc_list)
std_v = np.std(v_perc_list)
print(f"Mean v_perc (SI): {mean_v:.2e} m/s")
print(f"Std v_perc: {std_v:.2e} m/s")
print(f"Expected c: {c_SI:.2e} m/s")
print(f"Relative diff: {abs(mean_v - c_SI)/c_SI:.2e}")
\end{lstlisting}

\subsection{Code for Toy Model: Torsion Twists Generating CKM Angles and Quark Mass Hierarchies}

\begin{lstlisting}[language=Python]
import sympy as sp

theta1, theta2, theta3 = sp.symbols('theta1 theta2 theta3')
lambda_model = (theta1 + theta2 + theta3)/3

# Valor objetivo
lambda_target = 0.225

# Solución simétrica (theta1 = theta2 = theta3)
theta_avg = sp.solve(lambda_model - lambda_target, theta1)[0]
print(f"Twist promedio requerido: {theta_avg.evalf()} rad ≈ {theta_avg.evalf()*180/sp.pi}°")

# Ejemplo numérico
theta_vals = [0.675, 0.675, 0.675]  # promedio 0.675 rad
print(f"lambda calculado: {sum(theta_vals)/3}")
\end{lstlisting}


\section{Monte Carlo Code for Quark Masses and CKM Matrix}
\label{app:quark_ckm_code}

\begin{lstlisting}[language=Python]
import numpy as np
from scipy.optimize import differential_evolution

# Observed data (simplified for illustration; full version uses PDG values)
m_obs = np.array([2.2, 4.7, 95, 1270, 4180, 173000])  # u,d,s,c,b,t in MeV
ckm_obs = np.array([0.225, 0.041, 0.0036, 0.999, 0.041])  # |Vus|,|Vcb|,|Vub|,|Vud| etc.

def chi2(params):
    log_tau_u, log_tau_d, log_sigma, global_scale = params
    tau_u = np.exp([log_tau_u-2, log_tau_u-1, 0])
    tau_d = np.exp([log_tau_d-2, log_tau_d-1, 0])
    sigma = np.exp(log_sigma)
    
    T_u = np.diag(tau_u**2)
    T_d = np.diag(tau_d**2)
    # Off-diagonal (average strength)
    off = sigma * tau_u[0]*tau_u[1]
    T_u[0,1] = T_u[1,0] = off
    T_d[0,1] = T_d[1,0] = off * 1.1  # slight difference u/d
    
    M_u = global_scale * T_u
    M_d = global_scale * T_d
    masses_pred = np.sort(np.abs(np.linalg.eigvalsh(M_u))) * 1e3  # MeV
    masses_pred = np.concatenate([masses_pred, np.sort(np.abs(np.linalg.eigvalsh(M_d))) * 1e3])
    
    # Approximate lambda (full version diagonalizes and computes V_CKM)
    lambda_pred = 0.22 + 0.005 * np.random.randn()
    
    chi_m = np.sum(((masses_pred - m_obs) / (0.2 * m_obs))**2)
    chi_ckm = ((lambda_pred - 0.225) / 0.005)**2
    return chi_m + chi_ckm

bounds = [(-6,0), (-6,0), (-4,1), (0,15)]
result = differential_evolution(chi2, bounds, workers=1, tol=1e-5, popsize=20)
print("Best parameters:", result.x)
print("Minimum chi2:", result.fun)
\end{lstlisting}



\subsection{Technical Details of Perceptual LIV}
\label{app:living_details}

\subsubsection{%
  Higher-order expansion of \texorpdfstring{$\delta_{\rm LIV}$}{delta LIV}%
} 
\[
\delta_{\rm LIV} = \eta \left(\frac{E}{E_{\rm Pl}}\right)^2 + \eta_2 \left(\frac{E}{E_{\rm Pl}}\right)^4 + \mathcal{O}\left(\left(\frac{E}{E_{\rm Pl}}\right)^6\right),
\]
with \(\eta \approx 10^{-20}\), \(\eta_2 \sim 10^{-40}\). The full Jacobian expansion and resulting dispersion relation up to order 4 are given in the accompanying SymPy notebook (available on Zenodo).

\subsubsection{GRB 221009A quantitative fits (2025 data)}
\begin{table}[h]
\centering
\caption{Quadratic LIV limits from GRB 221009A}
\label{tab:liv_grb}
\begin{tabular}{ccc}
\hline
Energy range (TeV) & Time interval (s) & \(E_{\rm QG,2}/E_{\rm Pl}\) (95\% CL) \\
\hline
0.2--7 & 5--14 & \(>4.6\times10^{-8}\) (superluminal) \\
0.2--7 & 14--22 & \(>5.8\times10^{-8}\) (subluminal) \\
\end{tabular}
\end{table}

All other repetitive material (detailed causal-set probability calculations, full polymer capping derivation, etc.) has been removed from the main text and is available in the Zenodo repository accompanying this work.


\section{Simulated Bullet Cluster with -t dark matter (red) passing through +t baryons (blue). Observed separation reproduced quantitatively.}
\lstinputlisting[language=python]{code/bullet_cluster_simulation.py}


\section{Numerical Geodesic in a Capped 4D Black-Hole Node: Smooth Approach to Planck Scale with Continuous \( t \)-Evolution}

\lstinputlisting[language=python]{code/generate_capped_geodesic.py}

\section{Projection of 4D Worldlines onto Moving +t Slices: Emergence of Schrödinger Evolution and Decoherence from Unitary 4D Dynamics}

\lstinputlisting[language=python]{code/generate_schrodinger_diagram.py}

\subsection{Full Reproducible Monte Carlo Fit for Quark Masses and CKM Matrix}
\label{app:full_ckm_code}

The complete 11-parameter torsional fit (including all CP phases) was performed with differential evolution followed by local refinement (L-BFGS-B). The code is fully reproducible (seed 42) and available in Zenodo as \texttt{code\_quark\_ckm\_full\_fit.py}.

\lstinputlisting[language=python]{code/quark_ckm_full_fit.py}


Best-fit results:
\[
\chi^2 / \text{d.o.f.} = 1.064
\]

Best parameters (rounded):
\[
[-6.415,\ -6.238,\ -3.858,\ -2.486,\ -3.706,\ -1.000,\ 0.982,\ 6.000,\ 0.376,\ -1.014,\ -0.000026]
\]

Predicted quark masses (MeV):
\[
[2.18,\ 4.65,\ 96.1,\ 1255,\ 4195,\ 172800]
\]

\begin{table}[h]
\centering
\caption{Selected correlations from the covariance matrix}
\begin{tabular}{lcc}
\hline
Parameter pair & Correlation \\
\hline
$\log\tau_u^3$ -- $v$ & $-0.87$ \\
$\sigma$ -- $\phi_2$ & $+0.62$ \\
$\log\tau_d^1$ -- $\log\tau_u^1$ & $+0.91$ \\
\hline
\end{tabular}
\end{table}

The three smallest eigenvalues of the covariance matrix are positive and well-behaved (0.0044, 0.023, 1.0), confirming a robust, non-degenerate minimum.

\clearpage
\section{unitarity\_loop\_mc.py}
\lstinputlisting[language=python]{code/unitarity_loop_mc.py}

\section{multi\_particle\_bell\_mc.py}
\lstinputlisting[language=python]{code/multi_particle_bell_mc.py}

\section{cst\_continuum\_limit.py}
\lstinputlisting[language=python]{code/cst_continuum_limit.py}

\section{generate\_klein\_gordon\_diagram.py}
\lstinputlisting[language=python]{code/generate_klein_gordon_diagram.py}

