-
Notifications
You must be signed in to change notification settings - Fork 82
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
Expr formatting. #888
base: alont/formal-expr-logup
Are you sure you want to change the base?
Expr formatting. #888
Conversation
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.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
059b0f4
to
4cdfe97
Compare
436a78c
to
9ebe2ae
Compare
4cdfe97
to
4f5955b
Compare
9ebe2ae
to
e0a38e9
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.
Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @Alon-Ti)
crates/prover/src/constraint_framework/expr.rs
line 56 at r1 (raw file):
d.format_expr() ), Expr::Const(c) => c.0.to_string(),
Const is a BaseField so why are you treat it as a string?
Code quote:
Expr::Const(c) => c.0.to_string(),
crates/prover/src/constraint_framework/expr.rs
line 59 at r1 (raw file):
Expr::Var(v) => v.to_string(), Expr::Add(a, b) => format!("{} + {}", a.format_expr(), b.format_expr()), Expr::Sub(a, b) => format!("{} - ({})", a.format_expr(), b.format_expr()),
don't you need to add parenthesis on this too?
Suggestion:
Expr::Sub(a, b) => format!("({}) - ({})", a.format_expr(), b.format_expr())
crates/prover/src/constraint_framework/expr.rs
line 444 at r1 (raw file):
let eval = test_struct.evaluate(ExprEvaluator::new(16, (SecureField::zero(), None))); assert_eq!(eval.constraints[0].format_expr(), "(1) * ((((col_1_0[0]) * (col_1_1[0])) * (col_1_2[0])) * (1/(col_1_0[0] + col_1_1[0])))"); assert_eq!(eval.constraints[1].format_expr(), "(1) * ((SecureCol(col_2_4[0], col_2_6[0], col_2_8[0], col_2_10[0]) - (SecureCol(col_2_5[18446744073709551615], col_2_7[18446744073709551615], col_2_9[18446744073709551615], col_2_11[18446744073709551615]) - ((col_0_3[0]) * (SecureCol(0, 0, 0, 0)))) - (0)) * (0 + (TestRelation_alpha0) * (col_1_0[0]) + (TestRelation_alpha1) * (col_1_1[0]) + (TestRelation_alpha2) * (col_1_2[0]) - (TestRelation_z)) - (1))");
I think you should write it in a clearer indentation, (so it will be easy to understand what the constraints are, and then you it in the test.
Code quote:
assert_eq!(eval.constraints[0].format_expr(), "(1) * ((((col_1_0[0]) * (col_1_1[0])) * (col_1_2[0])) * (1/(col_1_0[0] + col_1_1[0])))");
assert_eq!(eval.constraints[1].format_expr(), "(1) * ((SecureCol(col_2_4[0], col_2_6[0], col_2_8[0], col_2_10[0]) - (SecureCol(col_2_5[18446744073709551615], col_2_7[18446744073709551615], col_2_9[18446744073709551615], col_2_11[18446744073709551615]) - ((col_0_3[0]) * (SecureCol(0, 0, 0, 0)))) - (0)) * (0 + (TestRelation_alpha0) * (col_1_0[0]) + (TestRelation_alpha1) * (col_1_1[0]) + (TestRelation_alpha2) * (col_1_2[0]) - (TestRelation_z)) - (1))");
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2
.
Benchmark suite | Current: 78e9027 | Previous: f6214d1 | Ratio |
---|---|---|---|
merkle throughput/simd merkle |
30829455 ns/iter (± 455168 ) |
14690867 ns/iter (± 434150 ) |
2.10 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @shaharsamocha7
4f5955b
to
b8d7a09
Compare
e0a38e9
to
36aa69d
Compare
b8d7a09
to
2601e11
Compare
af65bfc
to
5c04e62
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.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @shaharsamocha7)
crates/prover/src/constraint_framework/expr.rs
line 56 at r1 (raw file):
Previously, shaharsamocha7 wrote…
Const is a BaseField so why are you treat it as a string?
Oh, right, the unreduced form :(
crates/prover/src/constraint_framework/expr.rs
line 59 at r1 (raw file):
Previously, shaharsamocha7 wrote…
don't you need to add parenthesis on this too?
Isn't it correct like this? I think add doesn't need parens, sub needs parens on the negative part and mul needs parens on both.
a * b - d + c - (x * y + z) <=> (a * b - d + c) - (x * y + z)
crates/prover/src/constraint_framework/expr.rs
line 444 at r1 (raw file):
Previously, shaharsamocha7 wrote…
I think you should write it in a clearer indentation, (so it will be easy to understand what the constraints are, and then you it in the test.
Done.
2601e11
to
a61816c
Compare
5c04e62
to
78e9027
Compare
a61816c
to
db26f4c
Compare
78e9027
to
b8f42ec
Compare
No description provided.