Non quadratic constraints are not allowed #7
-
在下面的代码中,如果main= Max0(), 或者main =Max1(), 电路都能正常运行,在main=Max2()的时候,zkrepl提示Non quadratic constraints are not allowed!, 大家知道具体原因吗?
|
Beta Was this translation helpful? Give feedback.
Answered by
wenjin1997
Apr 24, 2023
Replies: 3 comments 2 replies
-
类似的, pragma circom 2.1.4;
template AND(){
signal input a;
signal input b;
signal output out;
out <== a&b;
// out[1] <== a|b;
// out[2] <== ~a;
// out[3] <== a^b;
}
component main = AND();
/* INPUT = {
"a": "7", //0x111
"b": "8 //0x1000
} */ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Max0和Max1之所以没有报错,是因为没有约束产生,可以注意看一下输出。 Max2出现的错误是试图产生约束时,发现约束无法被正确的写出。 &(AND)不是未知信号(unknown signal)可以使用的操作符,需要使用上课时讲解的数学表达式方法进行编写。 |
Beta Was this translation helpful? Give feedback.
1 reply
-
可以参考Circom文档Constraint Generation,所有约束必须是二次表达式。 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
readygo67
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
可以参考Circom文档Constraint Generation,所有约束必须是二次表达式。