Skip to content

Commit 0720894

Browse files
committed
Small edits to PIL and zkASM
1 parent cfd8b89 commit 0720894

16 files changed

+59
-220
lines changed

docs/pos/how-to/smart-contracts/chainstack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Chainstack provides infrastructure for Ethereum-based applications and other blo
1212

1313
Foundry is a fast toolkit for Ethereum application development written in Rust. It provides testing, interaction with EVM smart contracts, sending transactions, and blockchain data retrieval.
1414

15-
!!! note
15+
!!! tip
1616

1717
If you have any questions, reach out in the [<ins>Chainstack Discord</ins>](https://discord.com/invite/Cymtg2f7pX) server.
1818

docs/zkEVM/specifications/pil/pil-compile.md renamed to docs/zkEVM/specifications/pil/compiling-using-pilcom.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
---
2-
id: pil-compile
3-
title: Compilation of PIL Programs
4-
sidebar_label: Compilation
5-
description: This document describes how Polynomial Identity Language programs are compiled by PILCOM.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- pilcom
11-
- compilation
12-
---
1+
This document describes how Polynomial Identity Language programs are compiled by PILCOM.
132

143
Depending on the language used in implementation, every PIL code can be compiled into either a $\texttt{JSON}$ file or a $\texttt{C++}$ code by using a compiler called $\bf{pilcom}$.
154

docs/zkEVM/specifications/pil/pil-config.md renamed to docs/zkEVM/specifications/pil/configuration-files.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
---
2-
id: pil-config
3-
title: PIL Configuration File
4-
sidebar_label: PIL Configuration
5-
description: The following document describes why Polynomial Identity Language uses a special configuration file.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- configuration
11-
- dependency inclusion
12-
---
1+
The following document describes why Polynomial Identity Language uses a special configuration file.
132

143
In order for PIL to securely enable modularity, especially in complex settings such as the Polygon zkEVM's, where the Main SM has several secondary state machines executing different computations, a **dependency inclusion feature** among different `.pil` files needed to be developed.
154

docs/zkEVM/specifications/pil/connect-arg.md renamed to docs/zkEVM/specifications/pil/connection-arguments.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
1-
---
2-
id: connect-arg
3-
title: Connection Arguments
4-
sidebar_label: Connection Arguments
5-
description: This document describes the Connection Arguments and how they are used in Polynomial Identity Language.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- connection arguments
11-
- Copy Satisfiability
12-
---
13-
14-
## Copy Satisfiability
1+
This document describes the Connection Arguments and how they are used in Polynomial Identity Language.
152

163
### Connection Argument
174

185
Given a vector $a = ( a_1 , \dots , a_n) \in \mathbb{F}_n$ and a partition ${\large{\S}} = \{ S_1, \dots , S_t \}$ of $[n]$, we say "$a$ $\text{\it{copy-satisfies}}$ ${\large{\S}}$" if for each $S_k \in {\large{\S}}$, we have that $a_i = a_j$ whenever $i, j \in S_k$, with $i, j \in [n]$ and $k \in [t]$.
196

207
Moreover, we say that a protocol $(\mathcal{P}, \mathcal{V})$ is a **connection argument** if the protocol can be used by $\mathcal{P}$ to prove to $\mathcal{V}$ that a vector $\text{\it{copy-satisfies}}$ a partition of $[n]$.
218

22-
:::info
9+
!!! info
2310

24-
We use the term “connection” instead of “copy-satisfaction” because the argument is used in PIL in a more general sense than in the original definition given in [<ins>GWC19</ins>](https://eprint.iacr.org/2019/953).
25-
26-
:::
11+
We use the term “connection” instead of “copy-satisfaction” because the argument is used in PIL in a more general sense than in the original definition given in [<ins>GWC19</ins>](https://eprint.iacr.org/2019/953).
2712

2813
### Example
2914

@@ -93,11 +78,9 @@ pol constant SA;
9378

9479
A valid execution trace for this example was shown in Table 1 above.
9580

96-
:::info Remark
97-
98-
The column $\texttt{SA}$ does not need to be declared as a constant polynomial. The **connection argument** will still hold true even if it is declared as committed.
81+
!!! info Remark
9982

100-
:::
83+
The column $\texttt{SA}$ does not need to be declared as a constant polynomial. The **connection argument** will still hold true even if it is declared as committed.
10184

10285
## Multiple Copy Satisfiability
10386

docs/zkEVM/specifications/pil/cyclic-nature.md renamed to docs/zkEVM/specifications/pil/cyclicity-in-pil.md

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
---
2-
id: cyclic-nature
3-
title: Cyclic Nature of PIL
4-
sidebar_label: Cyclic Nature
5-
description: This document describes how to introduce cyclicity to execution traces in Polynomial Identity Language.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- cyclic nature
11-
---
1+
This document describes how to introduce cyclicity to execution traces in Polynomial Identity Language.
122

133
In order to synchronize the execution trace of a given program with the subgroup $G$ of the multiplicative group $\mathbb{F}^*$, over which interpolation is performed, an extra constant polynomial (or precompiled column) is added to the trace.
144

@@ -44,27 +34,26 @@ $$
4434

4535
Denote the cyclic group over which interpolation is carried out as $G = \{ g, g^2, g^3, g^4 = 1 \} \subset \mathbb{F}$.
4636

47-
:::info Concession to an abuse of notation
48-
We use the symbols $\texttt{a}$ and $\texttt{b}$, that denote columns of the execution trace, to also denote the corresponding polynomials resulting from interpolation. The columns $\texttt{a}$ and $\texttt{b}$ are best expressed as arrays,
37+
!!! info Concession to an abuse of notation
38+
We use the symbols $\texttt{a}$ and $\texttt{b}$, that denote columns of the execution trace, to also denote the corresponding polynomials resulting from interpolation. The columns $\texttt{a}$ and $\texttt{b}$ are best expressed as arrays,
4939

50-
$$
51-
\texttt{a} = [1,0,-1,1] \ \text{and}\ \texttt{b} = [1,2,2,1]
52-
$$
40+
$$
41+
\texttt{a} = [1,0,-1,1] \ \text{and}\ \texttt{b} = [1,2,2,1]
42+
$$
5343

54-
while the respective polynomials that result from interpolation, should rather be denoted differently, say with, $P(X)$ and $Q(X)$, such that for each row index $i$,
44+
while the respective polynomials that result from interpolation, should rather be denoted differently, say with, $P(X)$ and $Q(X)$, such that for each row index $i$,
5545

56-
$$
57-
P(g^i) = \texttt{a}[i]\ \ \text{and}\ \ Q(g^i) = \texttt{b}[i] \tag{eqn}
58-
$$
46+
$$
47+
P(g^i) = \texttt{a}[i]\ \ \text{and}\ \ Q(g^i) = \texttt{b}[i] \tag{eqn}
48+
$$
5949

60-
**But in order to keep the PIL code simple and easily relatable to the execution trace**, we replace the $P$ and $Q$ with $\texttt{a}$ and $\texttt{b}$, respectively. The above $\text{eqn}$ will therefore be seen written as,
50+
**But in order to keep the PIL code simple and easily relatable to the execution trace**, we replace the $P$ and $Q$ with $\texttt{a}$ and $\texttt{b}$, respectively. The above $\text{eqn}$ will therefore be seen written as,
6151

62-
$$
63-
\texttt{a}(g^i) = \texttt{a}[i]\ \ \text{and}\ \ \texttt{b}(g^i) = \texttt{b}[i].
64-
$$
52+
$$
53+
\texttt{a}(g^i) = \texttt{a}[i]\ \ \text{and}\ \ \texttt{b}(g^i) = \texttt{b}[i].
54+
$$
6555

66-
For the sake of convenience, in this particular example, the row index starts at $0$ just so it syncs with the normal array indexing.
67-
:::
56+
For the sake of convenience, in this particular example, the row index starts at $0$ just so it syncs with the normal array indexing.
6857

6958
### Constraints And Cyclicity
7059

docs/zkEVM/specifications/pil/filling-polynomial.md renamed to docs/zkEVM/specifications/pil/filling-polynomials.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
---
2-
id: filling-polynomial
3-
title: Filling Polynomials
4-
sidebar_label: Filling Polynomials
5-
description: This document describes how to fill Polynomials in PIL using JavaScript and Pilcom.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- pilcom
11-
- Filling Polynomials
12-
- execution trace
13-
---
1+
This document describes how to fill Polynomials in PIL using JavaScript and Pilcom.
142

153
In this document, we are going to use **Javascript** and **pilcom** to generate a specific execution trace for a given PIL.
164

17-
To do so, we are going to use the execution trace of a program previously discussed in the [Connecting Programs](connect-programs.md) section.
5+
To do so, we are going to use the execution trace of a program previously discussed in the [Connection Arguments](connection-arguments.md) section.
186

197
We will also use the **pil-stark** library, which is a utility that provides a framework for setup, generation and verification of proofs. It uses an FGL class which mimics a finite field, and it is required by some functions that provide the **pilcom** package.
208

@@ -76,7 +64,7 @@ Using these, the polynomials can now be filled.
7664

7765
## `Main.pil` Code Example
7866

79-
In our example, we recall the `main.pil` seen in the [Connecting Programs](connect-programs.md) section about $4$-bit integers.
67+
In our example, we recall the `main.pil` seen in the [Connection Arguments](connection-arguments.md) section about $4$-bit integers.
8068

8169
Since we are only allowed to use $4$-bit integers, inputs for the trace, which are also the ones introduced in the $\mathtt{Main.a}$ polynomial, is a chain of integers n ascending cyclically from $0$ to $15$.
8270

docs/zkEVM/specifications/pil/generate-proof.md renamed to docs/zkEVM/specifications/pil/generating-proofs.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
---
2-
id: generate-proof
3-
title: Generating Proofs Using pil-stark
4-
sidebar_label: Generating Proofs
5-
description: The following document describes how proofs of execution correctness are generated using pil-stark package.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- proofs of execution correctness
11-
- starkSetup
12-
- starkGen
13-
- starkVerify
14-
---
15-
16-
Once the constant and the committed polynomials are filled (as seen in the [Filling Polynomial section](filling-polynomial.md)), the next step is generation of a proof of correctness.
1+
The following document describes how proofs of execution correctness are generated using pil-stark package.
2+
3+
Once the constant and the committed polynomials are filled (as seen in the [Filling Polynomial section](filling-polynomials.md)), the next step is generation of a proof of correctness.
174

185
A Javascript package called `pil-stark` has been specially designed to work together with `pilcom` to generate STARK proofs for execution correctness of programs being verified.
196

docs/zkEVM/specifications/pil/pil-arguments.md renamed to docs/zkEVM/specifications/pil/inclusion-arguments.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
---
2-
id: pil-arguments
3-
title: Inclusion Arguments
4-
sidebar_label: Inclusion Arguments
5-
description: This document describes how Polynomial Identity Language implements Inclusion Arguments.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- execution trace
11-
- addition
12-
- polynomials
13-
---
1+
This document describes how Polynomial Identity Language implements Inclusion Arguments.
142

153
For most of the programs used in the zkEVM's Prover, the values recorded in the columns of execution traces are field elements.
164

docs/zkEVM/specifications/pil/index.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
---
2-
id: introduction
3-
title: Polynomial Identity Language
4-
sidebar_label: Introduction
5-
description: Polynomial Identity Language (PIL) is a domain-specific language (DSL) created to provide developers with a holistic framework for constructing programs through an easy-to-use interface, and abstracting the complexity of proof/verification mechanisms.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- introduction to PIL
11-
- Polynomial Identity Language
12-
---
13-
14-
## Overview
15-
161
**Polynomial Identity Language (PIL)** is a domain-specific language (DSL) created to provide developers with a holistic framework for constructing programs through an easy-to-use interface, and abstracting the complexity of proof/verification mechanisms. In the zkEVM context, PIL is the very DNA of verification.
172

183
One of the main peculiarities of PIL is its modularity, which allows programmers to define parametrizable programs called `namespaces`. Developers can therefore create their own custom namespaces and instantiate them from larger programs or some public library.

docs/zkEVM/specifications/pil/connect-programs.md renamed to docs/zkEVM/specifications/pil/modular-programs.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
---
2-
id: connect-programs
3-
title: Connecting Programs
4-
sidebar_label: Connecting Programs
5-
description: One of the core features of Polynomial Identity Language is that it allows modular design of its programs. This document describes how PIL connects programs.
6-
keywords:
7-
- polygon
8-
- PIL
9-
- zkEVM
10-
- modular
11-
---
1+
One of the core features of Polynomial Identity Language is that it allows modular design of its programs. This document describes how PIL connects programs.
122

133
## Modular Design
144

@@ -72,11 +62,11 @@ pol commit a, neg_a , op;
7262
a in Global.BITS4;
7363
```
7464

75-
:::info Remarks about the above code
76-
`BITS4` is a polynomial containing each of the possible 4-bit integers. These 4-bit integers can be chosen in any order when constructing `BITS4` because **inclusion checks do not respect orderings**.
65+
!!! info "Remarks about the above code"
7766

78-
Also, observe that `BITS4` is called from a namespace which is different from where it is defined. The syntax `Namespace.polynomial` can be used to access polynomials of other namespaces.
79-
:::
67+
`BITS4` is a polynomial containing each of the possible 4-bit integers. These 4-bit integers can be chosen in any order when constructing `BITS4` because **inclusion checks do not respect orderings**.
68+
69+
Also, observe that `BITS4` is called from a namespace which is different from where it is defined. The syntax `Namespace.polynomial` can be used to access polynomials of other namespaces.
8070

8171
The traditional procedure is to put different namespaces in separate files and then use the include keyword to **“connect”** them. For instance, two programs can be defined as follows.
8272

0 commit comments

Comments
 (0)