You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, constraints generated for enf match expressions are not combined in any way. This results in a large number of constraints which will significantly impact verifier performance. There are two ways of combining constraints for enf match:
It is easy to see that the second constraint is just $s_1' - s_2 = 0$, but we'll leave this optimization for later.
General methodology
The key tool we'll use in this methodology is evaluation at a random point to test for equivalence between constraints. This works in our case because we deal with bounded-degree polynomials, and if we evaluate on a large enough domain, the probability that two distinct polynomials will evaluate to the same value is negligible. For us, I think degree 2 extension of our base field should be sufficiently large, but we can also go to degree 3 extension to be extra safe.
Let's say we have the following enf match statement:
enf match:
s0: a, b, c, d
s1: e, f, g
s2: h, i
Where s0, s1, s2 are selectors and a, .., h are individual constraints.
Let's also say that when evaluated at a random point, we get the following values for each constraint:
a, c, and f evaluate to r0.
b evaluates to r1
d evaluates to r2
e evaluates to r3
g, h evaluate to r4.
i evaluates to r5
Then, we start processing arms of enf match statement one-by-one, keeping track of aggregated results. We want to do the following two things:
Eliminate equivalent constraints in the same arm (e.g., a and c).
Establish links between equivalent constraints across different arms (e.g., a and f).
At the end of the process we want to end up with a data structure which records the following:
Then, we combine thee expressions together in a way that each constraint ends up having distinct selectors. Strategies for this could be different. One result could look like so:
Great write-up, thank you!
As for evaluating at a random point, I think that we can just evaluate twice (or three times depending on the degree and number of variables) over the base field in order to drive the soundness error down.
Currently, constraints generated for
enf match
expressions are not combined in any way. This results in a large number of constraints which will significantly impact verifier performance. There are two ways of combining constraints forenf match
:A simple example
Let's say we have the following
enf match
statement:Currently, this will be reduced to 4 individual constraints:
But we'd like to reduce it to two constraints which are much simpler:
It is easy to see that the second constraint is just$s_1' - s_2 = 0$ , but we'll leave this optimization for later.
General methodology
The key tool we'll use in this methodology is evaluation at a random point to test for equivalence between constraints. This works in our case because we deal with bounded-degree polynomials, and if we evaluate on a large enough domain, the probability that two distinct polynomials will evaluate to the same value is negligible. For us, I think degree 2 extension of our base field should be sufficiently large, but we can also go to degree 3 extension to be extra safe.
Let's say we have the following
enf match
statement:Where
s0
,s1
,s2
are selectors anda, .., h
are individual constraints.Let's also say that when evaluated at a random point, we get the following values for each constraint:
a
,c
, andf
evaluate tor0
.b
evaluates tor1
d
evaluates tor2
e
evaluates tor3
g
,h
evaluate tor4
.i
evaluates tor5
Then, we start processing arms of
enf match
statement one-by-one, keeping track of aggregated results. We want to do the following two things:a
andc
).a
andf
).At the end of the process we want to end up with a data structure which records the following:
Then, we combine thee expressions together in a way that each constraint ends up having distinct selectors. Strategies for this could be different. One result could look like so:
And then, in the end, we get 3 constraints which look like so:
Notice that
f
andh
are eliminated because they are the same constraints asa
andg
respectively.The text was updated successfully, but these errors were encountered: