Skip to content

Commit

Permalink
Merge pull request #2692 from o1-labs/fizzixnerd/dw/continue-quotient…
Browse files Browse the repository at this point in the history
…-polynomial

o1vm/pickles: Remove linearization and add quotient polynomial evaluations
  • Loading branch information
Fizzixnerd authored Oct 9, 2024
2 parents 23753d5 + 9f649e1 commit 09cf803
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
16 changes: 16 additions & 0 deletions o1vm/src/pickles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,21 @@ pub mod column_env;
pub mod proof;
pub mod prover;

/// Maximum degree of the constraints.
/// It does include the additional degree induced by the multiplication of the
/// selectors.
pub const MAXIMUM_DEGREE_CONSTRAINTS: u64 = 6;

/// Degree of the quotient polynomial. We do evaluate all polynomials on d8
/// (because of the value of [MAXIMUM_DEGREE_CONSTRAINTS]), and therefore, we do
/// have a degree 7 for the quotient polynomial.
/// Used to keep track of the number of chunks we do have when we commit to the
/// quotient polynomial.
pub const DEGREE_QUOTIENT_POLYNOMIAL: u64 = 7;

/// Total number of constraints for all instructions, including the constraints
/// added for the selectors.
pub const TOTAL_NUMBER_OF_CONSTRAINTS: usize = 463;

#[cfg(test)]
mod tests;
13 changes: 12 additions & 1 deletion o1vm/src/pickles/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use rayon::iter::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterato
use super::{
column_env::ColumnEnvironment,
proof::{Proof, ProofInputs, WitnessColumns},
DEGREE_QUOTIENT_POLYNOMIAL,
};
use crate::{interpreters::mips::column::N_MIPS_SEL_COLS, E};
use thiserror::Error;
Expand Down Expand Up @@ -257,7 +258,9 @@ where
quotient
};

let _t_comm = srs.commit_non_hiding(&quotient_poly, 7);
let t_comm = srs.commit_non_hiding(&quotient_poly, DEGREE_QUOTIENT_POLYNOMIAL as usize);

absorb_commitment(&mut fq_sponge, &t_comm);

////////////////////////////////////////////////////////////////////////////
// Round 3: Evaluations at ζ and ζω
Expand Down Expand Up @@ -303,6 +306,10 @@ where
let mut fr_sponge = EFrSponge::new(G::sponge_params());
fr_sponge.absorb(&fq_sponge.digest());

// Quotient poly evals
let quotient_zeta_eval = quotient_poly.evaluate(&zeta);
let quotient_zeta_omega_eval = quotient_poly.evaluate(&zeta_omega);

for (zeta_eval, zeta_omega_eval) in zeta_evaluations
.scratch
.iter()
Expand All @@ -323,6 +330,8 @@ where
fr_sponge.absorb(zeta_eval);
fr_sponge.absorb(zeta_omega_eval);
}
fr_sponge.absorb(&quotient_zeta_eval);
fr_sponge.absorb(&quotient_zeta_omega_eval);

////////////////////////////////////////////////////////////////////////////
// Round 4: Opening proof w/o linearization polynomial
Expand All @@ -333,6 +342,8 @@ where
polynomials.push(polys.instruction_counter);
polynomials.push(polys.error);
polynomials.extend(polys.selector);
polynomials.push(quotient_poly);

let polynomials: Vec<_> = polynomials
.iter()
.map(|poly| {
Expand Down
13 changes: 7 additions & 6 deletions o1vm/src/pickles/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::interpreters::mips::{
constraints as mips_constraints, interpreter, interpreter::InterpreterEnv, Instruction,
use crate::{
interpreters::mips::{
constraints as mips_constraints, interpreter, interpreter::InterpreterEnv, Instruction,
},
pickles::{MAXIMUM_DEGREE_CONSTRAINTS, TOTAL_NUMBER_OF_CONSTRAINTS},
};
use interpreter::{ITypeInstruction, JTypeInstruction, RTypeInstruction};
use kimchi_msm::expr::E;
Expand Down Expand Up @@ -28,12 +31,10 @@ fn test_regression_constraints_with_selectors() {
constraints
};

// Total number of constraints
assert_eq!(constraints.len(), 463);
assert_eq!(constraints.len(), TOTAL_NUMBER_OF_CONSTRAINTS);

// Check highest degree
let max_degree = constraints.iter().map(|c| c.degree(1, 0)).max().unwrap();
assert_eq!(max_degree, 6);
assert_eq!(max_degree, MAXIMUM_DEGREE_CONSTRAINTS);
}

#[test]
Expand Down

0 comments on commit 09cf803

Please sign in to comment.