A wire variable is the scalar assigned to a variable or wire in an arithmetic circuit or quadratic arithmetic program (QAP). Each a_j value represents an input, intermediate result, or output; some are public statement values, while the rest form the private witness. section 19.5.4 section 19.5.2
Wire values support several implementation stages:
- Initialize primary inputs and the constant wire a_0 = 1. section 19.5.4
- Compute intermediate wires from arithmetic relations, such as a_6 = a_2·a_3 and a_7 = (a_1 + a_2)·a_1. section 19.5.4
- Classify selected wires as public statement values and keep the remaining values in the witness. section 19.5.2
- Feed the complete vector into cross-term, matrix, and proof-point calculations. section 19.5.4 section 19.5.2
Computing a QAP wire vector
A C routine stores a1, a2, and a3 in aj[1..3], sets aj[0] to 1, assigns aj[5] = a1, samples aj[4], computes aj[6] = a2·a3, then derives aj[7], aj[8], and aj[9] through further additions and multiplications. With a1 = 2036, a2 = 1700000, and a3 = 49, the resulting vector supplies the inputs to crossterms() and later proof calculations. section 19.5.4
Listing 19.23 Computing line values for QAP
void wires(mpz_t *aj, mpz_t a1, mpz_t a2, mpz_t a3)
{
mpz_t tmp;
mpz_set(aj[1], a1); #1
mpz_set(aj[2], a2); #1
mpz_set(aj[3], a3); #1
mpz_set_ui(aj[0], 1); #2
mpz_set(aj[5], a1);
mrand(aj[4]); #3
mmul(aj[6], a2, a3); #4
mpz_init_set(tmp, a1);
madd(tmp, tmp, a2);
mmul(aj[7], tmp, a1); #5
mpz_set(tmp, a3);
madd(tmp, tmp, aj[4]);
mmul(aj[8], tmp, aj[6]); #6
mmul(aj[9], aj[8], aj[7]); #7
mpz_clear(tmp);
}
Inspect the compact C implementation that initializes, derives, and clears the QAP wire-value vector. section 19.5.4
