CCS

Introduction

Customizable Constraint System

Definition 2.1 (R1CS). An R1CS structure S\mathcal{S} consists of:

  • size bounds m,n,N,Nm, n, N,\ell \in \mathbb{N} where n>n > \ell

  • and three matrices A,B,CFm×n\bm{A},\bm{B},\bm{C} \in \mathbb{F}^{m\times n} with at most N=Ω(max(m,n))N = \Omega(\mathsf{max}(m, n)) non-zero entries in total.

An R1CS instance consists of public input xF\bm{x} \in F^\ell. An R1CS witness consists of a vector wFn1\bm{w} ∈ F^{n−\ell−1}. An R1CS structure-instance tuple (S,x)(\mathcal{S}, \bm{x}) is satisfied by an R1CS witness w\bm{w} if:

(Az)(Bz)Cz=0(\bm{A} \cdot \bm{z}) \circ (\bm{B} \cdot \bm{z}) − \bm{C} \cdot \bm{z} = \bm{0}

where

z=(w,1,x)Fn\bm{z} = (\bm{w}, 1, \bm{x}) ∈ \mathbb{F}^n

Here, Az\bm{A}\cdot \bm{z} denotes a matrix-vector multiplication operation, \circ denotes the Hadamard (i.e., entry-wise) product between vectors, and 0\bold{0} is a zero vector in Fm\mathbb{F}^m.

Definition 2.2 (CCS). A CCS structure S\mathcal{S} consists of:

  • size bounds m,n,N,,t,q,dNm, n, N, \ell, t, q, d \in \mathbb{N} where n>n > \ell

  • a sequence of matrices M0,,Mt1Fm×n\bm{M}_0,\dots ,\bm{M}_{t−1}\in \mathbb{F}_{m\times n} with at most N=Ω(max(m,n))N = \Omega(\mathsf{max}(m, n)) non-zero entries in total

  • a sequence of qq multisets [S0,,Sq1][S_0,\dots, S_{q−1}], where an element in each multiset is from the domain {0,...,t1}\{0, . . . , t − 1\} and the cardinality of each multiset is at most dd

  • a sequence of qq constants [c0,,cq1][c_0,\dots, c_{q−1}], where each constant is from F\mathbb{F}

A CCS instance consists of public input xFx \in \mathbb{F}^{\ell}. A CCS witness consists of a vector wFn1w\in\mathbb{F}^{n-\ell-1}. Then, a CCS structure-instance tuple (S,x)(\mathcal{S}, x) is satisfied by a CCS witness ww if:

i=0q1cijSiMjz=0\sum^{q-1}_{i=0}c_i\cdot \bigcirc_{j\in S_{i}}M_j\cdot z=\bold{0}

where

z=(w,1,x)Fnz = (w, 1, x) \in \mathbb{F}^n

MjzM_j \cdot z denotes matrix-vector multiplication, \bigcirc denotes the Hadamard product between vectors, and 0\bold{0} is a zero vector in Fm\mathbb{F}^m.

CCS can be easily converted to R1CS. I will leave it as a thought exercise.

Representing Plonkish with CCS

Let's recall the Plonkish constraint system first.

Definition 2.3 (Plonkish). A Plonkish structure S\mathcal{S} consists of:

  • size bounds m,n,,t,q,d,eNm, n, \ell, t, q, d, e \in \mathbb{N};

  • a multivariate polynomial gg in tt variables, where gg is expressed as a sum of qq monomials and each monomial has a total degree at most dd;

  • a vector of constants called selectors sFe\bm{s} \in F^e; and

  • a set of mm constraints. Each constraint ii is specified via a vector Ti\bm{T}_i of length tt, with entries in the range {0,...,n+e1}\{0, . . . , n + e − 1\}. Ti\bm{T}_i is interpreted as specifying tt entries of a purported satisfying assignment zz to feed into gg.

A Plonkish instance consists of public input xF\bm{x} \in \mathbb{F}^\ell. A Plonkish witness consists of a vector wFn\bm{w} \in F^{n−\ell}. A Plonkish structure-instance tuple (S,x)(\mathcal{S}, \bm{x}) is satisfied by a Plonkish witness w\bm{w} if:

i{0,,m1}:g(z[Ti[1]],...,z[Ti[t]])=0\forall i \in \{0,\dots,m-1\}: g(\bm{z}[\bm{T}_i[1]], . . . , \bm{z}[\bm{T}_i[t]]) = 0

where z=(w,x,s)Fn+e\bm{z} = (\bm{w}, \bm{x}, \bm{s})\in F^{n+e}.

Representing AIR with CCS

Definition 2.4 (AIR). An AIR structure S\mathcal{S} consists of:

  • size bounds m,t,q,dNm, t, q, d \in \mathbb{N}, where tt is even;

  • a multivariate polynomial gg in tt variables, where gg is expressed as a sum of qq monomials and each monomial has total degree at most dd.

An AIR instance consists of public input and output xFt\bm{x} \in \mathbb{F}^t. An AIR witness consists of a vector wF(m1)t/2\bm{w} ∈ \mathbb{F}^{(m−1)\cdot t/2}. Let

z=(x[..t/2],w,x[t/2+1..])(Ft/2)m+1\begin{equation} \bm{z} = (\bm{x}[..t/2], \bm{w}, \bm{x}[t/2 + 1..]) \in (\mathbb{F}^{t/2})^{m+1} \tag{6} \end{equation}

Notice that, z\bm{z} can be viewed as F(m+1)×t/2\mathbb{F}^{(m+1)\times t/2} matrix. Let us index the m+1m + 1 “rows” of z\bm{z} as 0,1,...,m0, 1, . . . , m. An AIR structure-instance tuple (S,x)(\mathcal{S}, \bm{x}) is satisfied by an AIR witness ww if:

i{1,...,m}:g(z[i1],z[i])=0.\begin{equation} \forall i ∈ \{1, . . . , m\}: g(\bm{z}[i − 1], \bm{z}[i]) = 0. \tag{7} \end{equation}

This gg can be also called as state transition constraint.

Handling many AIR constraint polynomials

To represent the constraints capturing a single step of a CPU, typically many polynomials gg will be needed, say g1,...,gkg_1, . . . , g_k. In practice, kk may be in the many dozens to hundreds [GPR21, BGtRZt23]. There is, however, a straightforward and standard randomized reduction from AIR with k>1k > 1 constraint polynomials to AIR with a single constraint polynomial gg: the verifier picks a random rFr \in \mathbb{F} and sends it to the prover, and the prover replaces g1,...,gkg_1, . . . , g_k with the single constraint polynomial

g:=i=0k1rigi\begin{equation} g:=\sum^{k-1}_{i=0}r^i\cdot g_i \tag{8} \end{equation}

If Equation (7) holds for all g1,,gkg_1, \dots , g_k in place of gg, then with probability 1 over the choice of rr the same will hold for the random linear combination gg. Meanwhile, if it fails to hold for any gig_i then with probability at least 1(k1)F1 − \frac{(k − 1)}{|\mathbb{F}|}, it will fail to hold for the random linear combination gg. You could also get kk random values for each polynomial, which improves the soundness error to 1F\frac{1}{|\mathbb{F}|}.

Lemma 3 (AIR to CCS transformation). Given an AIR structure SAIR=(m,t,q,d,g)\mathcal{S}_{AIR} = (m, t, q, d,g), instance IAIR=x\mathcal{I}_{AIR} = \bm{x}, and witness wAIR=w\bm{w}_{AIR} = \bm{w}, there exists a CCS structure SCCS\mathcal{S}_{CCS} such that the tuple (SCCS,x)(\mathcal{S}_{CCS}, \bm{x}) is satisfied by w\bm{w} if and only if (SAIR,x)(\mathcal{S}_{AIR},\bm{x}) is satisfied by w\bm{w}. The natural NP checker’s time to verify the tuple ((SCCS,x),w)((\mathcal{S}_{CCS}, \bm{x}), \bm{w}) is identical to the runtime of the NP checker that evaluates gg monomial-by-monomial when checking that ((SAIR,x),w)((\mathcal{S}_{AIR}, \bm{x}), \bm{w}) satisfies Equation (7).

Proof. TODO

Last updated