Skip to content

feat(prover-ray): pack up to 4 fractions per log-derivative column - #4211

Open
ThomasPiellard wants to merge 1 commit into
mainfrom
feat/logderiv-arity-4
Open

ThomasPiellard wants to merge 1 commit into
mainfrom
feat/logderiv-arity-4

Conversation

@ThomasPiellard

@ThomasPiellard ThomasPiellard commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

feat(prover-ray): pack up to 4 fractions per log-derivative column

Follow-up of #4171 (cyclic logderivativesum running sums).

Summary

The logderivativesum compiler packs the fractions of a module into running-sum (Z) columns. It used to pack exactly 3 per column (packingArity = 3). It now packs up to 4, greedily and in order, as long as the column's recurrence stays of degree factor at most 5.

With linear filters, numerators and denominators (all lookup fractions), modules with many fractions get up to 25% fewer Z columns, and as many fewer average cells, at no extra cost in the quotient.

Why 4 is now free

A Z column packing fractions F_j·N_j/D_j has the cyclic recurrence zNum − (Z − Z[−1] + C)·zDen, of degree factor

max(1 + Σ_k deg D_k,  max_j (deg F_j + deg N_j + Σ_(k≠j) deg D_k))

that is 4 for 3 linear fractions and 5 for 4.

I checked this directly: a column of 3 and a column of 4 linear filtered fractions both get the same four ratio-4 quotient shares (q-r4-s0…s3).

Change

  • packingArity is 4.
  • A new bound, maxPackedDegree = 5, applies to the recurrence's degree factor. packedDegree computes it from the expressions' DegreeFactor().
  • packFractions is now greedy: a group takes the next fraction while it has fewer than 4 and the degree stays at most 5. A group always holds at least one fraction, whatever its degree.
    • Fractions of higher degree pack fewer per column. For example, denominators of degree 2 pack 2 per column, since 3 would give degree 7.
    • So the quotient ratio stays 4 in every case.

Soundness

None of the argument changes. Packing is only algebra on the same fractions: a column's total is still the sum of its fractions. The cyclic recurrence, the average cells and the verifier's Σ n·C = Result check are unchanged.

The shape of compiled systems changes, though: there are fewer Z columns and average cells. Proofs from before this change don't verify after it.

verifier-ray

verifier-ray pins its prover-ray version, so this PR doesn't affect it. When verifier-ray is bumped past it, its generated fixtures must be regenerated (make generate-testdata), since the number of entries per log-derivative query changes. No code change is needed there: the codegen reads the entries from the compiled system.

Tests

  • TestCompile_PacksFractions is now table-driven:

    • 4 linear fractions → 1 column;
    • 5 → 2 (4 + 1);
    • 4 with constant denominators → 1;
    • 4 with quadratic denominators → 2.

    Every case also checks that each recurrence has degree factor ≤ 5 and cancels no row.

  • go test ./wiop/... passes, including the full pipeline (lookups → log-derivative → local vanishing → global → PCS).

  • go test ./zkcdriver passes (it proves zkc systems end to end), except TestZkcIntegrationTestSynced, which needs make download-zkc-testdata and fails on main too without it.

🤖 Generated with Claude Code


Note

Medium Risk
Changes compiled WIOP shape (fewer Z columns and average cells), so proofs and verifier-ray fixtures must be regenerated after bump; constraint logic is unchanged but deployment coupling is real.

Overview
The log-derivative sum compiler now packs up to four fractions per running-sum Z column (was three), using greedy in-order grouping instead of fixed-size chunks.

Packing is capped by a new maxPackedDegree (5) on the cyclic recurrence’s degree factor, computed by packedDegree from numerator, denominator, and filter DegreeFactor() values. Higher-degree fractions still pack fewer per column so the global quotient ratio stays at 4 (degree 4 and 5 both map to the same ratio after cyclic recurrence). The unused utils import is dropped.

TestCompile_PacksFractions is table-driven and asserts column counts, recurrence degree ≤ 5, and that no rows are cancelled on the cyclic vanishing.

Reviewed by Cursor Bugbot for commit d00e248. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Thomas Piellard <thomas.piellard@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant