Skip to content

feat(u4): compute exact centered binomial moments - #321

Merged
RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:codex/u4-binomial-moments
Nov 9, 2026
Merged

RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:codex/u4-binomial-moments

Conversation

@brenorb

@brenorb brenorb commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Result

Adds arithmetic::u4::binomial_moments::u4_centered_binomial_moments(n). It consumes up to 997 canonical nibbles and returns exact signed moments with weights 1, i, and binomial(i,2) applied to x[i]-8. A reverse recurrence updates the higher moments before the lower ones. Staged initialization delays zero-valued state until the corresponding input guard has run.

Inputs Schedule Leaf bytes Data witness bytes Ordinary items Hint items Combined peak Executed non-push ops
2 Staged initialization 34 4 2 0 5 22
2 Eager initialization 55 4 2 0 8 39
2 Direct weights 55 4 2 0 7 37
4 Staged initialization 83 8 4 0 7 60
4 Eager initialization 101 8 4 0 10 75
4 Direct weights 113 8 4 0 10 84
32 Staged initialization 700 62 32 0 35 564
32 Eager initialization 718 62 32 0 38 579
32 Direct weights 1546 62 32 0 41 1404
128 Staged initialization 2814 249 128 0 131 2292
128 Eager initialization 2832 249 128 0 134 2307
128 Direct weights 8424 249 128 0 139 7896

Each complete leaf checks the same three outputs and uses the same canonical input encoding. Data witness bytes exclude the leaf, control block, annex and transaction. Evidence is locally reproduced with unclassified execution.

At 997 inputs the staged schedule reaches a 1,000-item combined peak and returns an exact quadratic moment of -1,317,395,920 for all-zero raw nibbles. The eager schedule fails at 995 inputs. The negative result also gives two distinct vectors with all three outputs equal.

Verification

  • Independent host model, exhaustive short cases, positional impulses, malformed witnesses, wrong outputs, collisions and stack frontier
  • Exact metric snapshots, python3 tools/kb.py validate, cargo fmt --all -- --check, and git diff --check
  • cargo test --locked -- --skip fields::

@brenorb
brenorb marked this pull request as ready for review November 6, 2026 10:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T10:38:38.903434Z 13a7c72 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@RobinLinus
RobinLinus merged commit 4022890 into solving-bitcoin:main Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants