Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Dec 4, 2024
1 parent 44212d6 commit aa08a54
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions backend/src/mock/polynomial_constraint_checker.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::BTreeMap, fmt};

use powdr_ast::{
analyzed::{Identity, PolynomialIdentity},
analyzed::{AlgebraicExpression, Identity, PolynomialIdentity},
parsed::visitor::AllChildren,
};
use powdr_executor::witgen::{
Expand Down Expand Up @@ -70,8 +70,13 @@ impl<'a, F: FieldElement> PolynomialConstraintChecker<'a, F> {
let result = evaluator.evaluate(&identity.expression);

if result != F::zero() {
let used_variables = identity.all_children().filter_map(|child| {
child.try_into().ok().map(|_: AlgebraicVariable| child)
let used_variables = identity.all_children().filter(|expr| match expr {
AlgebraicExpression::Reference(_)
| AlgebraicExpression::PublicReference(_)
| AlgebraicExpression::Challenge(_) => true,
AlgebraicExpression::Number(_)
| AlgebraicExpression::BinaryOperation(_)
| AlgebraicExpression::UnaryOperation(_) => false,
});
Some(FailingPolynomialConstraint {
row,
Expand Down

0 comments on commit aa08a54

Please sign in to comment.