Skip to content

Does calculation methods in frontend.api implicitly define constraints? #1389

Answered by ivokub
simplexity-ckcclc asked this question in Q&A
Discussion options

You must be logged in to vote

The calculation methods in frontend.api, like Add and Mul, do they implicitly enforce constraints to the variables? For example, sum := api.Add(c.A, c.B), can we say that it implicitly define a constraint: A + B = sum?

In general yes, the calculations imply constraints. There are some edge cases though where we have optimized not to add constraints, e.g.

  • double constraints - if there already exists similar (or a multiple of it) constraint for the inputs
  • constant inputs - you can call for example sum := api.Add(2,1), in this case sum would be constant 3 and no constraint added
  • trivial constraints - for example diff := api.Sub(x,x) is a constant 1 and no constraint is added.

And in some…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by simplexity-ckcclc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants