Skip to content

Commit

Permalink
o1vm/pickles: add ft - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Oct 4, 2024
1 parent b802ccf commit 57a6adb
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions o1vm/src/pickles/prover.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
use ark_ec::AffineRepr;
use ark_ff::{PrimeField, Zero};
use ark_poly::{univariate::DensePolynomial, Evaluations, Polynomial, Radix2EvaluationDomain as D};
use ark_ff::{Field, PrimeField, Zero};
use ark_poly::{
univariate::DensePolynomial, EvaluationDomain, Evaluations, Polynomial,
Radix2EvaluationDomain as D,
};
use kimchi::{
circuits::{
domains::EvaluationDomains,
expr::{l0_1, BerkeleyChallenges, Constants},
},
curve::KimchiCurve,
groupmap::GroupMap,
o1_utils::ExtendedDensePolynomial,
plonk_sponge::FrSponge,
};
use mina_poseidon::{sponge::ScalarChallenge, FqSponge};
Expand Down Expand Up @@ -239,6 +243,7 @@ where
let zeta_omega = zeta * omega;

// FIXME: add selectors
// FIXME: add quotient polynomial?
let evals = |point| {
let WitnessColumns {
scratch,
Expand Down Expand Up @@ -282,6 +287,29 @@ where
fr_sponge.absorb(&zeta_omega_evaluations.error);
// FIXME: add selectors

// Compute ft(X) = \
// (1 - ζ^n) \
// (t_0(X) + ζ^n t_1(X) + ... + ζ^{kn} t_{k}(X))
// where Σ_i t_i(X) X^{i n} = t(X), and t(X) is the quotient polynomial.
// At the end, we get the (partial) evaluation of the constraint polynomial
// in ζ.
let ft: DensePolynomial<G::ScalarField> = {
let evaluation_point_to_domain_size = zeta.pow([domain.d1.size]);
// Compute \sum_i t_i(X) ζ^{i n}
// First we split t in t_i, and we reduce to degree (n - 1) after using `linearize`
let t_chunked: DensePolynomial<G::ScalarField> = quotient_poly
.to_chunked_polynomial(7, domain.d1.size as usize)
.linearize(evaluation_point_to_domain_size);
// -Z_H = (1 - ζ^n)
let minus_vanishing_poly_at_zeta = -domain.d1.vanishing_polynomial().evaluate(&zeta);
// Multiply the polynomial Σ_i t_i(X) ζ^{i n} by -Z_H(ζ)
// (the evaluation in ζ of the vanishing polynomial)
t_chunked.scale(minus_vanishing_poly_at_zeta)
};

let ft_eval_zeta_omega = ft.evaluate(&zeta_omega);
fr_sponge.absorb(&ft_eval_zeta_omega);

////////////////////////////////////////////////////////////////////////////
// Round 4: Opening proof w/o linearization polynomial
////////////////////////////////////////////////////////////////////////////
Expand All @@ -291,6 +319,8 @@ where
polynomials.push(polys.instruction_counter);
polynomials.push(polys.error);
// FIXME: add selectors
// quotient polynomial
polynomials.push(ft);
let polynomials: Vec<_> = polynomials
.iter()
.map(|poly| {
Expand Down

0 comments on commit 57a6adb

Please sign in to comment.