evaluate
function, where we call next_interaction_mask
on the EvalAtRow
instance.
This function can retrieve values from arbitrary row offsets, which means we can access the previous row value using -1
.
Since we call this function with offsets [-1, 0]
, we will retrieve the values for the previous and current rows.
Once we have these values, we can now assert that the difference between the current and previous row is always 1
with the constraint: E::F::one() - (sorted_col_curr_row.clone() - sorted_col_prev_row.clone())
.
But this will fail with a ConstraintsNotSatisfied
error, can you see why?
(You can try running it yourself here)
evaluate
on the first row of our trace, the previous row value wraps around to the last row because there are no negative indices.
This means that in our example, we are expecting the 0 - 15 = 1
constraint to hold, which is clearly not true.
To fix this, we can use the IsFirstColumn
preprocessed column that we created in the Preprocessed Trace section.
So we will copy over the same code for creating the preprocessed column and modify our new constraint as follows:
ConstraintsNotSatisfied
error.
(You can run it here)
CircleEvaluation
instances from our BaseColumn
instances, the order of the elements that we were creating it with was actually not the order that S-two understands it to be.
Instead, it assumes that the values are in the bit-reversed, circle domain order.
It’s not important to understand what this order is, specifically, but this does mean that when S-two tries to find the -1
offset when calling evaluate
, it will find the previous value assuming that it’s in a different order.
This means that when we create a CircleEvaluation
instance, we need to convert it to a bit-reversed circle domain order.
Thus, every time we create a CircleEvaluation
instance, we need to convert the order of the values in the BaseColumn
beforehand.