Compiling Using Pilcom
This document describes how Polynomial Identity Language programs are compiled by PILCOM. Depending on the language used in implementation, every PIL code can b
This document describes how Polynomial Identity Language programs are compiled by PILCOM.
Depending on the language used in implementation, every PIL code can be compiled into either a file or a code by using a compiler called pilcom.
The pilcom compiler package can be found at this Github repository here. Setup can be fired up at the command line with the usual , and CLI commands.
Any PIL code can be compiled into a file with the command,
node src/pil.js <input.pil> -o <output.pil.json>which is a basic representation of the PIL program (with some extra metadata) to be later consumed on by the pil-stark package in order to generate a STARK proof.
Similarly, any PIL code can be compiled into C++ code with this command,
node src/pil.js <input.pil> -c -n namespacein which case the corresponding header files (.hpp) will be generated in the ./pols_generated folder.
Restriction on polynomial degrees
The current version of PIL can only handle quadratics. That is, given any set of polynomials; , and ; PIL can only handle products of two polynomials at a time,
but not higher degrees such as,
These higher degree products are handled via an polynomial, conveniently dubbed . Consider again the constraint of the optimized Multiplier program:
which involves the trinomial,
A can be used in as follows,
where in this case, .
In the same sense that keywords and can be thought of as of polynomials, can also be regarded as a third type of polynomial in PIL.
PIL compilation
In order to compile the above PIL code to a JSON file, follow the following steps.
-
Create a subdirectory/folder for the Multiplier SM and call it multiplier_sm.
-
Switch directory to the new subdirectory multiplier_sm, and open a new file. Name it multiplier.pil , copy in it the text below and save;
namespace Multiplier(2**10); // Constant Polynomials pol constant RESET; // Committed Polynomials pol commit freeIn; pol commit out; // Intermediate Polynomials pol carry = out*freeIn; // Constraints out' = RESET*freeIn + (1-RESET)*carry; -
Switch directory to and run the below command,
node src/pil.js ~/multiplier_sm/multiplier.pil -o multiplier-1st.json
If compilation is successful, the following debug message will be printed on the command line,
Input Pol Commitments: 2
Q Pol Commitmets: 1
Constant Pols: 1
Im Pols: 1
plookupIdentities: 0
permutationIdentities: 0
connectionIdentities: 0
polIdentities: 1The debug message reflects the numbers of;
- Input committed polynomials, denoted by .
- Quadratic polynomials, denoted by .
- Constant polynomials, denoted by .
- Intermediate polynomials, denoted by .
- The various identities that can be checked; the , the , the and the identities.
The resulting file into which the multiplier.pil code is compiled looks like this:
{
"name": "multiplier_sm",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}This file contains all the information needed by the proof/verification package called for processing.
Last updated on
Index
_Polynomial Identity Language_ (PIL) is a domain-specific language (DSL) created to provide developers with a holistic framework for constructing programs throu
Configuration Files
The following document describes why Polynomial Identity Language uses a special configuration file. In order for PIL to securely enable modularity, especially