Refactor free variable removal#3773
Merged
Merged
Conversation
georgwiese
commented
Jun 25, 2026
| /// Like `try_solve_for`, but also handles the case where the constraint is a | ||
| /// product of two expressions. In this case, the found solution (if any) might | ||
| /// not be unique. | ||
| pub fn try_solve_for_not_unique(&self, variable: &V) -> Option<GroupedExpression<T, V>> { |
Collaborator
Author
There was a problem hiding this comment.
I originally put it into try_solve_for, but I think we might use it in situations were we only want unique solutions.
chriseth
reviewed
Jun 25, 2026
| /// Like `try_solve_for`, but also handles the case where the constraint is a | ||
| /// product of two expressions. In this case, the found solution (if any) might | ||
| /// not be unique. | ||
| pub fn try_solve_for_not_unique(&self, variable: &V) -> Option<GroupedExpression<T, V>> { |
Member
There was a problem hiding this comment.
Just naming: try_find_arbitrary_solution? try_find_some_solution? try_get_some_solution?
chriseth
reviewed
Jun 25, 2026
| if let Some((left, right)) = self.expression.try_as_single_product() { | ||
| // If either `left` or `right` can be set to 0, the constraint is satisfied. | ||
| return AlgebraicConstraint::from(left) | ||
| .try_solve_for(variable) |
Collaborator
Author
There was a problem hiding this comment.
Right, of course!
chriseth
approved these changes
Jun 26, 2026
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.
A small refactor in preparation of a PR I'm planning on top of #3761: Whenever we remove a variable, we should emit a hint of how that variable could have been assigned in the original circuit (to aid FV). With this PR, at least the algebraic constraint case should be trivial.