Index Mathematics Conjectures nbv lettuce Widgets

into_public_static!

Turn witness variables into statics by publishing their values as outputs. Static evaluation

into_public_static! var[, var2, ...]

Makes the values of witness variables known at compile time by declaring them public outputs of the program. The prover reads the values from the witness; a verifier compiling the same program reads them from the claimed outputs attached with NBVProgram::with_output. Either way the result is a static, so it can set lengths, loop counts and other compile-time parameters, and the output constraints bind the published values to the witness.

The outputs are appended in invocation order, before the program's return values. When compiling without a witness, the n-th published variable takes the n-th claimed output.

Arguments

var
One or more witness vectors whose entries are each a single witness variable (identity linear combinations), such as entrypoint inputs or results of wtns!. Linear combinations like x + 1 are an error; materialize them with wtns! first.

Returns

A static vector with the variable's values, or a tuple of them when several variables are passed. It is an expression-form precompile.

Constraints

No rows of its own. Each published variable becomes a public output, which the argument or NBVProgram::eval_safe constrains to the published values.

Example

(let n)
static n = into_public_static! n
static twice = n * 2
twice
(let n)
static m = into_public_static! n + 1
m

Notes

The first output of the example is the published n, the second the return value. Compiling without a witness and without enough claimed outputs panics. Used by the in-DSL SLIP verifier (slip_r1cs_arg_verify) to make the proof widths static.

Used in the standard library

slip/slip_r1cs_arg_verify