1- use crate :: fq12_poly:: {
2- eq_weights, eval_multilinear, fq12_to_multilinear_evals, g_coeffs, to_multilinear_evals,
3- } ;
1+ use crate :: fq12_poly:: { eq_weights, eval_multilinear, fq12_to_multilinear_evals, g_coeffs} ;
42use ark_bn254:: { Fq , Fq12 , Fr } ;
53use ark_ff:: { BigInteger , Field , One , PrimeField , Zero } ;
64use ark_serialize:: { CanonicalDeserialize , CanonicalSerialize } ;
@@ -82,15 +80,13 @@ impl ExponentiationSteps {
8280 }
8381 }
8482
85- /// Verify that the final result matches base^exponent,
86- /// Used for testing
83+ /// Verify that the final result matches base^exponent
8784 pub fn verify_result ( & self ) -> bool {
8885 self . result == self . base . pow ( self . exponent . into_bigint ( ) )
8986 }
9087
9188 /// Verify constraint at a Boolean cube point
9289 /// Checks that the constraint holds at cube vertices where it was constructed to be zero
93- /// Used for testing
9490 pub fn verify_constraint_at_cube_point ( & self , step : usize , cube_index : usize ) -> bool {
9591 if step == 0 || step > self . quotient_mles . len ( ) || cube_index >= 16 {
9692 return false ;
@@ -144,23 +140,20 @@ fn compute_step_quotient_msb(rho_prev: Fq12, rho_i: Fq12, base: Fq12, bit: bool)
144140}
145141
146142/// Get g as MLE evaluations over the Boolean cube {0,1}^4
147- /// Used for testing
148143pub fn get_g_mle ( ) -> Vec < Fq > {
149- // Use the same encoding as fq12_to_multilinear_evals
150- // g(X) = X^12 - 18X^6 + 82 as coefficient array
144+ use crate :: fq12_poly:: eval_poly_vec;
151145 let g_vec = g_coeffs ( ) ;
152- let mut g_array = [ Fq :: zero ( ) ; 12 ] ;
153- for i in 0 ..12 {
154- if i < g_vec . len ( ) {
155- g_array [ i ] = g_vec [ i ] ;
156- }
157- }
158- to_multilinear_evals ( & g_array )
146+
147+ ( 0 ..16 )
148+ . map ( |i| {
149+ let x = Fq :: from ( i as u64 ) ;
150+ eval_poly_vec ( & g_vec [ .. ] , & x )
151+ } )
152+ . collect ( )
159153}
160154
161155/// Convert a cube index (0..15) to a Boolean point in {0,1}^4
162- /// Used for testing
163- pub fn index_to_boolean_point ( index : usize ) -> Vec < Fq > {
156+ pub ( crate ) fn index_to_boolean_point ( index : usize ) -> Vec < Fq > {
164157 vec ! [
165158 Fq :: from( ( index & 1 ) as u64 ) , // bit 0
166159 Fq :: from( ( ( index >> 1 ) & 1 ) as u64 ) , // bit 1
@@ -171,7 +164,6 @@ pub fn index_to_boolean_point(index: usize) -> Vec<Fq> {
171164
172165/// Evaluate an MLE at a Boolean cube point
173166/// For Boolean points, this is equivalent to indexing but makes the evaluation explicit
174- /// Used for testing
175167fn eval_mle_at_boolean_point ( mle : & [ Fq ] , point : & [ Fq ] ) -> Fq {
176168 // For Boolean points, we could just index, but using eval_multilinear
177169 // makes it clear we're doing MLE evaluation
@@ -180,7 +172,6 @@ fn eval_mle_at_boolean_point(mle: &[Fq], point: &[Fq]) -> Fq {
180172
181173/// H(x) = ρᵢ(x) - ρᵢ₋₁(x)² · A(x)^{bᵢ} - Qᵢ(x) · g(x) for x ∈ {0,1}^4
182174/// H̃(z) = Σ_{x∈{0,1}^4} eq(z,x) · H(x)
183- /// Used for testing
184175pub fn h_tilde_at_point (
185176 rho_prev_mle : & [ Fq ] ,
186177 rho_curr_mle : & [ Fq ] ,
0 commit comments