59 inline static void accumulate(ContainerOverSubrelations& accumulators,
60 const AllEntities& in,
61 const Parameters& params,
62 const FF& scaling_factor)
68 using CoefficientAccumulator =
typename Accumulator::CoefficientAccumulator;
70 using ParameterCoefficientAccumulator =
typename Parameters::DataType::CoefficientAccumulator;
72 const auto& eta_m = ParameterCoefficientAccumulator(params.eta);
73 const auto& eta_two_m = ParameterCoefficientAccumulator(params.eta_two);
74 const auto& eta_three_m = ParameterCoefficientAccumulator(params.eta_three);
76 auto w_1_m = CoefficientAccumulator(in.w_l);
77 auto w_2_m = CoefficientAccumulator(in.w_r);
78 auto w_3_m = CoefficientAccumulator(in.w_o);
79 auto w_4_m = CoefficientAccumulator(in.w_4);
80 auto w_1_shift_m = CoefficientAccumulator(in.w_l_shift);
81 auto w_2_shift_m = CoefficientAccumulator(in.w_r_shift);
82 auto w_3_shift_m = CoefficientAccumulator(in.w_o_shift);
83 auto w_4_shift_m = CoefficientAccumulator(in.w_4_shift);
85 auto q_1_m = CoefficientAccumulator(in.q_l);
86 auto q_2_m = CoefficientAccumulator(in.q_r);
87 auto q_3_m = CoefficientAccumulator(in.q_o);
88 auto q_4_m = CoefficientAccumulator(in.q_4);
89 auto q_m_m = CoefficientAccumulator(in.q_m);
90 auto q_c_m = CoefficientAccumulator(in.q_c);
92 auto q_memory_m = CoefficientAccumulator(in.q_memory);
135 auto memory_record_check_m = w_3_m * eta_three_m;
136 memory_record_check_m += w_2_m * eta_two_m;
137 memory_record_check_m += w_1_m * eta_m;
138 memory_record_check_m += q_c_m;
139 auto partial_record_check_m = memory_record_check_m;
140 memory_record_check_m = memory_record_check_m - w_4_m;
141 auto memory_record_check = Accumulator(memory_record_check_m);
159 auto neg_index_delta_m = w_1_m - w_1_shift_m;
160 auto index_delta_is_zero_m = neg_index_delta_m +
FF(1);
161 auto record_delta_m = w_4_shift_m - w_4_m;
163 Accumulator index_increases_by_zero_or_one(neg_index_delta_m.sqr() +
167 auto adjacent_values_match_if_adjacent_indices_match =
168 Accumulator(index_delta_is_zero_m * record_delta_m);
170 auto q_memory_by_scaling_m = q_memory_m * scaling_factor;
171 auto q_memory_by_scaling = Accumulator(q_memory_by_scaling_m);
172 auto q_one_by_two_m = q_1_m * q_2_m;
173 auto q_one_by_two = Accumulator(q_one_by_two_m);
174 auto q_one_by_two_by_memory_by_scaling = q_one_by_two * q_memory_by_scaling;
177 adjacent_values_match_if_adjacent_indices_match * q_one_by_two_by_memory_by_scaling;
179 std::get<2>(accumulators) += index_increases_by_zero_or_one * q_one_by_two_by_memory_by_scaling;
181 auto ROM_consistency_check_identity = memory_record_check * q_one_by_two;
207 auto neg_access_type_m = (partial_record_check_m - w_4_m);
208 Accumulator neg_access_type(neg_access_type_m);
209 auto access_check = neg_access_type.sqr() + neg_access_type;
211 auto neg_next_gate_access_type_m = w_3_shift_m * eta_three_m;
212 neg_next_gate_access_type_m += w_2_shift_m * eta_two_m;
213 neg_next_gate_access_type_m += w_1_shift_m * eta_m;
214 neg_next_gate_access_type_m = neg_next_gate_access_type_m - w_4_shift_m;
215 Accumulator neg_next_gate_access_type(neg_next_gate_access_type_m);
216 auto value_delta_m = w_3_shift_m - w_3_m;
217 auto adjacent_values_match_if_adjacent_indices_match_and_next_access_is_a_read_operation =
218 Accumulator(index_delta_is_zero_m * value_delta_m) *
219 Accumulator(neg_next_gate_access_type_m +
FF(1));
227 auto next_gate_access_type_is_boolean = neg_next_gate_access_type.sqr() + neg_next_gate_access_type;
229 auto q_3_by_memory_and_scaling = Accumulator(q_3_m * q_memory_by_scaling_m);
233 adjacent_values_match_if_adjacent_indices_match_and_next_access_is_a_read_operation *
234 q_3_by_memory_and_scaling;
235 std::get<4>(accumulators) += index_increases_by_zero_or_one * q_3_by_memory_and_scaling;
236 std::get<5>(accumulators) += next_gate_access_type_is_boolean * q_3_by_memory_and_scaling;
238 auto RAM_consistency_check_identity = access_check * q_3_by_memory_and_scaling;
259 auto timestamp_delta_m = w_2_shift_m - w_2_m;
260 auto RAM_timestamp_check_identity_m = index_delta_is_zero_m * timestamp_delta_m - w_3_m;
261 Accumulator RAM_timestamp_check_identity(RAM_timestamp_check_identity_m);
268 auto memory_identity = ROM_consistency_check_identity;
269 memory_identity += RAM_timestamp_check_identity * Accumulator(q_4_m * q_1_m);
270 memory_identity += memory_record_check * Accumulator(q_m_m * q_1_m);
272 memory_identity *= q_memory_by_scaling;
273 memory_identity += RAM_consistency_check_identity;