A computational framework grounded in a single axiom---all physical systems occupy bounded phase space---from which the complete thermodynamic, information-theoretic, and circuit-theoretic description of financial markets follows by mathematical necessity. The system integrates circulation transaction networks, harmonic pattern analysis, multi-modal financial representation, fuzzy oscillatory circuit graphs for portfolio optimisation, and a distributed thermodynamic market index, unified by the Poincare recurrence theorem, the triple equivalence of oscillation, category, and partition, and the market--gas isomorphism.
The framework derives from a chain of mathematical implications that admits no free parameters:
-
Bounded phase space (empirical fact: all financial quantities are finite) implies Poincare recurrence (every market state recurs), which implies oscillatory dynamics (all market observables oscillate).
-
Oscillatory dynamics admits three equivalent descriptions---oscillator, category, partition---unified by the triple equivalence theorem:
$S = k_B M \ln n$ under all three descriptions simultaneously. This identity establishes that observation, computation, and processing are the same operation: categorical address resolution in a ternary partition hierarchy. -
The processor--oscillator duality (
$dM/dt = M\omega / 2\pi = 1/\langle\tau_p\rangle$ ) eliminates the von Neumann bottleneck: in trajectory completion computing, the categorical state simultaneously encodes memory address, processor state, and semantic content. -
The market--gas isomorphism (
$\Phi : \Gamma_{\text{market}} \to \Gamma_{\text{gas}}$ , symplectic-structure-preserving) establishes that a financial market is mathematically identical to an ideal gas. Every theorem of statistical mechanics transfers without modification: the ideal gas law becomes a capital conservation identity, the Maxwell--Boltzmann distribution governs transaction timing, phase transitions predict market crashes, and the Carnot bound limits trading efficiency. -
Fuzzy circuit graphs with Kirchhoff conservation laws (KCL: capital balance; KVL: no-arbitrage) and trajectory completion via contraction mapping converge to a unique fixed-point optimal allocation that is time-invariant: it depends on the network's categorical structure, not on the absolute time of observation.
Batch settlement systems in which transactions circulate freely during the operating period
Harmonic coincidence detection transforms the transaction tree into a correlation graph. FFT extracts frequency signatures $\mathcal{H}i = {(n, A_n, \phi_n)}$ from each node's flow time series; pairs satisfying $|n\omega_i - m\omega_j| < \epsilon{\text{tol}}$ are connected by shadow edges weighted by spectral correlation. The shadow network reveals market structure invisible in raw transaction data: correlated pairs without direct transactions, sector clustering, systemic risk exposure, and arbitrage opportunities.
The shadow network identifies where flows should exist but do not. Directed loans complete the graph by filling flow gaps
The same financial network admits four mathematically equivalent representations, each revealing different structural properties:
- Circuit: nodes as junctions, edges as R-L-C elements, Kirchhoff's laws as conservation constraints.
- Sequence: transactions encoded as directional vectors enabling pattern matching and LLM-style semantic amplification.
- Gas molecular: nodes as molecules with wavefunctions, harmonic coincidence as quantum coherence, Maxwell--Boltzmann equilibrium.
- Shadow/Miraculous: virtual edges for pattern correlations, S-entropy navigation through states where intermediate values may be non-physical but final observables remain viable.
Information preservation exceeds 95% across full round-trip transformations.
The portfolio is modelled as an oscillatory circuit graph: each asset is a node occupying bounded phase space and exhibiting characteristic oscillatory dynamics; each coupling is an edge carrying conductance derived from a universal transport formula unifying correlation, capital flow, and information propagation.
Fuzzy membership functions $\tilde{\mu}i : \mathbb{R}{\geq 0} \to [0,1]$ encode epistemic uncertainty in asset valuations. Kirchhoff's laws are lifted to fuzzy arithmetic via the Zadeh extension principle. External market dynamics enter as boundary conditions (voltage and current sources at market nodes).
The trajectory completion operator $\mathcal{T} = \mathcal{T}{\text{Back}} \circ \mathcal{T}{\text{KVL}} \circ \mathcal{T}_{\text{KCL}}$ composes fuzzy capital conservation, fuzzy no-arbitrage, and MAP backward trajectory inference (Viterbi algorithm). We prove
Key results:
- Time-invariance (Theorem): the optimal allocation depends on current state and network topology, not observation time.
-
Spectral risk bound: portfolio risk
$\mathcal{R} \leq \mathcal{R}_0 / \lambda_2$ , where$\lambda_2$ is the Fiedler value (algebraic connectivity). -
Shock decay: external perturbations decay exponentially with graph distance at rate
$\sqrt{\lambda_2}$ . - Markowitz recovery: classical mean-variance optimisation emerges as the special case of zero epistemic uncertainty, complete uniform coupling, and vacuous trajectory constraints.
Validated experimentally: 7/7 predictions confirmed (convergence rate scaling, time-invariance, fuzzy risk, spectral risk, shock decay, harmonic detection, Markowitz limit).
A fundamentally new class of market index defined not as a weighted average of prices but as the partition function
The market--gas isomorphism maps stocks to molecules, order book depth to momentum, transaction timing variance to temperature, transaction rate density to pressure, and the instrument universe to volume. From this identity:
-
Ideal market gas law:
$P_{\text{load}} V_{\text{addr}} = N k_B T_{\text{var}}$ --- boundary transaction flux equals thermal transaction capacity. -
Maxwell--Boltzmann distribution: transaction traversal speeds follow
$f(v) = 4\pi(m/2\pi T)^{3/2} v^2 e^{-mv^2/2T}$ with zero adjustable parameters. -
Chemical potential as true valuation:
$\mu_i = \partial G / \partial N_i$ measures the thermodynamic cost of holding stock$i$ ; stocks with$\mu_i < 0$ are spontaneously absorbed into the portfolio. -
Phase diagram of markets: van der Waals equation predicts three phases---gas (uncorrelated bull), liquid (clustered normal), crystal (locked crash)---with Clausius--Clapeyron relations giving phase boundary slopes and a critical point
$(T_c, P_c, V_c)$ beyond which no phase distinction exists. -
Carnot bound on trading: no volatility arbitrage strategy exceeds efficiency
$\eta \leq 1 - T_{\text{cold}}/T_{\text{hot}}$ . -
Fluctuation--dissipation identity: implied and realised volatility are related by
$\sigma_{\text{implied}}^2 = (2k_BT/m) \cdot \sigma_{\text{realised}}^2$ ; departures measure disequilibrium. -
Third law: zero variance (
$T_{\text{var}} = 0$ ) is unreachable---perfect market efficiency is thermodynamically impossible. -
Gauge invariance: all observables depend only on frequency ratios (gear ratios
$R_{i\to j} = \omega_i/\omega_j$ ), rendering the DTI immune to inflation, stock splits, and currency effects.
The DTI subsumes all existing indices: S&P 500 is a projection onto pressure, VIX is a projection onto temperature. The full thermodynamic state contains
Validated experimentally: 8/8 predictions confirmed (Maxwell--Boltzmann distribution, ideal gas law, phase transitions, Carnot bound, fluctuation--dissipation, gauge invariance, third law, critical exponents).
Intraday capital optimisation leveraging circulation certainty and shadow network intelligence. Settlement certainty exceeds 99% for strongly correlated shadow edges (
The framework rests on six source publications establishing the theoretical foundations:
| Publication | Core Result |
|---|---|
| Trajectory Completion Computing | Computation IS trajectory completion in bounded phase space; |
| Single-Particle Gas Laws | Partition coordinates |
| Gas Ensemble Thermodynamic Duality | Temperature IS processing rate; entropy IS complexity; |
| Unified Cellular Circuit Model | Cells as circuits with fuzzy states; trajectory completion via Banach fixed-point convergence |
| Vehicle Oscillatory Circuit Graph | Complex systems as oscillatory circuit networks; universal transport formula; contraction mapping |
| Trans-Planckian Counting | Categorical observables commute with physical observables; |
- Python 3.9 or higher
- pip package manager
git clone https://github.com/yourusername/fourth-stomach.git
cd fourth-stomach
pip install -e .pip install -e ".[dev]"from ctn import CirculationTransactionNetwork, Transaction
ctn = CirculationTransactionNetwork()
ctn.add_node("Alice")
ctn.add_node("Bob")
ctn.add_node("Charlie")
ctn.process_transaction(Transaction("Alice", "Bob", 1500.0, timestamp=1.0))
ctn.process_transaction(Transaction("Bob", "Charlie", 800.0, timestamp=2.0))
ctn.process_transaction(Transaction("Charlie", "Alice", 2000.0, timestamp=3.0))
settlement = ctn.settle_end_of_day()from ctn import ShadowTransactionNetwork
shadow = ShadowTransactionNetwork()
patterns = shadow.extract_patterns(transactions, window_size=30)
coincidences = shadow.detect_harmonics(patterns, epsilon_tol=0.05)
correlation_graph = shadow.build_shadow_graph(coincidences)from representation import FinancialCircuit, RepresentationTransformer
circuit = FinancialCircuit()
circuit.add_node("Alice", net_worth=10000, credit_capacity=5000)
circuit.add_resistor("Alice", "Bob", resistance=0.05)
transformer = RepresentationTransformer()
results = transformer.full_cycle_transform(transactions)fourth-stomach/
├── src/
│ ├── ctn/ # Circulation transaction networks
│ │ ├── transaction_graph.py # Core CTN engine
│ │ ├── shadow_network.py # Shadow network analysis
│ │ ├── graph_completion_finance.py
│ │ └── visualization.py
│ └── representation/ # Multi-modal representations
│ ├── circuit.py # Electrical circuit model
│ ├── sequence.py # Sequential encoding
│ ├── gas_molecules.py # Molecular gas dynamics
│ ├── semantic.py # Semantic amplification
│ ├── shadow.py # Shadow/miraculous circuits
│ └── moon_landing.py # Chess with miracles
├── publications/
│ ├── sources/ # Foundational papers (PDF + LaTeX)
│ ├── portfolio-optimisation/ # Fuzzy circuit portfolio paper
│ │ ├── portfolio-fuzzy-circuit-graph.tex
│ │ ├── references.bib
│ │ └── validation/ # 7/7 experiments, panels, results
│ └── thermodynamic-index/ # Distributed thermodynamic index paper
│ ├── distributed-thermodynamic-stock-index.tex
│ ├── sango/ # Sango network-gas source papers
│ ├── references.bib
│ └── validation/ # 8/8 experiments, panels, results
├── docs/
│ ├── publication/ # Financial circuit papers (LaTeX)
│ ├── philosophy/ # Mathematical necessity
│ ├── economics/ # Economic theory
│ ├── algorithms/ # Algorithm specifications
│ └── time/ # S-entropy and timing
├── tests/ # Test suite
├── pyproject.toml
├── requirements.txt
└── Makefile
| Prediction | Result |
|---|---|
| Convergence rate scales with |
Confirmed: 69 iterations at |
| Time-invariance of optimal allocation | Confirmed: zero drift across |
| Fuzzy risk is a meaningful risk bound | Confirmed: non-zero residual uncertainty preserved at fixed point |
| Risk scales as |
Confirmed: risk drops from 1000 to 8 as |
| Shock decays exponentially with distance | Confirmed: |
| Harmonic coincidence detects regime changes | Confirmed: both spectral and correlation detect within 15 days |
| Markowitz recovery as special case | Confirmed: uniform conductance |
| Prediction | Result |
|---|---|
| Maxwell--Boltzmann for transaction speeds | Confirmed: |
| Ideal gas law |
Confirmed: |
| Phase transitions (van der Waals) | Confirmed: critical ratio |
| Carnot bound on trading efficiency | Confirmed: 200/200 strategies below bound |
| Fluctuation--dissipation theorem | Confirmed: FDT ratio exactly linear in |
| Gauge invariance under frequency scaling | Confirmed: zero drift across |
| Third law (zero variance unreachable) | Confirmed: |
| Critical exponents near |
Confirmed: measurable power-law divergence of |
pytest tests/ -v
pytest tests/ --cov=src --cov-report=html- Transaction processing: 10,000+ transactions/second
-
Settlement complexity:
$O(n \log n)$ -
Pattern extraction:
$O(NH)$ via FFT -
Portfolio trajectory completion:
$O(N \cdot E \cdot L \cdot \log(1/\varepsilon))$ -
DTI computation:
$O(N^2)$ for pairwise gear ratios
MIT License
@software{fourth_stomach,
title = {Fourth Stomach: Unified Economic Coordination Framework},
author = {Sachikonye, Kundai Farai},
year = {2024},
url = {https://github.com/yourusername/fourth-stomach}
}Kundai Farai Sachikonye
- AIMe Registry for Artificial Intelligence
- kundai.sachikonye@bitspark.com
