Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add variant of fingerprint() that yields intermediate columns #2072

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

georgwiese
Copy link
Collaborator

This test (simulating folding a size-200 tuple) now works:

use std::math::fp2::from_base;
use std::math::fp2::Fp2;
use std::math::fp2::constrain_eq_ext;
use std::prover::challenge;
use std::protocols::fingerprint::fingerprint;
use std::protocols::fingerprint::fingerprint_inter;
use std::array;

machine Main with degree: 8 {

    col witness x;
    // let alpha = from_base(challenge(0, 0));
    let alpha = Fp2::Fp2(challenge(0, 0), challenge(0, 1));

    let n = 200;
    // Because all elements except the first are 0, the fingerprint
    // is going to be alpha^{n - 1} * x.
    let tuple = array::new(n, |i| if i == 0 { x } else { 1 });

    constrain_eq_ext(fingerprint_inter(tuple, alpha), from_base(0));
}

All generated expressions are constant-length.

A few observations:

  • Yielding intermediate columns means that we have to turn everything into constr functions. Because fingerprint() is also used in a hint, we need to implement to variants, one that yields intermediate columns and one that computes the result as a pure function. Maybe that can be fixed by passing an expr (involving intermediate columns) to the hint...
  • We store all inputs to square_ext_inter, so a single invocation of pow_ext_inter should generate $log(n)$ intermediate columns of constant size.
  • fingerprint_inter then calls pow_ext_inter $n$ times. So, overall, $O(n \cdot log(n))$ constant-size expressions are generated. No computation is shared between the $n$ calls to pow_ext_inter!

@georgwiese georgwiese changed the title [WIP] Add variant of fingerprint() that yields intermediate columns [WIP] Add variant of fingerprint() that yields intermediate columns Nov 11, 2024
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