Make changes of domain in Evaluations type clearer
ATM I believe we rely on three different domains d1, d4, d8 where the size of d8 is 8 times the size of d1, and the size of d4 is 4 times the size of d1.
Because of the way domains are generated in our multiplicative group, we have a special relationship between these groups. From domain.rs:
// ensure the relationship between the three domains in case the library's behavior changes
assert_eq!(d2.group_gen.square(), d1.group_gen);
assert_eq!(d4.group_gen.square(), d2.group_gen);
assert_eq!(d8.group_gen.square(), d4.group_gen);
This means that we can easily switch from evaluations in different domains. We use this in different ways:
1. to switch between fields.
2. to (binary) operate on evaluations on different domains. For example:
mul.evals
.par_iter_mut()
.enumerate()
.for_each(|(i, eval)| *eval *= mul_selector_d8[2 * i]);
3. To retrieve evaluations like we're in d1. For example, the following code in prover.rs converts the Evaluations from domain d8 to d1:
let row = lookup_table8.iter().map(|e| &e.evals[8 * i]);
We have these all over the place, and it is sometimes really hard to parse them (especially in expr.rs I find). It would be nice to have an abstraction so that one could do something like this for example
let thing_d1 = domains.to_d1(thing_d8);
or
domains.d2_times_d4(thing_d2, thing_d4);
I'm not sure what would be the cleanest way to achieve this.
I've toyed with it here: https://github.com/o1-labs/proof-systems/pull/455
We only care about the evaluations over d8 for fixed columns like lookup_table when generating the verifier index, so we can save memory by only storing the d1 evaluations and the polynomials, then evaluating the polynomial over the domain only when we're computing the verifier index. It should be fairly easy to add a variant of commit_evaluations_non_hiding and friends (perhaps commit_polynomial_non_hiding?) that does this.
The only wrinkle is that we'll want to make the OCaml bindings release the global lock and wrap the 'make verifier index' function in an Async.Deferred.t.
Stale issue message
Stale issue message
Stale issue message