diff --git a/.github/workflows/build-pdf.yml b/.github/workflows/build-pdf.yml new file mode 100644 index 0000000..5a86abc --- /dev/null +++ b/.github/workflows/build-pdf.yml @@ -0,0 +1,47 @@ +name: Compile LaTeX and Publish PDF + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + # 1. Checkout repository code + - name: Checkout repository + uses: actions/checkout@v4 + + # 2. Compile LaTeX book to PDF + - name: Compile LaTeX + uses: xu-cheng/latex-action@v4 + with: + root_file: book.tex + texlive_version: 2020 # For some reason CI doesn't work for newer versions of TeX + latexmk_shell_escape: true + + # 3. Save PDF as an Actions artifact (for downloading from the workflow run tab) + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: compiled-book + path: book.pdf + + # 4. Create or update the 'latest' GitHub Release + - name: Publish to GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: latest + name: "Latest Book Build" + body: "Automated build compiled from the latest push to `main`." + draft: false + prerelease: false + files: book.pdf + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/book.tex b/book.tex index 1eb7bca..819c338 100644 --- a/book.tex +++ b/book.tex @@ -93,7 +93,7 @@ \section{Sigma Protocols}\label{section:sigma} \subfile{contents/3-zk-foundations/2-sigma.tex} - \section[Arithmetic Circuits. R1CS]{Introduction to SNARKs. Arithmetic Circuits. R1CS} \label{section:r1cs} + \section[Arithmetic Circuits. R1CS]{Introduction to SNARKs. Arithmetic Circuits. R1CS}\label{section:r1cs} \subfile{contents/3-zk-foundations/3-circuits.tex}\label{section:circuits} \section[Quadratic Arithmetic Program]{Quadratic Arithmetic Program. Probabilistically Checkable Proofs}\label{section:qap-pcp} diff --git a/contents/0-auxiliary/chapter-intros/chapter-1.tex b/contents/0-auxiliary/chapter-intros/chapter-1.tex index d5a762f..035155c 100644 --- a/contents/0-auxiliary/chapter-intros/chapter-1.tex +++ b/contents/0-auxiliary/chapter-intros/chapter-1.tex @@ -23,15 +23,15 @@ \rowcolor{blue!10}\ref{section:number-theory} & Number Theory & Modular Arithmetic, Ring $\mathbb{Z}_n$ and field $\mathbb{Z}_n^{\times}$, Fermat's Little Theorem \\ - \hdashline + \hline \rowcolor{blue!20}\ref{section:abstract-algebra} & Abstract Algebra & Groups, Subgroups, Fields, Prime field $\mathbb{F}_p$, Isomorphisms, Automorphisms \\ - \hdashline + \hline \rowcolor{blue!10}\ref{section:polynomial-rings} & Polynomials & Divisibility, Lagrange Interpolation, Schwartz-Zippel Lemma \\ - \hdashline + \hline \rowcolor{blue!20}\ref{section:linear-algebra} & Linear Algebra Basics & Basic Operations over Vectors and Matrices \\ - \hdashline + \hline \rowcolor{blue!10}\ref{section:finite-fields} & Fields Extensions & Definition of $\mathbb{F}_{p^m}$, Field Multiplicative Subgroup, Algebraic Closure \\ \Xhline{3\arrayrulewidth} \end{tabularx} diff --git a/contents/0-auxiliary/chapter-intros/chapter-2.tex b/contents/0-auxiliary/chapter-intros/chapter-2.tex index d400d38..92589b8 100644 --- a/contents/0-auxiliary/chapter-intros/chapter-2.tex +++ b/contents/0-auxiliary/chapter-intros/chapter-2.tex @@ -13,9 +13,9 @@ \rowcolor{green!30}\textbf{Section} & \textbf{Topic} & \textbf{Key Concepts} \\ \Xhline{3\arrayrulewidth} \rowcolor{green!10}\ref{section:security-analysis} & Security Analysis & Advantage, negligible function, DL/CDH/DDH Assumptions \\ - \hdashline + \hline \rowcolor{green!10}\ref{section:elliptic-curves} & Elliptic Curves, $\mathsf{ecpairing}$ & Group of points on Elliptic Curve, Projective Coordinates, elliptic curve pairing \\ - \hdashline + \hline \rowcolor{green!20}\ref{section:commitment-schemes} & Commitment Schemes & Hash-based Commitments, Pedersen Commitments, KZG Commitments \\ \Xhline{3\arrayrulewidth} diff --git a/contents/0-auxiliary/chapter-intros/chapter-3.tex b/contents/0-auxiliary/chapter-intros/chapter-3.tex index 4acc56d..57f252a 100644 --- a/contents/0-auxiliary/chapter-intros/chapter-3.tex +++ b/contents/0-auxiliary/chapter-intros/chapter-3.tex @@ -16,20 +16,20 @@ \Xhline{3\arrayrulewidth} \rowcolor{purple!10}\ref{section:intro-zk} & Introduction to Zero-Knowledge & Proof of Knowledge, Soundness, Relation and Language, P/NP Complexities, Fiat-Shamir Heuristic \\ - \hdashline + \hline \rowcolor{purple!20}\ref{section:sigma} & $\Sigma$-Protocols & Shnorr Signatures, Okamoto Representation Protocol, Generalization \\ - \hdashline + \hline \rowcolor{purple!10}\ref{section:r1cs} & R1CS & Arithmetical Circuits, Why Rank-1, Matrix Form \\ - \hdashline + \hline \rowcolor{purple!20}\ref{section:qap-pcp} & QAP & Quadratic Arithmetic Program, Polynomial as Universal Encoders \\ - \hdashline + \hline \rowcolor{purple!10}\ref{section:groth} & Pairing-based SNARKs & Pinnochio and Groth16 Protocols; why such complicated expressions? \\ - \hdashline + \hline \rowcolor{purple!20}\ref{section:circom} & Circom & Programming R1CS in Circom, the language of zk-SNARKs \\ - \hdashline + \hline \rowcolor{purple!10}\ref{section:plonk} & PlonK & FFT, Blinding, PlonKish Arithmetization \\ - \hdashline + \hline \rowcolor{purple!20}\ref{section:bulletproofs} & BulletProofs & Bulletproofs construction and performance \\ \Xhline{3\arrayrulewidth} \end{tabularx} diff --git a/contents/0-auxiliary/chapter-intros/chapter-4.tex b/contents/0-auxiliary/chapter-intros/chapter-4.tex index a4e1431..32f26d9 100644 --- a/contents/0-auxiliary/chapter-intros/chapter-4.tex +++ b/contents/0-auxiliary/chapter-intros/chapter-4.tex @@ -27,12 +27,12 @@ \Xhline{3\arrayrulewidth} \rowcolor{yellow!10}\ref{section:sumcheck} & Sum-Check Protocol & Construction of Sum-Check protocol, its performance and soundness \\ - \hdashline + \hline \rowcolor{yellow!20}\ref{section:gkr} & GKR Protocol & Sum-Check-based SNARK over arithmetical circuits \\ - \hdashline + \hline \rowcolor{yellow!10}\ref{section:lookups} & Lookup Checks & Motivation for lookup checks; plookup and logup constructions \\ - \hdashline + \hline \rowcolor{yellow!20}\ref{section:ultragroth} & UltraGroth & Implementing lookup checks in Groth16 \\ \Xhline{3\arrayrulewidth} \end{tabularx} diff --git a/contents/3-zk-foundations/7-plonk.tex b/contents/3-zk-foundations/7-plonk.tex index 41f87bf..68fcabf 100644 --- a/contents/3-zk-foundations/7-plonk.tex +++ b/contents/3-zk-foundations/7-plonk.tex @@ -1,9 +1,5 @@ \documentclass[../../book.tex]{subfiles} -\usepackage[T1]{fontenc} - -\pgfplotsset{compat=1.18} - \begin{document} \subsection[Number Theoretical Trasnform]{Number Theoretical Trasnform: Universal Polynomial Accelerator}\label{section:ntt} diff --git a/opencolor.sty b/opencolor.sty new file mode 100644 index 0000000..faa4311 --- /dev/null +++ b/opencolor.sty @@ -0,0 +1,154 @@ +% opencolor 1.0.4 2026-04-26 +% Michele Piazzai +% https://piazzai.github.io/ +% https://mit-license.org/ + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{opencolor}[2026-04-26 Open Color] + +\RequirePackage{xcolor} + +\definecolor{oc-gray-0}{HTML}{F8F9FA} +\definecolor{oc-gray-1}{HTML}{F1F3F5} +\definecolor{oc-gray-2}{HTML}{E9ECEF} +\definecolor{oc-gray-3}{HTML}{DEE2E6} +\definecolor{oc-gray-4}{HTML}{CED4DA} +\definecolor{oc-gray-5}{HTML}{ADB5BD} +\definecolor{oc-gray-6}{HTML}{868E96} +\definecolor{oc-gray-7}{HTML}{495057} +\definecolor{oc-gray-8}{HTML}{343A40} +\definecolor{oc-gray-9}{HTML}{212529} + +\definecolor{oc-red-0}{HTML}{FFF5F5} +\definecolor{oc-red-1}{HTML}{FFE3E3} +\definecolor{oc-red-2}{HTML}{FFC9C9} +\definecolor{oc-red-3}{HTML}{FFA8A8} +\definecolor{oc-red-4}{HTML}{FF8787} +\definecolor{oc-red-5}{HTML}{FF6B6B} +\definecolor{oc-red-6}{HTML}{FA5252} +\definecolor{oc-red-7}{HTML}{F03E3E} +\definecolor{oc-red-8}{HTML}{E03131} +\definecolor{oc-red-9}{HTML}{C92A2A} + +\definecolor{oc-pink-0}{HTML}{FFF0F6} +\definecolor{oc-pink-1}{HTML}{FFDEEB} +\definecolor{oc-pink-2}{HTML}{FCC2D7} +\definecolor{oc-pink-3}{HTML}{FAA2C1} +\definecolor{oc-pink-4}{HTML}{F783AC} +\definecolor{oc-pink-5}{HTML}{F06595} +\definecolor{oc-pink-6}{HTML}{E64980} +\definecolor{oc-pink-7}{HTML}{D6336C} +\definecolor{oc-pink-8}{HTML}{C2255C} +\definecolor{oc-pink-9}{HTML}{A61E4D} + +\definecolor{oc-grape-0}{HTML}{F8F0FC} +\definecolor{oc-grape-1}{HTML}{F3D9FA} +\definecolor{oc-grape-2}{HTML}{EEBEFA} +\definecolor{oc-grape-3}{HTML}{E599F7} +\definecolor{oc-grape-4}{HTML}{DA77F2} +\definecolor{oc-grape-5}{HTML}{CC5DE8} +\definecolor{oc-grape-6}{HTML}{BE4BDB} +\definecolor{oc-grape-7}{HTML}{AE3EC9} +\definecolor{oc-grape-8}{HTML}{9C36B5} +\definecolor{oc-grape-9}{HTML}{862E9C} + +\definecolor{oc-violet-0}{HTML}{F3F0FF} +\definecolor{oc-violet-1}{HTML}{E5DBFF} +\definecolor{oc-violet-2}{HTML}{D0BFFF} +\definecolor{oc-violet-3}{HTML}{B197FC} +\definecolor{oc-violet-4}{HTML}{9775FA} +\definecolor{oc-violet-5}{HTML}{845EF7} +\definecolor{oc-violet-6}{HTML}{7950F2} +\definecolor{oc-violet-7}{HTML}{7048E8} +\definecolor{oc-violet-8}{HTML}{6741D9} +\definecolor{oc-violet-9}{HTML}{5F3DC4} + +\definecolor{oc-indigo-0}{HTML}{EDF2FF} +\definecolor{oc-indigo-1}{HTML}{DBE4FF} +\definecolor{oc-indigo-2}{HTML}{BAC8FF} +\definecolor{oc-indigo-3}{HTML}{91A7FF} +\definecolor{oc-indigo-4}{HTML}{748FFC} +\definecolor{oc-indigo-5}{HTML}{5C7CFA} +\definecolor{oc-indigo-6}{HTML}{4C6EF5} +\definecolor{oc-indigo-7}{HTML}{4263EB} +\definecolor{oc-indigo-8}{HTML}{3B5BDB} +\definecolor{oc-indigo-9}{HTML}{364FC7} + +\definecolor{oc-blue-0}{HTML}{E7F5FF} +\definecolor{oc-blue-1}{HTML}{D0EBFF} +\definecolor{oc-blue-2}{HTML}{A5D8FF} +\definecolor{oc-blue-3}{HTML}{74C0FC} +\definecolor{oc-blue-4}{HTML}{4DABF7} +\definecolor{oc-blue-5}{HTML}{339AF0} +\definecolor{oc-blue-6}{HTML}{228BE6} +\definecolor{oc-blue-7}{HTML}{1C7ED6} +\definecolor{oc-blue-8}{HTML}{1971C2} +\definecolor{oc-blue-9}{HTML}{1864AB} + +\definecolor{oc-cyan-0}{HTML}{E3FAFC} +\definecolor{oc-cyan-1}{HTML}{C5F6FA} +\definecolor{oc-cyan-2}{HTML}{99E9F2} +\definecolor{oc-cyan-3}{HTML}{66D9E8} +\definecolor{oc-cyan-4}{HTML}{3BC9DB} +\definecolor{oc-cyan-5}{HTML}{22B8CF} +\definecolor{oc-cyan-6}{HTML}{15AABF} +\definecolor{oc-cyan-7}{HTML}{1098AD} +\definecolor{oc-cyan-8}{HTML}{0C8599} +\definecolor{oc-cyan-9}{HTML}{0B7285} + +\definecolor{oc-teal-0}{HTML}{E6FCF5} +\definecolor{oc-teal-1}{HTML}{C3FAE8} +\definecolor{oc-teal-2}{HTML}{96F2D7} +\definecolor{oc-teal-3}{HTML}{63E6BE} +\definecolor{oc-teal-4}{HTML}{38D9A9} +\definecolor{oc-teal-5}{HTML}{20C997} +\definecolor{oc-teal-6}{HTML}{12B886} +\definecolor{oc-teal-7}{HTML}{0CA678} +\definecolor{oc-teal-8}{HTML}{099268} +\definecolor{oc-teal-9}{HTML}{087F5B} + +\definecolor{oc-green-0}{HTML}{EBFBEE} +\definecolor{oc-green-1}{HTML}{D3F9D8} +\definecolor{oc-green-2}{HTML}{B2F2BB} +\definecolor{oc-green-3}{HTML}{8CE99A} +\definecolor{oc-green-4}{HTML}{69DB7C} +\definecolor{oc-green-5}{HTML}{51CF66} +\definecolor{oc-green-6}{HTML}{40C057} +\definecolor{oc-green-7}{HTML}{37B24D} +\definecolor{oc-green-8}{HTML}{2F9E44} +\definecolor{oc-green-9}{HTML}{2B8A3E} + +\definecolor{oc-lime-0}{HTML}{F4FCE3} +\definecolor{oc-lime-1}{HTML}{E9FAC8} +\definecolor{oc-lime-2}{HTML}{D8F5A2} +\definecolor{oc-lime-3}{HTML}{C0EB75} +\definecolor{oc-lime-4}{HTML}{A9E34B} +\definecolor{oc-lime-5}{HTML}{94D82D} +\definecolor{oc-lime-6}{HTML}{82C91E} +\definecolor{oc-lime-7}{HTML}{74B816} +\definecolor{oc-lime-8}{HTML}{66A80F} +\definecolor{oc-lime-9}{HTML}{5C940D} + +\definecolor{oc-yellow-0}{HTML}{FFF9DB} +\definecolor{oc-yellow-1}{HTML}{FFF3BF} +\definecolor{oc-yellow-2}{HTML}{FFEC99} +\definecolor{oc-yellow-3}{HTML}{FFE066} +\definecolor{oc-yellow-4}{HTML}{FFD43B} +\definecolor{oc-yellow-5}{HTML}{FCC419} +\definecolor{oc-yellow-6}{HTML}{FAB005} +\definecolor{oc-yellow-7}{HTML}{F59F00} +\definecolor{oc-yellow-8}{HTML}{F08C00} +\definecolor{oc-yellow-9}{HTML}{E67700} + +\definecolor{oc-orange-0}{HTML}{FFF4E6} +\definecolor{oc-orange-1}{HTML}{FFE8CC} +\definecolor{oc-orange-2}{HTML}{FFD8A8} +\definecolor{oc-orange-3}{HTML}{FFC078} +\definecolor{oc-orange-4}{HTML}{FFA94D} +\definecolor{oc-orange-5}{HTML}{FF922B} +\definecolor{oc-orange-6}{HTML}{FD7E14} +\definecolor{oc-orange-7}{HTML}{F76707} +\definecolor{oc-orange-8}{HTML}{E8590C} +\definecolor{oc-orange-9}{HTML}{D9480F} + +\endinput