@@ -337,12 +337,13 @@ impl<'a, T: FieldElement> Processor<'a, T> {
337
337
// that are inside the block.
338
338
let unknown_variables = self
339
339
. unsolved_polynomial_identities_in_block ( witgen)
340
- . flat_map ( |( id, row_offset) | {
341
- let Identity :: Polynomial ( PolynomialIdentity { expression, .. } ) = id else {
342
- unreachable ! ( )
343
- } ;
340
+ . flat_map ( |( expression, row_offset) | {
344
341
unknown_relevant_variables ( expression, witgen, row_offset) . filter ( |var| match var {
345
342
Variable :: WitnessCell ( cell) | Variable :: IntermediateCell ( cell) => {
343
+ // We only want to guess cells in the block. This does not work
344
+ // for irregularly-shaped blocks. If we knew the extent of each column,
345
+ // we could use the respective check here, but that is currently only
346
+ // determined after witgen solving.
346
347
cell. row_offset >= 0 && cell. row_offset < self . block_size as i32
347
348
}
348
349
Variable :: FixedCell ( _) => unreachable ! ( ) ,
@@ -463,29 +464,29 @@ impl<'a, T: FieldElement> Processor<'a, T> {
463
464
}
464
465
}
465
466
466
- /// Returns all pairs of polynomial identity and row where the identity is not solved
467
- /// in `self.block_size` contiguous rows. A polynomial identity is considered solved if
468
- /// it evaluates to a known value.
467
+ /// Returns all pairs of polynomial identity (represented by its algebraic expression)
468
+ /// and row where the identity is not solved in `self.block_size` contiguous rows.
469
+ /// A polynomial identity is considered solved if it evaluates to a known value.
469
470
/// If a polynomial identity is solved for `self.block_size` contiguous rows, it is not
470
471
/// returned, not even on the rows where it is not solved.
471
472
fn unsolved_polynomial_identities_in_block < ' b , FixedEval : FixedEvaluator < T > > (
472
473
& ' b self ,
473
474
witgen : & ' b WitgenInference < ' a , T , FixedEval > ,
474
- ) -> impl Iterator < Item = ( & ' a Identity < T > , i32 ) > + ' b {
475
+ ) -> impl Iterator < Item = ( & ' a AlgebraicExpression < T > , i32 ) > + ' b {
475
476
// Group all identity-row-pairs by their identities.
476
477
self . identities
477
478
. iter ( )
478
479
. filter_map ( |( id, row_offset) | {
479
480
if let Identity :: Polynomial ( PolynomialIdentity { expression, .. } ) = id {
480
481
// Group by identity id.
481
- Some ( ( ( id. id ( ) , id ) , ( expression, * row_offset) ) )
482
+ Some ( ( id. id ( ) , ( expression, * row_offset) ) )
482
483
} else {
483
484
None
484
485
}
485
486
} )
486
487
. into_group_map ( )
487
- . into_iter ( )
488
- . flat_map ( move |( ( _ , & identity ) , pairs) | {
488
+ . into_values ( )
489
+ . flat_map ( move |pairs| {
489
490
// For each identity, check if it is fully solved
490
491
// for at least "self.blocks_size" rows.
491
492
let is_solved = pairs
@@ -512,7 +513,6 @@ impl<'a, T: FieldElement> Processor<'a, T> {
512
513
pairs
513
514
}
514
515
. into_iter ( )
515
- . map ( move |( _, row_offset) | ( identity, row_offset) )
516
516
} )
517
517
}
518
518
0 commit comments