Skip to content
Draft
2 changes: 2 additions & 0 deletions libiop/protocols/encoded/lincheck/basic_lincheck_aux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class multi_lincheck_virtual_oracle : public virtual_oracle<FieldT> {
lagrange_polynomial<FieldT> p_alpha_;
std::vector<FieldT> p_alpha_evals_;
std::vector<FieldT> p_alpha_ABC_evals_;
vanishing_polynomial<FieldT> vd_vp_;
vanishing_polynomial<FieldT> cd_vp_;
std::shared_ptr<lagrange_cache<FieldT> > lagrange_coefficients_cache_;
public:
multi_lincheck_virtual_oracle(
Expand Down
37 changes: 33 additions & 4 deletions libiop/protocols/encoded/lincheck/basic_lincheck_aux.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ void multi_lincheck_virtual_oracle<FieldT>::set_challenge(const FieldT &alpha, c
/* Set alpha polynomial, and its evaluations */
this->p_alpha_ = lagrange_polynomial<FieldT>(alpha, this->constraint_domain_);
this->p_alpha_evals_ = this->p_alpha_.evaluations_over_field_subset(this->constraint_domain_);

this->vd_vp_ = vanishing_polynomial<FieldT>(this->variable_domain_);
this->cd_vp_ = vanishing_polynomial<FieldT>(this->constraint_domain_);
leave_block("multi_lincheck compute random polynomial evaluations");

/* Set p_alpha_ABC_evals */
Expand Down Expand Up @@ -92,9 +93,24 @@ std::shared_ptr<std::vector<FieldT>> multi_lincheck_virtual_oracle<FieldT>::eval
/* p_{alpha}^1 in [BCRSVW18], but now using the lagrange polynomial from
* [TODO: cite Succinct Aurora] instead of powers of alpha. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change that citation to be [BCGGRS19]?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err, no the original citation was right. I meant can you change the TODO haha

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err, no the original citation was right. I meant can you change the TODO haha

Oh my bad, yeah will be fixed in upcoming commit.

/* Compute p_alpha_prime. */
std::vector<FieldT> p_alpha_prime_over_codeword_domain =
std::vector<FieldT> p_alpha_prime_over_codeword_domain;
std::vector<FieldT> vd_vp_evaluations;
std::vector<FieldT> cd_vp_evaluations;
if (this->variable_domain_.num_elements() > this->constraint_domain_.num_elements()){
p_alpha_prime_over_codeword_domain =
this->p_alpha_.evaluations_over_field_subset(this->codeword_domain_);

vd_vp_evaluations = this->vd_vp_.evaluations_over_field_subset(this->codeword_domain_);
cd_vp_evaluations = this->cd_vp_.evaluations_over_field_subset(this->codeword_domain_);

for (int i = 0; i < vd_vp_evaluations.size(); i++)
p_alpha_prime_over_codeword_domain[i] *= vd_vp_evaluations[i] * cd_vp_evaluations[i].inverse();

}else{
p_alpha_prime_over_codeword_domain =
this->p_alpha_.evaluations_over_field_subset(this->codeword_domain_);
}

/* p_{alpha}^2 in [BCRSVW18] */
const std::vector<FieldT> p_alpha_ABC_over_codeword_domain =
FFT_over_field_subset<FieldT>(this->p_alpha_ABC_.coefficients(), this->codeword_domain_);
Expand Down Expand Up @@ -133,13 +149,26 @@ FieldT multi_lincheck_virtual_oracle<FieldT>::evaluation_at_point(
const std::vector<FieldT> &constituent_oracle_evaluations) const
{
UNUSED(evaluation_position);
FieldT p_alpha_prime_X;
if (constituent_oracle_evaluations.size() != this->matrices_.size() + 1)
{
throw std::invalid_argument("multi_lincheck uses more constituent oracles than what was provided.");
}

FieldT p_alpha_prime_X = this->p_alpha_.evaluation_at_point(evaluation_point);;
// Depending on the cardinalities of the constraint / variable domain
// multiplies the constraint domain vanishing polynomial Z_C = (Z_C(a) - Z_C(X)) / (a - X) with Z_V / Z_C, where
// Z_V is the variable domain vanishing polynomial. Since polynomials typically don't have inverses,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this comment the same as the one in evaluated_contents

// We instead consider the inverse via pointwise multiplication.

if (this->variable_domain_.num_elements() > this->constraint_domain_.num_elements())
FieldT p_alpha_prime_X = this->p_alpha_.evaluation_at_point(evaluation_point) *
this->vd_vp_.evaluation_at_point(evaluation_point) *
this->cd_vp_.evaluation_at_point(evaluation_point).inverse();
else
FieldT p_alpha_prime_X = this->p_alpha_.evaluation_at_point(evaluation_point);

FieldT p_alpha_ABC_X = this->p_alpha_ABC_.evaluation_at_point(evaluation_point);

if (this->use_lagrange_)
{
const std::vector<FieldT> lagrange_coefficients =
Expand All @@ -159,4 +188,4 @@ FieldT multi_lincheck_virtual_oracle<FieldT>::evaluation_at_point(
return (f_combined_Mz_x * p_alpha_prime_X - fz_X * p_alpha_ABC_X);
}

} // libiop
} // libiop