-
Notifications
You must be signed in to change notification settings - Fork 97
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
Parse next as operator #733
Conversation
ed672b2
to
c2fa193
Compare
3347421
to
4aad1d2
Compare
pil_analyzer/src/condenser.rs
Outdated
@@ -160,6 +160,19 @@ impl<T: FieldElement> Condenser<T> { | |||
} | |||
Expression::UnaryOperation(op, inner) => { | |||
let inner = self.condense_expression(inner); | |||
if *op == UnaryOperator::Next { | |||
if let AlgebraicExpression::Reference(reference) = inner { | |||
assert!(!reference.next, "Double application of \"'\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just allow this here and change next: bool
to shift: int32
or something. But this would need substantial changes in the witness generator as well.
49b57f3
to
d36b461
Compare
Actually let me try to restrict the operators. It makes no sense to allow |
d36b461
to
d40cf0a
Compare
@@ -72,6 +72,7 @@ pub fn evaluate_unary_operation<T: FieldElement>(op: UnaryOperator, v: T) -> T { | |||
UnaryOperator::Plus => v, | |||
UnaryOperator::Minus => -v, | |||
UnaryOperator::LogicalNot => v.is_zero().into(), | |||
UnaryOperator::Next => panic!("Cannot evaluate \"'\"."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be fine to actually return v
here, but I'm leaving it like that for now.
d40cf0a
to
b2a8960
Compare
Expression::UnaryOperation(op, expr) => { | ||
// Special case to allow `x'` for now on witness columns. | ||
// TODO: Check if we actually need this or should replace it by `x(i + 1)` | ||
if let Expression::Reference(Reference::Poly(poly)) = expr.as_ref() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and if op == UnaryOperation::Next
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha yes! :)
e746304
to
50e94d1
Compare
50e94d1
to
9a3c5e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, maybe @georgwiese should check the witgen file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the witgen part!
No description provided.