% TODO % - notation: Z(X) -> t(X), q(X) -> h(X) % - on pairings, add suffix []_1, []_2 \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsfonts} \usepackage{amsthm} \usepackage{amsmath} \usepackage{enumerate} \usepackage{hyperref} \usepackage{amssymb} \usepackage{tikz} % diagram \begin{filecontents}[overwrite]{pinocchio-groth16.bib} @misc{cryptoeprint:2013/279, author = {Bryan Parno and Craig Gentry and Jon Howell and Mariana Raykova}, title = {Pinocchio: Nearly Practical Verifiable Computation}, howpublished = {Cryptology {ePrint} Archive, Paper 2013/279}, year = {2013}, url = {https://eprint.iacr.org/2013/279} } @misc{cryptoeprint:2016/260, author = {Jens Groth}, title = {On the Size of Pairing-based Non-interactive Arguments}, howpublished = {Cryptology {ePrint} Archive, Paper 2016/260}, year = {2016}, url = {https://eprint.iacr.org/2016/260} } @misc{pairings, note = {\url{https://github.com/arnaucube/math/blob/master/weil-pairing.pdf}}, url = {https://github.com/arnaucube/math/blob/master/weil-pairing.pdf} } \end{filecontents} \nocite{*} % TODO review \newtheorem{thm}{Theorem}[section] \newtheorem{lemma}[thm]{Lemma} \newtheorem{prop}[thm]{Proposition} \newtheorem{cor}[thm]{Corollary} \newtheorem{defn}[thm]{Definition} \title{Pinocchio and Groth16 notes} \author{arnaucube} \date{2026} \begin{document} \maketitle \begin{abstract} Notes taken while studying the schemes Pinocchio (\cite{cryptoeprint:2013/279}) and Groth16 (\cite{cryptoeprint:2016/260}). Usually while reading books and papers I take handwritten notes in a notebook, this document contains some of them re-written to $LaTeX$. The proofs may slightly differ from the ones from the books or papers, since I try to extend them for a deeper understanding. \end{abstract} \tableofcontents \newpage \section{Introduction} % TODO. % what we want to prove, how it connects with R1CS & QAP \section{Notation} Let $g \in \mathbb{G}$ be the generator of the group $\mathbb{G}$, ie. $\mathbb{G}=$, then denote with $[a]$ by $g^a \in \mathbb{G}$. \section{R1CS} % TODO Add R_{R1CS} relation definition. Rank-One Constraint System (R1CS) is the representation of the constraints of the circuit by 3 linear combinations, where there is one constraint per operation. $$ \begin{aligned} (a_{11}w_1 + a_{12}w_2 + ... + a_{1n}w_n) \cdot (b_{11}w_1 + b_{12}w_2 + ... + b_{1n}w_n)\\- (c_{11}w_1 + c_{12}w_2 + ... + c_{1n}w_n) = 0 \\ (a_{21}w_1 + a_{22}w_2 + ... + a_{2n}w_n) \cdot (b_{21}w_1 + b_{22}w_2 + ... + b_{2n}w_n)\\- (c_{21}w_1 + c_{22}w_2 + ... + c_{2n}w_n) = 0 \\ (a_{31}w_1 + a_{32}w_2 + ... + a_{3n}w_n) \cdot (b_{31}w_1 + b_{32}w_2 + ... + b_{3n}w_n)\\- (c_{31}w_1 + c_{32}w_2 + ... + c_{3n}w_n) = 0 \\ \ldots \\ (a_{m1}w_1 + a_{m2}w_2 + ... + a_{mn}w_n) \cdot (b_{m1}w_1 + b_{m2}w_2 + ... + b_{mn}w_n)\\- (c_{m1}w_1 + c_{m2}w_2 + ... + c_{mn}w_n) = 0 \end{aligned} $$ Where the R1CS linear combinations can be represented by three matrices $A$, $B$ and $C$: $$ \begin{aligned} A = \begin{pmatrix} a_{11} & a_{12} & ... & a_{1n}\\ a_{21} & a_{22} & ... & a_{2n}\\ a_{31} & a_{32} & ... & a_{3n}\\ ...\\ a_{m1} & a_{m2} & ... & a_{mn} \end{pmatrix} B = \begin{pmatrix} b_{11} & b_{12} & ... & b_{1n}\\ b_{21} & b_{22} & ... & b_{2n}\\ b_{31} & b_{32} & ... & b_{3n}\\ ...\\ b_{m1} & b_{m2} & ... & b_{mn} \end{pmatrix} \\ C = \begin{pmatrix} c_{11} & c_{12} & ... & c_{1n}\\ c_{21} & c_{22} & ... & c_{2n}\\ c_{31} & c_{32} & ... & c_{3n}\\ ...\\ c_{m1} & c_{m2} & ... & c_{mn} \end{pmatrix} \end{aligned} $$ Where $(A, B, C) = A w \circ B w - C w = 0$ The process that converts the \emph{flat constraints} into \emph{R1CS} is the following: Lets assume that we have a constraint $5 w_3 = w_1 \cdot 2 w_2$ (being $w_1$, $w_2$ and $w_3$ the signals 1, 2 and 3 respectively)). We can represent this constraint in the matrices form by: $$ \begin{aligned} A = \begin{pmatrix} 1 & 0 & 0 & ... & 0\\ \end{pmatrix} \\ B = \begin{pmatrix} 0 & 2 & 0 & ... & 0\\ \end{pmatrix} \\ C = \begin{pmatrix} 0 & 0 & 5 & ... & 0\\ \end{pmatrix} \end{aligned} $$ Which in the R1CS equation form would look as: $$ \begin{aligned} (1 \cdot w_1 + 0 \cdot w_2 + 0 \cdot w_3 + ... + 0 \cdot w_n) \cdot (0 \cdot w_1 + 2 \cdot w_2 + 0 \cdot w_3 + ... + 0 \cdot w_n) -\\ (0 \cdot w_1 + 0 \cdot w_2 + 5 \cdot w_3 + ... + 0 \cdot w_n) = 0 \end{aligned} $$ If we simplify the previous liniar combination we get: $$ \begin{aligned} (1 \cdot w_1) \cdot (2 \cdot w_2) - (5 \cdot w_3) = 0 \\ w_1 \cdot 2w_1 - 5 w_3 = 0 \\ 5 w_3 = w_1 \cdot 2w_1 \end{aligned} $$ Where $5 w_3 = w_1 \cdot 2w_1$ is the constraint that we wanted to represent in the R1CS format. The nice thing from R1CS is that allows us to standaridze the constraints in an equation fashion, where all the signals are involved and we 'activate' these ones that are used in each constraint. Since we have now the constraints in a polynomial format, we can do work with it in the polynomial way. \section{QAP (Quadratic Arithmetic Programs)} \label{qap} \subsection{QAP} Once we have the constraints of a circuit represented in \emph{R1CS}, we can do one more iteration and represent it in \emph{Quadratic Arithmetic Programs (QAP)}. %% TODO %% \emph{QAP} is a representation of the XXX in a linear combination of the \emph{R1CS}, represented by 3 polynomials $a(X)$, $b(X)$ and $c(X)$. The \emph{QAP} consists of the 3 polynomials $a(X)$, $b(X)$ and $c(X)$, plus a divisor polynomial $h(X) \in \mathbb{F}[X]^{