proof-systems icon indicating copy to clipboard operation
proof-systems copied to clipboard

need better abstractions to represent chunked polynomials, chunked evaluations, chunked commitments, etc.

Open mimoo opened this issue 2 years ago • 6 comments

I believe we mostly used chunked SOMETHING for the quotient polynomial, and the f polynomial, in their different forms (coefficient form, evaluation form, or commitment form).

The code is quite messy in parts where we handle the chunked polynomials IMO. This issue is mostly about brainstorming what could be a good abstraction for these to make the code clearer.

For example, this is part of the prover:

        let chunked_evals = {
            let chunked_evals_zeta = ProofEvaluations::<Vec<Fr<G>>> {
                s: array_init(|i| {
                    index.cs.sigmam[0..PERMUTS - 1][i].eval(zeta, index.max_poly_size)
                }),
                w: array_init(|i| witness_poly[i].eval(zeta, index.max_poly_size)),
                z: z_poly.eval(zeta, index.max_poly_size),
                lookup: lookup_evals(zeta),
                generic_selector: index.cs.genericm.eval(zeta, index.max_poly_size),
                poseidon_selector: index.cs.psm.eval(zeta, index.max_poly_size),
            };
            let chunked_evals_zeta_omega = ProofEvaluations::<Vec<Fr<G>>> {
                s: array_init(|i| {
                    index.cs.sigmam[0..PERMUTS - 1][i].eval(zeta_omega, index.max_poly_size)
                }),
                w: array_init(|i| witness_poly[i].eval(zeta_omega, index.max_poly_size)),
                z: z_poly.eval(zeta_omega, index.max_poly_size),
                lookup: lookup_evals(zeta_omega),
                generic_selector: index.cs.genericm.eval(zeta_omega, index.max_poly_size),
                poseidon_selector: index.cs.psm.eval(zeta_omega, index.max_poly_size),
            };

            [chunked_evals_zeta, chunked_evals_zeta_omega]
        };

mimoo avatar Mar 17 '22 17:03 mimoo

also this eval function should really be called linearization

mimoo avatar Mar 18 '22 18:03 mimoo

perhaps something like this:

struct ChunkedPolynomial<F>(Vec<DensePolynomial<F>>);

impl ChunkedPolynomial {
  fn linearize(&self, chunk_size: usize, x: F) -> DensePolynomial<F>
}

with a function to convert a polynomial into a chunked polynomial?

mimoo avatar Mar 18 '22 18:03 mimoo

I will take this

xiangxiecrypto avatar Mar 22 '22 07:03 xiangxiecrypto

Stale issue message

github-actions[bot] avatar Jun 04 '22 07:06 github-actions[bot]

Let's try something like:

pub struct ChunkedEvaluations<F> (ProofEvaluations<Vec<F>>);

instead of duplicating manually all chunked types, and still keep ProofEvaluations generic enough

querolita avatar Jun 13 '22 15:06 querolita

Stale issue message

github-actions[bot] avatar Aug 14 '22 07:08 github-actions[bot]