Fix constraint satisfaction check#409
Merged
Merged
Conversation
Pratyush
commented
Jul 25, 2025
| }) | ||
| .collect(); | ||
| if self.predicate.is_satisfied(&variables) { | ||
| if !self.predicate.is_satisfied(&variables) { |
Member
Author
There was a problem hiding this comment.
This is because of a weird typo; see the other change.
Pratyush
commented
Jul 25, 2025
| pub fn is_satisfied(&self, variables: &[F]) -> bool { | ||
| // TODO: Change the polynomial eval to get a slice as an evaluation point | ||
| !self.polynomial.evaluate(&variables.to_vec()).is_zero() | ||
| self.polynomial.evaluate(&variables.to_vec()).is_zero() |
Member
Author
There was a problem hiding this comment.
The predicate is supposed to be satisfied when it is zero; not unsatisfied.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes constraint satisfaction checking in the GR1CS predicate system by correcting the boolean logic in satisfaction checks and adding support for linear combination (LC) variable evaluation.
- Fixed the boolean logic in
is_satisfiedmethod to return true when polynomial evaluates to zero - Added proper handling of linear combination variables in constraint satisfaction checking
- Updated constraint checking logic to correctly identify unsatisfied constraints
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| relations/src/gr1cs/predicate/polynomial_constraint.rs | Fixed boolean logic in is_satisfied method by removing negation |
| relations/src/gr1cs/predicate/mod.rs | Added LC variable handling and fixed constraint satisfaction check logic |
alireza-shirzad
approved these changes
Jul 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes constraint satisfaction checking to always work.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pendingsection inCHANGELOG.mdFiles changedin the Github PR explorer