Traits
BaseAire
contains width(the number of columns) and preprocessed_trace(what is this used for?)
AirBuilderWithPublicValues
it extend the AirBuilder trait, which is the main trait, by adding the function to get public values
AirBuilder
it has many functions like these: to help user build air constraints
The main function return M, M is a Matrix, seems to be the core data struct to store constraints information?
Prove function
Plonk recap:
Debugging notes
initialized trace
trace is stores in the RowMajorMatrix, which is a DenseMatrix.
the trace is flatten to values, then use width to record the number of the cols.
the trace passed to the prove function is
INFO i [info]: trace after computation is DenseMatrix { values: [0, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 8, 13, 13, 21], width: 2, _phantom: PhantomData<p3_monty_31::monty_31::MontyField31<p3_baby_bear::baby_bear::BabyBearParameters>> }
get the degree of the cols, namely, the length of the column and restrict it to be power of 2
there are 5 constraints:
constraint degree is 2 is because when_first_row means a multiplication to isFirstRow
explanation line by line
let quotient_domain =
trace_domain.create_disjoint_domain(1 << (log_degree + log_quotient_degree));
quotient domain is double the log size of (trace log degree and quotient degree)
Explanation:
- suppose the is one witness traces: \(f(x)\), the quotient polynomial will be computed like this (constraint degree is 1):
\(\frac{f(x)}{(x-w_0)(x-w_1)…(x-w_n)}\)
if this is computed in the trace domain, the denominator will be evaluated to 0, this doesn’t mean that you only need a constant to present the quotient polynomial, instead, you need at least the trace domain size to present the quotient poly and then verify it to be a constant!
- suppose there are three witness traces: \(f(x),g(x),c(x)\), the quotient polynomial will be computed like this (constraint degree is 2):
\(\frac{f(x)g(x)-c(x)}{(x-w_0)(x-w_1)…(x-w_n)}\)
then the degree of the
the prove function has input type air, here is the Fibonacci air, the air parameter and air.eval function belongs to Fibonacci air
let quotient_values = quotient_values(
air,
public_values,
trace_domain,// size 8
quotient_domain, // size log_degree + log_quotient_degree 8
trace_on_quotient_domain,
alpha,
constraint_count,
);
the quotient_values function is one of the core
this folder function seems fold all the constraint to one constraint, need to know how exactly it is folded.