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

ProofEvaluations is too generic

Open mimoo opened this issue 3 years ago • 9 comments

pub struct ProofEvaluations<Field> {
    /// witness polynomials
    pub w: [Field; COLUMNS],
    /// permutation polynomial
    pub z: Field,
    /// permutation polynomials
    /// (PERMUTS-1 evaluations because the last permutation is only used in commitment form)
    pub s: [Field; PERMUTS - 1],
    /// lookup-related evaluations
    pub lookup: Option<LookupEvaluations<Field>>,
    /// evaluation of the generic selector polynomial
    pub generic_selector: Field,
    /// evaluation of the poseidon selector polynomial
    pub poseidon_selector: Field,
}

should be

pub struct ProofEvaluations<Field> {
    /// witness polynomials
    pub w: [Vec<Field>; COLUMNS],
    /// permutation polynomial
    pub z: Vec<Field>,
    /// permutation polynomials
    /// (PERMUTS-1 evaluations because the last permutation is only used in commitment form)
    pub s: [Vec<Field>; PERMUTS - 1],
    /// lookup-related evaluations
    pub lookup: Option<LookupEvaluations<Vec<Field>>>,
    /// evaluation of the generic selector polynomial
    pub generic_selector: Vec<Field>,
    /// evaluation of the poseidon selector polynomial
    pub poseidon_selector: Vec<Field>,
}

it'd be nice if we actually abstracted chunked evaluations, chunked polynomials, chunked commitments, etc.

mimoo avatar Nov 23 '21 17:11 mimoo

Stale issue message

github-actions[bot] avatar Jan 23 '22 07:01 github-actions[bot]

we might not be able to tackle this one without https://github.com/o1-labs/proof-systems/issues/432 first

mimoo avatar Mar 18 '22 18:03 mimoo

Stale issue message

github-actions[bot] avatar May 31 '22 07:05 github-actions[bot]

I think we might be able to just write this struct as:

pub struct ProofEvaluations<F> where F: FftField {
    /// witness polynomials
    pub w: [F; COLUMNS],
    /// permutation polynomial
    pub z: F,
    /// permutation polynomials
    /// (PERMUTS-1 evaluations because the last permutation is only used in commitment form)
    pub s: [F; PERMUTS - 1],
    /// lookup-related evaluations
    pub lookup: Option<LookupEvaluations<F>>,
    /// evaluation of the generic selector polynomial
    pub generic_selector: F,
    /// evaluation of the poseidon selector polynomial
    pub poseidon_selector: F,
}

as none of these evaluations are chunked (unless I'm misunderstanding something)

mimoo avatar Jun 06 '22 19:06 mimoo

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

I tried removing the Vec<F> and just making them single elements: https://github.com/o1-labs/proof-systems/pull/680

tests don't pass due to how the PCS is written, specifically when something evaluates to zero it expects you to pass an empty vec: https://github.com/o1-labs/proof-systems/blob/master/poly-commitment/src/commitment.rs#L434

    for (evals_tr, shifted) in polys.iter().filter(|(evals_tr, _)| !evals_tr[0].is_empty()) {

mimoo avatar Jul 08 '22 00:07 mimoo

Closing in sight of issue #680

querolita avatar Jul 25 '22 15:07 querolita

if you don't mind let's reopen it until I test this on the mina side, as I predict that it might be a bit painful

mimoo avatar Jul 25 '22 18:07 mimoo

Stale issue message

github-actions[bot] avatar Sep 24 '22 07:09 github-actions[bot]

Stale issue message

github-actions[bot] avatar Nov 26 '22 07:11 github-actions[bot]

truer today than ever :D I think we will need to look into simplifying that part at some point. The problem now is all the generics:

pub struct PointEvaluations<Evals> {
    /// Evaluation at the challenge point zeta.
    pub zeta: Evals,
    /// Evaluation at `zeta . omega`, the product of the challenge point and the group generator.
    pub zeta_omega: Evals,
}

pub struct ProofEvaluations<Evals> {
    /// witness polynomials
    pub w: [Evals; COLUMNS],
    /// permutation polynomial
    pub z: Evals,
    /// permutation polynomials
    /// (PERMUTS-1 evaluations because the last permutation is only used in commitment form)
    pub s: [Evals; PERMUTS - 1],
    /// coefficient polynomials
    pub coefficients: [Evals; COLUMNS],
    /// lookup-related evaluations
    pub lookup: Option<LookupEvaluations<Evals>>,
    /// evaluation of the generic selector polynomial
    pub generic_selector: Evals,
    /// evaluation of the poseidon selector polynomial
    pub poseidon_selector: Evals,
}

which we instantiate like that:

pub evals: ProofEvaluations<PointEvaluations<Vec<G::ScalarField>>>,

mimoo avatar Dec 05 '22 21:12 mimoo

Stale issue message

github-actions[bot] avatar Feb 05 '23 07:02 github-actions[bot]

Stale issue message

github-actions[bot] avatar Apr 07 '23 07:04 github-actions[bot]