hyperplonk PolyIOP sketch (#36)

This commit is contained in:
chancharles92
2022-07-05 14:38:03 -04:00
committed by GitHub
parent d41a0cf623
commit 88d0ee89ef
4 changed files with 163 additions and 0 deletions

View File

@@ -31,6 +31,18 @@ pub trait PermutationCheck<F: PrimeField>: ZeroCheck<F> {
type PermutationCheckSubClaim;
type PermutationChallenge;
/// Generate the preprocessed polynomial for the permutation check.
///
/// The algorithm takes as input a permutation and outputs a merged
/// multilinear polynomial s(X0, X1, ..., Xn) such that
/// - s(0, X1, ..., Xn) = s_id(X1, ..., Xn) (identity permutation
/// polynomial)
/// - s(1, X1, ..., Xn) = s_perm(X1, ..., Xn) (permutation polynomial)
fn preprocess(
permutation: &[F],
aux_info: &Self::VPAuxInfo,
) -> Result<DenseMultilinearExtension<F>, PolyIOPErrors>;
/// Initialize the system with a transcript
///
/// This function is optional -- in the case where a PermutationCheck is
@@ -81,6 +93,8 @@ pub trait PermutationCheck<F: PrimeField>: ZeroCheck<F> {
///
/// The caller needs to check num_vars matches in f/g/s_id/s_perm
/// Cost: linear in N.
///
/// TODO: replace argument `s_perm` with the merged polynomial `s`.
fn compute_products(
challenge: &Self::PermutationChallenge,
fx: &DenseMultilinearExtension<F>,
@@ -162,6 +176,20 @@ impl<F: PrimeField> PermutationCheck<F> for PolyIOP<F> {
type PermutationChallenge = PermutationChallenge<F>;
/// Generate the preprocessed polynomial for the permutation check.
///
/// The algorithm takes as input a permutation and outputs a merged
/// multilinear polynomial s(X0, X1, ..., Xn) such that
/// - s(0, X1, ..., Xn) = s_id(X1, ..., Xn) (identity permutation
/// polynomial)
/// - s(1, X1, ..., Xn) = s_perm(X1, ..., Xn) (permutation polynomial)
fn preprocess(
_permutation: &[F],
_aux_info: &Self::VPAuxInfo,
) -> Result<DenseMultilinearExtension<F>, PolyIOPErrors> {
unimplemented!();
}
/// Initialize the system with a transcript
///
/// This function is optional -- in the case where a PermutationCheck is
@@ -229,6 +257,8 @@ impl<F: PrimeField> PermutationCheck<F> for PolyIOP<F> {
///
/// The caller needs to check num_vars matches in f/g/s_id/s_perm
/// Cost: linear in N.
///
/// TODO: replace argument `s_perm` with the merged polynomial `s`.
fn compute_products(
challenge: &Self::PermutationChallenge,
fx: &DenseMultilinearExtension<F>,

View File

@@ -25,6 +25,8 @@ use ark_std::{end_timer, rand::RngCore, start_timer};
///
/// The caller needs to check num_vars matches in f/g/s_id/s_perm
/// Cost: linear in N.
///
/// TODO: replace `s_perm` with the merged poly `s`.
#[allow(clippy::type_complexity)]
pub(super) fn compute_prod_0<F: PrimeField>(
beta: &F,
@@ -47,6 +49,7 @@ pub(super) fn compute_prod_0<F: PrimeField>(
let mut numerator_evals = vec![];
let mut denominator_evals = vec![];
// TODO: remove this line after replacing `s_perm` with `s`.
let s_id = identity_permutation_mle::<F>(num_vars);
for (&fi, (&gi, (&s_id_i, &s_perm_i))) in