# 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 $q_1, q_2.$ We wish to enforce that, say, the first value in row $i$ , is equal to $q_b(i)$ where $b$ is the second value in the same row. This can be obtained by the constraint

$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 $x_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+\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 $G_1,G_2$we might want to enforce only $G_1$on some row transitions, only $G_2$ on other row transitions, and both constraints on the rest. The generic way to achieve this is to add two selectors $q_{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 $P$ in $G_i$ by $q_{G_i}$, and define the new gate's constraints to be the union of these constraints from both gates.