Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove wide fibonacci boundary constraint. #582

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions crates/prover/src/examples/wide_fibonacci/avx.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use itertools::Itertools;
use num_traits::{One, Zero};
use num_traits::One;
use tracing::{span, Level};

use super::component::{WideFibAir, WideFibComponent};
Expand Down Expand Up @@ -80,14 +80,7 @@ impl ComponentProver<AVX512Backend> for WideFibComponent {
for vec_row in 0..(1 << (eval_domain.log_size() - VECS_LOG_SIZE as u32)) {
// Numerator.
let a = trace_eval[0].data[vec_row];
let mut row_res =
PackedSecureField::from_packed_m31s([
a - PackedBaseField::one(),
PackedBaseField::zero(),
PackedBaseField::zero(),
PackedBaseField::zero(),
]) * PackedSecureField::broadcast(accum.random_coeff_powers[self.n_columns() - 2]);

let mut row_res = PackedSecureField::zero();
let mut a_sq = a.square();
let mut b_sq = trace_eval[1].data[vec_row].square();
#[allow(clippy::needless_range_loop)]
Expand Down
7 changes: 1 addition & 6 deletions crates/prover/src/examples/wide_fibonacci/component.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use num_traits::One;

use crate::core::air::accumulation::PointEvaluationAccumulator;
use crate::core::air::mask::fixed_mask_points;
use crate::core::air::{Air, Component};
Expand Down Expand Up @@ -51,7 +49,7 @@ impl Air for WideFibAir {

impl Component for WideFibComponent {
fn n_constraints(&self) -> usize {
self.n_columns() - 1
self.n_columns() - 2
}

fn max_constraint_log_degree_bound(&self) -> u32 {
Expand All @@ -78,9 +76,6 @@ impl Component for WideFibComponent {
let constraint_zero_domain = CanonicCoset::new(self.log_column_size()).coset;
let denom = coset_vanishing(constraint_zero_domain, point);
let denom_inverse = denom.inverse();
let numerator = mask[0][0] - BaseField::one();
evaluation_accumulator.accumulate(numerator * denom_inverse);

for i in 0..self.n_columns() - 2 {
let numerator = mask[i][0].square() + mask[i + 1][0].square() - mask[i + 2][0];
evaluation_accumulator.accumulate(numerator * denom_inverse);
Expand Down
6 changes: 1 addition & 5 deletions crates/prover/src/examples/wide_fibonacci/constraint_eval.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use itertools::Itertools;
use num_traits::{One, Zero};
use num_traits::Zero;

use super::component::{Input, WideFibAir, WideFibComponent};
use super::trace_gen::write_trace_row;
Expand Down Expand Up @@ -46,10 +46,6 @@ impl ComponentProver<CPUBackend> for WideFibComponent {

#[allow(clippy::needless_range_loop)]
for i in 0..trace_eval_domain.size() {
// Boundary constraint.
numerators[i] += accum.random_coeff_powers[self.n_columns() - 2]
* (trace_evals[0].values.at(i) - BaseField::one());

// Step constraints.
for j in 0..self.n_columns() - 2 {
numerators[i] += accum.random_coeff_powers[self.n_columns() - 3 - j]
Expand Down
6 changes: 3 additions & 3 deletions crates/prover/src/examples/wide_fibonacci/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ mod tests {
}

#[test_log::test]
fn test_prove() {
fn test_single_instance_wide_fib_prove() {
// Note: To see time measurement, run test with
// RUST_LOG_SPAN_EVENTS=enter,close RUST_LOG=info RUST_BACKTRACE=1 cargo test
// test_prove -- --nocapture

const LOG_N_INSTANCES: u32 = 3;
const LOG_N_INSTANCES: u32 = 0;
let component = WideFibComponent {
log_fibonacci_size: LOG_N_COLUMNS as u32,
log_fibonacci_size: 3 + LOG_N_COLUMNS as u32,
log_n_instances: LOG_N_INSTANCES,
};
let private_input = (0..(1 << LOG_N_INSTANCES))
Expand Down
Loading