diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_binary.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_binary.hpp index e99d59d2e7a..e58112cbfd7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_binary.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_binary.hpp @@ -6,170 +6,152 @@ namespace bb::Avm_vm { -template struct Avm_binaryRow { - FF avm_binary_acc_ia {}; - FF avm_binary_acc_ia_shift {}; - FF avm_binary_acc_ib {}; - FF avm_binary_acc_ib_shift {}; - FF avm_binary_acc_ic {}; - FF avm_binary_acc_ic_shift {}; - FF avm_binary_bin_sel {}; - FF avm_binary_ia_bytes {}; - FF avm_binary_ib_bytes {}; - FF avm_binary_ic_bytes {}; - FF avm_binary_mem_tag_ctr {}; - FF avm_binary_mem_tag_ctr_inv {}; - FF avm_binary_mem_tag_ctr_shift {}; - FF avm_binary_op_id {}; - FF avm_binary_op_id_shift {}; - }; - - - inline std::string get_relation_label_avm_binary(int index) { - switch (index) { - case 1: - return "OP_ID_REL"; - -case 2: - return "MEM_TAG_REL"; - -case 3: - return "BIN_SEL_CTR_REL"; - -case 7: - return "ACC_REL_A"; - -case 8: - return "ACC_REL_B"; - -case 9: - return "ACC_REL_C"; - - } - return std::to_string(index); +template struct Avm_binaryRow { + FF avm_binary_acc_ia{}; + FF avm_binary_acc_ia_shift{}; + FF avm_binary_acc_ib{}; + FF avm_binary_acc_ib_shift{}; + FF avm_binary_acc_ic{}; + FF avm_binary_acc_ic_shift{}; + FF avm_binary_bin_sel{}; + FF avm_binary_ia_bytes{}; + FF avm_binary_ib_bytes{}; + FF avm_binary_ic_bytes{}; + FF avm_binary_mem_tag_ctr{}; + FF avm_binary_mem_tag_ctr_inv{}; + FF avm_binary_mem_tag_ctr_shift{}; + FF avm_binary_op_id{}; + FF avm_binary_op_id_shift{}; +}; + +inline std::string get_relation_label_avm_binary(int index) +{ + switch (index) { + case 1: + return "OP_ID_REL"; + + case 2: + return "MEM_TAG_REL"; + + case 3: + return "BIN_SEL_CTR_REL"; + + case 7: + return "ACC_REL_A"; + + case 8: + return "ACC_REL_B"; + + case 9: + return "ACC_REL_C"; } - + return std::to_string(index); +} template class avm_binaryImpl { - public: - using FF = FF_; - - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ - 3, - 3, - 3, - 4, - 3, - 3, - 3, - 4, - 4, - 4, -}; - - + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ + 3, 3, 3, 4, 3, 3, 3, 4, 4, 4, + }; + template - void static accumulate( - ContainerOverSubrelations& evals, - const AllEntities& new_term, - [[maybe_unused]] const RelationParameters&, - [[maybe_unused]] const FF& scaling_factor - ){ - - //Contribution 0 - { -Avm_DECLARE_VIEWS(0); - - - auto tmp = (avm_binary_bin_sel * (-avm_binary_bin_sel + FF(1))); - tmp *= scaling_factor; - std::get<0>(evals) += tmp; -} -//Contribution 1 + void static accumulate(ContainerOverSubrelations& evals, + const AllEntities& new_term, + [[maybe_unused]] const RelationParameters&, + [[maybe_unused]] const FF& scaling_factor) { -Avm_DECLARE_VIEWS(1); - - - auto tmp = ((avm_binary_op_id_shift - avm_binary_op_id) * avm_binary_mem_tag_ctr); - tmp *= scaling_factor; - std::get<1>(evals) += tmp; -} -//Contribution 2 - { -Avm_DECLARE_VIEWS(2); - - - auto tmp = (((avm_binary_mem_tag_ctr_shift - avm_binary_mem_tag_ctr) + FF(1)) * avm_binary_mem_tag_ctr); - tmp *= scaling_factor; - std::get<2>(evals) += tmp; -} -//Contribution 3 - { -Avm_DECLARE_VIEWS(3); - - - auto tmp = ((avm_binary_mem_tag_ctr * (((-avm_binary_bin_sel + FF(1)) * (-avm_binary_mem_tag_ctr_inv + FF(1))) + avm_binary_mem_tag_ctr_inv)) - avm_binary_bin_sel); - tmp *= scaling_factor; - std::get<3>(evals) += tmp; -} -//Contribution 4 - { -Avm_DECLARE_VIEWS(4); - - - auto tmp = ((-avm_binary_bin_sel + FF(1)) * avm_binary_acc_ia); - tmp *= scaling_factor; - std::get<4>(evals) += tmp; -} -//Contribution 5 - { -Avm_DECLARE_VIEWS(5); - - - auto tmp = ((-avm_binary_bin_sel + FF(1)) * avm_binary_acc_ib); - tmp *= scaling_factor; - std::get<5>(evals) += tmp; -} -//Contribution 6 - { -Avm_DECLARE_VIEWS(6); - - - auto tmp = ((-avm_binary_bin_sel + FF(1)) * avm_binary_acc_ic); - tmp *= scaling_factor; - std::get<6>(evals) += tmp; -} -//Contribution 7 - { -Avm_DECLARE_VIEWS(7); - - - auto tmp = (((avm_binary_acc_ia - avm_binary_ia_bytes) - (avm_binary_acc_ia_shift * FF(256))) * avm_binary_mem_tag_ctr); - tmp *= scaling_factor; - std::get<7>(evals) += tmp; -} -//Contribution 8 - { -Avm_DECLARE_VIEWS(8); - - - auto tmp = (((avm_binary_acc_ib - avm_binary_ib_bytes) - (avm_binary_acc_ib_shift * FF(256))) * avm_binary_mem_tag_ctr); - tmp *= scaling_factor; - std::get<8>(evals) += tmp; -} -//Contribution 9 - { -Avm_DECLARE_VIEWS(9); - - - auto tmp = (((avm_binary_acc_ic - avm_binary_ic_bytes) - (avm_binary_acc_ic_shift * FF(256))) * avm_binary_mem_tag_ctr); - tmp *= scaling_factor; - std::get<9>(evals) += tmp; -} -} + // Contribution 0 + { + Avm_DECLARE_VIEWS(0); + + auto tmp = (avm_binary_bin_sel * (-avm_binary_bin_sel + FF(1))); + tmp *= scaling_factor; + std::get<0>(evals) += tmp; + } + // Contribution 1 + { + Avm_DECLARE_VIEWS(1); + + auto tmp = ((avm_binary_op_id_shift - avm_binary_op_id) * avm_binary_mem_tag_ctr); + tmp *= scaling_factor; + std::get<1>(evals) += tmp; + } + // Contribution 2 + { + Avm_DECLARE_VIEWS(2); + + auto tmp = (((avm_binary_mem_tag_ctr_shift - avm_binary_mem_tag_ctr) + FF(1)) * avm_binary_mem_tag_ctr); + tmp *= scaling_factor; + std::get<2>(evals) += tmp; + } + // Contribution 3 + { + Avm_DECLARE_VIEWS(3); + + auto tmp = + ((avm_binary_mem_tag_ctr * (((-avm_binary_bin_sel + FF(1)) * (-avm_binary_mem_tag_ctr_inv + FF(1))) + + avm_binary_mem_tag_ctr_inv)) - + avm_binary_bin_sel); + tmp *= scaling_factor; + std::get<3>(evals) += tmp; + } + // Contribution 4 + { + Avm_DECLARE_VIEWS(4); + + auto tmp = ((-avm_binary_bin_sel + FF(1)) * avm_binary_acc_ia); + tmp *= scaling_factor; + std::get<4>(evals) += tmp; + } + // Contribution 5 + { + Avm_DECLARE_VIEWS(5); + + auto tmp = ((-avm_binary_bin_sel + FF(1)) * avm_binary_acc_ib); + tmp *= scaling_factor; + std::get<5>(evals) += tmp; + } + // Contribution 6 + { + Avm_DECLARE_VIEWS(6); + + auto tmp = ((-avm_binary_bin_sel + FF(1)) * avm_binary_acc_ic); + tmp *= scaling_factor; + std::get<6>(evals) += tmp; + } + // Contribution 7 + { + Avm_DECLARE_VIEWS(7); + + auto tmp = (((avm_binary_acc_ia - avm_binary_ia_bytes) - (avm_binary_acc_ia_shift * FF(256))) * + avm_binary_mem_tag_ctr); + tmp *= scaling_factor; + std::get<7>(evals) += tmp; + } + // Contribution 8 + { + Avm_DECLARE_VIEWS(8); + + auto tmp = (((avm_binary_acc_ib - avm_binary_ib_bytes) - (avm_binary_acc_ib_shift * FF(256))) * + avm_binary_mem_tag_ctr); + tmp *= scaling_factor; + std::get<8>(evals) += tmp; + } + // Contribution 9 + { + Avm_DECLARE_VIEWS(9); + + auto tmp = (((avm_binary_acc_ic - avm_binary_ic_bytes) - (avm_binary_acc_ic_shift * FF(256))) * + avm_binary_mem_tag_ctr); + tmp *= scaling_factor; + std::get<9>(evals) += tmp; + } + } }; template using avm_binary = Relation>; - } \ No newline at end of file +} // namespace bb::Avm_vm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp index ff1e06b8c92..53fc2849245 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp @@ -6,837 +6,732 @@ namespace bb::Avm_vm { -template struct Avm_mainRow { - FF avm_main_alu_in_tag {}; - FF avm_main_alu_sel {}; - FF avm_main_bin_op_id {}; - FF avm_main_bin_sel {}; - FF avm_main_first {}; - FF avm_main_ia {}; - FF avm_main_ib {}; - FF avm_main_ic {}; - FF avm_main_id {}; - FF avm_main_id_zero {}; - FF avm_main_ind_op_a {}; - FF avm_main_ind_op_b {}; - FF avm_main_ind_op_c {}; - FF avm_main_ind_op_d {}; - FF avm_main_internal_return_ptr {}; - FF avm_main_internal_return_ptr_shift {}; - FF avm_main_inv {}; - FF avm_main_mem_idx_a {}; - FF avm_main_mem_idx_b {}; - FF avm_main_mem_op_a {}; - FF avm_main_mem_op_b {}; - FF avm_main_mem_op_c {}; - FF avm_main_mem_op_d {}; - FF avm_main_op_err {}; - FF avm_main_pc {}; - FF avm_main_pc_shift {}; - FF avm_main_r_in_tag {}; - FF avm_main_rwa {}; - FF avm_main_rwb {}; - FF avm_main_rwc {}; - FF avm_main_rwd {}; - FF avm_main_sel_cmov {}; - FF avm_main_sel_halt {}; - FF avm_main_sel_internal_call {}; - FF avm_main_sel_internal_return {}; - FF avm_main_sel_jump {}; - FF avm_main_sel_mov {}; - FF avm_main_sel_mov_a {}; - FF avm_main_sel_mov_b {}; - FF avm_main_sel_op_add {}; - FF avm_main_sel_op_and {}; - FF avm_main_sel_op_cast {}; - FF avm_main_sel_op_div {}; - FF avm_main_sel_op_eq {}; - FF avm_main_sel_op_fdiv {}; - FF avm_main_sel_op_lt {}; - FF avm_main_sel_op_lte {}; - FF avm_main_sel_op_mul {}; - FF avm_main_sel_op_not {}; - FF avm_main_sel_op_or {}; - FF avm_main_sel_op_shl {}; - FF avm_main_sel_op_shr {}; - FF avm_main_sel_op_sub {}; - FF avm_main_sel_op_xor {}; - FF avm_main_tag_err {}; - FF avm_main_w_in_tag {}; - }; - - - inline std::string get_relation_label_avm_main(int index) { - switch (index) { - case 36: - return "OUTPUT_U8"; - -case 37: - return "SUBOP_FDIV"; - -case 38: - return "SUBOP_FDIV_ZERO_ERR1"; - -case 39: - return "SUBOP_FDIV_ZERO_ERR2"; - -case 40: - return "SUBOP_FDIV_R_IN_TAG_FF"; - -case 41: - return "SUBOP_FDIV_W_IN_TAG_FF"; - -case 42: - return "SUBOP_ERROR_RELEVANT_OP"; - -case 44: - return "RETURN_POINTER_INCREMENT"; - -case 50: - return "RETURN_POINTER_DECREMENT"; - -case 55: - return "PC_INCREMENT"; - -case 56: - return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - -case 57: - return "CMOV_CONDITION_RES_1"; - -case 58: - return "CMOV_CONDITION_RES_2"; - -case 61: - return "MOV_SAME_VALUE_A"; - -case 62: - return "MOV_SAME_VALUE_B"; - -case 63: - return "MOV_MAIN_SAME_TAG"; - -case 67: - return "BIN_SEL_1"; - -case 68: - return "BIN_SEL_2"; - - } - return std::to_string(index); +template struct Avm_mainRow { + FF avm_main_alu_in_tag{}; + FF avm_main_alu_sel{}; + FF avm_main_bin_op_id{}; + FF avm_main_bin_sel{}; + FF avm_main_first{}; + FF avm_main_ia{}; + FF avm_main_ib{}; + FF avm_main_ic{}; + FF avm_main_id{}; + FF avm_main_id_zero{}; + FF avm_main_ind_op_a{}; + FF avm_main_ind_op_b{}; + FF avm_main_ind_op_c{}; + FF avm_main_ind_op_d{}; + FF avm_main_internal_return_ptr{}; + FF avm_main_internal_return_ptr_shift{}; + FF avm_main_inv{}; + FF avm_main_mem_idx_a{}; + FF avm_main_mem_idx_b{}; + FF avm_main_mem_op_a{}; + FF avm_main_mem_op_b{}; + FF avm_main_mem_op_c{}; + FF avm_main_mem_op_d{}; + FF avm_main_op_err{}; + FF avm_main_pc{}; + FF avm_main_pc_shift{}; + FF avm_main_r_in_tag{}; + FF avm_main_rwa{}; + FF avm_main_rwb{}; + FF avm_main_rwc{}; + FF avm_main_rwd{}; + FF avm_main_sel_cmov{}; + FF avm_main_sel_halt{}; + FF avm_main_sel_internal_call{}; + FF avm_main_sel_internal_return{}; + FF avm_main_sel_jump{}; + FF avm_main_sel_mov{}; + FF avm_main_sel_mov_a{}; + FF avm_main_sel_mov_b{}; + FF avm_main_sel_op_add{}; + FF avm_main_sel_op_and{}; + FF avm_main_sel_op_cast{}; + FF avm_main_sel_op_div{}; + FF avm_main_sel_op_eq{}; + FF avm_main_sel_op_fdiv{}; + FF avm_main_sel_op_lt{}; + FF avm_main_sel_op_lte{}; + FF avm_main_sel_op_mul{}; + FF avm_main_sel_op_not{}; + FF avm_main_sel_op_or{}; + FF avm_main_sel_op_shl{}; + FF avm_main_sel_op_shr{}; + FF avm_main_sel_op_sub{}; + FF avm_main_sel_op_xor{}; + FF avm_main_tag_err{}; + FF avm_main_w_in_tag{}; +}; + +inline std::string get_relation_label_avm_main(int index) +{ + switch (index) { + case 36: + return "OUTPUT_U8"; + + case 37: + return "SUBOP_FDIV"; + + case 38: + return "SUBOP_FDIV_ZERO_ERR1"; + + case 39: + return "SUBOP_FDIV_ZERO_ERR2"; + + case 40: + return "SUBOP_FDIV_R_IN_TAG_FF"; + + case 41: + return "SUBOP_FDIV_W_IN_TAG_FF"; + + case 42: + return "SUBOP_ERROR_RELEVANT_OP"; + + case 44: + return "RETURN_POINTER_INCREMENT"; + + case 50: + return "RETURN_POINTER_DECREMENT"; + + case 55: + return "PC_INCREMENT"; + + case 56: + return "INTERNAL_RETURN_POINTER_CONSISTENCY"; + + case 57: + return "CMOV_CONDITION_RES_1"; + + case 58: + return "CMOV_CONDITION_RES_2"; + + case 61: + return "MOV_SAME_VALUE_A"; + + case 62: + return "MOV_SAME_VALUE_B"; + + case 63: + return "MOV_MAIN_SAME_TAG"; + + case 67: + return "BIN_SEL_1"; + + case 68: + return "BIN_SEL_2"; } - + return std::to_string(index); +} template class avm_mainImpl { - public: - using FF = FF_; - - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 5, - 4, - 4, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 5, - 3, - 4, - 4, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 2, -}; - - + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, + }; + template - void static accumulate( - ContainerOverSubrelations& evals, - const AllEntities& new_term, - [[maybe_unused]] const RelationParameters&, - [[maybe_unused]] const FF& scaling_factor - ){ - - //Contribution 0 - { -Avm_DECLARE_VIEWS(0); - - - auto tmp = (avm_main_sel_op_add * (-avm_main_sel_op_add + FF(1))); - tmp *= scaling_factor; - std::get<0>(evals) += tmp; -} -//Contribution 1 - { -Avm_DECLARE_VIEWS(1); - - - auto tmp = (avm_main_sel_op_sub * (-avm_main_sel_op_sub + FF(1))); - tmp *= scaling_factor; - std::get<1>(evals) += tmp; -} -//Contribution 2 - { -Avm_DECLARE_VIEWS(2); - - - auto tmp = (avm_main_sel_op_mul * (-avm_main_sel_op_mul + FF(1))); - tmp *= scaling_factor; - std::get<2>(evals) += tmp; -} -//Contribution 3 - { -Avm_DECLARE_VIEWS(3); - - - auto tmp = (avm_main_sel_op_div * (-avm_main_sel_op_div + FF(1))); - tmp *= scaling_factor; - std::get<3>(evals) += tmp; -} -//Contribution 4 - { -Avm_DECLARE_VIEWS(4); - - - auto tmp = (avm_main_sel_op_fdiv * (-avm_main_sel_op_fdiv + FF(1))); - tmp *= scaling_factor; - std::get<4>(evals) += tmp; -} -//Contribution 5 - { -Avm_DECLARE_VIEWS(5); - - - auto tmp = (avm_main_sel_op_not * (-avm_main_sel_op_not + FF(1))); - tmp *= scaling_factor; - std::get<5>(evals) += tmp; -} -//Contribution 6 - { -Avm_DECLARE_VIEWS(6); - - - auto tmp = (avm_main_sel_op_eq * (-avm_main_sel_op_eq + FF(1))); - tmp *= scaling_factor; - std::get<6>(evals) += tmp; -} -//Contribution 7 - { -Avm_DECLARE_VIEWS(7); - - - auto tmp = (avm_main_sel_op_and * (-avm_main_sel_op_and + FF(1))); - tmp *= scaling_factor; - std::get<7>(evals) += tmp; -} -//Contribution 8 - { -Avm_DECLARE_VIEWS(8); - - - auto tmp = (avm_main_sel_op_or * (-avm_main_sel_op_or + FF(1))); - tmp *= scaling_factor; - std::get<8>(evals) += tmp; -} -//Contribution 9 - { -Avm_DECLARE_VIEWS(9); - - - auto tmp = (avm_main_sel_op_xor * (-avm_main_sel_op_xor + FF(1))); - tmp *= scaling_factor; - std::get<9>(evals) += tmp; -} -//Contribution 10 - { -Avm_DECLARE_VIEWS(10); - - - auto tmp = (avm_main_sel_op_cast * (-avm_main_sel_op_cast + FF(1))); - tmp *= scaling_factor; - std::get<10>(evals) += tmp; -} -//Contribution 11 - { -Avm_DECLARE_VIEWS(11); - - - auto tmp = (avm_main_sel_op_lt * (-avm_main_sel_op_lt + FF(1))); - tmp *= scaling_factor; - std::get<11>(evals) += tmp; -} -//Contribution 12 - { -Avm_DECLARE_VIEWS(12); - - - auto tmp = (avm_main_sel_op_lte * (-avm_main_sel_op_lte + FF(1))); - tmp *= scaling_factor; - std::get<12>(evals) += tmp; -} -//Contribution 13 - { -Avm_DECLARE_VIEWS(13); - - - auto tmp = (avm_main_sel_op_shl * (-avm_main_sel_op_shl + FF(1))); - tmp *= scaling_factor; - std::get<13>(evals) += tmp; -} -//Contribution 14 - { -Avm_DECLARE_VIEWS(14); - - - auto tmp = (avm_main_sel_op_shr * (-avm_main_sel_op_shr + FF(1))); - tmp *= scaling_factor; - std::get<14>(evals) += tmp; -} -//Contribution 15 - { -Avm_DECLARE_VIEWS(15); - - - auto tmp = (avm_main_sel_internal_call * (-avm_main_sel_internal_call + FF(1))); - tmp *= scaling_factor; - std::get<15>(evals) += tmp; -} -//Contribution 16 - { -Avm_DECLARE_VIEWS(16); - - - auto tmp = (avm_main_sel_internal_return * (-avm_main_sel_internal_return + FF(1))); - tmp *= scaling_factor; - std::get<16>(evals) += tmp; -} -//Contribution 17 - { -Avm_DECLARE_VIEWS(17); - - - auto tmp = (avm_main_sel_jump * (-avm_main_sel_jump + FF(1))); - tmp *= scaling_factor; - std::get<17>(evals) += tmp; -} -//Contribution 18 - { -Avm_DECLARE_VIEWS(18); - - - auto tmp = (avm_main_sel_halt * (-avm_main_sel_halt + FF(1))); - tmp *= scaling_factor; - std::get<18>(evals) += tmp; -} -//Contribution 19 - { -Avm_DECLARE_VIEWS(19); - - - auto tmp = (avm_main_sel_mov * (-avm_main_sel_mov + FF(1))); - tmp *= scaling_factor; - std::get<19>(evals) += tmp; -} -//Contribution 20 - { -Avm_DECLARE_VIEWS(20); - - - auto tmp = (avm_main_sel_cmov * (-avm_main_sel_cmov + FF(1))); - tmp *= scaling_factor; - std::get<20>(evals) += tmp; -} -//Contribution 21 - { -Avm_DECLARE_VIEWS(21); - - - auto tmp = (avm_main_op_err * (-avm_main_op_err + FF(1))); - tmp *= scaling_factor; - std::get<21>(evals) += tmp; -} -//Contribution 22 - { -Avm_DECLARE_VIEWS(22); - - - auto tmp = (avm_main_tag_err * (-avm_main_tag_err + FF(1))); - tmp *= scaling_factor; - std::get<22>(evals) += tmp; -} -//Contribution 23 - { -Avm_DECLARE_VIEWS(23); - - - auto tmp = (avm_main_id_zero * (-avm_main_id_zero + FF(1))); - tmp *= scaling_factor; - std::get<23>(evals) += tmp; -} -//Contribution 24 - { -Avm_DECLARE_VIEWS(24); - - - auto tmp = (avm_main_mem_op_a * (-avm_main_mem_op_a + FF(1))); - tmp *= scaling_factor; - std::get<24>(evals) += tmp; -} -//Contribution 25 - { -Avm_DECLARE_VIEWS(25); - - - auto tmp = (avm_main_mem_op_b * (-avm_main_mem_op_b + FF(1))); - tmp *= scaling_factor; - std::get<25>(evals) += tmp; -} -//Contribution 26 - { -Avm_DECLARE_VIEWS(26); - - - auto tmp = (avm_main_mem_op_c * (-avm_main_mem_op_c + FF(1))); - tmp *= scaling_factor; - std::get<26>(evals) += tmp; -} -//Contribution 27 - { -Avm_DECLARE_VIEWS(27); - - - auto tmp = (avm_main_mem_op_d * (-avm_main_mem_op_d + FF(1))); - tmp *= scaling_factor; - std::get<27>(evals) += tmp; -} -//Contribution 28 - { -Avm_DECLARE_VIEWS(28); - - - auto tmp = (avm_main_rwa * (-avm_main_rwa + FF(1))); - tmp *= scaling_factor; - std::get<28>(evals) += tmp; -} -//Contribution 29 - { -Avm_DECLARE_VIEWS(29); - - - auto tmp = (avm_main_rwb * (-avm_main_rwb + FF(1))); - tmp *= scaling_factor; - std::get<29>(evals) += tmp; -} -//Contribution 30 - { -Avm_DECLARE_VIEWS(30); - - - auto tmp = (avm_main_rwc * (-avm_main_rwc + FF(1))); - tmp *= scaling_factor; - std::get<30>(evals) += tmp; -} -//Contribution 31 - { -Avm_DECLARE_VIEWS(31); - - - auto tmp = (avm_main_rwd * (-avm_main_rwd + FF(1))); - tmp *= scaling_factor; - std::get<31>(evals) += tmp; -} -//Contribution 32 - { -Avm_DECLARE_VIEWS(32); - - - auto tmp = (avm_main_ind_op_a * (-avm_main_ind_op_a + FF(1))); - tmp *= scaling_factor; - std::get<32>(evals) += tmp; -} -//Contribution 33 - { -Avm_DECLARE_VIEWS(33); - - - auto tmp = (avm_main_ind_op_b * (-avm_main_ind_op_b + FF(1))); - tmp *= scaling_factor; - std::get<33>(evals) += tmp; -} -//Contribution 34 - { -Avm_DECLARE_VIEWS(34); - - - auto tmp = (avm_main_ind_op_c * (-avm_main_ind_op_c + FF(1))); - tmp *= scaling_factor; - std::get<34>(evals) += tmp; -} -//Contribution 35 - { -Avm_DECLARE_VIEWS(35); - - - auto tmp = (avm_main_ind_op_d * (-avm_main_ind_op_d + FF(1))); - tmp *= scaling_factor; - std::get<35>(evals) += tmp; -} -//Contribution 36 - { -Avm_DECLARE_VIEWS(36); - - - auto tmp = (((avm_main_sel_op_eq + avm_main_sel_op_lte) + avm_main_sel_op_lt) * (avm_main_w_in_tag - FF(1))); - tmp *= scaling_factor; - std::get<36>(evals) += tmp; -} -//Contribution 37 - { -Avm_DECLARE_VIEWS(37); - - - auto tmp = ((avm_main_sel_op_fdiv * (-avm_main_op_err + FF(1))) * ((avm_main_ic * avm_main_ib) - avm_main_ia)); - tmp *= scaling_factor; - std::get<37>(evals) += tmp; -} -//Contribution 38 - { -Avm_DECLARE_VIEWS(38); - - - auto tmp = ((avm_main_sel_op_fdiv + avm_main_sel_op_div) * (((avm_main_ib * avm_main_inv) - FF(1)) + avm_main_op_err)); - tmp *= scaling_factor; - std::get<38>(evals) += tmp; -} -//Contribution 39 - { -Avm_DECLARE_VIEWS(39); - - - auto tmp = (((avm_main_sel_op_fdiv + avm_main_sel_op_div) * avm_main_op_err) * (-avm_main_inv + FF(1))); - tmp *= scaling_factor; - std::get<39>(evals) += tmp; -} -//Contribution 40 - { -Avm_DECLARE_VIEWS(40); - - - auto tmp = (avm_main_sel_op_fdiv * (avm_main_r_in_tag - FF(6))); - tmp *= scaling_factor; - std::get<40>(evals) += tmp; -} -//Contribution 41 - { -Avm_DECLARE_VIEWS(41); - - - auto tmp = (avm_main_sel_op_fdiv * (avm_main_w_in_tag - FF(6))); - tmp *= scaling_factor; - std::get<41>(evals) += tmp; -} -//Contribution 42 - { -Avm_DECLARE_VIEWS(42); - - - auto tmp = (avm_main_op_err * ((avm_main_sel_op_fdiv + avm_main_sel_op_div) - FF(1))); - tmp *= scaling_factor; - std::get<42>(evals) += tmp; -} -//Contribution 43 - { -Avm_DECLARE_VIEWS(43); - - - auto tmp = (avm_main_sel_jump * (avm_main_pc_shift - avm_main_ia)); - tmp *= scaling_factor; - std::get<43>(evals) += tmp; -} -//Contribution 44 - { -Avm_DECLARE_VIEWS(44); - - - auto tmp = (avm_main_sel_internal_call * (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr + FF(1)))); - tmp *= scaling_factor; - std::get<44>(evals) += tmp; -} -//Contribution 45 - { -Avm_DECLARE_VIEWS(45); - - - auto tmp = (avm_main_sel_internal_call * (avm_main_internal_return_ptr - avm_main_mem_idx_b)); - tmp *= scaling_factor; - std::get<45>(evals) += tmp; -} -//Contribution 46 - { -Avm_DECLARE_VIEWS(46); - - - auto tmp = (avm_main_sel_internal_call * (avm_main_pc_shift - avm_main_ia)); - tmp *= scaling_factor; - std::get<46>(evals) += tmp; -} -//Contribution 47 - { -Avm_DECLARE_VIEWS(47); - - - auto tmp = (avm_main_sel_internal_call * ((avm_main_pc + FF(1)) - avm_main_ib)); - tmp *= scaling_factor; - std::get<47>(evals) += tmp; -} -//Contribution 48 - { -Avm_DECLARE_VIEWS(48); - - - auto tmp = (avm_main_sel_internal_call * (avm_main_rwb - FF(1))); - tmp *= scaling_factor; - std::get<48>(evals) += tmp; -} -//Contribution 49 - { -Avm_DECLARE_VIEWS(49); - - - auto tmp = (avm_main_sel_internal_call * (avm_main_mem_op_b - FF(1))); - tmp *= scaling_factor; - std::get<49>(evals) += tmp; -} -//Contribution 50 - { -Avm_DECLARE_VIEWS(50); - - - auto tmp = (avm_main_sel_internal_return * (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr - FF(1)))); - tmp *= scaling_factor; - std::get<50>(evals) += tmp; -} -//Contribution 51 - { -Avm_DECLARE_VIEWS(51); - - - auto tmp = (avm_main_sel_internal_return * ((avm_main_internal_return_ptr - FF(1)) - avm_main_mem_idx_a)); - tmp *= scaling_factor; - std::get<51>(evals) += tmp; -} -//Contribution 52 - { -Avm_DECLARE_VIEWS(52); - - - auto tmp = (avm_main_sel_internal_return * (avm_main_pc_shift - avm_main_ia)); - tmp *= scaling_factor; - std::get<52>(evals) += tmp; -} -//Contribution 53 - { -Avm_DECLARE_VIEWS(53); - - - auto tmp = (avm_main_sel_internal_return * avm_main_rwa); - tmp *= scaling_factor; - std::get<53>(evals) += tmp; -} -//Contribution 54 - { -Avm_DECLARE_VIEWS(54); - - - auto tmp = (avm_main_sel_internal_return * (avm_main_mem_op_a - FF(1))); - tmp *= scaling_factor; - std::get<54>(evals) += tmp; -} -//Contribution 55 - { -Avm_DECLARE_VIEWS(55); - - - auto tmp = ((((-avm_main_first + FF(1)) * (-avm_main_sel_halt + FF(1))) * ((((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_div) + avm_main_sel_op_fdiv) + avm_main_sel_op_mul) + avm_main_sel_op_not) + avm_main_sel_op_eq) + avm_main_sel_op_and) + avm_main_sel_op_or) + avm_main_sel_op_xor) + avm_main_sel_op_cast)) * (avm_main_pc_shift - (avm_main_pc + FF(1)))); - tmp *= scaling_factor; - std::get<55>(evals) += tmp; -} -//Contribution 56 - { -Avm_DECLARE_VIEWS(56); - - - auto tmp = ((-(((avm_main_first + avm_main_sel_internal_call) + avm_main_sel_internal_return) + avm_main_sel_halt) + FF(1)) * (avm_main_internal_return_ptr_shift - avm_main_internal_return_ptr)); - tmp *= scaling_factor; - std::get<56>(evals) += tmp; -} -//Contribution 57 - { -Avm_DECLARE_VIEWS(57); - - - auto tmp = (avm_main_sel_cmov * (((avm_main_id * avm_main_inv) - FF(1)) + avm_main_id_zero)); - tmp *= scaling_factor; - std::get<57>(evals) += tmp; -} -//Contribution 58 - { -Avm_DECLARE_VIEWS(58); - - - auto tmp = ((avm_main_sel_cmov * avm_main_id_zero) * (-avm_main_inv + FF(1))); - tmp *= scaling_factor; - std::get<58>(evals) += tmp; -} -//Contribution 59 - { -Avm_DECLARE_VIEWS(59); - - - auto tmp = (avm_main_sel_mov_a - (avm_main_sel_mov + (avm_main_sel_cmov * (-avm_main_id_zero + FF(1))))); - tmp *= scaling_factor; - std::get<59>(evals) += tmp; -} -//Contribution 60 - { -Avm_DECLARE_VIEWS(60); - - - auto tmp = (avm_main_sel_mov_b - (avm_main_sel_cmov * avm_main_id_zero)); - tmp *= scaling_factor; - std::get<60>(evals) += tmp; -} -//Contribution 61 - { -Avm_DECLARE_VIEWS(61); - - - auto tmp = (avm_main_sel_mov_a * (avm_main_ia - avm_main_ic)); - tmp *= scaling_factor; - std::get<61>(evals) += tmp; -} -//Contribution 62 - { -Avm_DECLARE_VIEWS(62); - - - auto tmp = (avm_main_sel_mov_b * (avm_main_ib - avm_main_ic)); - tmp *= scaling_factor; - std::get<62>(evals) += tmp; -} -//Contribution 63 - { -Avm_DECLARE_VIEWS(63); - - - auto tmp = ((avm_main_sel_mov + avm_main_sel_cmov) * (avm_main_r_in_tag - avm_main_w_in_tag)); - tmp *= scaling_factor; - std::get<63>(evals) += tmp; -} -//Contribution 64 - { -Avm_DECLARE_VIEWS(64); - - - auto tmp = (avm_main_alu_sel - (((((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_mul) + avm_main_sel_op_div) + avm_main_sel_op_not) + avm_main_sel_op_eq) + avm_main_sel_op_lt) + avm_main_sel_op_lte) + avm_main_sel_op_shr) + avm_main_sel_op_shl) + avm_main_sel_op_cast) * (-avm_main_tag_err + FF(1)))); - tmp *= scaling_factor; - std::get<64>(evals) += tmp; -} -//Contribution 65 - { -Avm_DECLARE_VIEWS(65); - - - auto tmp = ((((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_mul) + avm_main_sel_op_div) + avm_main_sel_op_not) + avm_main_sel_op_eq) + avm_main_sel_op_lt) + avm_main_sel_op_lte) + avm_main_sel_op_shr) + avm_main_sel_op_shl) * (avm_main_alu_in_tag - avm_main_r_in_tag)); - tmp *= scaling_factor; - std::get<65>(evals) += tmp; -} -//Contribution 66 + void static accumulate(ContainerOverSubrelations& evals, + const AllEntities& new_term, + [[maybe_unused]] const RelationParameters&, + [[maybe_unused]] const FF& scaling_factor) { -Avm_DECLARE_VIEWS(66); - - - auto tmp = (avm_main_sel_op_cast * (avm_main_alu_in_tag - avm_main_w_in_tag)); - tmp *= scaling_factor; - std::get<66>(evals) += tmp; -} -//Contribution 67 - { -Avm_DECLARE_VIEWS(67); - - - auto tmp = (avm_main_bin_op_id - (avm_main_sel_op_or + (avm_main_sel_op_xor * FF(2)))); - tmp *= scaling_factor; - std::get<67>(evals) += tmp; -} -//Contribution 68 - { -Avm_DECLARE_VIEWS(68); - - - auto tmp = (avm_main_bin_sel - ((avm_main_sel_op_and + avm_main_sel_op_or) + avm_main_sel_op_xor)); - tmp *= scaling_factor; - std::get<68>(evals) += tmp; -} -} + // Contribution 0 + { + Avm_DECLARE_VIEWS(0); + + auto tmp = (avm_main_sel_op_add * (-avm_main_sel_op_add + FF(1))); + tmp *= scaling_factor; + std::get<0>(evals) += tmp; + } + // Contribution 1 + { + Avm_DECLARE_VIEWS(1); + + auto tmp = (avm_main_sel_op_sub * (-avm_main_sel_op_sub + FF(1))); + tmp *= scaling_factor; + std::get<1>(evals) += tmp; + } + // Contribution 2 + { + Avm_DECLARE_VIEWS(2); + + auto tmp = (avm_main_sel_op_mul * (-avm_main_sel_op_mul + FF(1))); + tmp *= scaling_factor; + std::get<2>(evals) += tmp; + } + // Contribution 3 + { + Avm_DECLARE_VIEWS(3); + + auto tmp = (avm_main_sel_op_div * (-avm_main_sel_op_div + FF(1))); + tmp *= scaling_factor; + std::get<3>(evals) += tmp; + } + // Contribution 4 + { + Avm_DECLARE_VIEWS(4); + + auto tmp = (avm_main_sel_op_fdiv * (-avm_main_sel_op_fdiv + FF(1))); + tmp *= scaling_factor; + std::get<4>(evals) += tmp; + } + // Contribution 5 + { + Avm_DECLARE_VIEWS(5); + + auto tmp = (avm_main_sel_op_not * (-avm_main_sel_op_not + FF(1))); + tmp *= scaling_factor; + std::get<5>(evals) += tmp; + } + // Contribution 6 + { + Avm_DECLARE_VIEWS(6); + + auto tmp = (avm_main_sel_op_eq * (-avm_main_sel_op_eq + FF(1))); + tmp *= scaling_factor; + std::get<6>(evals) += tmp; + } + // Contribution 7 + { + Avm_DECLARE_VIEWS(7); + + auto tmp = (avm_main_sel_op_and * (-avm_main_sel_op_and + FF(1))); + tmp *= scaling_factor; + std::get<7>(evals) += tmp; + } + // Contribution 8 + { + Avm_DECLARE_VIEWS(8); + + auto tmp = (avm_main_sel_op_or * (-avm_main_sel_op_or + FF(1))); + tmp *= scaling_factor; + std::get<8>(evals) += tmp; + } + // Contribution 9 + { + Avm_DECLARE_VIEWS(9); + + auto tmp = (avm_main_sel_op_xor * (-avm_main_sel_op_xor + FF(1))); + tmp *= scaling_factor; + std::get<9>(evals) += tmp; + } + // Contribution 10 + { + Avm_DECLARE_VIEWS(10); + + auto tmp = (avm_main_sel_op_cast * (-avm_main_sel_op_cast + FF(1))); + tmp *= scaling_factor; + std::get<10>(evals) += tmp; + } + // Contribution 11 + { + Avm_DECLARE_VIEWS(11); + + auto tmp = (avm_main_sel_op_lt * (-avm_main_sel_op_lt + FF(1))); + tmp *= scaling_factor; + std::get<11>(evals) += tmp; + } + // Contribution 12 + { + Avm_DECLARE_VIEWS(12); + + auto tmp = (avm_main_sel_op_lte * (-avm_main_sel_op_lte + FF(1))); + tmp *= scaling_factor; + std::get<12>(evals) += tmp; + } + // Contribution 13 + { + Avm_DECLARE_VIEWS(13); + + auto tmp = (avm_main_sel_op_shl * (-avm_main_sel_op_shl + FF(1))); + tmp *= scaling_factor; + std::get<13>(evals) += tmp; + } + // Contribution 14 + { + Avm_DECLARE_VIEWS(14); + + auto tmp = (avm_main_sel_op_shr * (-avm_main_sel_op_shr + FF(1))); + tmp *= scaling_factor; + std::get<14>(evals) += tmp; + } + // Contribution 15 + { + Avm_DECLARE_VIEWS(15); + + auto tmp = (avm_main_sel_internal_call * (-avm_main_sel_internal_call + FF(1))); + tmp *= scaling_factor; + std::get<15>(evals) += tmp; + } + // Contribution 16 + { + Avm_DECLARE_VIEWS(16); + + auto tmp = (avm_main_sel_internal_return * (-avm_main_sel_internal_return + FF(1))); + tmp *= scaling_factor; + std::get<16>(evals) += tmp; + } + // Contribution 17 + { + Avm_DECLARE_VIEWS(17); + + auto tmp = (avm_main_sel_jump * (-avm_main_sel_jump + FF(1))); + tmp *= scaling_factor; + std::get<17>(evals) += tmp; + } + // Contribution 18 + { + Avm_DECLARE_VIEWS(18); + + auto tmp = (avm_main_sel_halt * (-avm_main_sel_halt + FF(1))); + tmp *= scaling_factor; + std::get<18>(evals) += tmp; + } + // Contribution 19 + { + Avm_DECLARE_VIEWS(19); + + auto tmp = (avm_main_sel_mov * (-avm_main_sel_mov + FF(1))); + tmp *= scaling_factor; + std::get<19>(evals) += tmp; + } + // Contribution 20 + { + Avm_DECLARE_VIEWS(20); + + auto tmp = (avm_main_sel_cmov * (-avm_main_sel_cmov + FF(1))); + tmp *= scaling_factor; + std::get<20>(evals) += tmp; + } + // Contribution 21 + { + Avm_DECLARE_VIEWS(21); + + auto tmp = (avm_main_op_err * (-avm_main_op_err + FF(1))); + tmp *= scaling_factor; + std::get<21>(evals) += tmp; + } + // Contribution 22 + { + Avm_DECLARE_VIEWS(22); + + auto tmp = (avm_main_tag_err * (-avm_main_tag_err + FF(1))); + tmp *= scaling_factor; + std::get<22>(evals) += tmp; + } + // Contribution 23 + { + Avm_DECLARE_VIEWS(23); + + auto tmp = (avm_main_id_zero * (-avm_main_id_zero + FF(1))); + tmp *= scaling_factor; + std::get<23>(evals) += tmp; + } + // Contribution 24 + { + Avm_DECLARE_VIEWS(24); + + auto tmp = (avm_main_mem_op_a * (-avm_main_mem_op_a + FF(1))); + tmp *= scaling_factor; + std::get<24>(evals) += tmp; + } + // Contribution 25 + { + Avm_DECLARE_VIEWS(25); + + auto tmp = (avm_main_mem_op_b * (-avm_main_mem_op_b + FF(1))); + tmp *= scaling_factor; + std::get<25>(evals) += tmp; + } + // Contribution 26 + { + Avm_DECLARE_VIEWS(26); + + auto tmp = (avm_main_mem_op_c * (-avm_main_mem_op_c + FF(1))); + tmp *= scaling_factor; + std::get<26>(evals) += tmp; + } + // Contribution 27 + { + Avm_DECLARE_VIEWS(27); + + auto tmp = (avm_main_mem_op_d * (-avm_main_mem_op_d + FF(1))); + tmp *= scaling_factor; + std::get<27>(evals) += tmp; + } + // Contribution 28 + { + Avm_DECLARE_VIEWS(28); + + auto tmp = (avm_main_rwa * (-avm_main_rwa + FF(1))); + tmp *= scaling_factor; + std::get<28>(evals) += tmp; + } + // Contribution 29 + { + Avm_DECLARE_VIEWS(29); + + auto tmp = (avm_main_rwb * (-avm_main_rwb + FF(1))); + tmp *= scaling_factor; + std::get<29>(evals) += tmp; + } + // Contribution 30 + { + Avm_DECLARE_VIEWS(30); + + auto tmp = (avm_main_rwc * (-avm_main_rwc + FF(1))); + tmp *= scaling_factor; + std::get<30>(evals) += tmp; + } + // Contribution 31 + { + Avm_DECLARE_VIEWS(31); + + auto tmp = (avm_main_rwd * (-avm_main_rwd + FF(1))); + tmp *= scaling_factor; + std::get<31>(evals) += tmp; + } + // Contribution 32 + { + Avm_DECLARE_VIEWS(32); + + auto tmp = (avm_main_ind_op_a * (-avm_main_ind_op_a + FF(1))); + tmp *= scaling_factor; + std::get<32>(evals) += tmp; + } + // Contribution 33 + { + Avm_DECLARE_VIEWS(33); + + auto tmp = (avm_main_ind_op_b * (-avm_main_ind_op_b + FF(1))); + tmp *= scaling_factor; + std::get<33>(evals) += tmp; + } + // Contribution 34 + { + Avm_DECLARE_VIEWS(34); + + auto tmp = (avm_main_ind_op_c * (-avm_main_ind_op_c + FF(1))); + tmp *= scaling_factor; + std::get<34>(evals) += tmp; + } + // Contribution 35 + { + Avm_DECLARE_VIEWS(35); + + auto tmp = (avm_main_ind_op_d * (-avm_main_ind_op_d + FF(1))); + tmp *= scaling_factor; + std::get<35>(evals) += tmp; + } + // Contribution 36 + { + Avm_DECLARE_VIEWS(36); + + auto tmp = + (((avm_main_sel_op_eq + avm_main_sel_op_lte) + avm_main_sel_op_lt) * (avm_main_w_in_tag - FF(1))); + tmp *= scaling_factor; + std::get<36>(evals) += tmp; + } + // Contribution 37 + { + Avm_DECLARE_VIEWS(37); + + auto tmp = + ((avm_main_sel_op_fdiv * (-avm_main_op_err + FF(1))) * ((avm_main_ic * avm_main_ib) - avm_main_ia)); + tmp *= scaling_factor; + std::get<37>(evals) += tmp; + } + // Contribution 38 + { + Avm_DECLARE_VIEWS(38); + + auto tmp = ((avm_main_sel_op_fdiv + avm_main_sel_op_div) * + (((avm_main_ib * avm_main_inv) - FF(1)) + avm_main_op_err)); + tmp *= scaling_factor; + std::get<38>(evals) += tmp; + } + // Contribution 39 + { + Avm_DECLARE_VIEWS(39); + + auto tmp = (((avm_main_sel_op_fdiv + avm_main_sel_op_div) * avm_main_op_err) * (-avm_main_inv + FF(1))); + tmp *= scaling_factor; + std::get<39>(evals) += tmp; + } + // Contribution 40 + { + Avm_DECLARE_VIEWS(40); + + auto tmp = (avm_main_sel_op_fdiv * (avm_main_r_in_tag - FF(6))); + tmp *= scaling_factor; + std::get<40>(evals) += tmp; + } + // Contribution 41 + { + Avm_DECLARE_VIEWS(41); + + auto tmp = (avm_main_sel_op_fdiv * (avm_main_w_in_tag - FF(6))); + tmp *= scaling_factor; + std::get<41>(evals) += tmp; + } + // Contribution 42 + { + Avm_DECLARE_VIEWS(42); + + auto tmp = (avm_main_op_err * ((avm_main_sel_op_fdiv + avm_main_sel_op_div) - FF(1))); + tmp *= scaling_factor; + std::get<42>(evals) += tmp; + } + // Contribution 43 + { + Avm_DECLARE_VIEWS(43); + + auto tmp = (avm_main_sel_jump * (avm_main_pc_shift - avm_main_ia)); + tmp *= scaling_factor; + std::get<43>(evals) += tmp; + } + // Contribution 44 + { + Avm_DECLARE_VIEWS(44); + + auto tmp = (avm_main_sel_internal_call * + (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr + FF(1)))); + tmp *= scaling_factor; + std::get<44>(evals) += tmp; + } + // Contribution 45 + { + Avm_DECLARE_VIEWS(45); + + auto tmp = (avm_main_sel_internal_call * (avm_main_internal_return_ptr - avm_main_mem_idx_b)); + tmp *= scaling_factor; + std::get<45>(evals) += tmp; + } + // Contribution 46 + { + Avm_DECLARE_VIEWS(46); + + auto tmp = (avm_main_sel_internal_call * (avm_main_pc_shift - avm_main_ia)); + tmp *= scaling_factor; + std::get<46>(evals) += tmp; + } + // Contribution 47 + { + Avm_DECLARE_VIEWS(47); + + auto tmp = (avm_main_sel_internal_call * ((avm_main_pc + FF(1)) - avm_main_ib)); + tmp *= scaling_factor; + std::get<47>(evals) += tmp; + } + // Contribution 48 + { + Avm_DECLARE_VIEWS(48); + + auto tmp = (avm_main_sel_internal_call * (avm_main_rwb - FF(1))); + tmp *= scaling_factor; + std::get<48>(evals) += tmp; + } + // Contribution 49 + { + Avm_DECLARE_VIEWS(49); + + auto tmp = (avm_main_sel_internal_call * (avm_main_mem_op_b - FF(1))); + tmp *= scaling_factor; + std::get<49>(evals) += tmp; + } + // Contribution 50 + { + Avm_DECLARE_VIEWS(50); + + auto tmp = (avm_main_sel_internal_return * + (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr - FF(1)))); + tmp *= scaling_factor; + std::get<50>(evals) += tmp; + } + // Contribution 51 + { + Avm_DECLARE_VIEWS(51); + + auto tmp = (avm_main_sel_internal_return * ((avm_main_internal_return_ptr - FF(1)) - avm_main_mem_idx_a)); + tmp *= scaling_factor; + std::get<51>(evals) += tmp; + } + // Contribution 52 + { + Avm_DECLARE_VIEWS(52); + + auto tmp = (avm_main_sel_internal_return * (avm_main_pc_shift - avm_main_ia)); + tmp *= scaling_factor; + std::get<52>(evals) += tmp; + } + // Contribution 53 + { + Avm_DECLARE_VIEWS(53); + + auto tmp = (avm_main_sel_internal_return * avm_main_rwa); + tmp *= scaling_factor; + std::get<53>(evals) += tmp; + } + // Contribution 54 + { + Avm_DECLARE_VIEWS(54); + + auto tmp = (avm_main_sel_internal_return * (avm_main_mem_op_a - FF(1))); + tmp *= scaling_factor; + std::get<54>(evals) += tmp; + } + // Contribution 55 + { + Avm_DECLARE_VIEWS(55); + + auto tmp = + ((((-avm_main_first + FF(1)) * (-avm_main_sel_halt + FF(1))) * + ((((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_div) + avm_main_sel_op_fdiv) + + avm_main_sel_op_mul) + + avm_main_sel_op_not) + + avm_main_sel_op_eq) + + avm_main_sel_op_and) + + avm_main_sel_op_or) + + avm_main_sel_op_xor) + + avm_main_sel_op_cast)) * + (avm_main_pc_shift - (avm_main_pc + FF(1)))); + tmp *= scaling_factor; + std::get<55>(evals) += tmp; + } + // Contribution 56 + { + Avm_DECLARE_VIEWS(56); + + auto tmp = ((-(((avm_main_first + avm_main_sel_internal_call) + avm_main_sel_internal_return) + + avm_main_sel_halt) + + FF(1)) * + (avm_main_internal_return_ptr_shift - avm_main_internal_return_ptr)); + tmp *= scaling_factor; + std::get<56>(evals) += tmp; + } + // Contribution 57 + { + Avm_DECLARE_VIEWS(57); + + auto tmp = (avm_main_sel_cmov * (((avm_main_id * avm_main_inv) - FF(1)) + avm_main_id_zero)); + tmp *= scaling_factor; + std::get<57>(evals) += tmp; + } + // Contribution 58 + { + Avm_DECLARE_VIEWS(58); + + auto tmp = ((avm_main_sel_cmov * avm_main_id_zero) * (-avm_main_inv + FF(1))); + tmp *= scaling_factor; + std::get<58>(evals) += tmp; + } + // Contribution 59 + { + Avm_DECLARE_VIEWS(59); + + auto tmp = (avm_main_sel_mov_a - (avm_main_sel_mov + (avm_main_sel_cmov * (-avm_main_id_zero + FF(1))))); + tmp *= scaling_factor; + std::get<59>(evals) += tmp; + } + // Contribution 60 + { + Avm_DECLARE_VIEWS(60); + + auto tmp = (avm_main_sel_mov_b - (avm_main_sel_cmov * avm_main_id_zero)); + tmp *= scaling_factor; + std::get<60>(evals) += tmp; + } + // Contribution 61 + { + Avm_DECLARE_VIEWS(61); + + auto tmp = (avm_main_sel_mov_a * (avm_main_ia - avm_main_ic)); + tmp *= scaling_factor; + std::get<61>(evals) += tmp; + } + // Contribution 62 + { + Avm_DECLARE_VIEWS(62); + + auto tmp = (avm_main_sel_mov_b * (avm_main_ib - avm_main_ic)); + tmp *= scaling_factor; + std::get<62>(evals) += tmp; + } + // Contribution 63 + { + Avm_DECLARE_VIEWS(63); + + auto tmp = ((avm_main_sel_mov + avm_main_sel_cmov) * (avm_main_r_in_tag - avm_main_w_in_tag)); + tmp *= scaling_factor; + std::get<63>(evals) += tmp; + } + // Contribution 64 + { + Avm_DECLARE_VIEWS(64); + + auto tmp = + (avm_main_alu_sel - + (((((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_mul) + avm_main_sel_op_div) + + avm_main_sel_op_not) + + avm_main_sel_op_eq) + + avm_main_sel_op_lt) + + avm_main_sel_op_lte) + + avm_main_sel_op_shr) + + avm_main_sel_op_shl) + + avm_main_sel_op_cast) * + (-avm_main_tag_err + FF(1)))); + tmp *= scaling_factor; + std::get<64>(evals) += tmp; + } + // Contribution 65 + { + Avm_DECLARE_VIEWS(65); + + auto tmp = + ((((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_mul) + avm_main_sel_op_div) + + avm_main_sel_op_not) + + avm_main_sel_op_eq) + + avm_main_sel_op_lt) + + avm_main_sel_op_lte) + + avm_main_sel_op_shr) + + avm_main_sel_op_shl) * + (avm_main_alu_in_tag - avm_main_r_in_tag)); + tmp *= scaling_factor; + std::get<65>(evals) += tmp; + } + // Contribution 66 + { + Avm_DECLARE_VIEWS(66); + + auto tmp = (avm_main_sel_op_cast * (avm_main_alu_in_tag - avm_main_w_in_tag)); + tmp *= scaling_factor; + std::get<66>(evals) += tmp; + } + // Contribution 67 + { + Avm_DECLARE_VIEWS(67); + + auto tmp = (avm_main_bin_op_id - (avm_main_sel_op_or + (avm_main_sel_op_xor * FF(2)))); + tmp *= scaling_factor; + std::get<67>(evals) += tmp; + } + // Contribution 68 + { + Avm_DECLARE_VIEWS(68); + + auto tmp = (avm_main_bin_sel - ((avm_main_sel_op_and + avm_main_sel_op_or) + avm_main_sel_op_xor)); + tmp *= scaling_factor; + std::get<68>(evals) += tmp; + } + } }; template using avm_main = Relation>; - } \ No newline at end of file +} // namespace bb::Avm_vm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_mem.hpp index ec0fde5f0ef..26b504f9ce2 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_mem.hpp @@ -6,507 +6,446 @@ namespace bb::Avm_vm { -template struct Avm_memRow { - FF avm_main_first {}; - FF avm_mem_addr {}; - FF avm_mem_addr_shift {}; - FF avm_mem_clk {}; - FF avm_mem_diff_hi {}; - FF avm_mem_diff_lo {}; - FF avm_mem_ind_op_a {}; - FF avm_mem_ind_op_b {}; - FF avm_mem_ind_op_c {}; - FF avm_mem_ind_op_d {}; - FF avm_mem_last {}; - FF avm_mem_lastAccess {}; - FF avm_mem_mem_sel {}; - FF avm_mem_mem_sel_shift {}; - FF avm_mem_one_min_inv {}; - FF avm_mem_op_a {}; - FF avm_mem_op_b {}; - FF avm_mem_op_c {}; - FF avm_mem_op_d {}; - FF avm_mem_r_in_tag {}; - FF avm_mem_rng_chk_sel {}; - FF avm_mem_rw {}; - FF avm_mem_rw_shift {}; - FF avm_mem_sel_cmov {}; - FF avm_mem_sel_mov_a {}; - FF avm_mem_sel_mov_b {}; - FF avm_mem_skip_check_tag {}; - FF avm_mem_tag {}; - FF avm_mem_tag_err {}; - FF avm_mem_tag_shift {}; - FF avm_mem_tsp {}; - FF avm_mem_tsp_shift {}; - FF avm_mem_val {}; - FF avm_mem_val_shift {}; - FF avm_mem_w_in_tag {}; - }; - - - inline std::string get_relation_label_avm_mem(int index) { - switch (index) { - case 14: - return "MEM_CONTIGUOUS"; - -case 15: - return "MEM_FIRST_EMPTY"; - -case 17: - return "TIMESTAMP"; - -case 18: - return "LAST_ACCESS_FIRST_ROW"; - -case 19: - return "MEM_LAST_ACCESS_DELIMITER"; - -case 20: - return "DIFF_RNG_CHK_DEC"; - -case 21: - return "MEM_READ_WRITE_VAL_CONSISTENCY"; - -case 22: - return "MEM_READ_WRITE_TAG_CONSISTENCY"; - -case 23: - return "MEM_ZERO_INIT"; - -case 24: - return "SKIP_CHECK_TAG"; - -case 25: - return "MEM_IN_TAG_CONSISTENCY_1"; - -case 26: - return "MEM_IN_TAG_CONSISTENCY_2"; - -case 27: - return "NO_TAG_ERR_WRITE_OR_SKIP"; - -case 29: - return "NO_TAG_ERR_WRITE"; - -case 38: - return "MOV_SAME_TAG"; - - } - return std::to_string(index); +template struct Avm_memRow { + FF avm_main_first{}; + FF avm_mem_addr{}; + FF avm_mem_addr_shift{}; + FF avm_mem_clk{}; + FF avm_mem_diff_hi{}; + FF avm_mem_diff_lo{}; + FF avm_mem_ind_op_a{}; + FF avm_mem_ind_op_b{}; + FF avm_mem_ind_op_c{}; + FF avm_mem_ind_op_d{}; + FF avm_mem_last{}; + FF avm_mem_lastAccess{}; + FF avm_mem_mem_sel{}; + FF avm_mem_mem_sel_shift{}; + FF avm_mem_one_min_inv{}; + FF avm_mem_op_a{}; + FF avm_mem_op_b{}; + FF avm_mem_op_c{}; + FF avm_mem_op_d{}; + FF avm_mem_r_in_tag{}; + FF avm_mem_rng_chk_sel{}; + FF avm_mem_rw{}; + FF avm_mem_rw_shift{}; + FF avm_mem_sel_cmov{}; + FF avm_mem_sel_mov_a{}; + FF avm_mem_sel_mov_b{}; + FF avm_mem_skip_check_tag{}; + FF avm_mem_tag{}; + FF avm_mem_tag_err{}; + FF avm_mem_tag_shift{}; + FF avm_mem_tsp{}; + FF avm_mem_tsp_shift{}; + FF avm_mem_val{}; + FF avm_mem_val_shift{}; + FF avm_mem_w_in_tag{}; +}; + +inline std::string get_relation_label_avm_mem(int index) +{ + switch (index) { + case 14: + return "MEM_CONTIGUOUS"; + + case 15: + return "MEM_FIRST_EMPTY"; + + case 17: + return "TIMESTAMP"; + + case 18: + return "LAST_ACCESS_FIRST_ROW"; + + case 19: + return "MEM_LAST_ACCESS_DELIMITER"; + + case 20: + return "DIFF_RNG_CHK_DEC"; + + case 21: + return "MEM_READ_WRITE_VAL_CONSISTENCY"; + + case 22: + return "MEM_READ_WRITE_TAG_CONSISTENCY"; + + case 23: + return "MEM_ZERO_INIT"; + + case 24: + return "SKIP_CHECK_TAG"; + + case 25: + return "MEM_IN_TAG_CONSISTENCY_1"; + + case 26: + return "MEM_IN_TAG_CONSISTENCY_2"; + + case 27: + return "NO_TAG_ERR_WRITE_OR_SKIP"; + + case 29: + return "NO_TAG_ERR_WRITE"; + + case 38: + return "MOV_SAME_TAG"; } - + return std::to_string(index); +} template class avm_memImpl { - public: - using FF = FF_; - - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 2, - 3, - 4, - 3, - 3, - 4, - 3, - 3, - 4, - 4, - 4, - 4, - 4, - 5, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, -}; - - + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 4, 3, 3, 4, 3, 3, + 4, 4, 4, 4, 4, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + }; + template - void static accumulate( - ContainerOverSubrelations& evals, - const AllEntities& new_term, - [[maybe_unused]] const RelationParameters&, - [[maybe_unused]] const FF& scaling_factor - ){ - - //Contribution 0 + void static accumulate(ContainerOverSubrelations& evals, + const AllEntities& new_term, + [[maybe_unused]] const RelationParameters&, + [[maybe_unused]] const FF& scaling_factor) { -Avm_DECLARE_VIEWS(0); - - - auto tmp = (avm_mem_lastAccess * (-avm_mem_lastAccess + FF(1))); - tmp *= scaling_factor; - std::get<0>(evals) += tmp; -} -//Contribution 1 - { -Avm_DECLARE_VIEWS(1); - - - auto tmp = (avm_mem_last * (-avm_mem_last + FF(1))); - tmp *= scaling_factor; - std::get<1>(evals) += tmp; -} -//Contribution 2 - { -Avm_DECLARE_VIEWS(2); - - - auto tmp = (avm_mem_rw * (-avm_mem_rw + FF(1))); - tmp *= scaling_factor; - std::get<2>(evals) += tmp; -} -//Contribution 3 - { -Avm_DECLARE_VIEWS(3); - - - auto tmp = (avm_mem_tag_err * (-avm_mem_tag_err + FF(1))); - tmp *= scaling_factor; - std::get<3>(evals) += tmp; -} -//Contribution 4 - { -Avm_DECLARE_VIEWS(4); - - - auto tmp = (avm_mem_op_a * (-avm_mem_op_a + FF(1))); - tmp *= scaling_factor; - std::get<4>(evals) += tmp; -} -//Contribution 5 - { -Avm_DECLARE_VIEWS(5); - - - auto tmp = (avm_mem_op_b * (-avm_mem_op_b + FF(1))); - tmp *= scaling_factor; - std::get<5>(evals) += tmp; -} -//Contribution 6 - { -Avm_DECLARE_VIEWS(6); - - - auto tmp = (avm_mem_op_c * (-avm_mem_op_c + FF(1))); - tmp *= scaling_factor; - std::get<6>(evals) += tmp; -} -//Contribution 7 - { -Avm_DECLARE_VIEWS(7); - - - auto tmp = (avm_mem_op_d * (-avm_mem_op_d + FF(1))); - tmp *= scaling_factor; - std::get<7>(evals) += tmp; -} -//Contribution 8 - { -Avm_DECLARE_VIEWS(8); - - - auto tmp = (avm_mem_ind_op_a * (-avm_mem_ind_op_a + FF(1))); - tmp *= scaling_factor; - std::get<8>(evals) += tmp; -} -//Contribution 9 - { -Avm_DECLARE_VIEWS(9); - - - auto tmp = (avm_mem_ind_op_b * (-avm_mem_ind_op_b + FF(1))); - tmp *= scaling_factor; - std::get<9>(evals) += tmp; -} -//Contribution 10 - { -Avm_DECLARE_VIEWS(10); - - - auto tmp = (avm_mem_ind_op_c * (-avm_mem_ind_op_c + FF(1))); - tmp *= scaling_factor; - std::get<10>(evals) += tmp; -} -//Contribution 11 - { -Avm_DECLARE_VIEWS(11); - - - auto tmp = (avm_mem_ind_op_d * (-avm_mem_ind_op_d + FF(1))); - tmp *= scaling_factor; - std::get<11>(evals) += tmp; -} -//Contribution 12 - { -Avm_DECLARE_VIEWS(12); - - - auto tmp = (avm_mem_mem_sel - (((((((avm_mem_op_a + avm_mem_op_b) + avm_mem_op_c) + avm_mem_op_d) + avm_mem_ind_op_a) + avm_mem_ind_op_b) + avm_mem_ind_op_c) + avm_mem_ind_op_d)); - tmp *= scaling_factor; - std::get<12>(evals) += tmp; -} -//Contribution 13 - { -Avm_DECLARE_VIEWS(13); - - - auto tmp = (avm_mem_mem_sel * (avm_mem_mem_sel - FF(1))); - tmp *= scaling_factor; - std::get<13>(evals) += tmp; -} -//Contribution 14 - { -Avm_DECLARE_VIEWS(14); - - - auto tmp = (((-avm_main_first + FF(1)) * avm_mem_mem_sel_shift) * (-avm_mem_mem_sel + FF(1))); - tmp *= scaling_factor; - std::get<14>(evals) += tmp; -} -//Contribution 15 - { -Avm_DECLARE_VIEWS(15); - - - auto tmp = (avm_main_first * avm_mem_mem_sel); - tmp *= scaling_factor; - std::get<15>(evals) += tmp; -} -//Contribution 16 - { -Avm_DECLARE_VIEWS(16); - - - auto tmp = (avm_mem_rng_chk_sel - (avm_mem_mem_sel * (-avm_mem_last + FF(1)))); - tmp *= scaling_factor; - std::get<16>(evals) += tmp; -} -//Contribution 17 - { -Avm_DECLARE_VIEWS(17); - - - auto tmp = (avm_mem_tsp - ((avm_mem_clk * FF(12)) + (avm_mem_mem_sel * ((((avm_mem_ind_op_b + avm_mem_op_b) + ((avm_mem_ind_op_c + avm_mem_op_c) * FF(2))) + ((avm_mem_ind_op_d + avm_mem_op_d) * FF(3))) + (((-(((avm_mem_ind_op_a + avm_mem_ind_op_b) + avm_mem_ind_op_c) + avm_mem_ind_op_d) + FF(1)) + avm_mem_rw) * FF(4)))))); - tmp *= scaling_factor; - std::get<17>(evals) += tmp; -} -//Contribution 18 - { -Avm_DECLARE_VIEWS(18); - - - auto tmp = (avm_main_first * (-avm_mem_lastAccess + FF(1))); - tmp *= scaling_factor; - std::get<18>(evals) += tmp; -} -//Contribution 19 - { -Avm_DECLARE_VIEWS(19); - - - auto tmp = ((-avm_mem_lastAccess + FF(1)) * (avm_mem_addr_shift - avm_mem_addr)); - tmp *= scaling_factor; - std::get<19>(evals) += tmp; -} -//Contribution 20 - { -Avm_DECLARE_VIEWS(20); - - - auto tmp = (avm_mem_rng_chk_sel * ((((avm_mem_lastAccess * (avm_mem_addr_shift - avm_mem_addr)) + ((-avm_mem_lastAccess + FF(1)) * (avm_mem_tsp_shift - avm_mem_tsp))) - (avm_mem_diff_hi * FF(65536))) - avm_mem_diff_lo)); - tmp *= scaling_factor; - std::get<20>(evals) += tmp; -} -//Contribution 21 - { -Avm_DECLARE_VIEWS(21); - - - auto tmp = (((-avm_mem_lastAccess + FF(1)) * (-avm_mem_rw_shift + FF(1))) * (avm_mem_val_shift - avm_mem_val)); - tmp *= scaling_factor; - std::get<21>(evals) += tmp; -} -//Contribution 22 - { -Avm_DECLARE_VIEWS(22); - - - auto tmp = (((-avm_mem_lastAccess + FF(1)) * (-avm_mem_rw_shift + FF(1))) * (avm_mem_tag_shift - avm_mem_tag)); - tmp *= scaling_factor; - std::get<22>(evals) += tmp; -} -//Contribution 23 - { -Avm_DECLARE_VIEWS(23); - - - auto tmp = ((avm_mem_lastAccess * (-avm_mem_rw_shift + FF(1))) * avm_mem_val_shift); - tmp *= scaling_factor; - std::get<23>(evals) += tmp; -} -//Contribution 24 - { -Avm_DECLARE_VIEWS(24); - - - auto tmp = (avm_mem_skip_check_tag - (avm_mem_sel_cmov * ((avm_mem_op_d + (avm_mem_op_a * (-avm_mem_sel_mov_a + FF(1)))) + (avm_mem_op_b * (-avm_mem_sel_mov_b + FF(1)))))); - tmp *= scaling_factor; - std::get<24>(evals) += tmp; -} -//Contribution 25 - { -Avm_DECLARE_VIEWS(25); - - - auto tmp = (((-avm_mem_skip_check_tag + FF(1)) * (-avm_mem_rw + FF(1))) * (((avm_mem_r_in_tag - avm_mem_tag) * (-avm_mem_one_min_inv + FF(1))) - avm_mem_tag_err)); - tmp *= scaling_factor; - std::get<25>(evals) += tmp; -} -//Contribution 26 - { -Avm_DECLARE_VIEWS(26); - - - auto tmp = ((-avm_mem_tag_err + FF(1)) * avm_mem_one_min_inv); - tmp *= scaling_factor; - std::get<26>(evals) += tmp; -} -//Contribution 27 - { -Avm_DECLARE_VIEWS(27); - - - auto tmp = ((avm_mem_skip_check_tag + avm_mem_rw) * avm_mem_tag_err); - tmp *= scaling_factor; - std::get<27>(evals) += tmp; -} -//Contribution 28 - { -Avm_DECLARE_VIEWS(28); - - - auto tmp = (avm_mem_rw * (avm_mem_w_in_tag - avm_mem_tag)); - tmp *= scaling_factor; - std::get<28>(evals) += tmp; -} -//Contribution 29 - { -Avm_DECLARE_VIEWS(29); - - - auto tmp = (avm_mem_rw * avm_mem_tag_err); - tmp *= scaling_factor; - std::get<29>(evals) += tmp; -} -//Contribution 30 - { -Avm_DECLARE_VIEWS(30); - - - auto tmp = (avm_mem_ind_op_a * (avm_mem_r_in_tag - FF(3))); - tmp *= scaling_factor; - std::get<30>(evals) += tmp; -} -//Contribution 31 - { -Avm_DECLARE_VIEWS(31); - - - auto tmp = (avm_mem_ind_op_b * (avm_mem_r_in_tag - FF(3))); - tmp *= scaling_factor; - std::get<31>(evals) += tmp; -} -//Contribution 32 - { -Avm_DECLARE_VIEWS(32); - - - auto tmp = (avm_mem_ind_op_c * (avm_mem_r_in_tag - FF(3))); - tmp *= scaling_factor; - std::get<32>(evals) += tmp; -} -//Contribution 33 - { -Avm_DECLARE_VIEWS(33); - - - auto tmp = (avm_mem_ind_op_d * (avm_mem_r_in_tag - FF(3))); - tmp *= scaling_factor; - std::get<33>(evals) += tmp; -} -//Contribution 34 - { -Avm_DECLARE_VIEWS(34); - - - auto tmp = (avm_mem_ind_op_a * avm_mem_rw); - tmp *= scaling_factor; - std::get<34>(evals) += tmp; -} -//Contribution 35 - { -Avm_DECLARE_VIEWS(35); - - - auto tmp = (avm_mem_ind_op_b * avm_mem_rw); - tmp *= scaling_factor; - std::get<35>(evals) += tmp; -} -//Contribution 36 - { -Avm_DECLARE_VIEWS(36); - - - auto tmp = (avm_mem_ind_op_c * avm_mem_rw); - tmp *= scaling_factor; - std::get<36>(evals) += tmp; -} -//Contribution 37 - { -Avm_DECLARE_VIEWS(37); - - - auto tmp = (avm_mem_ind_op_d * avm_mem_rw); - tmp *= scaling_factor; - std::get<37>(evals) += tmp; -} -//Contribution 38 - { -Avm_DECLARE_VIEWS(38); - - - auto tmp = ((avm_mem_sel_mov_a + avm_mem_sel_mov_b) * avm_mem_tag_err); - tmp *= scaling_factor; - std::get<38>(evals) += tmp; -} -} + // Contribution 0 + { + Avm_DECLARE_VIEWS(0); + + auto tmp = (avm_mem_lastAccess * (-avm_mem_lastAccess + FF(1))); + tmp *= scaling_factor; + std::get<0>(evals) += tmp; + } + // Contribution 1 + { + Avm_DECLARE_VIEWS(1); + + auto tmp = (avm_mem_last * (-avm_mem_last + FF(1))); + tmp *= scaling_factor; + std::get<1>(evals) += tmp; + } + // Contribution 2 + { + Avm_DECLARE_VIEWS(2); + + auto tmp = (avm_mem_rw * (-avm_mem_rw + FF(1))); + tmp *= scaling_factor; + std::get<2>(evals) += tmp; + } + // Contribution 3 + { + Avm_DECLARE_VIEWS(3); + + auto tmp = (avm_mem_tag_err * (-avm_mem_tag_err + FF(1))); + tmp *= scaling_factor; + std::get<3>(evals) += tmp; + } + // Contribution 4 + { + Avm_DECLARE_VIEWS(4); + + auto tmp = (avm_mem_op_a * (-avm_mem_op_a + FF(1))); + tmp *= scaling_factor; + std::get<4>(evals) += tmp; + } + // Contribution 5 + { + Avm_DECLARE_VIEWS(5); + + auto tmp = (avm_mem_op_b * (-avm_mem_op_b + FF(1))); + tmp *= scaling_factor; + std::get<5>(evals) += tmp; + } + // Contribution 6 + { + Avm_DECLARE_VIEWS(6); + + auto tmp = (avm_mem_op_c * (-avm_mem_op_c + FF(1))); + tmp *= scaling_factor; + std::get<6>(evals) += tmp; + } + // Contribution 7 + { + Avm_DECLARE_VIEWS(7); + + auto tmp = (avm_mem_op_d * (-avm_mem_op_d + FF(1))); + tmp *= scaling_factor; + std::get<7>(evals) += tmp; + } + // Contribution 8 + { + Avm_DECLARE_VIEWS(8); + + auto tmp = (avm_mem_ind_op_a * (-avm_mem_ind_op_a + FF(1))); + tmp *= scaling_factor; + std::get<8>(evals) += tmp; + } + // Contribution 9 + { + Avm_DECLARE_VIEWS(9); + + auto tmp = (avm_mem_ind_op_b * (-avm_mem_ind_op_b + FF(1))); + tmp *= scaling_factor; + std::get<9>(evals) += tmp; + } + // Contribution 10 + { + Avm_DECLARE_VIEWS(10); + + auto tmp = (avm_mem_ind_op_c * (-avm_mem_ind_op_c + FF(1))); + tmp *= scaling_factor; + std::get<10>(evals) += tmp; + } + // Contribution 11 + { + Avm_DECLARE_VIEWS(11); + + auto tmp = (avm_mem_ind_op_d * (-avm_mem_ind_op_d + FF(1))); + tmp *= scaling_factor; + std::get<11>(evals) += tmp; + } + // Contribution 12 + { + Avm_DECLARE_VIEWS(12); + + auto tmp = (avm_mem_mem_sel - + (((((((avm_mem_op_a + avm_mem_op_b) + avm_mem_op_c) + avm_mem_op_d) + avm_mem_ind_op_a) + + avm_mem_ind_op_b) + + avm_mem_ind_op_c) + + avm_mem_ind_op_d)); + tmp *= scaling_factor; + std::get<12>(evals) += tmp; + } + // Contribution 13 + { + Avm_DECLARE_VIEWS(13); + + auto tmp = (avm_mem_mem_sel * (avm_mem_mem_sel - FF(1))); + tmp *= scaling_factor; + std::get<13>(evals) += tmp; + } + // Contribution 14 + { + Avm_DECLARE_VIEWS(14); + + auto tmp = (((-avm_main_first + FF(1)) * avm_mem_mem_sel_shift) * (-avm_mem_mem_sel + FF(1))); + tmp *= scaling_factor; + std::get<14>(evals) += tmp; + } + // Contribution 15 + { + Avm_DECLARE_VIEWS(15); + + auto tmp = (avm_main_first * avm_mem_mem_sel); + tmp *= scaling_factor; + std::get<15>(evals) += tmp; + } + // Contribution 16 + { + Avm_DECLARE_VIEWS(16); + + auto tmp = (avm_mem_rng_chk_sel - (avm_mem_mem_sel * (-avm_mem_last + FF(1)))); + tmp *= scaling_factor; + std::get<16>(evals) += tmp; + } + // Contribution 17 + { + Avm_DECLARE_VIEWS(17); + + auto tmp = + (avm_mem_tsp - + ((avm_mem_clk * FF(12)) + + (avm_mem_mem_sel * + ((((avm_mem_ind_op_b + avm_mem_op_b) + ((avm_mem_ind_op_c + avm_mem_op_c) * FF(2))) + + ((avm_mem_ind_op_d + avm_mem_op_d) * FF(3))) + + (((-(((avm_mem_ind_op_a + avm_mem_ind_op_b) + avm_mem_ind_op_c) + avm_mem_ind_op_d) + FF(1)) + + avm_mem_rw) * + FF(4)))))); + tmp *= scaling_factor; + std::get<17>(evals) += tmp; + } + // Contribution 18 + { + Avm_DECLARE_VIEWS(18); + + auto tmp = (avm_main_first * (-avm_mem_lastAccess + FF(1))); + tmp *= scaling_factor; + std::get<18>(evals) += tmp; + } + // Contribution 19 + { + Avm_DECLARE_VIEWS(19); + + auto tmp = ((-avm_mem_lastAccess + FF(1)) * (avm_mem_addr_shift - avm_mem_addr)); + tmp *= scaling_factor; + std::get<19>(evals) += tmp; + } + // Contribution 20 + { + Avm_DECLARE_VIEWS(20); + + auto tmp = (avm_mem_rng_chk_sel * ((((avm_mem_lastAccess * (avm_mem_addr_shift - avm_mem_addr)) + + ((-avm_mem_lastAccess + FF(1)) * (avm_mem_tsp_shift - avm_mem_tsp))) - + (avm_mem_diff_hi * FF(65536))) - + avm_mem_diff_lo)); + tmp *= scaling_factor; + std::get<20>(evals) += tmp; + } + // Contribution 21 + { + Avm_DECLARE_VIEWS(21); + + auto tmp = + (((-avm_mem_lastAccess + FF(1)) * (-avm_mem_rw_shift + FF(1))) * (avm_mem_val_shift - avm_mem_val)); + tmp *= scaling_factor; + std::get<21>(evals) += tmp; + } + // Contribution 22 + { + Avm_DECLARE_VIEWS(22); + + auto tmp = + (((-avm_mem_lastAccess + FF(1)) * (-avm_mem_rw_shift + FF(1))) * (avm_mem_tag_shift - avm_mem_tag)); + tmp *= scaling_factor; + std::get<22>(evals) += tmp; + } + // Contribution 23 + { + Avm_DECLARE_VIEWS(23); + + auto tmp = ((avm_mem_lastAccess * (-avm_mem_rw_shift + FF(1))) * avm_mem_val_shift); + tmp *= scaling_factor; + std::get<23>(evals) += tmp; + } + // Contribution 24 + { + Avm_DECLARE_VIEWS(24); + + auto tmp = (avm_mem_skip_check_tag - + (avm_mem_sel_cmov * ((avm_mem_op_d + (avm_mem_op_a * (-avm_mem_sel_mov_a + FF(1)))) + + (avm_mem_op_b * (-avm_mem_sel_mov_b + FF(1)))))); + tmp *= scaling_factor; + std::get<24>(evals) += tmp; + } + // Contribution 25 + { + Avm_DECLARE_VIEWS(25); + + auto tmp = (((-avm_mem_skip_check_tag + FF(1)) * (-avm_mem_rw + FF(1))) * + (((avm_mem_r_in_tag - avm_mem_tag) * (-avm_mem_one_min_inv + FF(1))) - avm_mem_tag_err)); + tmp *= scaling_factor; + std::get<25>(evals) += tmp; + } + // Contribution 26 + { + Avm_DECLARE_VIEWS(26); + + auto tmp = ((-avm_mem_tag_err + FF(1)) * avm_mem_one_min_inv); + tmp *= scaling_factor; + std::get<26>(evals) += tmp; + } + // Contribution 27 + { + Avm_DECLARE_VIEWS(27); + + auto tmp = ((avm_mem_skip_check_tag + avm_mem_rw) * avm_mem_tag_err); + tmp *= scaling_factor; + std::get<27>(evals) += tmp; + } + // Contribution 28 + { + Avm_DECLARE_VIEWS(28); + + auto tmp = (avm_mem_rw * (avm_mem_w_in_tag - avm_mem_tag)); + tmp *= scaling_factor; + std::get<28>(evals) += tmp; + } + // Contribution 29 + { + Avm_DECLARE_VIEWS(29); + + auto tmp = (avm_mem_rw * avm_mem_tag_err); + tmp *= scaling_factor; + std::get<29>(evals) += tmp; + } + // Contribution 30 + { + Avm_DECLARE_VIEWS(30); + + auto tmp = (avm_mem_ind_op_a * (avm_mem_r_in_tag - FF(3))); + tmp *= scaling_factor; + std::get<30>(evals) += tmp; + } + // Contribution 31 + { + Avm_DECLARE_VIEWS(31); + + auto tmp = (avm_mem_ind_op_b * (avm_mem_r_in_tag - FF(3))); + tmp *= scaling_factor; + std::get<31>(evals) += tmp; + } + // Contribution 32 + { + Avm_DECLARE_VIEWS(32); + + auto tmp = (avm_mem_ind_op_c * (avm_mem_r_in_tag - FF(3))); + tmp *= scaling_factor; + std::get<32>(evals) += tmp; + } + // Contribution 33 + { + Avm_DECLARE_VIEWS(33); + + auto tmp = (avm_mem_ind_op_d * (avm_mem_r_in_tag - FF(3))); + tmp *= scaling_factor; + std::get<33>(evals) += tmp; + } + // Contribution 34 + { + Avm_DECLARE_VIEWS(34); + + auto tmp = (avm_mem_ind_op_a * avm_mem_rw); + tmp *= scaling_factor; + std::get<34>(evals) += tmp; + } + // Contribution 35 + { + Avm_DECLARE_VIEWS(35); + + auto tmp = (avm_mem_ind_op_b * avm_mem_rw); + tmp *= scaling_factor; + std::get<35>(evals) += tmp; + } + // Contribution 36 + { + Avm_DECLARE_VIEWS(36); + + auto tmp = (avm_mem_ind_op_c * avm_mem_rw); + tmp *= scaling_factor; + std::get<36>(evals) += tmp; + } + // Contribution 37 + { + Avm_DECLARE_VIEWS(37); + + auto tmp = (avm_mem_ind_op_d * avm_mem_rw); + tmp *= scaling_factor; + std::get<37>(evals) += tmp; + } + // Contribution 38 + { + Avm_DECLARE_VIEWS(38); + + auto tmp = ((avm_mem_sel_mov_a + avm_mem_sel_mov_b) * avm_mem_tag_err); + tmp *= scaling_factor; + std::get<38>(evals) += tmp; + } + } }; template using avm_mem = Relation>; - } \ No newline at end of file +} // namespace bb::Avm_vm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp index 4a5e364abab..cfb4885c4b5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp @@ -1,172 +1,167 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class incl_main_tag_err_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class incl_main_tag_err_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_mem_tag_err == 1 || in.avm_main_tag_err == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_mem_tag_err); const auto is_table_entry = View(in.avm_main_tag_err); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.incl_main_tag_err, -in.incl_main_tag_err_counts, -in.avm_mem_tag_err, -in.avm_main_tag_err, -in.avm_mem_clk, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.incl_main_tag_err, -in.incl_main_tag_err_counts, -in.avm_mem_tag_err, -in.avm_main_tag_err, -in.avm_mem_clk, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.incl_main_tag_err, + in.incl_main_tag_err_counts, + in.avm_mem_tag_err, + in.avm_main_tag_err, + in.avm_mem_clk, + in.avm_main_clk); } - - }; - - template using incl_main_tag_err_relation = GenericLookupRelation; - template using incl_main_tag_err = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.incl_main_tag_err, + in.incl_main_tag_err_counts, + in.avm_mem_tag_err, + in.avm_main_tag_err, + in.avm_mem_clk, + in.avm_main_clk); } - \ No newline at end of file +}; + +template +using incl_main_tag_err_relation = GenericLookupRelation; +template using incl_main_tag_err = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp index fc6d5d99751..4055ceb7951 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class incl_mem_tag_err_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class incl_mem_tag_err_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_tag_err == 1 || in.avm_mem_tag_err == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_main_tag_err); const auto is_table_entry = View(in.avm_mem_tag_err); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.incl_mem_tag_err, -in.incl_mem_tag_err_counts, -in.avm_main_tag_err, -in.avm_mem_tag_err, -in.avm_main_clk, -in.avm_mem_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.incl_mem_tag_err, -in.incl_mem_tag_err_counts, -in.avm_main_tag_err, -in.avm_mem_tag_err, -in.avm_main_clk, -in.avm_mem_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.incl_mem_tag_err, + in.incl_mem_tag_err_counts, + in.avm_main_tag_err, + in.avm_mem_tag_err, + in.avm_main_clk, + in.avm_mem_clk); } - - }; - - template using incl_mem_tag_err_relation = GenericLookupRelation; - template using incl_mem_tag_err = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.incl_mem_tag_err, + in.incl_mem_tag_err_counts, + in.avm_main_tag_err, + in.avm_mem_tag_err, + in.avm_main_clk, + in.avm_mem_clk); } - \ No newline at end of file +}; + +template using incl_mem_tag_err_relation = GenericLookupRelation; +template using incl_mem_tag_err = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp index dd0e670d158..66268991c7c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp @@ -1,176 +1,171 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_byte_lengths_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_byte_lengths_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_binary_start == 1 || in.avm_byte_lookup_bin_sel == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_binary_start); const auto is_table_entry = View(in.avm_byte_lookup_bin_sel); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_byte_lengths, -in.lookup_byte_lengths_counts, -in.avm_binary_start, -in.avm_byte_lookup_bin_sel, -in.avm_binary_in_tag, -in.avm_binary_mem_tag_ctr, -in.avm_byte_lookup_table_in_tags, -in.avm_byte_lookup_table_byte_lengths - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_byte_lengths, -in.lookup_byte_lengths_counts, -in.avm_binary_start, -in.avm_byte_lookup_bin_sel, -in.avm_binary_in_tag, -in.avm_binary_mem_tag_ctr, -in.avm_byte_lookup_table_in_tags, -in.avm_byte_lookup_table_byte_lengths - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_byte_lengths, + in.lookup_byte_lengths_counts, + in.avm_binary_start, + in.avm_byte_lookup_bin_sel, + in.avm_binary_in_tag, + in.avm_binary_mem_tag_ctr, + in.avm_byte_lookup_table_in_tags, + in.avm_byte_lookup_table_byte_lengths); } - - }; - - template using lookup_byte_lengths_relation = GenericLookupRelation; - template using lookup_byte_lengths = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_byte_lengths, + in.lookup_byte_lengths_counts, + in.avm_binary_start, + in.avm_byte_lookup_bin_sel, + in.avm_binary_in_tag, + in.avm_binary_mem_tag_ctr, + in.avm_byte_lookup_table_in_tags, + in.avm_byte_lookup_table_byte_lengths); } - \ No newline at end of file +}; + +template +using lookup_byte_lengths_relation = GenericLookupRelation; +template using lookup_byte_lengths = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp index 537002aeff0..baf2995fcb8 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp @@ -1,184 +1,179 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_byte_operations_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 4; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_byte_operations_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 4; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_binary_bin_sel == 1 || in.avm_byte_lookup_bin_sel == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_binary_bin_sel); const auto is_table_entry = View(in.avm_byte_lookup_bin_sel); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_byte_operations, -in.lookup_byte_operations_counts, -in.avm_binary_bin_sel, -in.avm_byte_lookup_bin_sel, -in.avm_binary_op_id, -in.avm_binary_ia_bytes, -in.avm_binary_ib_bytes, -in.avm_binary_ic_bytes, -in.avm_byte_lookup_table_op_id, -in.avm_byte_lookup_table_input_a, -in.avm_byte_lookup_table_input_b, -in.avm_byte_lookup_table_output - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_byte_operations, -in.lookup_byte_operations_counts, -in.avm_binary_bin_sel, -in.avm_byte_lookup_bin_sel, -in.avm_binary_op_id, -in.avm_binary_ia_bytes, -in.avm_binary_ib_bytes, -in.avm_binary_ic_bytes, -in.avm_byte_lookup_table_op_id, -in.avm_byte_lookup_table_input_a, -in.avm_byte_lookup_table_input_b, -in.avm_byte_lookup_table_output - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_byte_operations, + in.lookup_byte_operations_counts, + in.avm_binary_bin_sel, + in.avm_byte_lookup_bin_sel, + in.avm_binary_op_id, + in.avm_binary_ia_bytes, + in.avm_binary_ib_bytes, + in.avm_binary_ic_bytes, + in.avm_byte_lookup_table_op_id, + in.avm_byte_lookup_table_input_a, + in.avm_byte_lookup_table_input_b, + in.avm_byte_lookup_table_output); } - - }; - - template using lookup_byte_operations_relation = GenericLookupRelation; - template using lookup_byte_operations = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_byte_operations, + in.lookup_byte_operations_counts, + in.avm_binary_bin_sel, + in.avm_byte_lookup_bin_sel, + in.avm_binary_op_id, + in.avm_binary_ia_bytes, + in.avm_binary_ib_bytes, + in.avm_binary_ic_bytes, + in.avm_byte_lookup_table_op_id, + in.avm_byte_lookup_table_input_a, + in.avm_byte_lookup_table_input_b, + in.avm_byte_lookup_table_output); } - \ No newline at end of file +}; + +template +using lookup_byte_operations_relation = GenericLookupRelation; +template using lookup_byte_operations = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp index cf031ad4d57..534c53a0f5f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp @@ -1,172 +1,167 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_mem_rng_chk_hi_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_mem_rng_chk_hi_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_mem_rng_chk_sel == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_mem_rng_chk_sel); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_mem_rng_chk_hi, -in.lookup_mem_rng_chk_hi_counts, -in.avm_mem_rng_chk_sel, -in.avm_main_sel_rng_16, -in.avm_mem_diff_hi, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_mem_rng_chk_hi, -in.lookup_mem_rng_chk_hi_counts, -in.avm_mem_rng_chk_sel, -in.avm_main_sel_rng_16, -in.avm_mem_diff_hi, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, + in.lookup_mem_rng_chk_hi_counts, + in.avm_mem_rng_chk_sel, + in.avm_main_sel_rng_16, + in.avm_mem_diff_hi, + in.avm_main_clk); } - - }; - - template using lookup_mem_rng_chk_hi_relation = GenericLookupRelation; - template using lookup_mem_rng_chk_hi = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, + in.lookup_mem_rng_chk_hi_counts, + in.avm_mem_rng_chk_sel, + in.avm_main_sel_rng_16, + in.avm_mem_diff_hi, + in.avm_main_clk); } - \ No newline at end of file +}; + +template +using lookup_mem_rng_chk_hi_relation = GenericLookupRelation; +template using lookup_mem_rng_chk_hi = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp index 9d0bc3fc524..d59ef829c2d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp @@ -1,172 +1,167 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_mem_rng_chk_lo_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_mem_rng_chk_lo_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_mem_rng_chk_sel == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_mem_rng_chk_sel); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_mem_rng_chk_lo, -in.lookup_mem_rng_chk_lo_counts, -in.avm_mem_rng_chk_sel, -in.avm_main_sel_rng_16, -in.avm_mem_diff_lo, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_mem_rng_chk_lo, -in.lookup_mem_rng_chk_lo_counts, -in.avm_mem_rng_chk_sel, -in.avm_main_sel_rng_16, -in.avm_mem_diff_lo, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, + in.lookup_mem_rng_chk_lo_counts, + in.avm_mem_rng_chk_sel, + in.avm_main_sel_rng_16, + in.avm_mem_diff_lo, + in.avm_main_clk); } - - }; - - template using lookup_mem_rng_chk_lo_relation = GenericLookupRelation; - template using lookup_mem_rng_chk_lo = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, + in.lookup_mem_rng_chk_lo_counts, + in.avm_mem_rng_chk_sel, + in.avm_main_sel_rng_16, + in.avm_mem_diff_lo, + in.avm_main_clk); } - \ No newline at end of file +}; + +template +using lookup_mem_rng_chk_lo_relation = GenericLookupRelation; +template using lookup_mem_rng_chk_lo = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp index 41b126f32ab..a4629615a75 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp @@ -1,176 +1,170 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_pow_2_0_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_pow_2_0_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_shift_sel == 1 || in.avm_main_sel_rng_8 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_shift_sel); const auto is_table_entry = View(in.avm_main_sel_rng_8); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_pow_2_0, -in.lookup_pow_2_0_counts, -in.avm_alu_shift_sel, -in.avm_main_sel_rng_8, -in.avm_alu_ib, -in.avm_alu_two_pow_s, -in.avm_main_clk, -in.avm_main_table_pow_2 - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_pow_2_0, -in.lookup_pow_2_0_counts, -in.avm_alu_shift_sel, -in.avm_main_sel_rng_8, -in.avm_alu_ib, -in.avm_alu_two_pow_s, -in.avm_main_clk, -in.avm_main_table_pow_2 - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_pow_2_0, + in.lookup_pow_2_0_counts, + in.avm_alu_shift_sel, + in.avm_main_sel_rng_8, + in.avm_alu_ib, + in.avm_alu_two_pow_s, + in.avm_main_clk, + in.avm_main_table_pow_2); } - - }; - - template using lookup_pow_2_0_relation = GenericLookupRelation; - template using lookup_pow_2_0 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_pow_2_0, + in.lookup_pow_2_0_counts, + in.avm_alu_shift_sel, + in.avm_main_sel_rng_8, + in.avm_alu_ib, + in.avm_alu_two_pow_s, + in.avm_main_clk, + in.avm_main_table_pow_2); } - \ No newline at end of file +}; + +template using lookup_pow_2_0_relation = GenericLookupRelation; +template using lookup_pow_2_0 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp index c1aca450ed1..e1e7284056e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp @@ -1,176 +1,170 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_pow_2_1_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_pow_2_1_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_shift_sel == 1 || in.avm_main_sel_rng_8 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_shift_sel); const auto is_table_entry = View(in.avm_main_sel_rng_8); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_pow_2_1, -in.lookup_pow_2_1_counts, -in.avm_alu_shift_sel, -in.avm_main_sel_rng_8, -in.avm_alu_t_sub_s_bits, -in.avm_alu_two_pow_t_sub_s, -in.avm_main_clk, -in.avm_main_table_pow_2 - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_pow_2_1, -in.lookup_pow_2_1_counts, -in.avm_alu_shift_sel, -in.avm_main_sel_rng_8, -in.avm_alu_t_sub_s_bits, -in.avm_alu_two_pow_t_sub_s, -in.avm_main_clk, -in.avm_main_table_pow_2 - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_pow_2_1, + in.lookup_pow_2_1_counts, + in.avm_alu_shift_sel, + in.avm_main_sel_rng_8, + in.avm_alu_t_sub_s_bits, + in.avm_alu_two_pow_t_sub_s, + in.avm_main_clk, + in.avm_main_table_pow_2); } - - }; - - template using lookup_pow_2_1_relation = GenericLookupRelation; - template using lookup_pow_2_1 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_pow_2_1, + in.lookup_pow_2_1_counts, + in.avm_alu_shift_sel, + in.avm_main_sel_rng_8, + in.avm_alu_t_sub_s_bits, + in.avm_alu_two_pow_t_sub_s, + in.avm_main_clk, + in.avm_main_table_pow_2); } - \ No newline at end of file +}; + +template using lookup_pow_2_1_relation = GenericLookupRelation; +template using lookup_pow_2_1 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp index 88fe289a098..67c79053609 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_0_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_0_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_0, -in.lookup_u16_0_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r0, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_0, -in.lookup_u16_0_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r0, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_0, + in.lookup_u16_0_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r0, + in.avm_main_clk); } - - }; - - template using lookup_u16_0_relation = GenericLookupRelation; - template using lookup_u16_0 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_0, + in.lookup_u16_0_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r0, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_0_relation = GenericLookupRelation; +template using lookup_u16_0 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp index b78029d9003..c5c39dd2f80 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_1_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_1_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_1, -in.lookup_u16_1_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r1, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_1, -in.lookup_u16_1_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r1, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_1, + in.lookup_u16_1_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r1, + in.avm_main_clk); } - - }; - - template using lookup_u16_1_relation = GenericLookupRelation; - template using lookup_u16_1 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_1, + in.lookup_u16_1_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r1, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_1_relation = GenericLookupRelation; +template using lookup_u16_1 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp index 1f67f41a02d..275dcb0f824 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_10_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_10_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_10, -in.lookup_u16_10_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r10, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_10, -in.lookup_u16_10_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r10, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_10, + in.lookup_u16_10_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r10, + in.avm_main_clk); } - - }; - - template using lookup_u16_10_relation = GenericLookupRelation; - template using lookup_u16_10 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_10, + in.lookup_u16_10_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r10, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_10_relation = GenericLookupRelation; +template using lookup_u16_10 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp index f98a686b914..b94a5f65d84 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_11_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_11_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_11, -in.lookup_u16_11_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r11, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_11, -in.lookup_u16_11_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r11, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_11, + in.lookup_u16_11_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r11, + in.avm_main_clk); } - - }; - - template using lookup_u16_11_relation = GenericLookupRelation; - template using lookup_u16_11 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_11, + in.lookup_u16_11_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r11, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_11_relation = GenericLookupRelation; +template using lookup_u16_11 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp index 6aadbd421e9..4fc5cca4ebe 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_12_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_12_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_12, -in.lookup_u16_12_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r12, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_12, -in.lookup_u16_12_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r12, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_12, + in.lookup_u16_12_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r12, + in.avm_main_clk); } - - }; - - template using lookup_u16_12_relation = GenericLookupRelation; - template using lookup_u16_12 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_12, + in.lookup_u16_12_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r12, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_12_relation = GenericLookupRelation; +template using lookup_u16_12 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp index ff3af5c9592..908d478b8ad 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_13_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_13_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_13, -in.lookup_u16_13_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r13, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_13, -in.lookup_u16_13_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r13, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_13, + in.lookup_u16_13_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r13, + in.avm_main_clk); } - - }; - - template using lookup_u16_13_relation = GenericLookupRelation; - template using lookup_u16_13 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_13, + in.lookup_u16_13_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r13, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_13_relation = GenericLookupRelation; +template using lookup_u16_13 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp index 92dc0c2c84e..735361f8e6c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_14_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_14_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_14, -in.lookup_u16_14_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r14, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_14, -in.lookup_u16_14_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r14, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_14, + in.lookup_u16_14_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r14, + in.avm_main_clk); } - - }; - - template using lookup_u16_14_relation = GenericLookupRelation; - template using lookup_u16_14 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_14, + in.lookup_u16_14_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r14, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_14_relation = GenericLookupRelation; +template using lookup_u16_14 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp index 7a40a19fc2e..8aa66dc7a70 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_2_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_2_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_2, -in.lookup_u16_2_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r2, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_2, -in.lookup_u16_2_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r2, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_2, + in.lookup_u16_2_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r2, + in.avm_main_clk); } - - }; - - template using lookup_u16_2_relation = GenericLookupRelation; - template using lookup_u16_2 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_2, + in.lookup_u16_2_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r2, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_2_relation = GenericLookupRelation; +template using lookup_u16_2 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp index 2519e05a478..b1bda551024 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_3_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_3_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_3, -in.lookup_u16_3_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r3, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_3, -in.lookup_u16_3_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r3, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_3, + in.lookup_u16_3_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r3, + in.avm_main_clk); } - - }; - - template using lookup_u16_3_relation = GenericLookupRelation; - template using lookup_u16_3 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_3, + in.lookup_u16_3_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r3, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_3_relation = GenericLookupRelation; +template using lookup_u16_3 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp index caf45234db0..5984e1a6e59 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_4_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_4_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_4, -in.lookup_u16_4_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r4, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_4, -in.lookup_u16_4_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r4, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_4, + in.lookup_u16_4_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r4, + in.avm_main_clk); } - - }; - - template using lookup_u16_4_relation = GenericLookupRelation; - template using lookup_u16_4 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_4, + in.lookup_u16_4_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r4, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_4_relation = GenericLookupRelation; +template using lookup_u16_4 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp index effff724035..d1bc6db3a29 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_5_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_5_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_5, -in.lookup_u16_5_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r5, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_5, -in.lookup_u16_5_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r5, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_5, + in.lookup_u16_5_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r5, + in.avm_main_clk); } - - }; - - template using lookup_u16_5_relation = GenericLookupRelation; - template using lookup_u16_5 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_5, + in.lookup_u16_5_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r5, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_5_relation = GenericLookupRelation; +template using lookup_u16_5 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp index 5d90864905f..3838f21e967 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_6_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_6_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_6, -in.lookup_u16_6_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r6, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_6, -in.lookup_u16_6_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r6, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_6, + in.lookup_u16_6_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r6, + in.avm_main_clk); } - - }; - - template using lookup_u16_6_relation = GenericLookupRelation; - template using lookup_u16_6 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_6, + in.lookup_u16_6_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r6, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_6_relation = GenericLookupRelation; +template using lookup_u16_6 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp index 57e012a9fc8..84b098172e9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_7_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_7_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_7, -in.lookup_u16_7_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r7, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_7, -in.lookup_u16_7_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r7, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_7, + in.lookup_u16_7_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r7, + in.avm_main_clk); } - - }; - - template using lookup_u16_7_relation = GenericLookupRelation; - template using lookup_u16_7 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_7, + in.lookup_u16_7_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r7, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_7_relation = GenericLookupRelation; +template using lookup_u16_7 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp index 89a39d1b16e..f75f9fa9c28 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_8_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_8_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_8, -in.lookup_u16_8_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r8, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_8, -in.lookup_u16_8_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r8, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_8, + in.lookup_u16_8_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r8, + in.avm_main_clk); } - - }; - - template using lookup_u16_8_relation = GenericLookupRelation; - template using lookup_u16_8 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_8, + in.lookup_u16_8_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r8, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_8_relation = GenericLookupRelation; +template using lookup_u16_8 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp index 6c1e6fc86aa..5e72a369ac4 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u16_9_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u16_9_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_16 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_9, -in.lookup_u16_9_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r9, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u16_9, -in.lookup_u16_9_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_16, -in.avm_alu_u16_r9, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_9, + in.lookup_u16_9_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r9, + in.avm_main_clk); } - - }; - - template using lookup_u16_9_relation = GenericLookupRelation; - template using lookup_u16_9 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u16_9, + in.lookup_u16_9_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_16, + in.avm_alu_u16_r9, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u16_9_relation = GenericLookupRelation; +template using lookup_u16_9 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp index 4ab9eda3c0e..37b5936f008 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u8_0_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u8_0_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_8 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_8); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u8_0, -in.lookup_u8_0_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_8, -in.avm_alu_u8_r0, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u8_0, -in.lookup_u8_0_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_8, -in.avm_alu_u8_r0, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u8_0, + in.lookup_u8_0_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_8, + in.avm_alu_u8_r0, + in.avm_main_clk); } - - }; - - template using lookup_u8_0_relation = GenericLookupRelation; - template using lookup_u8_0 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u8_0, + in.lookup_u8_0_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_8, + in.avm_alu_u8_r0, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u8_0_relation = GenericLookupRelation; +template using lookup_u8_0 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp index 6ffac9227bf..7941ecb1aee 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp @@ -1,172 +1,166 @@ - - #pragma once - - #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" - - #include - #include - - - namespace bb { - - /** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ - class lookup_u8_1_lookup_settings { - public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ - static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ - static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ - static constexpr size_t READ_TERM_TYPES[READ_TERMS] = {0}; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ - static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = {0}; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ - static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ - static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ - static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - - static constexpr size_t WRITE_TERM_DEGREE = 0; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_u8_1_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_alu_rng_chk_lookup_selector == 1 || in.avm_main_sel_rng_8 == 1); } - - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - - template static inline auto compute_inverse_exists(const AllEntities& in) { + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { using View = typename Accumulator::View; const auto is_operation = View(in.avm_alu_rng_chk_lookup_selector); const auto is_table_entry = View(in.avm_main_sel_rng_8); return (is_operation + is_table_entry - is_operation * is_table_entry); } - - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u8_1, -in.lookup_u8_1_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_8, -in.avm_alu_u8_r1, -in.avm_main_clk - ); - - } - - - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.lookup_u8_1, -in.lookup_u8_1_counts, -in.avm_alu_rng_chk_lookup_selector, -in.avm_main_sel_rng_8, -in.avm_alu_u8_r1, -in.avm_main_clk - ); - + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u8_1, + in.lookup_u8_1_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_8, + in.avm_alu_u8_r1, + in.avm_main_clk); } - - }; - - template using lookup_u8_1_relation = GenericLookupRelation; - template using lookup_u8_1 = GenericLookup; - + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_u8_1, + in.lookup_u8_1_counts, + in.avm_alu_rng_chk_lookup_selector, + in.avm_main_sel_rng_8, + in.avm_alu_u8_r1, + in.avm_main_clk); } - \ No newline at end of file +}; + +template using lookup_u8_1_relation = GenericLookupRelation; +template using lookup_u8_1 = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp index 8fe374e3e42..83506a187ff 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp @@ -1,157 +1,150 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_alu_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 16; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_alu_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 16; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_alu_sel == 1 || in.avm_alu_alu_sel == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_alu, -in.avm_main_alu_sel, -in.avm_main_alu_sel, -in.avm_alu_alu_sel, -in.avm_main_clk, -in.avm_main_ia, -in.avm_main_ib, -in.avm_main_ic, -in.avm_main_sel_op_add, -in.avm_main_sel_op_sub, -in.avm_main_sel_op_mul, -in.avm_main_sel_op_div, -in.avm_main_sel_op_eq, -in.avm_main_sel_op_not, -in.avm_main_sel_op_cast, -in.avm_main_sel_op_lt, -in.avm_main_sel_op_lte, -in.avm_main_sel_op_shr, -in.avm_main_sel_op_shl, -in.avm_main_alu_in_tag, -in.avm_alu_clk, -in.avm_alu_ia, -in.avm_alu_ib, -in.avm_alu_ic, -in.avm_alu_op_add, -in.avm_alu_op_sub, -in.avm_alu_op_mul, -in.avm_alu_op_div, -in.avm_alu_op_eq, -in.avm_alu_op_not, -in.avm_alu_op_cast, -in.avm_alu_op_lt, -in.avm_alu_op_lte, -in.avm_alu_op_shr, -in.avm_alu_op_shl, -in.avm_alu_in_tag - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_alu, -in.avm_main_alu_sel, -in.avm_main_alu_sel, -in.avm_alu_alu_sel, -in.avm_main_clk, -in.avm_main_ia, -in.avm_main_ib, -in.avm_main_ic, -in.avm_main_sel_op_add, -in.avm_main_sel_op_sub, -in.avm_main_sel_op_mul, -in.avm_main_sel_op_div, -in.avm_main_sel_op_eq, -in.avm_main_sel_op_not, -in.avm_main_sel_op_cast, -in.avm_main_sel_op_lt, -in.avm_main_sel_op_lte, -in.avm_main_sel_op_shr, -in.avm_main_sel_op_shl, -in.avm_main_alu_in_tag, -in.avm_alu_clk, -in.avm_alu_ia, -in.avm_alu_ib, -in.avm_alu_ic, -in.avm_alu_op_add, -in.avm_alu_op_sub, -in.avm_alu_op_mul, -in.avm_alu_op_div, -in.avm_alu_op_eq, -in.avm_alu_op_not, -in.avm_alu_op_cast, -in.avm_alu_op_lt, -in.avm_alu_op_lte, -in.avm_alu_op_shr, -in.avm_alu_op_shl, -in.avm_alu_in_tag - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_alu, + in.avm_main_alu_sel, + in.avm_main_alu_sel, + in.avm_alu_alu_sel, + in.avm_main_clk, + in.avm_main_ia, + in.avm_main_ib, + in.avm_main_ic, + in.avm_main_sel_op_add, + in.avm_main_sel_op_sub, + in.avm_main_sel_op_mul, + in.avm_main_sel_op_div, + in.avm_main_sel_op_eq, + in.avm_main_sel_op_not, + in.avm_main_sel_op_cast, + in.avm_main_sel_op_lt, + in.avm_main_sel_op_lte, + in.avm_main_sel_op_shr, + in.avm_main_sel_op_shl, + in.avm_main_alu_in_tag, + in.avm_alu_clk, + in.avm_alu_ia, + in.avm_alu_ib, + in.avm_alu_ic, + in.avm_alu_op_add, + in.avm_alu_op_sub, + in.avm_alu_op_mul, + in.avm_alu_op_div, + in.avm_alu_op_eq, + in.avm_alu_op_not, + in.avm_alu_op_cast, + in.avm_alu_op_lt, + in.avm_alu_op_lte, + in.avm_alu_op_shr, + in.avm_alu_op_shl, + in.avm_alu_in_tag); } - - }; - - template using perm_main_alu_relation = GenericPermutationRelation; - template using perm_main_alu = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_alu, + in.avm_main_alu_sel, + in.avm_main_alu_sel, + in.avm_alu_alu_sel, + in.avm_main_clk, + in.avm_main_ia, + in.avm_main_ib, + in.avm_main_ic, + in.avm_main_sel_op_add, + in.avm_main_sel_op_sub, + in.avm_main_sel_op_mul, + in.avm_main_sel_op_div, + in.avm_main_sel_op_eq, + in.avm_main_sel_op_not, + in.avm_main_sel_op_cast, + in.avm_main_sel_op_lt, + in.avm_main_sel_op_lte, + in.avm_main_sel_op_shr, + in.avm_main_sel_op_shl, + in.avm_main_alu_in_tag, + in.avm_alu_clk, + in.avm_alu_ia, + in.avm_alu_ib, + in.avm_alu_ic, + in.avm_alu_op_add, + in.avm_alu_op_sub, + in.avm_alu_op_mul, + in.avm_alu_op_div, + in.avm_alu_op_eq, + in.avm_alu_op_not, + in.avm_alu_op_cast, + in.avm_alu_op_lt, + in.avm_alu_op_lte, + in.avm_alu_op_shr, + in.avm_alu_op_shl, + in.avm_alu_in_tag); } - \ No newline at end of file +}; + +template +using perm_main_alu_relation = GenericPermutationRelation; +template using perm_main_alu = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp index 679685f9a1e..0e3533051d1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp @@ -1,117 +1,110 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_bin_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 6; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_bin_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 6; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_bin_sel == 1 || in.avm_binary_start == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_bin, -in.avm_main_bin_sel, -in.avm_main_bin_sel, -in.avm_binary_start, -in.avm_main_clk, -in.avm_main_ia, -in.avm_main_ib, -in.avm_main_ic, -in.avm_main_bin_op_id, -in.avm_main_r_in_tag, -in.avm_binary_clk, -in.avm_binary_acc_ia, -in.avm_binary_acc_ib, -in.avm_binary_acc_ic, -in.avm_binary_op_id, -in.avm_binary_in_tag - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_bin, -in.avm_main_bin_sel, -in.avm_main_bin_sel, -in.avm_binary_start, -in.avm_main_clk, -in.avm_main_ia, -in.avm_main_ib, -in.avm_main_ic, -in.avm_main_bin_op_id, -in.avm_main_r_in_tag, -in.avm_binary_clk, -in.avm_binary_acc_ia, -in.avm_binary_acc_ib, -in.avm_binary_acc_ic, -in.avm_binary_op_id, -in.avm_binary_in_tag - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_bin, + in.avm_main_bin_sel, + in.avm_main_bin_sel, + in.avm_binary_start, + in.avm_main_clk, + in.avm_main_ia, + in.avm_main_ib, + in.avm_main_ic, + in.avm_main_bin_op_id, + in.avm_main_r_in_tag, + in.avm_binary_clk, + in.avm_binary_acc_ia, + in.avm_binary_acc_ib, + in.avm_binary_acc_ic, + in.avm_binary_op_id, + in.avm_binary_in_tag); } - - }; - - template using perm_main_bin_relation = GenericPermutationRelation; - template using perm_main_bin = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_bin, + in.avm_main_bin_sel, + in.avm_main_bin_sel, + in.avm_binary_start, + in.avm_main_clk, + in.avm_main_ia, + in.avm_main_ib, + in.avm_main_ic, + in.avm_main_bin_op_id, + in.avm_main_r_in_tag, + in.avm_binary_clk, + in.avm_binary_acc_ia, + in.avm_binary_acc_ib, + in.avm_binary_acc_ic, + in.avm_binary_op_id, + in.avm_binary_in_tag); } - \ No newline at end of file +}; + +template +using perm_main_bin_relation = GenericPermutationRelation; +template using perm_main_bin = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp index 1244babe9ed..fb2a35e3ce0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp @@ -1,125 +1,118 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_a_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 8; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_a_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 8; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_mem_op_a == 1 || in.avm_mem_op_a == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_a, -in.avm_main_mem_op_a, -in.avm_main_mem_op_a, -in.avm_mem_op_a, -in.avm_main_clk, -in.avm_main_mem_idx_a, -in.avm_main_ia, -in.avm_main_rwa, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_main_sel_mov_a, -in.avm_main_sel_cmov, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag, -in.avm_mem_sel_mov_a, -in.avm_mem_sel_cmov - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_a, -in.avm_main_mem_op_a, -in.avm_main_mem_op_a, -in.avm_mem_op_a, -in.avm_main_clk, -in.avm_main_mem_idx_a, -in.avm_main_ia, -in.avm_main_rwa, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_main_sel_mov_a, -in.avm_main_sel_cmov, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag, -in.avm_mem_sel_mov_a, -in.avm_mem_sel_cmov - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_a, + in.avm_main_mem_op_a, + in.avm_main_mem_op_a, + in.avm_mem_op_a, + in.avm_main_clk, + in.avm_main_mem_idx_a, + in.avm_main_ia, + in.avm_main_rwa, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_main_sel_mov_a, + in.avm_main_sel_cmov, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag, + in.avm_mem_sel_mov_a, + in.avm_mem_sel_cmov); } - - }; - - template using perm_main_mem_a_relation = GenericPermutationRelation; - template using perm_main_mem_a = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_a, + in.avm_main_mem_op_a, + in.avm_main_mem_op_a, + in.avm_mem_op_a, + in.avm_main_clk, + in.avm_main_mem_idx_a, + in.avm_main_ia, + in.avm_main_rwa, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_main_sel_mov_a, + in.avm_main_sel_cmov, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag, + in.avm_mem_sel_mov_a, + in.avm_mem_sel_cmov); } - \ No newline at end of file +}; + +template +using perm_main_mem_a_relation = GenericPermutationRelation; +template using perm_main_mem_a = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp index 098b4a57940..0cedcf27b6c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp @@ -1,125 +1,118 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_b_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 8; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_b_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 8; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_mem_op_b == 1 || in.avm_mem_op_b == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_b, -in.avm_main_mem_op_b, -in.avm_main_mem_op_b, -in.avm_mem_op_b, -in.avm_main_clk, -in.avm_main_mem_idx_b, -in.avm_main_ib, -in.avm_main_rwb, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_main_sel_mov_b, -in.avm_main_sel_cmov, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag, -in.avm_mem_sel_mov_b, -in.avm_mem_sel_cmov - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_b, -in.avm_main_mem_op_b, -in.avm_main_mem_op_b, -in.avm_mem_op_b, -in.avm_main_clk, -in.avm_main_mem_idx_b, -in.avm_main_ib, -in.avm_main_rwb, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_main_sel_mov_b, -in.avm_main_sel_cmov, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag, -in.avm_mem_sel_mov_b, -in.avm_mem_sel_cmov - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_b, + in.avm_main_mem_op_b, + in.avm_main_mem_op_b, + in.avm_mem_op_b, + in.avm_main_clk, + in.avm_main_mem_idx_b, + in.avm_main_ib, + in.avm_main_rwb, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_main_sel_mov_b, + in.avm_main_sel_cmov, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag, + in.avm_mem_sel_mov_b, + in.avm_mem_sel_cmov); } - - }; - - template using perm_main_mem_b_relation = GenericPermutationRelation; - template using perm_main_mem_b = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_b, + in.avm_main_mem_op_b, + in.avm_main_mem_op_b, + in.avm_mem_op_b, + in.avm_main_clk, + in.avm_main_mem_idx_b, + in.avm_main_ib, + in.avm_main_rwb, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_main_sel_mov_b, + in.avm_main_sel_cmov, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag, + in.avm_mem_sel_mov_b, + in.avm_mem_sel_cmov); } - \ No newline at end of file +}; + +template +using perm_main_mem_b_relation = GenericPermutationRelation; +template using perm_main_mem_b = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp index ed89a5dccb8..5db71414a95 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp @@ -1,117 +1,110 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_c_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 6; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_c_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 6; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_mem_op_c == 1 || in.avm_mem_op_c == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_c, -in.avm_main_mem_op_c, -in.avm_main_mem_op_c, -in.avm_mem_op_c, -in.avm_main_clk, -in.avm_main_mem_idx_c, -in.avm_main_ic, -in.avm_main_rwc, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_c, -in.avm_main_mem_op_c, -in.avm_main_mem_op_c, -in.avm_mem_op_c, -in.avm_main_clk, -in.avm_main_mem_idx_c, -in.avm_main_ic, -in.avm_main_rwc, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_c, + in.avm_main_mem_op_c, + in.avm_main_mem_op_c, + in.avm_mem_op_c, + in.avm_main_clk, + in.avm_main_mem_idx_c, + in.avm_main_ic, + in.avm_main_rwc, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag); } - - }; - - template using perm_main_mem_c_relation = GenericPermutationRelation; - template using perm_main_mem_c = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_c, + in.avm_main_mem_op_c, + in.avm_main_mem_op_c, + in.avm_mem_op_c, + in.avm_main_clk, + in.avm_main_mem_idx_c, + in.avm_main_ic, + in.avm_main_rwc, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag); } - \ No newline at end of file +}; + +template +using perm_main_mem_c_relation = GenericPermutationRelation; +template using perm_main_mem_c = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp index 6b926aace61..389b6f2d880 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp @@ -1,121 +1,114 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_d_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 7; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_d_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 7; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_mem_op_d == 1 || in.avm_mem_op_d == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_d, -in.avm_main_mem_op_d, -in.avm_main_mem_op_d, -in.avm_mem_op_d, -in.avm_main_clk, -in.avm_main_mem_idx_d, -in.avm_main_id, -in.avm_main_rwd, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_main_sel_cmov, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag, -in.avm_mem_sel_cmov - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_d, -in.avm_main_mem_op_d, -in.avm_main_mem_op_d, -in.avm_mem_op_d, -in.avm_main_clk, -in.avm_main_mem_idx_d, -in.avm_main_id, -in.avm_main_rwd, -in.avm_main_r_in_tag, -in.avm_main_w_in_tag, -in.avm_main_sel_cmov, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val, -in.avm_mem_rw, -in.avm_mem_r_in_tag, -in.avm_mem_w_in_tag, -in.avm_mem_sel_cmov - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_d, + in.avm_main_mem_op_d, + in.avm_main_mem_op_d, + in.avm_mem_op_d, + in.avm_main_clk, + in.avm_main_mem_idx_d, + in.avm_main_id, + in.avm_main_rwd, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_main_sel_cmov, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag, + in.avm_mem_sel_cmov); } - - }; - - template using perm_main_mem_d_relation = GenericPermutationRelation; - template using perm_main_mem_d = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_d, + in.avm_main_mem_op_d, + in.avm_main_mem_op_d, + in.avm_mem_op_d, + in.avm_main_clk, + in.avm_main_mem_idx_d, + in.avm_main_id, + in.avm_main_rwd, + in.avm_main_r_in_tag, + in.avm_main_w_in_tag, + in.avm_main_sel_cmov, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val, + in.avm_mem_rw, + in.avm_mem_r_in_tag, + in.avm_mem_w_in_tag, + in.avm_mem_sel_cmov); } - \ No newline at end of file +}; + +template +using perm_main_mem_d_relation = GenericPermutationRelation; +template using perm_main_mem_d = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_a.hpp index 22614daa599..10504566450 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_a.hpp @@ -1,105 +1,98 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_ind_a_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 3; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_ind_a_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 3; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_ind_op_a == 1 || in.avm_mem_ind_op_a == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_a, -in.avm_main_ind_op_a, -in.avm_main_ind_op_a, -in.avm_mem_ind_op_a, -in.avm_main_clk, -in.avm_main_ind_a, -in.avm_main_mem_idx_a, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_a, -in.avm_main_ind_op_a, -in.avm_main_ind_op_a, -in.avm_mem_ind_op_a, -in.avm_main_clk, -in.avm_main_ind_a, -in.avm_main_mem_idx_a, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_a, + in.avm_main_ind_op_a, + in.avm_main_ind_op_a, + in.avm_mem_ind_op_a, + in.avm_main_clk, + in.avm_main_ind_a, + in.avm_main_mem_idx_a, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - - }; - - template using perm_main_mem_ind_a_relation = GenericPermutationRelation; - template using perm_main_mem_ind_a = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_a, + in.avm_main_ind_op_a, + in.avm_main_ind_op_a, + in.avm_mem_ind_op_a, + in.avm_main_clk, + in.avm_main_ind_a, + in.avm_main_mem_idx_a, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - \ No newline at end of file +}; + +template +using perm_main_mem_ind_a_relation = GenericPermutationRelation; +template using perm_main_mem_ind_a = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp index 40641995097..2214f7d0bd1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp @@ -1,105 +1,98 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_ind_b_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 3; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_ind_b_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 3; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_ind_op_b == 1 || in.avm_mem_ind_op_b == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_b, -in.avm_main_ind_op_b, -in.avm_main_ind_op_b, -in.avm_mem_ind_op_b, -in.avm_main_clk, -in.avm_main_ind_b, -in.avm_main_mem_idx_b, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_b, -in.avm_main_ind_op_b, -in.avm_main_ind_op_b, -in.avm_mem_ind_op_b, -in.avm_main_clk, -in.avm_main_ind_b, -in.avm_main_mem_idx_b, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_b, + in.avm_main_ind_op_b, + in.avm_main_ind_op_b, + in.avm_mem_ind_op_b, + in.avm_main_clk, + in.avm_main_ind_b, + in.avm_main_mem_idx_b, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - - }; - - template using perm_main_mem_ind_b_relation = GenericPermutationRelation; - template using perm_main_mem_ind_b = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_b, + in.avm_main_ind_op_b, + in.avm_main_ind_op_b, + in.avm_mem_ind_op_b, + in.avm_main_clk, + in.avm_main_ind_b, + in.avm_main_mem_idx_b, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - \ No newline at end of file +}; + +template +using perm_main_mem_ind_b_relation = GenericPermutationRelation; +template using perm_main_mem_ind_b = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp index 163ac531f02..37bdc19f975 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp @@ -1,105 +1,98 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_ind_c_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 3; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_ind_c_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 3; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_ind_op_c == 1 || in.avm_mem_ind_op_c == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_c, -in.avm_main_ind_op_c, -in.avm_main_ind_op_c, -in.avm_mem_ind_op_c, -in.avm_main_clk, -in.avm_main_ind_c, -in.avm_main_mem_idx_c, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_c, -in.avm_main_ind_op_c, -in.avm_main_ind_op_c, -in.avm_mem_ind_op_c, -in.avm_main_clk, -in.avm_main_ind_c, -in.avm_main_mem_idx_c, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_c, + in.avm_main_ind_op_c, + in.avm_main_ind_op_c, + in.avm_mem_ind_op_c, + in.avm_main_clk, + in.avm_main_ind_c, + in.avm_main_mem_idx_c, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - - }; - - template using perm_main_mem_ind_c_relation = GenericPermutationRelation; - template using perm_main_mem_ind_c = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_c, + in.avm_main_ind_op_c, + in.avm_main_ind_op_c, + in.avm_mem_ind_op_c, + in.avm_main_clk, + in.avm_main_ind_c, + in.avm_main_mem_idx_c, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - \ No newline at end of file +}; + +template +using perm_main_mem_ind_c_relation = GenericPermutationRelation; +template using perm_main_mem_ind_c = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_d.hpp index caa17e2dd9a..4b005cb3495 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_d.hpp @@ -1,105 +1,98 @@ - - #pragma once - - #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" - - #include - #include - - - namespace bb { - - class perm_main_mem_ind_d_permutation_settings { - public: - // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 3; - - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_mem_ind_d_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 3; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { return (in.avm_main_ind_op_d == 1 || in.avm_mem_ind_op_d == 1); } - - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_const_entities(const AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_d, -in.avm_main_ind_op_d, -in.avm_main_ind_op_d, -in.avm_mem_ind_op_d, -in.avm_main_clk, -in.avm_main_ind_d, -in.avm_main_mem_idx_d, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - - } - - - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - - template static inline auto get_nonconst_entities(AllEntities& in) { - - return std::forward_as_tuple( - in.perm_main_mem_ind_d, -in.avm_main_ind_op_d, -in.avm_main_ind_op_d, -in.avm_mem_ind_op_d, -in.avm_main_clk, -in.avm_main_ind_d, -in.avm_main_mem_idx_d, -in.avm_mem_clk, -in.avm_mem_addr, -in.avm_mem_val - ); - + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_d, + in.avm_main_ind_op_d, + in.avm_main_ind_op_d, + in.avm_mem_ind_op_d, + in.avm_main_clk, + in.avm_main_ind_d, + in.avm_main_mem_idx_d, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - - }; - - template using perm_main_mem_ind_d_relation = GenericPermutationRelation; - template using perm_main_mem_ind_d = GenericPermutation; - + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_mem_ind_d, + in.avm_main_ind_op_d, + in.avm_main_ind_op_d, + in.avm_mem_ind_op_d, + in.avm_main_clk, + in.avm_main_ind_d, + in.avm_main_mem_idx_d, + in.avm_mem_clk, + in.avm_mem_addr, + in.avm_mem_val); } - \ No newline at end of file +}; + +template +using perm_main_mem_ind_d_relation = GenericPermutationRelation; +template using perm_main_mem_ind_d = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp index 6c235688fb0..d923c58c1cc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp @@ -6,7 +6,6 @@ #include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_verifier.hpp" - namespace bb { using Flavor = AvmFlavor; @@ -37,8 +36,7 @@ AvmProver AvmComposer::create_prover(CircuitConstructor& circuit_constructor) return output_state; } -AvmVerifier AvmComposer::create_verifier( - CircuitConstructor& circuit_constructor) +AvmVerifier AvmComposer::create_verifier(CircuitConstructor& circuit_constructor) { auto verification_key = compute_verification_key(circuit_constructor); @@ -51,8 +49,7 @@ AvmVerifier AvmComposer::create_verifier( return output_state; } -std::shared_ptr AvmComposer::compute_proving_key( - CircuitConstructor& circuit_constructor) +std::shared_ptr AvmComposer::compute_proving_key(CircuitConstructor& circuit_constructor) { if (proving_key) { return proving_key; @@ -69,8 +66,7 @@ std::shared_ptr AvmComposer::compute_proving_key( return proving_key; } -std::shared_ptr AvmComposer::compute_verification_key( - CircuitConstructor& circuit_constructor) +std::shared_ptr AvmComposer::compute_verification_key(CircuitConstructor& circuit_constructor) { if (verification_key) { return verification_key; @@ -86,4 +82,4 @@ std::shared_ptr AvmComposer::compute_verification_key( return verification_key; } -} +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp index 6d168c52d3b..a2f9fe68dcf 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp @@ -7,67 +7,63 @@ #include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_prover.hpp" #include "barretenberg/vm/generated/avm_verifier.hpp" - namespace bb { class AvmComposer { - public: - using Flavor = AvmFlavor; - using CircuitConstructor = AvmCircuitBuilder; - using ProvingKey = Flavor::ProvingKey; - using VerificationKey = Flavor::VerificationKey; - using PCS = Flavor::PCS; - using CommitmentKey = Flavor::CommitmentKey; - using VerifierCommitmentKey = Flavor::VerifierCommitmentKey; - - // TODO: which of these will we really need - static constexpr std::string_view NAME_STRING = "Avm"; - static constexpr size_t NUM_RESERVED_GATES = 0; - static constexpr size_t NUM_WIRES = Flavor::NUM_WIRES; - - std::shared_ptr proving_key; - std::shared_ptr verification_key; - - // The crs_factory holds the path to the srs and exposes methods to extract the srs elements - std::shared_ptr> crs_factory_; - - // The commitment key is passed to the prover but also used herein to compute the verfication key commitments - std::shared_ptr commitment_key; - - std::vector recursive_proof_public_input_indices; - bool contains_recursive_proof = false; - bool computed_witness = false; - - AvmComposer() - { - crs_factory_ = bb::srs::get_bn254_crs_factory(); - } - - AvmComposer(std::shared_ptr p_key, std::shared_ptr v_key) - : proving_key(std::move(p_key)) - , verification_key(std::move(v_key)) - {} - - AvmComposer(AvmComposer&& other) noexcept = default; - AvmComposer(AvmComposer const& other) noexcept = default; - AvmComposer& operator=(AvmComposer&& other) noexcept = default; - AvmComposer& operator=(AvmComposer const& other) noexcept = default; - ~AvmComposer() = default; - - std::shared_ptr compute_proving_key(CircuitConstructor& circuit_constructor); - std::shared_ptr compute_verification_key(CircuitConstructor& circuit_constructor); - - void compute_witness(CircuitConstructor& circuit_constructor); - - AvmProver create_prover(CircuitConstructor& circuit_constructor); - AvmVerifier create_verifier(CircuitConstructor& circuit_constructor); - - void add_table_column_selector_poly_to_proving_key(bb::polynomial& small, const std::string& tag); - - void compute_commitment_key(size_t circuit_size) - { - proving_key->commitment_key = std::make_shared(circuit_size); - }; + public: + using Flavor = AvmFlavor; + using CircuitConstructor = AvmCircuitBuilder; + using ProvingKey = Flavor::ProvingKey; + using VerificationKey = Flavor::VerificationKey; + using PCS = Flavor::PCS; + using CommitmentKey = Flavor::CommitmentKey; + using VerifierCommitmentKey = Flavor::VerifierCommitmentKey; + + // TODO: which of these will we really need + static constexpr std::string_view NAME_STRING = "Avm"; + static constexpr size_t NUM_RESERVED_GATES = 0; + static constexpr size_t NUM_WIRES = Flavor::NUM_WIRES; + + std::shared_ptr proving_key; + std::shared_ptr verification_key; + + // The crs_factory holds the path to the srs and exposes methods to extract the srs elements + std::shared_ptr> crs_factory_; + + // The commitment key is passed to the prover but also used herein to compute the verfication key commitments + std::shared_ptr commitment_key; + + std::vector recursive_proof_public_input_indices; + bool contains_recursive_proof = false; + bool computed_witness = false; + + AvmComposer() { crs_factory_ = bb::srs::get_bn254_crs_factory(); } + + AvmComposer(std::shared_ptr p_key, std::shared_ptr v_key) + : proving_key(std::move(p_key)) + , verification_key(std::move(v_key)) + {} + + AvmComposer(AvmComposer&& other) noexcept = default; + AvmComposer(AvmComposer const& other) noexcept = default; + AvmComposer& operator=(AvmComposer&& other) noexcept = default; + AvmComposer& operator=(AvmComposer const& other) noexcept = default; + ~AvmComposer() = default; + + std::shared_ptr compute_proving_key(CircuitConstructor& circuit_constructor); + std::shared_ptr compute_verification_key(CircuitConstructor& circuit_constructor); + + void compute_witness(CircuitConstructor& circuit_constructor); + + AvmProver create_prover(CircuitConstructor& circuit_constructor); + AvmVerifier create_verifier(CircuitConstructor& circuit_constructor); + + void add_table_column_selector_poly_to_proving_key(bb::polynomial& small, const std::string& tag); + + void compute_commitment_key(size_t circuit_size) + { + proving_key->commitment_key = std::make_shared(circuit_size); + }; }; } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp index 0ca30eabc87..47e2603a9ca 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp @@ -1,5 +1,5 @@ - + #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" @@ -9,59 +9,56 @@ #include "barretenberg/vm/generated/avm_flavor.hpp" - - namespace bb { - - class AvmProver { - - using Flavor = AvmFlavor; - using FF = Flavor::FF; - using PCS = Flavor::PCS; - using PCSCommitmentKey = Flavor::CommitmentKey; - using ProvingKey = Flavor::ProvingKey; - using Polynomial = Flavor::Polynomial; - using ProverPolynomials = Flavor::ProverPolynomials; - using CommitmentLabels = Flavor::CommitmentLabels; - using Transcript = Flavor::Transcript; - - public: - explicit AvmProver(std::shared_ptr input_key, std::shared_ptr commitment_key); - - void execute_preamble_round(); - void execute_wire_commitments_round(); - void execute_log_derivative_inverse_round(); - void execute_relation_check_rounds(); - void execute_zeromorph_rounds(); - - HonkProof& export_proof(); - HonkProof& construct_proof(); - - std::shared_ptr transcript = std::make_shared(); - - std::vector public_inputs; - - bb::RelationParameters relation_parameters; - - std::shared_ptr key; - - // Container for spans of all polynomials required by the prover (i.e. all multivariates evaluated by Sumcheck). - ProverPolynomials prover_polynomials; - - CommitmentLabels commitment_labels; - typename Flavor::WitnessCommitments witness_commitments; - - Polynomial quotient_W; - - SumcheckOutput sumcheck_output; - - std::shared_ptr commitment_key; - - using ZeroMorph = ZeroMorphProver_; - - private: - HonkProof proof; - }; - - } // namespace bb - - \ No newline at end of file +namespace bb { + +class AvmProver { + + using Flavor = AvmFlavor; + using FF = Flavor::FF; + using PCS = Flavor::PCS; + using PCSCommitmentKey = Flavor::CommitmentKey; + using ProvingKey = Flavor::ProvingKey; + using Polynomial = Flavor::Polynomial; + using ProverPolynomials = Flavor::ProverPolynomials; + using CommitmentLabels = Flavor::CommitmentLabels; + using Transcript = Flavor::Transcript; + + public: + explicit AvmProver(std::shared_ptr input_key, std::shared_ptr commitment_key); + + void execute_preamble_round(); + void execute_wire_commitments_round(); + void execute_log_derivative_inverse_round(); + void execute_relation_check_rounds(); + void execute_zeromorph_rounds(); + + HonkProof& export_proof(); + HonkProof& construct_proof(); + + std::shared_ptr transcript = std::make_shared(); + + std::vector public_inputs; + + bb::RelationParameters relation_parameters; + + std::shared_ptr key; + + // Container for spans of all polynomials required by the prover (i.e. all multivariates evaluated by Sumcheck). + ProverPolynomials prover_polynomials; + + CommitmentLabels commitment_labels; + typename Flavor::WitnessCommitments witness_commitments; + + Polynomial quotient_W; + + SumcheckOutput sumcheck_output; + + std::shared_ptr commitment_key; + + using ZeroMorph = ZeroMorphProver_; + + private: + HonkProof proof; +}; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp index 941a867e36b..866eee52b19 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp @@ -5,33 +5,29 @@ #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/vm/generated/avm_flavor.hpp" - - namespace bb { - class AvmVerifier { - using Flavor = AvmFlavor; - using FF = Flavor::FF; - using Commitment = Flavor::Commitment; - using VerificationKey = Flavor::VerificationKey; - using VerifierCommitmentKey = Flavor::VerifierCommitmentKey; - using Transcript = Flavor::Transcript; - - public: - explicit AvmVerifier(std::shared_ptr verifier_key = nullptr); - AvmVerifier(AvmVerifier&& other) noexcept; - AvmVerifier(const AvmVerifier& other) = delete; - - AvmVerifier& operator=(const AvmVerifier& other) = delete; - AvmVerifier& operator=(AvmVerifier&& other) noexcept; - - bool verify_proof(const HonkProof& proof); - - std::shared_ptr key; - std::map commitments; - std::shared_ptr pcs_verification_key; - std::shared_ptr transcript; - }; - - } // namespace bb - - - \ No newline at end of file +namespace bb { +class AvmVerifier { + using Flavor = AvmFlavor; + using FF = Flavor::FF; + using Commitment = Flavor::Commitment; + using VerificationKey = Flavor::VerificationKey; + using VerifierCommitmentKey = Flavor::VerifierCommitmentKey; + using Transcript = Flavor::Transcript; + + public: + explicit AvmVerifier(std::shared_ptr verifier_key = nullptr); + AvmVerifier(AvmVerifier&& other) noexcept; + AvmVerifier(const AvmVerifier& other) = delete; + + AvmVerifier& operator=(const AvmVerifier& other) = delete; + AvmVerifier& operator=(AvmVerifier&& other) noexcept; + + bool verify_proof(const HonkProof& proof); + + std::shared_ptr key; + std::map commitments; + std::shared_ptr pcs_verification_key; + std::shared_ptr transcript; +}; + +} // namespace bb