Common techniques

Before describing our main example, we discuss two basic techniques that will be used in it.

Look Ups

We describe a basic primitive that will be useful in the next section. Suppose we have two selectors q1,q2.q_1, q_2. We wish to enforce that, say, the first value in row ii , is equal to qb(i)q_b(i) where bb is the second value in the same row. This can be obtained by the constraint

x1=q1(x22)+q2(x21)x_1 = -q_1\cdot (x _2 - 2) + q_2 \cdot (x_2-1)

A convenient trick that we will use in the next section, is that in the special case where we wish to choose between two values, and their negations, e.g. according to the third row value being 1 or -1, we can do it using the equation x1=(q1(x22)+q2(x21))x3x_1 = (-q_1\cdot (x _2 - 2) + q_2 \cdot (x_2-1))\cdot x_3.

Interleaving PLONK Gates

After designing several PLONK transition gates (recall that a transition gate means a set of 2w+2w+\ell - variate polynomials, together with values for \ell selector polynomials.) , one may wish to design a program that enforces a different subset of these constraints depending on the row. For example, given two gates G1,G2G_1,G_2we might want to enforce only G1G_1on some row transitions, only G2G_2 on other row transitions, and both constraints on the rest. The generic way to achieve this is to add two selectors qG1,qG2q_{G_1},q_{G_2} that will be zero or one according to whether we want the corresponding gate to be activated at a given row. Then we can multiply each constraint PP in GiG_i by qGiq_{G_i}, and define the new gate's constraints to be the union of these constraints from both gates.