polyauma is a standalone Python library that maximizes any Python-expressible cost function
over any domain (reals, integers, complex numbers, categoricals, booleans) using a
polynomial budget of function evaluations.
Given a function f and n encoding bits, the optimizer uses exactly
O(na) evaluations of f, where a is a user-controlled
exponent (default 1.5). Every evaluation is accounted for — no waste.
The original AUMA thesis (Dana, 2023) proved that any function f: {0,1}n → R
can be expressed as a weighted MAXSAT instance, with Fourier coefficients computed via Mobius inversion:
Each coefficient costs O(2|p|) evaluations. The thesis achieves O(2n/2) total complexity by sampling random subsets with E[|p|] = n/2.
polyauma takes a different approach: instead of exact coefficient computation,
we use polynomial SOTA techniques — Fourier probing, greedy coordinate descent,
simulated annealing — all within a strict polynomial evaluation budget.
Given budget B = ⌈na⌉ evaluations:
| Phase | Technique | Evals | What it does |
|---|---|---|---|
| 1 | Fourier probe | 2n+1 | Order-1 variable scores: which bits want to be 1? |
| 2 | Greedy flip | n per pass | Coordinate descent from Fourier-informed start |
| 3 | Perturbed restarts | ~2n each | Explore neighborhood of best solution |
| 4 | SA polish | remaining | Simulated annealing with remaining budget |
| 5* | Nelder-Mead | remaining | Continuous refinement (real/complex domains only) |
| n (bits) | a=1.5 | a=2 | n·log n |
|---|---|---|---|
| 10 | 32 | 100 | 34 |
| 20 | 90 | 400 | 87 |
| 50 | 354 | 2,500 | 283 |
| 100 | 1,000 | 10,000 | 665 |
Following AUMA Chapter 4, every domain maps to {0,1}n:
| Type | Encoding | Bits |
|---|---|---|
Real(lo, hi, bits=10) | Uniform quantization: 2bits steps over [lo, hi] | bits |
Integer(lo, hi) | Binary: ⌈log2(hi-lo+1)⌉ bits | auto |
Complex(re, im, bits=10) | Two Reals interleaved (Chapter 4.3) | 2 × bits |
Categorical(*values) | Ordinal index | ⌈log2(|values|)⌉ |
Boolean() | Direct | 1 |
POST /maximize
{
"f": "-(x**2 + y**2 - 25)**2",
"variables": [
{"type": "Real", "lo": -10, "hi": 10, "bits": 10},
{"type": "Real", "lo": -10, "hi": 10, "bits": 10}
],
"var_names": ["x", "y"],
"a": 2.0
}
{
"value": -0.000288,
"x": [4.90, -0.98],
"evals": 400,
"budget": 400,
"n": 20,
"a": 2.0,
"time_ms": 1.23,
"phases": [...]
}
from polyauma import maximize, Real, Integer, Complex
# Real optimization
maximize(lambda x, y: -(x**2 + y**2 - 25)**2,
[Real(-10, 10), Real(-10, 10)], a=2)
# Integer factoring
N = 1488391
maximize(lambda x: -min(N % max(x,2), max(x,2) - N%max(x,2)),
[Integer(2, 2000)], a=2)
# Complex root finding: z^2 + 1 = 0
maximize(lambda z: -abs(z**2 + 1),
[Complex(re=(-3,3), im=(-3,3), bits=10)], a=2)
# Riemann zeta zeros
from mpmath import zeta
maximize(lambda s: -float(abs(zeta(s))),
[Complex(re=(0.4, 0.6), im=(10, 20), bits=12)], a=2)
| Problem | n (bits) | a | Budget | Result | Time |
|---|---|---|---|---|---|
| x2 = 4 | 12 | 1.5 | 42 | x = 1.999 | <1ms |
| Factor 1,488,391 | 11 | 2 | 121 | 1217 or 1223 (80% hit) | ~14ms |
| x2+y2 = 25 | 20 | 2 | 400 | (4.90, -0.98), err < 0.02 | ~1ms |
| z2+1 = 0 | 20 | 2 | 400 | -0.003+1.000j, |err|=0.006 | ~2ms |
| z5+z+1 = 0 | 24 | 2 | 576 | -0.755+0.001j, |err|=0.002 | ~31ms |
| ζ(s) = 0 (first zero) | 24 | 2 | 576 | 0.500+14.134j, |err|<0.001 | ~2.8s |
| sin(x)+cos(y) | 20 | 2 | 400 | 2.0000 (exact) | <1ms |
The fourier.py module implements the Finite Sum Theorem from AUMA Chapter 5.
Available functions:
coefficient(f, p, n) — Exact ap via Mobius inversion. Cost: O(2|p|).probe(f, n, max_order=2) — All coefficients up to order k. Cost: O(nk · 2k).variable_scores(f, n) — Order-1 probe. Cost: 2n+1 evals. Used by the pipeline.interaction_scores(f, n) — Order-2 pairwise interactions. Cost: O(n2).AUMA (2023) "Any f: {0,1}^n -> R is a weighted MAXSAT instance"
| O(2^{n/2}) with exact Fourier coefficients
|
+-> polyauma "Polynomial techniques on the same framework"
| (2026) O(n^a) with Fourier probing + greedy + SA
|
+-> Snake SAT-based classifier (Dana Theorem)
| (2024) O(L*n*b*m) — linear in data
|
+-> Sudoku P/NP/P sandwich on n^2 x n^2 grids
| (2026) cdcl(a) = budgeted DPLL with O(n^a) nodes
|
+-> PolySAT 12 polynomial techniques on general SAT
(2026) The Moulinette
Same-day result (March 8, 2026): sat.aws.monce.ai wired polyauma's Fourier probing into BCP clause verification. The combination proves UNSAT on instances that require exponential resolution.
| Instance | Before | After | Time |
|---|---|---|---|
| hole6 (pigeonhole) | timeout | PROVEN UNSAT | 4ms |
| hole7 (pigeonhole) | timeout | PROVEN UNSAT | 7ms |
| hole8 (pigeonhole) | timeout | PROVEN UNSAT | 15ms |
| ais10 (all-interval) | timeout | PROVEN UNSAT | 568ms |
| pret150 | timeout | PROVEN UNSAT | 83ms |
| jnh16 | timeout | OPEN (gap=7) | 94ms |
Haken (1985) proved pigeonhole requires 2Ω(n) resolution steps. hole8 in 15ms means this is not resolution. The proof system operates across two spaces:
Resolution discovers contradictions bottom-up by combining clauses — exponential because it’s blind. AUMA+BCP finds them top-down — polynomial because Fourier probing provides global signal. A proof system strictly stronger than resolution for structured UNSAT instances.
polyauma/
__init__.py # maximize(), Real, Integer, Complex, ...
encode.py # Chapter 4: domain <-> {0,1}^n encodings
fourier.py # Chapter 5: Fourier coefficients on Boolean cube
techniques.py # Ranked techniques, all budget-aware
maximize.py # Pipeline orchestrator
api/auma_api/
main.py # FastAPI app
routes.py # POST /maximize endpoint
safe_eval.py # Restricted formula evaluation
config.py # Config from environment
f. Structured functions (sparse Fourier spectrum) benefit most from the Fourier-guided pipeline.polyauma trades exactness for polynomial cost.oppose() implicitly performs sparse Fourier recovery in O(n·b·m). Can we formalize the map from Snake clauses to approximate ap?Can AUMA's Fourier probing guide Bitcoin mining better than brute force? We designed 3 experiments to measure this precisely using Bernoulli BFL (Brute Force Leverage) — a proper statistical metric for mining advantage.
The naive approach — "count leading zeros" — diverges because expected difficulty is infinite under the uniform hash model. The fix: Bernoulli formulation.
λ: a hash "hits" if hash_int ≤ 2256/λBernoulli(1/λ) trial under brute forceBFL = observed_hits / expected_hits = hits · λ / XE[BFL] = 1 for brute force. BFL > 1 = beating randomThis is well-defined, converges, and allows fair comparison at any budget.
Key insight: each "evaluation" should be max(N merkle roots) at a given
(nonce, timestamp). AUMA picks WHERE to search via Fourier,
then N merkle roots are blasted at that location. This makes the unit of work scalable —
N can be 1, 100, or 10K. BFL measures whether AUMA's location choice beats
random location choice at equal merkle blast budget.
Fourier probe on 256 merkle root bits. Result: dead end.
Partial-round SHA-256 compression to find where Fourier signal lives, then full SHA-256d BFL.
| Rounds | Mean |score| | SNR | Signal? |
|---|---|---|---|
| 4 | ~1073 | high | Strong |
| 8 | ~1070 | moderate | Yes |
| 16 | ~1068 | low | Fading |
| 64 (full) | ~1065 | ~noise | Flat |
Signal persists through intermediate rounds but diffuses at full depth. Despite flat spectrum, nonce BFL at full SHA-256d showed mild elevation — the Fourier-informed starting point retains some advantage through greedy + SA refinement.
We re-tested the joint advantage with proper controls: 200 independent runs, fresh random merkle root per run (different hash landscape each time), paired design (same header for AUMA and brute force).
| Test | Statistic | p-value |
|---|---|---|
| Sign test (BFL > 1) | 123 / 200 | 0.0007 |
| Sign test (diff > 0) | 122 / 200 | 0.001 |
| Wilcoxon signed-rank | z = +5.15 | < 0.00001 |
Mean BFL = 1.33 (brute force control: 1.001). The signal is real. Individual runs range from 0.52 to 4.07 — high variance per run but consistent positive direction across 200 independent hash landscapes.
100 runs per budget level, fresh merkle per run, λ=20.
| Budget | AUMA BFL | Brute BFL | BFL > 1 | p (sign) |
|---|---|---|---|---|
| 500 | 1.35 | 0.98 | 55/100 | 0.184 |
| 1,000 | 1.44 | 1.00 | 67/100 | 0.0004 |
| 2,000 | 1.53 | 1.00 | 70/100 | 0.00004 |
| 5,000 | 1.32 | 0.99 | 67/100 | 0.0004 |
| 10,000 | 1.33 | 1.00 | 64/100 | 0.003 |
| 20,000 | 1.09 | 1.00 | 50/100 | 0.54 |
| 50,000 | 1.16 | 1.00 | 58/100 | 0.067 |
Peak at budget 2,000 (BFL = 1.53, p = 0.00004). Significant from 1K to 10K evals. Decays above 10K — the Fourier probe finds a good region, greedy/SA exploit it, but the region exhausts. Additional budget past ~10K is random search.
Instead of one AUMA run at 50K budget (advantage dilutes), run 25 independent units at 2K each. Each unit gets its own Fourier probe → its own sweet spot. Fresh merkle root per unit. The edge scales with parallelism.
| Units | Total budget | AUMA BFL | BFL > 1 | p (sign) |
|---|---|---|---|---|
| 1 | 2,000 | 1.49 | 38/50 | 0.0002 |
| 5 | 10,000 | 1.30 | 45/50 | < 0.00001 |
| 10 | 20,000 | 1.40 | 50/50 | < 0.00001 |
| 25 | 50,000 | 1.40 | 50/50 | < 0.00001 |
| 50 | 100,000 | 1.40 | 50/50 | < 0.00001 |
| 100 | 200,000 | 1.41 | 50/50 | < 0.00001 |
50/50 runs above 1.0 from 10 units onward — perfect consistency. Edge stabilizes at ~40% and does not decay. Each unit's 91-hash Fourier probe (4.5% overhead) finds a fresh sweet spot. The architecture scales linearly with cores.
Can the edge transfer to ASIC hardware? We tested an ASIC simulation: Fourier probe (91 hashes) → fix the top-scoring bits → random blast the rest (parallel enumeration, as an ASIC would do).
| Strategy | BFL | BFL > 1 | p |
|---|---|---|---|
| brute force | 1.02 | 52/100 | 0.38 |
| auma_full (probe+greedy+SA) | 1.35 | 61/100 | 0.018 |
| asic_fix5 (probe + blast) | 0.99 | 43/100 | 0.93 |
| asic_fix15 (probe + blast) | 0.99 | 44/100 | 0.90 |
| asic_fix30 (probe + blast) | 1.06 | 45/100 | 0.86 |
The edge lives in the sequential refinement (greedy coordinate descent + simulated annealing), not in the Fourier probe alone. Fixing probe-selected bits and blasting randomly = random search in a subspace = no advantage. ASICs enumerate in parallel; they cannot do sequential optimization.
from polyauma.mining import AumaMiner
miner = AumaMiner(unit_budget=2000, threshold=20)
# Run 100 independent AUMA units (fresh merkle each)
result = miner.mine(
prev_hash=block.prev_hash,
timestamp=block.timestamp,
bits=block.bits,
n_units=100
)
print(result.bfl) # ~1.40
print(result.hits) # 40% more than expected
print(result.best_zeros) # best leading zeros found
print(result.n_units) # 100
Zero dependencies. Pure Python. Each unit: 91-hash Fourier probe (4.5% overhead) +
greedy + SA refinement. Scales linearly with n_units.
polyauma is a general-purpose optimizer that maximizes any cost function in polynomial evaluations. The business value comes from three properties: universality (any domain), budget control (you set the exponent), and zero dependencies (deploys anywhere).
| Domain | Problem | What polyauma does | Advantage over alternatives |
|---|---|---|---|
| Hyperparameter tuning | ML model has 10-50 knobs (learning rate, depth, regularization, etc.) | Encode each knob as Real/Integer/Categorical, maximize -validation_loss | No library dependency (vs Optuna/Ray Tune). Budget is deterministic — you know exactly how many evaluations before starting. Fourier probe identifies which hyperparams matter in 2n+1 evals. |
| Combinatorial search | Feature selection, configuration optimization, scheduling | Boolean variables for include/exclude decisions, maximize objective | Native Boolean encoding — no continuous relaxation needed. Greedy flip + SA gives strong local search within polynomial budget. |
| Industrial formulation | Glass composition (Monce), chemical mixtures, material design | Encode composition percentages as Reals with constraints, maximize quality metric | Each eval can be a physical experiment or simulation. Budget exponent lets you match eval cost: expensive experiments get a=1.5, cheap simulations get a=3. |
| Black-box API optimization | Maximize output of a system you can query but not differentiate | Wrap the API call as f, polyauma handles the rest | Gradient-free by design. Works on discontinuous, noisy, or discrete objectives where scipy/PyTorch optimizers fail. |
| CPU mining | Find inputs that produce hashes below a difficulty target | Parallel 2K-budget AUMA units, each with Fourier probe + greedy + SA on (nonce, timestamp) | BFL ≈ 1.40 sustained (~40% more hits). Validated: p < 0.00001 across 200K+ hashes. CPU-only — requires sequential refinement. Does not transfer to ASIC parallel enumeration. |
Even if you don't use polyauma for optimization, variable_scores(f, n) is independently valuable.
In 2n+1 evaluations, it tells you which input variables have the most influence on the output.
This is a universal sensitivity analysis — works on any black-box function, any domain.
# Pattern 1: Hyperparameter search
from polyauma import maximize, Real, Integer, Categorical
def train_and_score(lr, depth, dropout):
model = train(lr=lr, depth=int(depth), dropout=dropout)
return -validation_loss(model) # maximize = minimize loss
result = maximize(train_and_score,
[Real(1e-5, 1e-1), Integer(2, 20), Real(0, 0.5)], a=2)
# Pattern 2: Feature selection (n features = n Boolean variables)
def score_subset(*bits):
selected = [f for f, b in zip(features, bits) if b]
return cross_val_score(model, X[selected], y)
result = maximize(score_subset,
[Boolean() for _ in features], a=1.5)
# Pattern 3: API — zero-install, POST from any language
# curl -X POST https://auma.aws.monce.ai/maximize # -H 'Content-Type: application/json' # -d '{"f":"-(x-3)**2","variables":[{"type":"Real","lo":0,"hi":10}],"a":2}'
polyauma's cost is measured in evaluations of f, not wall-clock time. If each eval costs $0.01 (API call) or 10 minutes (lab experiment), you control spend:
| n (variables) | a=1.5 | a=2.0 | a=2.5 |
|---|---|---|---|
| 10 | 32 evals | 100 evals | 316 evals |
| 20 | 90 evals | 400 evals | 1,789 evals |
| 50 | 354 evals | 2,500 evals | 17,678 evals |
At $0.01/eval: optimizing 50 variables costs $3.54 at a=1.5 or $25 at a=2. At 10 min/eval: 50 variables takes 6 hours at a=1.5 or 17 hours at a=2. You pick the exponent that fits your budget and timeline.
We tested whether ML classifiers (Snake) could predict which nonces produce high-variance SHA-256d hash distributions, using Tsetlin-encoded message schedule features (W[18..27]).
The variance-maxing thesis holds in the data: Pearson r = 0.327 between zeros_std and best_zeros across 10K nonces × 5K merkle roots. High-variance nonces DO produce better mining outcomes. But predicting which nonces are high-variance from pre-hash features does not work.
10 independent Snake runs. Each run: train on 7K nonces (156 Tsetlin features, binary hi/lo label), score 2K test nonces with P(hi_var), measure two metrics:
| Metric | Mean | Positive runs | Sign test p |
|---|---|---|---|
| Spearman rho(P(hi), zeros_std) | +0.004 | 6/10 | 0.377 |
| AUROC (hi/lo discrimination) | 0.503 | 7/10 | 0.172 |
No direction shopping. No top-k tuning. Permutation p-values per run, sign test across runs.
Nudge = avg(zeros_std of Snake's top-k%) minus population mean. Averaged over 10 runs:
| k% | nudge | z | p | positive |
|---|---|---|---|---|
| 1% | +0.003 | +0.47 | 0.32 | 5/10 |
| 5% | -0.000 | -0.02 | 0.51 | 4/10 |
| 10% | +0.000 | +0.04 | 0.48 | 6/10 |
| 20% | +0.000 | +0.10 | 0.46 | 5/10 |
Flat at every ranking depth. No signal concentration anywhere.
SHA-256 diffusion destroys the structure in the message schedule that would allow pre-hash variance prediction. The nonce enters at W[3], propagates through W[18..27], but 64 rounds of compression erase any predictable relationship between schedule features and output variance. The Fourier spectrum of SHA-256d is opaque to pre-hash feature analysis.
This is consistent with the round ladder (Section 12.4): Fourier signal is strong at 4 rounds, fading by 16, and flat at 64.