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

Formal polynomial evaluator. #836

Open
wants to merge 2 commits into
base: alont/symbolic-poly
Choose a base branch
from
Open

Conversation

Alon-Ti
Copy link
Contributor

@Alon-Ti Alon-Ti commented Sep 16, 2024

Formal polynomial evaluator.

Added rational functions for formal polynomial evaluator.


This change is Reviewable

Copy link
Contributor Author

Alon-Ti commented Sep 16, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Alon-Ti and the rest of your teammates on Graphite Graphite

@Alon-Ti Alon-Ti marked this pull request as ready for review September 16, 2024 15:48
@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 51.92308% with 100 lines in your changes missing coverage. Please review.

Project coverage is 90.95%. Comparing base (5a971e9) to head (0989676).

Files with missing lines Patch % Lines
crates/prover/src/constraint_framework/rational.rs 21.05% 45 Missing ⚠️
crates/prover/src/core/lookups/utils.rs 40.62% 19 Missing ⚠️
crates/prover/src/constraint_framework/poly.rs 73.13% 17 Missing and 1 partial ⚠️
...rates/prover/src/constraint_framework/poly_eval.rs 65.38% 18 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           alont/symbolic-poly     #836      +/-   ##
=======================================================
- Coverage                91.53%   90.95%   -0.59%     
=======================================================
  Files                       91       93       +2     
  Lines                    12629    12832     +203     
  Branches                 12629    12832     +203     
=======================================================
+ Hits                     11560    11671     +111     
- Misses                     953     1045      +92     
  Partials                   116      116              
Flag Coverage Δ
90.95% <51.92%> (-0.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@andrewmilson andrewmilson left a comment

Choose a reason for hiding this comment

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

:lgtm: with comment

Reviewable status: 0 of 5 files reviewed, 2 unresolved discussions (waiting on @Alon-Ti)


crates/prover/src/constraint_framework/poly.rs line 25 at r2 (raw file):

    fn default() -> Monomial {
        Monomial { vars: [].into() }
    }

Remove in favour of One?

Code quote:

    fn default() -> Monomial {
        Monomial { vars: [].into() }
    }

crates/prover/src/constraint_framework/poly_eval.rs line 83 at r2 (raw file):

        assert_eq!(eval.constraints[0].to_string(), "(x₀x₁x₂) / (x₀ + x₁)");
    }
}

Suggestion:

#[cfg(test)]
mod tests {
    use super::PolyEvaluator;
    use crate::constraint_framework::{EvalAtRow, FrameworkEval};
    use crate::core::fields::FieldExpOps;

    #[test]
    fn test_poly_eval() {
        let test_struct = TestStruct {};
        let eval = test_struct.evaluate(PolyEvaluator {
            cur_var_index: 0,
            constraints: vec![],
        });

        assert_eq!(eval.constraints[0].to_string(), "(x₀x₁x₂) / (x₀ + x₁)");
    }
    
    struct TestStruct {}
    
    impl FrameworkEval for TestStruct {
        fn log_size(&self) -> u32 {
            1 << 16
        }

        fn max_constraint_log_degree_bound(&self) -> u32 {
            1 << 17
        }

        fn evaluate<E: EvalAtRow>(&self, mut eval: E) -> E {
            let x0 = eval.next_trace_mask();
            let x1 = eval.next_trace_mask();
            let x2 = eval.next_trace_mask();

            eval.add_constraint(x0.clone() * x1.clone() * x2 * (x0 + x1).inverse());
            eval
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants