Skip to content

Commit

Permalink
menu and formats revised
Browse files Browse the repository at this point in the history
  • Loading branch information
alrubio committed Jan 18, 2024
1 parent f0deda4 commit c822cdd
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 35 deletions.
4 changes: 2 additions & 2 deletions circom/src/input_user.rs
Expand Up @@ -368,7 +368,7 @@ mod input_processing {
.long("O1")
.hidden(false)
.takes_value(false)
.help("Only applies var to var and var to constant simplification")
.help("Only applies signal to signal and signal to constant simplification")
.display_order(460)
)
.arg(
Expand Down Expand Up @@ -423,7 +423,7 @@ mod input_processing {
.long("simplification_substitution")
.takes_value(false)
.display_order(980)
.help("Outputs the substitution in json format"),
.help("Outputs the substitution applied in the simplification phase in json format"),
)
.arg(
Arg::with_name("print_sym")
Expand Down
2 changes: 1 addition & 1 deletion mkdocs/docs/circom-language/formats/simplification-json.md
Expand Up @@ -15,7 +15,7 @@ The file contains a dictionary where the entries are the numbers of the simplifi
where the linear expression is represented by a dictionary with the signal numbers as strings occurring in the linear expression (with non-zero coefficient) as entries and their coefficients (as string) as values:
`{ "sig_num_l1": "coef_1", ... , "sig_num_lm": "coef_m"}`

All signals occurring in the linear expression are signals that are not removed. Hence, if you also include the ```--sym``` flag, in the generated [sym file](../sym.md) all these signals are associated to a position in the witness list. On the other hand, al signals sig_num_1 ... sig_num_n that appear as entries in the substitution dictionary are associated to -1.
All signals occurring in the linear expression are signals that are not removed. Hence, if you also include the ```--sym``` flag, in the generated [sym file](sym.md) all these signals are associated to a position in the witness list. On the other hand, al signals sig_num_1 ... sig_num_n that appear as entries in the substitution dictionary are associated to -1.

Let us consider the following simple circuit in 'simplify.circom':

Expand Down
2 changes: 1 addition & 1 deletion mkdocs/docs/circom-language/formats/sym.md
Expand Up @@ -11,7 +11,7 @@ The format provides a list of lines, where each line contains the information ab
```
where
* #s: a positive number. It is the unique number starting in 1 (0 is reserved to the signal holding the constant value 1) which is assigned by the circom compiler to each signal in the circuit.
* #w: an integer larger than or equal to -1. It gives either the position in the witness where the signal occurs or -1 if the signal is not public and does not occur in any constraint in the generated R1CS. Note that many signals do not appear in the final R1CS because they have been replaced by a linear combination of other signals that is equivalent to it in the simplification phase. In order to know the substitution applied to a removed signal one can add the flag --simplification_substitution to the circom call and check the generated [json file](../simplification-json.md). All witness positions except 0 (which is again reserved to the constant value 1) must occur once in the sym file. The length of the witness coincides with the number of (different) signals occurring in the generated R1CS plus one (for the constant 1).
* #w: an integer larger than or equal to -1. It gives either the position in the witness where the signal occurs or -1 if the signal is not public and does not occur in any constraint in the generated R1CS. Note that many signals do not appear in the final R1CS because they have been replaced by a linear combination of other signals that is equivalent to it in the simplification phase. In order to know the substitution applied to a removed signal one can add the flag --simplification_substitution to the circom call and check the generated [json file](simplification-json.md). All witness positions except 0 (which is again reserved to the constant value 1) must occur once in the sym file. The length of the witness coincides with the number of (different) signals occurring in the generated R1CS plus one (for the constant 1).
* #c: a non-negative integer (starting in 0). It is the unique number given by the compiler to the component the signal belongs to.
* name: is a string containing the qualified name of the signal (including the complete component path).

Expand Down
6 changes: 3 additions & 3 deletions mkdocs/docs/getting-started/compilation-options.md
Expand Up @@ -12,13 +12,13 @@ FLAGS:
--wat Compiles the circuit to wat
-c, --c Compiles the circuit to c
--O0 No simplification is applied
--O1 Only applies var to var and var to constant simplification
--O1 Only applies signal to signal and signal to constant simplification
--O2 Full constraint simplification
--verbose Shows logs during compilation
--inspect Does an additional check over the constraints produced
--use_old_simplification_heuristics Applies the old version of the heuristics when performing linear
simplification
--simplification_substitution Outputs the substitution in json format
--simplification_substitution Outputs the substitution applied in the simplification phase in json format
-h, --help Prints help information
-V, --version Prints version information

Expand Down Expand Up @@ -53,7 +53,7 @@ In the following, we explain these options.


#####Flags and options related to the R1CS optimization
In the following, we explain the different optimizations that we can apply to the final R1CS during the constraint generation phase.
In the following, we explain the different optimizations that we can apply to the final R1CS during the constraint generation phase. More details on the simplification process can be found [here](../circom-language/circom-insight/simplification.md)

* Flag ```--O0``` does not apply any kind of simplification.

Expand Down
4 changes: 2 additions & 2 deletions mkdocs/docs/getting-started/compiling-circuits.md
Expand Up @@ -26,13 +26,13 @@ circom --help
--wat Compiles the circuit to wat
-c, --c Compiles the circuit to c
--O0 No simplification is applied
--O1 Only applies var to var and var to constant simplification
--O1 Only applies signal to signal and signal to constant simplification
--O2 Full constraint simplification
--verbose Shows logs during compilation
--inspect Does an additional check over the constraints produced
--use_old_simplification_heuristics Applies the old version of the heuristics when performing linear
simplification
--simplification_substitution Outputs the substitution in json format
--simplification_substitution Outputs the substitution in the simplification phase in json format
-h, --help Prints help information
-V, --version Prints version information

Expand Down
60 changes: 34 additions & 26 deletions mkdocs/docs/getting-started/installation.md
Expand Up @@ -61,32 +61,40 @@ Now, you should be able to see all the options of the executable by using the `h
```console
circom --help

Circom Compiler 2.0.0
IDEN3
Compiler for the Circom programming language

USAGE:
circom [FLAGS] [OPTIONS] [input]

FLAGS:
-h, --help Prints help information
--inspect Does an additional check over the constraints produced
--O0 No simplification is applied
-c, --c Compiles the circuit to c
--json outputs the constraints in json format
--r1cs outputs the constraints in r1cs format
--sym outputs witness in sym format
--wasm Compiles the circuit to wasm
--wat Compiles the circuit to wat
--O1 Only applies var to var and var to constant simplification
-V, --version Prints version information

OPTIONS:
--O2 <full_simplification> Full constraint simplification [default: full]
-o, --output <output> Path to the directory where the output will be written [default: .]

ARGS:
<input> Path to a circuit with a main component [default: ./circuit.circom]
circom compiler 2.1.7
IDEN3
Compiler for the circom programming language

USAGE:
circom [FLAGS] [OPTIONS] [--] [input]

FLAGS:
--r1cs Outputs the constraints in r1cs format
--sym Outputs witness in sym format
--wasm Compiles the circuit to wasm
--json Outputs the constraints in json format
--wat Compiles the circuit to wat
-c, --c Compiles the circuit to c
--O0 No simplification is applied
--O1 Only applies signal to signal and signal to constant simplification
--O2 Full constraint simplification
--verbose Shows logs during compilation
--inspect Does an additional check over the constraints produced
--use_old_simplification_heuristics Applies the old version of the heuristics when performing linear
simplification
--simplification_substitution Outputs the substitution applied in the simplification phase in json format
-h, --help Prints help information
-V, --version Prints version information

OPTIONS:
-o, --output <output> Path to the directory where the output will be written [default: .]
-p, --prime <prime> To choose the prime number to use to generate the circuit. Receives the
name of the curve (bn128, bls12381, goldilocks, grumpkin, secq256r1, pallas, vesta) [default: bn128]
-l <link_libraries>... Adds directory to library search path
--O2round <simplification_rounds> Maximum number of rounds of the simplification process

ARGS:
<input> Path to a circuit with a main component [default: ./circuit.circom]
```

## Installing snarkjs <a id="installing-the-tools"></a>
Expand Down

0 comments on commit c822cdd

Please sign in to comment.