@@ -5,7 +5,6 @@ use lean_vm::*;
55use lookup:: prove_gkr_product;
66use lookup:: { compute_pushforward, prove_logup_star} ;
77use p3_air:: BaseAir ;
8- use p3_field:: BasedVectorSpace ;
98use p3_field:: ExtensionField ;
109use p3_field:: PrimeCharacteristicRing ;
1110use p3_util:: { log2_ceil_usize, log2_strict_usize} ;
@@ -27,7 +26,7 @@ use whir_p3::dft::EvalsDft;
2726use whir_p3:: poly:: evals:: { eval_eq, fold_multilinear} ;
2827use whir_p3:: poly:: multilinear:: Evaluation ;
2928use whir_p3:: poly:: { evals:: EvaluationsList , multilinear:: MultilinearPoint } ;
30- use whir_p3:: utils:: { compute_eval_eq, compute_sparse_eval_eq, flatten_scalars_to_base } ;
29+ use whir_p3:: utils:: { compute_eval_eq, compute_sparse_eval_eq} ;
3130use whir_p3:: whir:: config:: { WhirConfig , second_batched_whir_config_builder} ;
3231
3332pub fn prove_execution (
@@ -131,63 +130,22 @@ pub fn prove_execution(
131130 F :: from_usize ( vm_multilinear_eval. addr_coeffs ) ,
132131 F :: from_usize ( vm_multilinear_eval. addr_point ) ,
133132 F :: from_usize ( vm_multilinear_eval. addr_res ) ,
134- F :: from_usize ( vm_multilinear_eval. n_vars ) ,
133+ F :: from_usize ( vm_multilinear_eval. n_vars ( ) ) ,
135134 ] ) ;
136135 prover_state. add_extension_scalars ( & vm_multilinear_eval. point ) ;
137136 prover_state. add_extension_scalar ( vm_multilinear_eval. res ) ;
138137 }
139138
140139 let mut memory_statements = vec ! [ ] ;
141- for multilinear_eval in & vm_multilinear_evals {
142- let addr_point = multilinear_eval. addr_point ;
143- let addr_coeffs = multilinear_eval. addr_coeffs ;
144- let addr_res = multilinear_eval. addr_res ;
145-
146- // point lookup into memory
147- let log_point_len = log2_ceil_usize ( multilinear_eval. point . len ( ) * DIMENSION ) ;
148- let point_random_challenge = prover_state. sample_vec ( log_point_len) ;
149- let point_random_value = {
150- let mut point_mle = flatten_scalars_to_base :: < PF < EF > , EF > ( & multilinear_eval. point ) ;
151- point_mle. resize ( point_mle. len ( ) . next_power_of_two ( ) , F :: ZERO ) ;
152- point_mle. evaluate ( & MultilinearPoint ( point_random_challenge. clone ( ) ) )
153- } ;
154- memory_statements. push ( Evaluation :: new (
155- [
156- to_big_endian_in_field ( addr_point, log_memory - log_point_len) ,
157- point_random_challenge. clone ( ) ,
158- ]
159- . concat ( ) ,
160- point_random_value,
161- ) ) ;
162-
163- // result lookup into memory
164- let res_random_challenge = prover_state. sample_vec ( LOG_VECTOR_LEN ) ;
165- let res_random_value = {
166- let mut res_mle = multilinear_eval. res . as_basis_coefficients_slice ( ) . to_vec ( ) ;
167- res_mle. resize ( VECTOR_LEN , F :: ZERO ) ;
168- res_mle. evaluate ( & MultilinearPoint ( res_random_challenge. clone ( ) ) )
169- } ;
170- memory_statements. push ( Evaluation :: new (
171- [
172- to_big_endian_in_field ( addr_res, log_memory - LOG_VECTOR_LEN ) ,
173- res_random_challenge. clone ( ) ,
174- ]
175- . concat ( ) ,
176- res_random_value,
177- ) ) ;
178-
179- {
180- let n_vars = multilinear_eval. n_vars ;
181- assert ! ( n_vars <= log_memory) ;
182- assert ! ( addr_coeffs < 1 << ( log_memory - n_vars) ) ;
183-
184- let addr_bits = to_big_endian_in_field ( addr_coeffs, log_memory - n_vars) ;
185- let statement = Evaluation :: new (
186- [ addr_bits, multilinear_eval. point . clone ( ) ] . concat ( ) ,
187- multilinear_eval. res ,
188- ) ;
189- memory_statements. push ( statement) ;
190- }
140+ for entry in & vm_multilinear_evals {
141+ add_memory_statements_for_dot_product_precompile (
142+ entry,
143+ log_memory,
144+ log_public_memory,
145+ & mut prover_state,
146+ & mut memory_statements,
147+ )
148+ . unwrap ( ) ;
191149 }
192150 let p16_indexes = all_poseidon_16_indexes ( & poseidons_16) ;
193151 let p24_indexes = all_poseidon_24_indexes ( & poseidons_24) ;
@@ -298,7 +256,7 @@ pub fn prove_execution(
298256 + grand_product_challenge_vm_multilinear_eval[ 4 ]
299257 * F :: from_usize ( multilinear_eval. addr_res )
300258 + grand_product_challenge_vm_multilinear_eval[ 5 ]
301- * F :: from_usize ( multilinear_eval. n_vars ) ;
259+ * F :: from_usize ( multilinear_eval. n_vars ( ) ) ;
302260 }
303261
304262 let ( grand_product_exec_res, grand_product_exec_statement) = prove_gkr_product (
@@ -363,7 +321,7 @@ pub fn prove_execution(
363321 + grand_product_challenge_vm_multilinear_eval[ 4 ]
364322 * F :: from_usize ( vm_multilinear_eval. addr_res )
365323 + grand_product_challenge_vm_multilinear_eval[ 5 ]
366- * F :: from_usize ( vm_multilinear_eval. n_vars )
324+ * F :: from_usize ( vm_multilinear_eval. n_vars ( ) )
367325 } )
368326 . product :: < EF > ( ) ;
369327
0 commit comments