1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use super::delta;
use crate::fft::{Evaluations, Polynomial};
use dusk_bls12_381::Scalar;
#[derive(Debug, Eq, PartialEq)]
pub struct ProverKey {
pub q_range: (Polynomial, Evaluations),
}
impl ProverKey {
#[allow(clippy::too_many_arguments)]
pub(crate) fn compute_quotient_i(
&self,
index: usize,
range_separation_challenge: &Scalar,
w_l_i: &Scalar,
w_r_i: &Scalar,
w_o_i: &Scalar,
w_4_i: &Scalar,
w_4_i_next: &Scalar,
) -> Scalar {
let four = Scalar::from(4);
let q_range_i = &self.q_range.1[index];
let kappa = range_separation_challenge.square();
let kappa_sq = kappa.square();
let kappa_cu = kappa_sq * kappa;
let b_1 = delta(w_o_i - four * w_4_i);
let b_2 = delta(w_r_i - four * w_o_i) * kappa;
let b_3 = delta(w_l_i - four * w_r_i) * kappa_sq;
let b_4 = delta(w_4_i_next - four * w_l_i) * kappa_cu;
(b_1 + b_2 + b_3 + b_4) * q_range_i * range_separation_challenge
}
pub(crate) fn compute_linearisation(
&self,
range_separation_challenge: &Scalar,
a_eval: &Scalar,
b_eval: &Scalar,
c_eval: &Scalar,
d_eval: &Scalar,
d_next_eval: &Scalar,
) -> Polynomial {
let four = Scalar::from(4);
let q_range_poly = &self.q_range.0;
let kappa = range_separation_challenge.square();
let kappa_sq = kappa.square();
let kappa_cu = kappa_sq * kappa;
let b_1 = delta(c_eval - four * d_eval);
let b_2 = delta(b_eval - four * c_eval) * kappa;
let b_3 = delta(a_eval - four * b_eval) * kappa_sq;
let b_4 = delta(d_next_eval - four * a_eval) * kappa_cu;
let t = (b_1 + b_2 + b_3 + b_4) * range_separation_challenge;
q_range_poly * &t
}
}