scroll-tech / ceno

Accelerate Zero-knowledge Virtual Machine by Non-uniform Prover Based on GKR Protocol
Apache License 2.0
43 stars 4 forks source link

`extrapolate` function #2

Closed yczhangsjtu closed 11 months ago

yczhangsjtu commented 11 months ago

https://github.com/scroll-tech/singer/blob/0d2260d6093d541cd99114ebf807434441679c20/sumcheck/src/util.rs#L83-L99

I guess the purpose is to evaluate the polynomial at a point $x$ using the evaluation form and the domain $x_1,\cdots,x_m$.

The result should be

$$ \sum_{i=1}^m vi\cdot\frac{\prod{j\neq i}(x-xj)}{\prod{j\neq i}(x_i-x_j)}=\sum v_i\cdot w_i\cdot\frac{\prod_j(x-x_j)}{x-x_i} $$

The computation should be:

  1. compute the list $1/(x-x_i)$
  2. multiply the list by the weight
  3. linearly combine $v_i$ by this list
  4. multiply the result by the product of all $x-x_i$

I see the code roughly follows the same procedure described here, but I'm confused by the sum_inv, which does not seem to be the desired product.

yczhangsjtu commented 11 months ago

It seems that $\frac{1}{\sum \frac{w_i}{x-x_i}}$ is exactly $\prod (x-x_i)$. So the two methods are equivalent.