Skip to content

var和signal之间的差异? #45

Discussion options

You must be logged in to vote

var你可以理解成一个占位符,方便你写circom,最后约束系统里如果用到需要展开成原来的样子。

    var inv; // 官方文档是写的signal inv;
    inv <-- in != 0 ? 1/in : 0;
    out <== -inv * in + 1;

这么写最后你就有一个约束是:

out <== (in != 0? 1/in:0) * in + 1;

但是这个约束不正确,因为约束力只能有+,*运算

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Xor0v0
Comment options

Answer selected by Xor0v0
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants