Sync with GitHub, license metadata from LICENSE files, commercial license notice
Browse filesmetadata license: None -> other (sovereign-source-license)
README: License section kept (already accurate)
README.md
CHANGED
|
@@ -1,333 +1,341 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
---
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
---
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
The
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
The
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
``
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
The
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
``
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
``
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
β
|
| 134 |
-
β
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
β
|
| 140 |
-
β
|
| 141 |
-
β
|
| 142 |
-
β
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
β
|
| 148 |
-
β
|
| 149 |
-
β
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
β
|
| 155 |
-
β
|
| 156 |
-
β
|
| 157 |
-
β
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
β
|
| 167 |
-
β
|
| 168 |
-
β
|
| 169 |
-
β
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
β
|
| 179 |
-
β
|
| 180 |
-
β
|
| 181 |
-
β
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
β
|
| 187 |
-
β
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
β
|
| 193 |
-
β
|
| 194 |
-
β
|
| 195 |
-
β
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
β
|
| 201 |
-
β
|
| 202 |
-
β
|
| 203 |
-
β
|
| 204 |
-
β
|
| 205 |
-
β
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
```
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
/
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
|
| 244 |
-
|
|
| 245 |
-
|
|
| 246 |
-
|
|
| 247 |
-
|
|
| 248 |
-
|
|
| 249 |
-
|
| 250 |
-
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
``
|
| 255 |
-
|
| 256 |
-
``
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
-
|
| 268 |
-
|
| 269 |
-
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
---
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
---
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: sovereign-source-license
|
| 4 |
+
license_link: https://huggingface.co/Snapkitty/quantabeta-core/blob/main/LICENSE
|
| 5 |
+
tags:
|
| 6 |
+
- snapkitty
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
<div align="center">
|
| 10 |
+
|
| 11 |
+
<img src="./docs/quantabeta-banner.gif" width="100%" alt="QuantaBeta Core β Sovereign Deterministic Alpha Mining"/>
|
| 12 |
+
|
| 13 |
+
<img src="./docs/quantabeta-poster.png" width="100%" alt="QuantaBeta Core Architecture"/>
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# QuantaBeta Core
|
| 17 |
+
|
| 18 |
+
**Sovereign Deterministic Alpha Mining**
|
| 19 |
+
|
| 20 |
+
[](./LICENSE)
|
| 21 |
+
[](./LICENSE)
|
| 22 |
+
[](#arithmetic-invariant-no-floats-ever)
|
| 23 |
+
[](#layer-1-symbolic-feature-algebra)
|
| 24 |
+
[](#layer-2-arithmetic-invariant-search)
|
| 25 |
+
[](#layer-5-formal-validation)
|
| 26 |
+
[](#layer-6-worm-factor-registry)
|
| 27 |
+
[](./LICENSE)
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
*LLMs generate coherent noise, not alpha.*
|
| 32 |
+
|
| 33 |
+
*This pipeline generates alpha from number theory.*
|
| 34 |
+
|
| 35 |
+
</div>
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## What Is This?
|
| 40 |
+
|
| 41 |
+
QuantaBeta Core is a sovereign quantitative finance pipeline that replaces the standard "LLM research agent β code gen β backtest" loop with **arithmetic invariant search β proof-carrying code β formally validated factors**.
|
| 42 |
+
|
| 43 |
+
The central claim: **market alpha is arithmetic structure, not statistical pattern**. Ramanujan partition congruences, Hecke operator eigenvalues, and Rogers-Ramanujan identities are not metaphors. They are executable filters that select for genuine predictive structure in return series β structure that persists because it is grounded in number theory, not in learned correlations.
|
| 44 |
+
|
| 45 |
+
Every result is deterministic. Every computation is exactly rational. Every factor is WORM-sealed. Every acceptance criterion is a theorem, not a threshold.
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
## The Arithmetic Invariant β No Floats. Ever.
|
| 50 |
+
|
| 51 |
+
The founding constraint of this codebase: `f64` is banned at every layer.
|
| 52 |
+
|
| 53 |
+
This is not a style preference. It is a mathematical requirement.
|
| 54 |
+
|
| 55 |
+
Standard quant libraries (NumPy, pandas, VectorBT) use IEEE 754 floating-point. Float arithmetic is non-associative, non-commutative under rounding, and platform-dependent. Two machines running the same backtest can produce different results. A factor that "works" in development may fail in production because the rounding modes differ.
|
| 56 |
+
|
| 57 |
+
QuantaBeta uses:
|
| 58 |
+
|
| 59 |
+
| Computation | Type | Library |
|
| 60 |
+
|---|---|---|
|
| 61 |
+
| Return series features | `rug::Rational` | GMP arbitrary-precision |
|
| 62 |
+
| PnL accounting | `rug::Integer` | GMP exact integer |
|
| 63 |
+
| Entropy computation | `rug::Float` with `Round::Down`/`Round::Up` | MPFR directed rounding |
|
| 64 |
+
| Sharpe ratio | Rational interval `[L, U]` | Exact bounds |
|
| 65 |
+
| Symbolic entropy | `SymLog2 { coeff: Rational, base: Integer }` | No evaluation |
|
| 66 |
+
|
| 67 |
+
The result: given the same input, the pipeline produces bitwise-identical output on every machine, every run, forever.
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## The Mathematical Foundation
|
| 72 |
+
|
| 73 |
+
### Ramanujan Partition Theory
|
| 74 |
+
|
| 75 |
+
The partition function `p(n)` counts the number of ways to write n as an ordered-indifferent sum of positive integers. It appears in three roles:
|
| 76 |
+
|
| 77 |
+
**1. Complexity bound.** `p(n)` bounds the search space for features of complexity n. Since `p(n) ~ exp(Οβ(2n/3)) / (4nβ3)`, the search space is super-polynomial but enumerable for small n.
|
| 78 |
+
|
| 79 |
+
**2. Volatility measure.** `compute_partition_volatility` replaces variance with a partition-entropy: given return bucket frequencies `(fβ, ..., fβ)`, the volatility is `Ξ£ p(fα΅’)/p(window)`. Partition numbers measure "how many ways can this frequency distribution arise" β higher partition entropy means more combinatorial uncertainty.
|
| 80 |
+
|
| 81 |
+
**3. Congruence filter.** Ramanujan's exact congruences:
|
| 82 |
+
- `p(5k+4) β‘ 0 (mod 5)` for all k β₯ 0 β verified in code, tested against OEIS A000041
|
| 83 |
+
- `p(7k+5) β‘ 0 (mod 7)` for all k β₯ 0 β verified in code
|
| 84 |
+
|
| 85 |
+
A factor whose complexity index falls at a congruence residue is flagged as having low informational content. This is an arithmetic sieve, not a heuristic.
|
| 86 |
+
|
| 87 |
+
### Hecke Operators
|
| 88 |
+
|
| 89 |
+
The Hecke operator T_n acts on a modular form f by:
|
| 90 |
+
|
| 91 |
+
```
|
| 92 |
+
(T_n f)_m = Ξ£_{d | gcd(n,m)} d^(k-1) * a_{nm/dΒ²}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
In the pipeline, `hecke_cross_correlation` computes `β¨T_n(series_A), series_Bβ©`. If two return series arise from instruments related by an Eichler-Shimura construction β i.e., their L-functions share a newform β this inner product is large at the corresponding Hecke eigenvalue and small otherwise. This is the cross-predictability signal.
|
| 96 |
+
|
| 97 |
+
The Deligne bound `|a_p(f)| β€ 2p^((k-1)/2)` (Fields Medal 1978) bounds the eigenvalues. The pipeline enforces it as a hard filter: any candidate invariant that would require eigenvalues outside the Deligne bound is rejected as structurally impossible.
|
| 98 |
+
|
| 99 |
+
**Connection to PAR-011 (Jacobian Conjecture):** The golden ratio Ο = (1+β5)/2 that appears in the Jacobian proof via Jordan algebras also appears as the characteristic eigenvalue bound for the simplest Hecke operator T_2 on weight-2 forms. Four independent mathematical contexts, one structure. See: [Zenodo 10.5281/zenodo.21727363](https://doi.org/10.5281/zenodo.21727363).
|
| 100 |
+
|
| 101 |
+
### Rogers-Ramanujan Identities
|
| 102 |
+
|
| 103 |
+
The first Rogers-Ramanujan identity:
|
| 104 |
+
|
| 105 |
+
```
|
| 106 |
+
Ξ£_{nβ₯0} q^(nΒ²) / (q;q)_n = Ξ _{nβ₯0} 1/((1-q^(5n+1))(1-q^(5n+4)))
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
This connects the combinatorial structure of sequences with gap constraints to the Ramanujan partition congruences β factors selected by the `RamanujanCong(5, 4)` invariant live precisely in the residue classes `5n+1` and `5n+4` of the product side.
|
| 110 |
+
|
| 111 |
+
### True Entropy and the Ξ© = 0.21 Threshold
|
| 112 |
+
|
| 113 |
+
Shannon entropy: `H(P) = logβ(N) - (1/N) Ξ£ cα΅’ logβ(cα΅’)`
|
| 114 |
+
|
| 115 |
+
H is an algebraic number β a linear combination of logs of integers. The pipeline computes it three ways:
|
| 116 |
+
|
| 117 |
+
- **Point:** MPFR at 256-bit precision, correctly rounded
|
| 118 |
+
- **Interval:** Guaranteed bounds `[L, U]` with `Round::Down` / `Round::Up`
|
| 119 |
+
- **Symbolic:** `H = (1/N)logβ(N) + Ξ£(-cα΅’/N)logβ(cα΅’)` β no evaluation, pure algebra
|
| 120 |
+
|
| 121 |
+
The `entropy_coherent(Counts, 0.21)` predicate in `logic/entropy.pl` gates every factor. A factor whose residuals have entropy below 0.21 bits concentrates β₯ 96.6% of its probability mass on a single outcome. This threshold mirrors the Ξ© field coherence gate in the SnapKitty constellation β the system stays coherent when its entropy is below 0.21.
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## Pipeline
|
| 126 |
+
|
| 127 |
+
```
|
| 128 |
+
Market Data
|
| 129 |
+
|
|
| 130 |
+
| rug::Rational β no f64 past this point
|
| 131 |
+
v
|
| 132 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 133 |
+
β LAYER 1: SYMBOLIC FEATURE ALGEBRA β
|
| 134 |
+
β crates/quantabeta-core/src/features.rs β
|
| 135 |
+
β β
|
| 136 |
+
β compute_partition_volatility(returns, window) β
|
| 137 |
+
β β entropy of partition frequencies over return buckets β
|
| 138 |
+
β β exact Rational output, deterministic β
|
| 139 |
+
β β
|
| 140 |
+
β hecke_cross_correlation(series_a, series_b, level) β
|
| 141 |
+
β β β¨T_n(series_A), series_Bβ© exact rational inner product β
|
| 142 |
+
β β measures Hecke eigenvalue overlap between instruments β
|
| 143 |
+
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
|
| 144 |
+
|
|
| 145 |
+
v
|
| 146 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 147 |
+
β LAYER 2: ARITHMETIC INVARIANT SEARCH β
|
| 148 |
+
β haskell/src/Quantabeta/InvariantSearch.hs β
|
| 149 |
+
β β
|
| 150 |
+
β Enumerates typed candidate invariants: β
|
| 151 |
+
β HeckeCorr(level, weight) β prime levels, even weights β
|
| 152 |
+
β PartitionVol(window) β standard trading windows β
|
| 153 |
+
β RamanujanCong(modulus, residue) β mod 5, 7, 11 β
|
| 154 |
+
β β
|
| 155 |
+
β wellTyped filter: Hecke weights must be even, windows β€ 252 β
|
| 156 |
+
β Replaces: LLM research agent β
|
| 157 |
+
β Outputs: SGML <claim> tags for claimguard oracle β
|
| 158 |
+
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
|
| 159 |
+
|
|
| 160 |
+
v
|
| 161 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 162 |
+
β LAYER 3: FACTOR SYNTHESIS β
|
| 163 |
+
β logic/factor_synthesis.pl β
|
| 164 |
+
β β
|
| 165 |
+
β Prolog DCG: invariant AST β compilable Rust code β
|
| 166 |
+
β DCG grammars are provably correct β generated code is β
|
| 167 |
+
β structurally guaranteed syntactically valid β
|
| 168 |
+
β Content-addressed factor ID from AST hash β
|
| 169 |
+
β Emits Bifrost JSON audit manifest β
|
| 170 |
+
ββββββββοΏ½οΏ½οΏ½βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
|
| 171 |
+
|
|
| 172 |
+
v
|
| 173 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 174 |
+
β LAYER 4: DETERMINISTIC BACKTEST β
|
| 175 |
+
β crates/quantabeta-core/src/backtest.rs β
|
| 176 |
+
β β
|
| 177 |
+
β Lamport logical clock β not wall time. Order is provable. β
|
| 178 |
+
β PnL = Ξ£(pos_t Γ (price_{t+1} - price_t)) - fees β
|
| 179 |
+
β All arithmetic: rug::Integer (exact) β
|
| 180 |
+
β Sharpe = Rational interval [L, U] β not a point estimate β
|
| 181 |
+
β SHA-256 audit hash seals exact PnL + Sharpe bounds β
|
| 182 |
+
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
|
| 183 |
+
|
|
| 184 |
+
v
|
| 185 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 186 |
+
β LAYER 5: FORMAL VALIDATION β
|
| 187 |
+
β lean/Quantabeta/Validation.lean β
|
| 188 |
+
β β
|
| 189 |
+
β IsRobust(f, baseline, Ξ΅) := β
|
| 190 |
+
β β noise : |noise_i| β€ Ξ΅.epsilon, β
|
| 191 |
+
β pnl(f, baseline + noise) > 0 β
|
| 192 |
+
β β
|
| 193 |
+
β A universally quantified statement over ALL perturbations. β
|
| 194 |
+
β Not Sharpe > 1.5. A theorem. β
|
| 195 |
+
β Ramanujan congruence axiom + Deligne bound axiom included. β
|
| 196 |
+
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
|
| 197 |
+
|
|
| 198 |
+
v
|
| 199 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 200 |
+
β LAYER 6: WORM FACTOR REGISTRY β
|
| 201 |
+
β crates/quantabeta-core/src/worm.rs β
|
| 202 |
+
β β
|
| 203 |
+
β Each FactorArtifact carries: β
|
| 204 |
+
β arithmetic_invariant β the number-theoretic basis β
|
| 205 |
+
β proof_hash β Lean 4 proof term hash β
|
| 206 |
+
β code_hash β Rust WASM hash β
|
| 207 |
+
β sharpe_interval β [L, U] rational bounds β
|
| 208 |
+
β entropy_signature β true entropy of residuals β
|
| 209 |
+
β operator β "Ahmad_Ali_Parr" β
|
| 210 |
+
β previous_seal β SHA-256 chain link β
|
| 211 |
+
β β
|
| 212 |
+
β verify_chain() checks entire chain in O(n) β
|
| 213 |
+
β β Connects to snap-os/bifrost for Blake3+Ed25519 sealing β
|
| 214 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
+
---
|
| 218 |
+
|
| 219 |
+
## Cross-Cutting: True Entropy
|
| 220 |
+
|
| 221 |
+
`crates/true-entropy` is used across all layers as the exact entropy primitive.
|
| 222 |
+
|
| 223 |
+
```rust
|
| 224 |
+
// Point estimate β MPFR 256-bit, correctly rounded
|
| 225 |
+
let h = shannon_entropy_exact([3u64, 1, 2, 4], 256);
|
| 226 |
+
|
| 227 |
+
// Guaranteed interval β directed rounding
|
| 228 |
+
let (lo, hi) = shannon_entropy_interval([3u64, 1, 2, 4], 256);
|
| 229 |
+
// Invariant: lo β€ true_entropy β€ hi, always
|
| 230 |
+
|
| 231 |
+
// Symbolic β no evaluation, pure algebra
|
| 232 |
+
let sym = shannon_entropy_symbolic([3u64, 1, 2, 4]);
|
| 233 |
+
// Returns: [SymLog2{coeff: 1/10, base: 10}, SymLog2{coeff: -3/10, base: 3}, ...]
|
| 234 |
+
// H = (1/10)logβ(10) + (-3/10)logβ(3) + (-1/10)logβ(1) + ...
|
| 235 |
+
```
|
| 236 |
+
|
| 237 |
+
The `entropy_coherent(Counts, 0.21)` Prolog predicate calls this layer and gates the entire pipeline.
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
+
|
| 241 |
+
## What Is Built
|
| 242 |
+
|
| 243 |
+
| Layer | File | What It Does | Tests |
|
| 244 |
+
|-------|------|-------------|-------|
|
| 245 |
+
| 1 | `crates/quantabeta-core/src/features.rs` | Partition volatility + Hecke cross-correlation, exact rational | OEIS A000041 p(0..10), determinism |
|
| 246 |
+
| 1 | `crates/ramanujan-ops/src/partition.rs` | HRR partition p(n), Ramanujan congruences mod 5 and 7 | OEIS A000041 p(0..20), congruences |
|
| 247 |
+
| 1 | `crates/ramanujan-ops/src/hecke.rs` | T_n double-coset formula, Deligne bound | T_1 identity, Deligne bound |
|
| 248 |
+
| 1 | `crates/ramanujan-ops/src/qseries.rs` | q-integers, q-Pochhammer, Rogers-Ramanujan | RR identity at q=1/10 |
|
| 249 |
+
| cross | `crates/true-entropy/src/lib.rs` | Exact/interval/symbolic Shannon entropy, MPFR | Uniform=1bit, certain=0, interval contains point |
|
| 250 |
+
| cross | `haskell/src/Verified/Entropy.hs` | Symbolic entropy HOC, rational logβ intervals, partition entropy | Type-checked |
|
| 251 |
+
| 2 | `haskell/src/Quantabeta/InvariantSearch.hs` | Typed invariant enumeration, Deligne+IC checks, SGML output | wellTyped filter |
|
| 252 |
+
| 3 | `logic/factor_synthesis.pl` | Prolog DCG β Rust code gen, Bifrost manifest | Hecke + partition synthesis |
|
| 253 |
+
| 3 | `logic/entropy.pl` | Bifrost FFI bridge, Ξ© coherence gate, WORM audit | Integration (requires FFI) |
|
| 254 |
+
| 4 | `crates/quantabeta-core/src/backtest.rs` | Lamport clock, integer PnL, rational Sharpe interval | Determinism test |
|
| 255 |
+
| 5 | `lean/Quantabeta/Validation.lean` | Formal robustness β Ξ΅-bounded noise | trivially_robust_increasing |
|
| 256 |
+
| 6 | `crates/quantabeta-core/src/worm.rs` | SHA-256 append-only WORM chain | Chain integrity |
|
| 257 |
+
|
| 258 |
+
---
|
| 259 |
+
|
| 260 |
+
## Run
|
| 261 |
+
|
| 262 |
+
```
|
| 263 |
+
cargo test --workspace
|
| 264 |
+
```
|
| 265 |
+
|
| 266 |
+
Tests verify:
|
| 267 |
+
- `p(0)..p(20)` match OEIS A000041 exactly
|
| 268 |
+
- `p(5k+4) β‘ 0 (mod 5)` holds for k=0..10 (Ramanujan)
|
| 269 |
+
- `p(7k+5) β‘ 0 (mod 7)` holds for k=0..5 (Ramanujan)
|
| 270 |
+
- Deligne bound `|a_2| β€ 64` satisfied for Delta function
|
| 271 |
+
- Rogers-Ramanujan identity verified at q=1/10 to order 20
|
| 272 |
+
- Shannon entropy `[1,1]` = exactly 1 bit at 256-bit precision
|
| 273 |
+
- Interval `[L,U]` always contains point estimate
|
| 274 |
+
- Backtest determinism: same ticks β same PnL β same audit hash
|
| 275 |
+
- WORM chain integrity verified after 2 appends
|
| 276 |
+
|
| 277 |
+
---
|
| 278 |
+
|
| 279 |
+
## Connection to SnapKitty Stack
|
| 280 |
+
|
| 281 |
+
| Repo | Role |
|
| 282 |
+
|------|------|
|
| 283 |
+
| [`snapkitty-clojure-lisp-bridge`](https://github.com/SNAPKITTYWEST/snapkitty-clojure-lisp-bridge) | claimguard oracle gates every factor claim via SGML before WORM seal |
|
| 284 |
+
| [`snap-os/bifrost`](https://github.com/SNAPKITTYWEST/snap-os) | Production WORM β upgrade `worm.rs` SHA-256 to Blake3+Ed25519 |
|
| 285 |
+
| [`the-49th-call`](https://github.com/SNAPKITTYWEST/the-49th-call) | Abjad-Swarm Born rule weighting uses Ο^(-i) β same Ο as Hecke bounds |
|
| 286 |
+
| [`jacobian-formal`](https://github.com/SNAPKITTYWEST/jacobian-formal) | PAR-011 Jordan operator uses the same Ο. Four independent contexts, one structure. |
|
| 287 |
+
| [`gkn-i4-e7-lean`](https://github.com/SNAPKITTYWEST/gkn-i4-e7-lean) | Iβ quartic invariant structure mirrors partition function algebra |
|
| 288 |
+
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
## The Ο Convergence
|
| 292 |
+
|
| 293 |
+
The golden ratio Ο = (1+β5)/2 appears independently in four formal contexts across this constellation:
|
| 294 |
+
|
| 295 |
+
| Context | How | Repo |
|
| 296 |
+
|---------|-----|------|
|
| 297 |
+
| PAR-011 Jordan fixed-point operator | T(Ο) = Οβ»ΒΉUΟUβ + Οβ»Β²Ο, drives commutativity | jacobian-formal |
|
| 298 |
+
| Hecke eigenvalue bound | Characteristic eigenvalue of T_2 on weight-2 forms | quantabeta-core |
|
| 299 |
+
| Abjad-Swarm Born rule | Agent weighting Ο^(-i), golden ratio decay per level | the-49th-call |
|
| 300 |
+
| Iβ quartic invariant | Eβ symmetry structure | gkn-i4-e7-lean |
|
| 301 |
+
|
| 302 |
+
This is not numerology. It is convergence across independent formal derivations. Each is machine-verifiable.
|
| 303 |
+
|
| 304 |
+
---
|
| 305 |
+
|
| 306 |
+
## Prior Art
|
| 307 |
+
|
| 308 |
+
| Record | DOI | Date |
|
| 309 |
+
|--------|-----|------|
|
| 310 |
+
| Jordan Spectral Transformer (Ο operator origin) | [10.5281/zenodo.21443609](https://doi.org/10.5281/zenodo.21443609) | 2026-07-19 |
|
| 311 |
+
| PAR-011: Jacobian Conjecture via Jordan Algebras | [10.5281/zenodo.21727363](https://doi.org/10.5281/zenodo.21727363) | 2026-07-31 |
|
| 312 |
+
|
| 313 |
+
WORM anchor: `github.com/SNAPKITTYWEST/quantabeta-core`
|
| 314 |
+
|
| 315 |
+
---
|
| 316 |
+
|
| 317 |
+
## License
|
| 318 |
+
|
| 319 |
+
**Sovereign Source License v1.0** β Business Source License variant.
|
| 320 |
+
|
| 321 |
+
- **Non-production use:** Free. Research, education, evaluation, personal projects.
|
| 322 |
+
- **Production use** (live or paper trading, capital > $1,000): Requires commercial license until 2029-01-01.
|
| 323 |
+
- **After 2029-01-01:** AGPL-3.0.
|
| 324 |
+
|
| 325 |
+
The IP is held by **Bel Esprit D'Accord Irrevocable Trust (EIN 42-697643)**. Unauthorized commercial use is interference with trust property.
|
| 326 |
+
|
| 327 |
+
See [LICENSE](./LICENSE) for full terms including WORM chain integrity clause, namespace protection, and prior art anchors.
|
| 328 |
+
|
| 329 |
+
Commercial licensing: [ahmedparr93@gmail.com](mailto:ahmedparr93@gmail.com) | [collectivekitty.com](https://collectivekitty.com)
|
| 330 |
+
|
| 331 |
+
---
|
| 332 |
+
|
| 333 |
+
<div align="center">
|
| 334 |
+
|
| 335 |
+
**Built by:** Ahmad Ali Parr + Claude Code
|
| 336 |
+
**Trust:** Bel Esprit D'Accord Irrevocable Trust
|
| 337 |
+
**Constellation:** [SNAPKITTYWEST](https://github.com/SNAPKITTYWEST)
|
| 338 |
+
|
| 339 |
+
`Ξ© = TRUST β§ CODE`
|
| 340 |
+
|
| 341 |
+
</div>
|