Maniflood

Unified category-theoretic audit of the trading pipeline (branches A · B · C)

Categorical Audit

Unified audit · branches A · B · C

The trading pipeline, audited as category theory.

Three independent structural audits run over the same engine: the tesseract sign-series as a confluent rewrite graph (A), the adaptive-meta stage as an indexed natural transformation ηd (B), and the trade ledger as a category with an associative composition and a monotone sizing functor (C). Each emits falsifiable witnesses, all reproducible from scripts/categorical_audit_all.py.

Audited witnesses

--

Flipped to hold

--

Mean score penalty

--

Max |Δscore|

--

Branch A · Tesseract sign-series

The curvature sign-state series as a rewrite graph, checked for confluence.

Each curvature sample lands on a sign-pattern vertex (e.g. +-+-); consecutive samples induce directed edges. The audit checks two-path redundancy (a Church–Rosser / confluence condition): any two rewrite routes between the same endpoints must agree, so the series has a well-defined terminal state.

Samples 96 curvature states
Unique vertices 1 sign-pattern (collapsed)
Terminal vertex +-+-
Confluence 0 ambiguous pairs — ok

Two-path redundancy: ok — max intermediate count 0, no ambiguous pairs. The dominant edge +-+- → +-+- fires 95×, i.e. the regime is a stable fixed point over this window.

Branch B · the categorical model

What objects, morphisms, and indices the audit assigns to the adaptive-meta stage.

Base category Sig Objects are pre-adaptive signal slices; morphisms are pipeline rewrites (flow-hybrid, de Rham).
Index base B = [0, 1] Drawdown risk d parameterizes an endofunctor Fd on Sig.
Component ηd F0(s) → Fd(s), the adaptive-meta re-weighting at drawdown d.
Fibration π: E → B The fiber over d collects all adapted signals at that drawdown level.

The audit changes no trading semantics. It centralizes the adaptive-meta math and exposes falsifiable witnesses for the structural laws below.

Naturality square

For a pipeline morphism f, applying ηd should commute with f.

eta_d( f(s) ) ≈ f( eta_d(s) )

The residual is the commutation error measured on the scalar projections (score, alpha, confidence) plus an action-match flag. Identity morphisms commute exactly; nonlinear pipeline morphisms leave a measured residual, which is exactly what the audit surfaces.

Audited witnesses

Synthetic signal battery checked at drawdown d = 0.25 (from the CLI audit).

Signal Fibration monotone η & identity η & score-scale action @ d=0.25 section flips→hold

"commutes" means residual within tolerance (1e-6); "residual" means the morphism is nonlinear enough to leave a measured commutation gap. Hover a cell for its score residual.

Drawdown explorer

Move along the fibration base B and watch ηd re-weight a signal live.

F0(s) · base object

Fd(s) · ηd applied

d score penalty ↑ alpha scale ↓ score alpha action

Fibration consistency requires score penalty to be non-decreasing and alpha scale non-increasing along d. A ▲ marks any violation; the math is computed in your browser from the same coefficients as the live engine.

Branch B · pipeline naturality

ηd commuted against the live pipeline morphisms on the curvature base.

Morphism f Verdict |Δscore| |Δalpha| |Δconfidence| action match
flow-hybrid residual 0.0872 0.0143 0.0403 yes
de Rham residual 0.0572 0.0109 0.0218 no
full pipeline residual 0.1129 0.0192 0.0532 yes

These morphisms act on the curvature-realized base, so they are audited once for the pipeline rather than per instrument. The de Rham square breaks action match: at d = 0.25 the adaptive-meta order vs. de Rham order disagree on the discrete action, which is exactly the kind of ordering defect the audit is built to expose.

Branch C · ledger category

Closed trades as composable morphisms on equity, with a sizing functor.

Objects are equity states; each closed trade is a morphism between them, and composing the whole chain must be associative — the realized equity path may not depend on how trades are bracketed. The position-sizing rule is audited as a functor whose multiplier must not jump up after a drawdown.

Trades composed 7 morphisms
Equity path 100,002.5 → 100,005.0
Associativity ok — 0 violations
Sizing functor ok — no large-drop violations

Prefix multipliers stay flat at 1.0 across all 7 trades and the full-window multiplier is 1.0 (reason: insufficient_closed_trades to scale up), so the sizing functor is trivially monotone here — conservative by construction on a short ledger.

Why this matters

Structural guarantees that a pile of if-statements cannot give you.