ToolszkEVMSpecIndex

Plonk In Pil

How PLONK verification is implemented in Polynomial Identity Language.

This document describes how PLONK verification is implemented in Polynomial Identity Language. It explains how to implement PlonK\mathcal{PlonK} verification using connection arguments.

PLONK-like circuit

Suppose one is given a PlonK\mathcal{PlonK}-like circuit CC. Such a circuit is defined as a set of preprocessed polynomials QL\texttt{QL}, QR\texttt{QR}, QM\texttt{QM}, QO\texttt{QO} and QC\texttt{QC} describing all the PlonK\mathcal{PlonK} gates (that is, interpolating the values of the PlonK selectors at each of the gates in a selected order), as well as connection polynomials; SA\texttt{SA}, SB\texttt{SB} and SC\texttt{SC}; specifying the copy-constraints that need to be satisfied.

The polynomials; SA\texttt{SA}, SB\texttt{SB} and SC\texttt{SC}; are constructed as before. We provide a concrete but small example of what the circuit-to-trace translation looks like.

Below figure depicts a PlonK\mathcal{PlonK} circuit.

Example of a PlonK-like circuit

Observations

  • All values in the below execution trace, depend only on the shape of the circuit itself. So, if the circuit does not change, the corresponding polynomial should not be recomputed.

  • The polynomials; SA\texttt{SA}, SB\texttt{SB} and SC\texttt{SC}; are constructed so as to enable verification of the copy-constraints; c2=b3c_2 = b_3 and c1=a2c_1 = a_2; as shown in the circuit.

  • As explained before, in the construction of the connection SS polynomials, values in cells of the same colour are swapped.

Belo figure shows the execution trace raised by the circuit.

Execution trace for the PlonK-like circuit

PIL code

The PIL code that validates this circuit is as follows:

include "config.pil"; 

namespace Plonk(%N);
pol constant QL, QR, QM, QO, QC; 
pol constant SA, SB, SC;
pol constant L1;

pol commit a, b, c; 

public pi = a(0);

// Public values check
L1 * (a - :pi) = 0;

// Plonk equation
pol ab = a*b;
QL*a + QR*b + QM*ab + QO*c + QC = 0;

// Copy-constraints check
{a, b, c} connect {SA, SB, SC};
Edit on GitHub

Last updated on