diff --git a/triton-air/src/table/processor.rs b/triton-air/src/table/processor.rs index d3fa080cc..e897297ac 100644 --- a/triton-air/src/table/processor.rs +++ b/triton-air/src/table/processor.rs @@ -3190,8 +3190,8 @@ mod tests { fn instruction_deselector_gives_0_for_all_other_instructions() { let circuit_builder = ConstraintCircuitBuilder::new(); - let mut master_base_table = Array2::zeros([2, NUM_MAIN_COLUMNS]); - let master_ext_table = Array2::zeros([2, NUM_AUX_COLUMNS]); + let mut master_main_table = Array2::zeros([2, NUM_MAIN_COLUMNS]); + let master_aux_table = Array2::zeros([2, NUM_AUX_COLUMNS]); // For this test, dummy challenges suffice to evaluate the constraints. let dummy_challenges = (0..ChallengeId::COUNT) @@ -3208,7 +3208,7 @@ mod tests { .into_iter() .filter(|other_instruction| *other_instruction != instruction) { - let mut curr_row = master_base_table.slice_mut(s![0, ..]); + let mut curr_row = master_main_table.slice_mut(s![0, ..]); curr_row[IB0.master_main_index()] = other_instruction.ib(InstructionBit::IB0); curr_row[IB1.master_main_index()] = other_instruction.ib(InstructionBit::IB1); curr_row[IB2.master_main_index()] = other_instruction.ib(InstructionBit::IB2); @@ -3217,8 +3217,8 @@ mod tests { curr_row[IB5.master_main_index()] = other_instruction.ib(InstructionBit::IB5); curr_row[IB6.master_main_index()] = other_instruction.ib(InstructionBit::IB6); let result = deselector.clone().consume().evaluate( - master_base_table.view(), - master_ext_table.view(), + master_main_table.view(), + master_aux_table.view(), &dummy_challenges, ); @@ -3231,7 +3231,7 @@ mod tests { } // Positive tests - let mut curr_row = master_base_table.slice_mut(s![0, ..]); + let mut curr_row = master_main_table.slice_mut(s![0, ..]); curr_row[IB0.master_main_index()] = instruction.ib(InstructionBit::IB0); curr_row[IB1.master_main_index()] = instruction.ib(InstructionBit::IB1); curr_row[IB2.master_main_index()] = instruction.ib(InstructionBit::IB2); @@ -3240,8 +3240,8 @@ mod tests { curr_row[IB5.master_main_index()] = instruction.ib(InstructionBit::IB5); curr_row[IB6.master_main_index()] = instruction.ib(InstructionBit::IB6); let result = deselector.consume().evaluate( - master_base_table.view(), - master_ext_table.view(), + master_main_table.view(), + master_aux_table.view(), &dummy_challenges, ); assert!( @@ -3328,17 +3328,17 @@ mod tests { #[strategy(0_usize..16)] indicator_poly_index: usize, #[strategy(0_u64..16)] query_index: u64, ) { - let mut base_table = Array2::ones([2, NUM_MAIN_COLUMNS]); + let mut main_table = Array2::ones([2, NUM_MAIN_COLUMNS]); let aux_table = Array2::ones([2, NUM_AUX_COLUMNS]); - base_table[[0, HV0.master_main_index()]] = bfe!(query_index % 2); - base_table[[0, HV1.master_main_index()]] = bfe!((query_index >> 1) % 2); - base_table[[0, HV2.master_main_index()]] = bfe!((query_index >> 2) % 2); - base_table[[0, HV3.master_main_index()]] = bfe!((query_index >> 3) % 2); + main_table[[0, HV0.master_main_index()]] = bfe!(query_index % 2); + main_table[[0, HV1.master_main_index()]] = bfe!((query_index >> 1) % 2); + main_table[[0, HV2.master_main_index()]] = bfe!((query_index >> 2) % 2); + main_table[[0, HV3.master_main_index()]] = bfe!((query_index >> 3) % 2); let builder = ConstraintCircuitBuilder::new(); let indicator_poly = indicator_polynomial(&builder, indicator_poly_index).consume(); - let evaluation = indicator_poly.evaluate(base_table.view(), aux_table.view(), &[]); + let evaluation = indicator_poly.evaluate(main_table.view(), aux_table.view(), &[]); if indicator_poly_index as u64 == query_index { prop_assert_eq!(xfe!(1), evaluation); @@ -3387,18 +3387,18 @@ mod tests { |col: ProcessorMainColumn| circuit_builder.input(Main(col.master_main_index())); let [x0, x1, x2, y0, y1, y2] = [ST0, ST1, ST2, ST3, ST4, ST5].map(main_row); - let mut base_table = Array2::zeros([1, NUM_MAIN_COLUMNS]); - let ext_table = Array2::zeros([1, NUM_AUX_COLUMNS]); - base_table[[0, ST0.master_main_index()]] = a.coefficients[0]; - base_table[[0, ST1.master_main_index()]] = a.coefficients[1]; - base_table[[0, ST2.master_main_index()]] = a.coefficients[2]; - base_table[[0, ST3.master_main_index()]] = b.coefficients[0]; - base_table[[0, ST4.master_main_index()]] = b.coefficients[1]; - base_table[[0, ST5.master_main_index()]] = b.coefficients[2]; + let mut main_table = Array2::zeros([1, NUM_MAIN_COLUMNS]); + let aux_table = Array2::zeros([1, NUM_AUX_COLUMNS]); + main_table[[0, ST0.master_main_index()]] = a.coefficients[0]; + main_table[[0, ST1.master_main_index()]] = a.coefficients[1]; + main_table[[0, ST2.master_main_index()]] = a.coefficients[2]; + main_table[[0, ST3.master_main_index()]] = b.coefficients[0]; + main_table[[0, ST4.master_main_index()]] = b.coefficients[1]; + main_table[[0, ST5.master_main_index()]] = b.coefficients[2]; let [c0, c1, c2] = xx_product([x0, x1, x2], [y0, y1, y2]) .map(|c| c.consume()) - .map(|c| c.evaluate(base_table.view(), ext_table.view(), &[])) + .map(|c| c.evaluate(main_table.view(), aux_table.view(), &[])) .map(|xfe| xfe.unlift().unwrap()); let c = a * b; @@ -3417,16 +3417,16 @@ mod tests { |col: ProcessorMainColumn| circuit_builder.input(Main(col.master_main_index())); let [x0, x1, x2, y] = [ST0, ST1, ST2, ST3].map(main_row); - let mut base_table = Array2::zeros([1, NUM_MAIN_COLUMNS]); - let ext_table = Array2::zeros([1, NUM_AUX_COLUMNS]); - base_table[[0, ST0.master_main_index()]] = a.coefficients[0]; - base_table[[0, ST1.master_main_index()]] = a.coefficients[1]; - base_table[[0, ST2.master_main_index()]] = a.coefficients[2]; - base_table[[0, ST3.master_main_index()]] = b; + let mut main_table = Array2::zeros([1, NUM_MAIN_COLUMNS]); + let aux_table = Array2::zeros([1, NUM_AUX_COLUMNS]); + main_table[[0, ST0.master_main_index()]] = a.coefficients[0]; + main_table[[0, ST1.master_main_index()]] = a.coefficients[1]; + main_table[[0, ST2.master_main_index()]] = a.coefficients[2]; + main_table[[0, ST3.master_main_index()]] = b; let [c0, c1, c2] = xb_product([x0, x1, x2], y) .map(|c| c.consume()) - .map(|c| c.evaluate(base_table.view(), ext_table.view(), &[])) + .map(|c| c.evaluate(main_table.view(), aux_table.view(), &[])) .map(|xfe| xfe.unlift().unwrap()); let c = a * b; diff --git a/triton-air/src/table_column.rs b/triton-air/src/table_column.rs index 5900d3fa7..863843086 100644 --- a/triton-air/src/table_column.rs +++ b/triton-air/src/table_column.rs @@ -483,16 +483,16 @@ pub enum U32AuxColumn { LookupServerLogDerivative, } -/// A trait for the columns of the master base table. This trait is implemented for all enums -/// relating to the base tables. This trait provides two methods: -/// - one to get the index of the column in the “local” base table, _i.e., not the master base +/// A trait for the columns of the master main table. This trait is implemented for all enums +/// relating to the main tables. This trait provides two methods: +/// - one to get the index of the column in the “local” main table, _i.e., not the master base /// table, and -/// - one to get the index of the column in the master base table. +/// - one to get the index of the column in the master main table. pub trait MasterMainColumn { - /// The index of the column in the “local” base table, _i.e., not the master base table. + /// The index of the column in the “local” main table, _i.e., not the master base table. fn main_index(&self) -> usize; - /// The index of the column in the master base table. + /// The index of the column in the master main table. fn master_main_index(&self) -> usize; } @@ -604,17 +604,17 @@ impl MasterMainColumn for U32MainColumn { } } -/// A trait for the columns in the master extension table. This trait is implemented for all enums -/// relating to the extension tables. The trait provides two methods: -/// - one to get the index of the column in the “local” extension table, _i.e._, not the master -/// extension table, and -/// - one to get the index of the column in the master extension table. +/// A trait for the columns in the master auxiliary table. This trait is implemented for all enums +/// relating to the auxiliary tables. The trait provides two methods: +/// - one to get the index of the column in the “local” auxiliary table, _i.e._, not the master +/// auxiliary table, and +/// - one to get the index of the column in the master auxiliary table. pub trait MasterAuxColumn { - /// The index of the column in the “local” extension table, _i.e._, not the master extension + /// The index of the column in the “local” auxiliary table, _i.e._, not the master extension /// table. fn aux_index(&self) -> usize; - /// The index of the column in the master extension table. + /// The index of the column in the master auxiliary table. fn master_aux_index(&self) -> usize; } @@ -733,7 +733,7 @@ mod tests { use super::*; #[test] - fn master_base_table_is_contiguous() { + fn master_main_table_is_contiguous() { let mut expected_column_index = 0; for column in ProgramMainColumn::iter() { assert_eq!(expected_column_index, column.master_main_index()); @@ -774,7 +774,7 @@ mod tests { } #[test] - fn master_ext_table_is_contiguous() { + fn master_aux_table_is_contiguous() { let mut expected_column_index = 0; for column in ProgramAuxColumn::iter() { assert_eq!(expected_column_index, column.master_aux_index()); diff --git a/triton-constraint-builder/src/codegen.rs b/triton-constraint-builder/src/codegen.rs index 48804e571..a2d7762a8 100644 --- a/triton-constraint-builder/src/codegen.rs +++ b/triton-constraint-builder/src/codegen.rs @@ -193,8 +193,8 @@ impl RustBackend { /// well as their degrees. In particular: /// 1. The first stream contains code that, when evaluated, produces the constraints' degrees, /// 1. the second stream contains code that, when evaluated, produces the constraints' values, - /// with the input type for the base row being `BFieldElement`, and - /// 1. the third stream is like the second, except that the input type for the base row is + /// with the input type for the main row being `BFieldElement`, and + /// 1. the third stream is like the second, except that the input type for the main row is /// `XFieldElement`. fn tokenize_circuits( constraints: &[ConstraintCircuit], @@ -210,7 +210,7 @@ impl RustBackend { .partition(|constraint| constraint.evaluates_to_base_element()); // The order of the constraints' degrees must match the order of the constraints. - // Hence, listing the degrees is only possible after the partition into base and extension + // Hence, listing the degrees is only possible after the partition into main and auxiliary // constraints is known. let tokenized_degree_bounds = main_constraints .iter() @@ -232,7 +232,7 @@ impl RustBackend { let tokenized_main_constraints = tokenize_constraint_evaluation(&main_constraints); let tokenized_aux_constraints = tokenize_constraint_evaluation(&aux_constraints); - // If there are no base constraints, the type needs to be explicitly declared. + // If there are no main constraints, the type needs to be explicitly declared. let tokenized_bfe_main_constraints = match main_constraints.is_empty() { true => quote!(let main_constraints: [BFieldElement; 0] = []), false => quote!(let main_constraints = [#(#tokenized_main_constraints),*]), @@ -652,10 +652,10 @@ impl TasmBackend { }; [ - IOList::NextExtRow, - IOList::NextBaseRow, - IOList::CurrExtRow, - IOList::CurrBaseRow, + IOList::NextAuxRow, + IOList::NextMainRow, + IOList::CurrAuxRow, + IOList::CurrMainRow, ] .into_iter() .flat_map(write_pointer_to_ram) @@ -669,7 +669,7 @@ impl TasmBackend { self.scope = HashSet::new(); let store_shared_nodes = self.store_all_shared_nodes(constraints); - // to match the `RustBackend`, base constraints must be emitted first + // to match the `RustBackend`, main constraints must be emitted first let (main_constraints, aux_constraints): (Vec<_>, Vec<_>) = constraints .iter() .partition(|constraint| constraint.evaluates_to_base_element()); @@ -780,10 +780,10 @@ impl TasmBackend { fn load_input(&self, input: II) -> Vec { let list = match (input.is_current_row(), input.is_main_table_column()) { - (true, true) => IOList::CurrBaseRow, - (true, false) => IOList::CurrExtRow, - (false, true) => IOList::NextBaseRow, - (false, false) => IOList::NextExtRow, + (true, true) => IOList::CurrMainRow, + (true, false) => IOList::CurrAuxRow, + (false, true) => IOList::NextMainRow, + (false, false) => IOList::NextAuxRow, }; if self.input_location_is_static { Self::load_ext_field_element_from_list(list, input.column()) @@ -859,10 +859,10 @@ impl TasmBackend { #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] enum IOList { FreeMemPage, - CurrBaseRow, - CurrExtRow, - NextBaseRow, - NextExtRow, + CurrMainRow, + CurrAuxRow, + NextMainRow, + NextAuxRow, Challenges, } @@ -870,10 +870,10 @@ impl ToTokens for IOList { fn to_tokens(&self, tokens: &mut TokenStream) { match self { IOList::FreeMemPage => tokens.extend(quote!(free_mem_page_ptr)), - IOList::CurrBaseRow => tokens.extend(quote!(curr_main_row_ptr)), - IOList::CurrExtRow => tokens.extend(quote!(curr_aux_row_ptr)), - IOList::NextBaseRow => tokens.extend(quote!(next_main_row_ptr)), - IOList::NextExtRow => tokens.extend(quote!(next_aux_row_ptr)), + IOList::CurrMainRow => tokens.extend(quote!(curr_main_row_ptr)), + IOList::CurrAuxRow => tokens.extend(quote!(curr_aux_row_ptr)), + IOList::NextMainRow => tokens.extend(quote!(next_main_row_ptr)), + IOList::NextAuxRow => tokens.extend(quote!(next_aux_row_ptr)), IOList::Challenges => tokens.extend(quote!(challenges_ptr)), } } diff --git a/triton-constraint-builder/src/lib.rs b/triton-constraint-builder/src/lib.rs index d6bc6c565..7af5a0d65 100644 --- a/triton-constraint-builder/src/lib.rs +++ b/triton-constraint-builder/src/lib.rs @@ -143,38 +143,38 @@ impl Constraints { ) -> AllSubstitutions { let mut info = lowering_info; - let (init_base_substitutions, init_ext_substitutions) = + let (init_main_substitutions, init_aux_substitutions) = ConstraintCircuitMonad::lower_to_degree(&mut self.init, info); - info.num_main_cols += init_base_substitutions.len(); - info.num_aux_cols += init_ext_substitutions.len(); + info.num_main_cols += init_main_substitutions.len(); + info.num_aux_cols += init_aux_substitutions.len(); - let (cons_base_substitutions, cons_ext_substitutions) = + let (cons_main_substitutions, cons_aux_substitutions) = ConstraintCircuitMonad::lower_to_degree(&mut self.cons, info); - info.num_main_cols += cons_base_substitutions.len(); - info.num_aux_cols += cons_ext_substitutions.len(); + info.num_main_cols += cons_main_substitutions.len(); + info.num_aux_cols += cons_aux_substitutions.len(); - let (tran_base_substitutions, tran_ext_substitutions) = + let (tran_main_substitutions, tran_aux_substitutions) = ConstraintCircuitMonad::lower_to_degree(&mut self.tran, info); - info.num_main_cols += tran_base_substitutions.len(); - info.num_aux_cols += tran_ext_substitutions.len(); + info.num_main_cols += tran_main_substitutions.len(); + info.num_aux_cols += tran_aux_substitutions.len(); - let (term_base_substitutions, term_ext_substitutions) = + let (term_main_substitutions, term_aux_substitutions) = ConstraintCircuitMonad::lower_to_degree(&mut self.term, info); AllSubstitutions { main: Substitutions { lowering_info, - init: init_base_substitutions, - cons: cons_base_substitutions, - tran: tran_base_substitutions, - term: term_base_substitutions, + init: init_main_substitutions, + cons: cons_main_substitutions, + tran: tran_main_substitutions, + term: term_main_substitutions, }, aux: Substitutions { lowering_info, - init: init_ext_substitutions, - cons: cons_ext_substitutions, - tran: tran_ext_substitutions, - term: term_ext_substitutions, + init: init_aux_substitutions, + cons: cons_aux_substitutions, + tran: tran_aux_substitutions, + term: term_aux_substitutions, }, } } @@ -182,16 +182,13 @@ impl Constraints { #[must_use] pub fn combine_with_substitution_induced_constraints( self, - AllSubstitutions { - main: base, - aux: ext, - }: AllSubstitutions, + AllSubstitutions { main, aux }: AllSubstitutions, ) -> Self { Self { - init: [self.init, base.init, ext.init].concat(), - cons: [self.cons, base.cons, ext.cons].concat(), - tran: [self.tran, base.tran, ext.tran].concat(), - term: [self.term, base.term, ext.term].concat(), + init: [self.init, main.init, aux.init].concat(), + cons: [self.cons, main.cons, aux.cons].concat(), + tran: [self.tran, main.tran, aux.tran].concat(), + term: [self.term, main.term, aux.term].concat(), } } diff --git a/triton-constraint-circuit/src/lib.rs b/triton-constraint-circuit/src/lib.rs index f155e6dca..68ba34052 100644 --- a/triton-constraint-circuit/src/lib.rs +++ b/triton-constraint-circuit/src/lib.rs @@ -94,8 +94,8 @@ impl BinOp { /// The position of variable in a constraint polynomial is, in principle, a `usize`. However, /// depending on the type of the constraint polynomial, this index may be an index into a single /// row (for initial, consistency and terminal constraints), or a pair of adjacent rows (for -/// transition constraints). Additionally, the index may refer to a column in the base table, or -/// a column in the extension table. This trait abstracts over these possibilities, and provides +/// transition constraints). Additionally, the index may refer to a column in the main table, or +/// a column in the auxiliary table. This trait abstracts over these possibilities, and provides /// a uniform interface for accessing the index. /// /// Having `Copy + Hash + Eq` helps to put `InputIndicator`s into containers. @@ -103,22 +103,22 @@ impl BinOp { /// This is a _sealed_ trait. It is not intended (or possible) to implement this trait outside the /// crate defining it. pub trait InputIndicator: Debug + Display + Copy + Hash + Eq + ToTokens + private::Seal { - /// `true` iff `self` refers to a column in the base table. + /// `true` iff `self` refers to a column in the main table. fn is_main_table_column(&self) -> bool; /// `true` iff `self` refers to the current row. fn is_current_row(&self) -> bool; - /// The index of the indicated (base or extension) column. + /// The index of the indicated (main or auxiliary) column. fn column(&self) -> usize; - fn base_table_input(index: usize) -> Self; + fn main_table_input(index: usize) -> Self; fn aux_table_input(index: usize) -> Self; fn evaluate( &self, - base_table: ArrayView2, - ext_table: ArrayView2, + main_table: ArrayView2, + aux_table: ArrayView2, ) -> XFieldElement; } @@ -167,7 +167,7 @@ impl InputIndicator for SingleRowIndicator { } } - fn base_table_input(index: usize) -> Self { + fn main_table_input(index: usize) -> Self { Self::Main(index) } @@ -177,12 +177,12 @@ impl InputIndicator for SingleRowIndicator { fn evaluate( &self, - base_table: ArrayView2, - ext_table: ArrayView2, + main_table: ArrayView2, + aux_table: ArrayView2, ) -> XFieldElement { match self { - Self::Main(i) => base_table[[0, *i]].lift(), - Self::Aux(i) => ext_table[[0, *i]], + Self::Main(i) => main_table[[0, *i]].lift(), + Self::Aux(i) => aux_table[[0, *i]], } } } @@ -238,8 +238,8 @@ impl InputIndicator for DualRowIndicator { } } - fn base_table_input(index: usize) -> Self { - // It seems that the choice between `CurrentBaseRow` and `NextBaseRow` is arbitrary: + fn main_table_input(index: usize) -> Self { + // It seems that the choice between `CurrentMain` and `NextMain` is arbitrary: // any transition constraint polynomial is evaluated on both the current and the next row. // Hence, both rows are in scope. Self::CurrentMain(index) @@ -251,14 +251,14 @@ impl InputIndicator for DualRowIndicator { fn evaluate( &self, - base_table: ArrayView2, - ext_table: ArrayView2, + main_table: ArrayView2, + aux_table: ArrayView2, ) -> XFieldElement { match self { - Self::CurrentMain(i) => base_table[[0, *i]].lift(), - Self::CurrentAux(i) => ext_table[[0, *i]], - Self::NextMain(i) => base_table[[1, *i]].lift(), - Self::NextAux(i) => ext_table[[1, *i]], + Self::CurrentMain(i) => main_table[[0, *i]].lift(), + Self::CurrentAux(i) => aux_table[[0, *i]], + Self::NextMain(i) => main_table[[1, *i]].lift(), + Self::NextAux(i) => aux_table[[1, *i]], } } } @@ -527,18 +527,18 @@ impl ConstraintCircuit { pub fn evaluate( &self, - base_table: ArrayView2, - ext_table: ArrayView2, + main_table: ArrayView2, + aux_table: ArrayView2, challenges: &[XFieldElement], ) -> XFieldElement { match &self.expression { CircuitExpression::BConst(bfe) => bfe.lift(), CircuitExpression::XConst(xfe) => *xfe, - CircuitExpression::Input(input) => input.evaluate(base_table, ext_table), + CircuitExpression::Input(input) => input.evaluate(main_table, aux_table), CircuitExpression::Challenge(challenge_id) => challenges[*challenge_id], CircuitExpression::BinOp(binop, lhs, rhs) => { - let lhs_value = lhs.borrow().evaluate(base_table, ext_table, challenges); - let rhs_value = rhs.borrow().evaluate(base_table, ext_table, challenges); + let lhs_value = lhs.borrow().evaluate(main_table, aux_table, challenges); + let rhs_value = rhs.borrow().evaluate(main_table, aux_table, challenges); binop.operation(lhs_value, rhs_value) } } @@ -716,7 +716,7 @@ impl ConstraintCircuitMonad { /// These can then be used to construct new columns, /// as well as derivation rules for filling those new columns. /// - /// The highest index of base and extension columns used by the multicircuit have to be + /// The highest index of main and auxiliary columns used by the multicircuit have to be /// provided. The uniqueness of the new columns' indices depends on these provided values. /// Note that these indices are generally not equal to the number of used columns, especially /// when a tables' constraints are built using the master table's column indices. @@ -747,7 +747,7 @@ impl ConstraintCircuitMonad { let chosen_node_is_main_col = chosen_node.circuit.borrow().evaluates_to_base_element(); let new_input_indicator = if chosen_node_is_main_col { let new_main_col_idx = info.num_main_cols + main_constraints.len(); - II::base_table_input(new_main_col_idx) + II::main_table_input(new_main_col_idx) } else { let new_aux_col_idx = info.num_aux_cols + aux_constraints.len(); II::aux_table_input(new_aux_col_idx) diff --git a/triton-vm/src/error.rs b/triton-vm/src/error.rs index 2b7862563..263fa0ddf 100644 --- a/triton-vm/src/error.rs +++ b/triton-vm/src/error.rs @@ -169,10 +169,10 @@ pub enum VerificationError { #[error("received and computed out-of-domain quotient values don't match")] OutOfDomainQuotientValueMismatch, - #[error("failed to verify authentication path for base codeword")] - BaseCodewordAuthenticationFailure, + #[error("failed to verify authentication path for main codeword")] + MainCodewordAuthenticationFailure, - #[error("failed to verify authentication path for extension codeword")] + #[error("failed to verify authentication path for auxiliary codeword")] AuxiliaryCodewordAuthenticationFailure, #[error("failed to verify authentication path for combined quotient codeword")] @@ -194,7 +194,7 @@ pub enum VerificationError { IncorrectNumberOfMainTableRows, #[error("the number of received auxiliary table rows does not match the parameters")] - IncorrectNumberOfExtTableRows, + IncorrectNumberOfAuxTableRows, #[error(transparent)] ProofStreamError(#[from] ProofStreamError), diff --git a/triton-vm/src/stark.rs b/triton-vm/src/stark.rs index e54a584c7..b19396d78 100644 --- a/triton-vm/src/stark.rs +++ b/triton-vm/src/stark.rs @@ -147,7 +147,7 @@ impl Stark { profiler!(stop "extend"); profiler!(stop "main tables"); - profiler!(start "ext tables"); + profiler!(start "aux tables"); profiler!(start "randomize trace" ("gen")); master_aux_table.randomize_trace(); profiler!(stop "randomize trace"); @@ -167,7 +167,7 @@ impl Stark { let quotient_combination_weights = proof_stream.sample_scalars(MasterAuxTable::NUM_CONSTRAINTS); profiler!(stop "Fiat-Shamir"); - profiler!(stop "ext tables"); + profiler!(stop "aux tables"); let (fri_domain_quotient_segment_codewords, quotient_segment_polynomials) = Self::compute_quotient_segments( @@ -245,18 +245,18 @@ impl Stark { }; profiler!(start "linear combination"); - profiler!(start "base" ("CC")); - let base_combination_polynomial = + profiler!(start "main" ("CC")); + let main_combination_polynomial = Self::random_linear_sum(master_main_table.interpolation_polynomials(), weights.main); - profiler!(stop "base"); - profiler!(start "ext" ("CC")); - let ext_combination_polynomial = + profiler!(stop "main"); + profiler!(start "aux" ("CC")); + let aux_combination_polynomial = Self::random_linear_sum(master_aux_table.interpolation_polynomials(), weights.aux); - profiler!(stop "ext"); - let base_and_ext_combination_polynomial = - base_combination_polynomial + ext_combination_polynomial; - let base_and_ext_codeword = short_domain.evaluate(&base_and_ext_combination_polynomial); + profiler!(stop "aux"); + let main_and_aux_combination_polynomial = + main_combination_polynomial + aux_combination_polynomial; + let main_and_aux_codeword = short_domain.evaluate(&main_and_aux_combination_polynomial); profiler!(start "quotient" ("CC")); let quotient_segments_combination_polynomial = @@ -269,11 +269,11 @@ impl Stark { profiler!(start "DEEP"); // There are (at least) two possible ways to perform the DEEP update. - // 1. The one used here, where base & ext codewords are DEEP'd twice: once with the out-of- + // 1. The one used here, where main & aux codewords are DEEP'd twice: once with the out-of- // domain point for the current row (i.e., α) and once using the out-of-domain point for // the next row (i.e., ω·α). The DEEP update's denominator is a degree-1 polynomial in // both cases, namely (ω^i - α) and (ω^i - ω·α) respectively. - // 2. One where the base & ext codewords are DEEP'd only once, using the degree-2 polynomial + // 2. One where the main & aux codewords are DEEP'd only once, using the degree-2 polynomial // (ω^i - α)·(ω^i - ω·α) as the denominator. This requires a linear interpolation in the // numerator: b(ω^i) - i((b(α), α) + (b(ω·α), ω·α))(w^i). // @@ -284,27 +284,27 @@ impl Stark { // // Both approaches are sound. The first approach is more efficient, as it requires fewer // operations. - profiler!(start "base&ext curr row"); - let out_of_domain_curr_row_base_and_ext_value = - base_and_ext_combination_polynomial.evaluate(out_of_domain_point_curr_row); - let base_and_ext_curr_row_deep_codeword = Self::deep_codeword( - &base_and_ext_codeword.clone(), + profiler!(start "main&aux curr row"); + let out_of_domain_curr_row_main_and_aux_value = + main_and_aux_combination_polynomial.evaluate(out_of_domain_point_curr_row); + let main_and_aux_curr_row_deep_codeword = Self::deep_codeword( + &main_and_aux_codeword.clone(), short_domain, out_of_domain_point_curr_row, - out_of_domain_curr_row_base_and_ext_value, + out_of_domain_curr_row_main_and_aux_value, ); - profiler!(stop "base&ext curr row"); + profiler!(stop "main&aux curr row"); - profiler!(start "base&ext next row"); - let out_of_domain_next_row_base_and_ext_value = - base_and_ext_combination_polynomial.evaluate(out_of_domain_point_next_row); - let base_and_ext_next_row_deep_codeword = Self::deep_codeword( - &base_and_ext_codeword.clone(), + profiler!(start "main&aux next row"); + let out_of_domain_next_row_main_and_aux_value = + main_and_aux_combination_polynomial.evaluate(out_of_domain_point_next_row); + let main_and_aux_next_row_deep_codeword = Self::deep_codeword( + &main_and_aux_codeword.clone(), short_domain, out_of_domain_point_next_row, - out_of_domain_next_row_base_and_ext_value, + out_of_domain_next_row_main_and_aux_value, ); - profiler!(stop "base&ext next row"); + profiler!(stop "main&aux next row"); profiler!(start "segmented quotient"); let out_of_domain_curr_row_quot_segments_value = quotient_segments_combination_polynomial @@ -321,8 +321,8 @@ impl Stark { profiler!(start "combined DEEP polynomial"); profiler!(start "sum" ("CC")); let deep_codeword = [ - base_and_ext_curr_row_deep_codeword, - base_and_ext_next_row_deep_codeword, + main_and_aux_curr_row_deep_codeword, + main_and_aux_next_row_deep_codeword, quotient_segments_curr_row_deep_codeword, ] .into_par_iter() @@ -356,7 +356,7 @@ impl Stark { profiler!(start "open trace leafs"); // Open leafs of zipped codewords at indicated positions - let revealed_base_elems = + let revealed_main_elems = if let Some(fri_domain_table) = master_main_table.fri_domain_table() { Self::read_revealed_rows(fri_domain_table, &revealed_current_row_indices)? } else { @@ -368,12 +368,12 @@ impl Stark { }; let base_authentication_structure = main_merkle_tree.authentication_structure(&revealed_current_row_indices)?; - proof_stream.enqueue(ProofItem::MasterMainTableRows(revealed_base_elems)); + proof_stream.enqueue(ProofItem::MasterMainTableRows(revealed_main_elems)); proof_stream.enqueue(ProofItem::AuthenticationStructure( base_authentication_structure, )); - let revealed_ext_elems = if let Some(fri_domain_table) = master_aux_table.fri_domain_table() + let revealed_aux_elems = if let Some(fri_domain_table) = master_aux_table.fri_domain_table() { Self::read_revealed_rows(fri_domain_table, &revealed_current_row_indices)? } else { @@ -383,14 +383,14 @@ impl Stark { fri.domain, ) }; - let ext_authentication_structure = + let aux_authentication_structure = aux_merkle_tree.authentication_structure(&revealed_current_row_indices)?; - proof_stream.enqueue(ProofItem::MasterAuxTableRows(revealed_ext_elems)); + proof_stream.enqueue(ProofItem::MasterAuxTableRows(revealed_aux_elems)); proof_stream.enqueue(ProofItem::AuthenticationStructure( - ext_authentication_structure, + aux_authentication_structure, )); - // Open quotient & combination codewords at the same positions as base & ext codewords. + // Open quotient & combination codewords at the same positions as main & aux codewords. let into_fixed_width_row = |row: ArrayView1<_>| -> QuotientSegments { row.to_vec().try_into().unwrap() }; let revealed_quotient_segments_rows = revealed_current_row_indices @@ -735,7 +735,7 @@ impl Stark { profiler!(stop "derive additional parameters"); profiler!(start "Fiat-Shamir 1" ("hash")); - let base_merkle_tree_root = proof_stream.dequeue()?.try_into_merkle_root()?; + let main_merkle_tree_root = proof_stream.dequeue()?.try_into_merkle_root()?; let extension_challenge_weights = proof_stream.sample_scalars(Challenges::SAMPLE_COUNT); let challenges = Challenges::new(extension_challenge_weights, claim); let auxiliary_tree_merkle_root = proof_stream.dequeue()?.try_into_merkle_root()?; @@ -843,19 +843,19 @@ impl Stark { profiler!(start "Fiat-Shamir 2" ("hash")); let weights = LinearCombinationWeights::sample(&mut proof_stream); - let base_and_ext_codeword_weights = weights.base_and_ext(); + let main_and_aux_codeword_weights = weights.main_and_aux(); profiler!(stop "Fiat-Shamir 2"); profiler!(start "sum out-of-domain values" ("CC")); - let out_of_domain_curr_row_base_and_ext_value = Self::linearly_sum_main_and_aux_row( + let out_of_domain_curr_row_main_and_aux_value = Self::linearly_sum_main_and_aux_row( out_of_domain_curr_main_row.view(), out_of_domain_curr_aux_row.view(), - base_and_ext_codeword_weights.view(), + main_and_aux_codeword_weights.view(), ); - let out_of_domain_next_row_base_and_ext_value = Self::linearly_sum_main_and_aux_row( + let out_of_domain_next_row_main_and_aux_value = Self::linearly_sum_main_and_aux_row( out_of_domain_next_main_row.view(), out_of_domain_next_aux_row.view(), - base_and_ext_codeword_weights.view(), + main_and_aux_codeword_weights.view(), ); let out_of_domain_curr_row_quotient_segment_value = weights .quot_segments @@ -871,13 +871,13 @@ impl Stark { profiler!(start "check leafs"); profiler!(start "dequeue main elements"); - let base_table_rows = proof_stream.dequeue()?.try_into_master_main_table_rows()?; - let base_authentication_structure = proof_stream + let main_table_rows = proof_stream.dequeue()?.try_into_master_main_table_rows()?; + let main_authentication_structure = proof_stream .dequeue()? .try_into_authentication_structure()?; - let leaf_digests_base: Vec<_> = base_table_rows + let leaf_digests_main: Vec<_> = main_table_rows .par_iter() - .map(|revealed_base_elem| Tip5::hash_varlen(revealed_base_elem)) + .map(|revealed_main_elem| Tip5::hash_varlen(revealed_main_elem)) .collect(); profiler!(stop "dequeue main elements"); @@ -888,20 +888,20 @@ impl Stark { profiler!(start "Merkle verify (main tree)" ("hash")); let base_merkle_tree_inclusion_proof = MerkleTreeInclusionProof { tree_height: merkle_tree_height, - indexed_leafs: index_leaves(leaf_digests_base), - authentication_structure: base_authentication_structure, + indexed_leafs: index_leaves(leaf_digests_main), + authentication_structure: main_authentication_structure, }; - if !base_merkle_tree_inclusion_proof.verify(base_merkle_tree_root) { - return Err(VerificationError::BaseCodewordAuthenticationFailure); + if !base_merkle_tree_inclusion_proof.verify(main_merkle_tree_root) { + return Err(VerificationError::MainCodewordAuthenticationFailure); } profiler!(stop "Merkle verify (main tree)"); profiler!(start "dequeue auxiliary elements"); - let ext_table_rows = proof_stream.dequeue()?.try_into_master_aux_table_rows()?; - let ext_authentication_structure = proof_stream + let aux_table_rows = proof_stream.dequeue()?.try_into_master_aux_table_rows()?; + let aux_authentication_structure = proof_stream .dequeue()? .try_into_authentication_structure()?; - let leaf_digests_ext = ext_table_rows + let leaf_digests_aux = aux_table_rows .par_iter() .map(|xvalues| { let b_values = xvalues.iter().flat_map(|xfe| xfe.coefficients.to_vec()); @@ -911,12 +911,12 @@ impl Stark { profiler!(stop "dequeue auxiliary elements"); profiler!(start "Merkle verify (auxiliary tree)" ("hash")); - let ext_merkle_tree_inclusion_proof = MerkleTreeInclusionProof { + let aux_merkle_tree_inclusion_proof = MerkleTreeInclusionProof { tree_height: merkle_tree_height, - indexed_leafs: index_leaves(leaf_digests_ext), - authentication_structure: ext_authentication_structure, + indexed_leafs: index_leaves(leaf_digests_aux), + authentication_structure: aux_authentication_structure, }; - if !ext_merkle_tree_inclusion_proof.verify(auxiliary_tree_merkle_root) { + if !aux_merkle_tree_inclusion_proof.verify(auxiliary_tree_merkle_root) { return Err(VerificationError::AuxiliaryCodewordAuthenticationFailure); } profiler!(stop "Merkle verify (auxiliary tree)"); @@ -953,17 +953,17 @@ impl Stark { if self.num_collinearity_checks != revealed_quotient_segments_elements.len() { return Err(VerificationError::IncorrectNumberOfQuotientSegmentElements); }; - if self.num_collinearity_checks != base_table_rows.len() { + if self.num_collinearity_checks != main_table_rows.len() { return Err(VerificationError::IncorrectNumberOfMainTableRows); }; - if self.num_collinearity_checks != ext_table_rows.len() { - return Err(VerificationError::IncorrectNumberOfExtTableRows); + if self.num_collinearity_checks != aux_table_rows.len() { + return Err(VerificationError::IncorrectNumberOfAuxTableRows); }; for (row_idx, main_row, aux_row, quotient_segments_elements, fri_value) in izip!( revealed_current_row_indices, - base_table_rows, - ext_table_rows, + main_table_rows, + aux_table_rows, revealed_quotient_segments_elements, revealed_fri_values, ) { @@ -971,29 +971,29 @@ impl Stark { let aux_row = Array1::from(aux_row.to_vec()); let current_fri_domain_value = fri.domain.domain_value(row_idx as u32); - profiler!(start "base & ext elements" ("CC")); - let base_and_ext_curr_row_element = Self::linearly_sum_main_and_aux_row( + profiler!(start "main & aux elements" ("CC")); + let main_and_aux_curr_row_element = Self::linearly_sum_main_and_aux_row( main_row.view(), aux_row.view(), - base_and_ext_codeword_weights.view(), + main_and_aux_codeword_weights.view(), ); let quotient_segments_curr_row_element = weights .quot_segments .dot(&Array1::from(quotient_segments_elements.to_vec())); - profiler!(stop "base & ext elements"); + profiler!(stop "main & aux elements"); profiler!(start "DEEP update"); - let base_and_ext_curr_row_deep_value = Self::deep_update( + let main_and_aux_curr_row_deep_value = Self::deep_update( current_fri_domain_value, - base_and_ext_curr_row_element, + main_and_aux_curr_row_element, out_of_domain_point_curr_row, - out_of_domain_curr_row_base_and_ext_value, + out_of_domain_curr_row_main_and_aux_value, ); - let base_and_ext_next_row_deep_value = Self::deep_update( + let main_and_aux_next_row_deep_value = Self::deep_update( current_fri_domain_value, - base_and_ext_curr_row_element, + main_and_aux_curr_row_element, out_of_domain_point_next_row, - out_of_domain_next_row_base_and_ext_value, + out_of_domain_next_row_main_and_aux_value, ); let quot_curr_row_deep_value = Self::deep_update( current_fri_domain_value, @@ -1005,8 +1005,8 @@ impl Stark { profiler!(start "combination codeword equality"); let deep_value_components = Array1::from(vec![ - base_and_ext_curr_row_deep_value, - base_and_ext_next_row_deep_value, + main_and_aux_curr_row_deep_value, + main_and_aux_next_row_deep_value, quot_curr_row_deep_value, ]); if fri_value != weights.deep.dot(&deep_value_components) { @@ -1043,12 +1043,12 @@ impl Stark { profiler!(stop "collect"); profiler!(start "inner product"); // todo: Try to get rid of this clone. The alternative line - // `let base_and_ext_element = (&weights * &summands).sum();` + // `let main_and_aux_element = (&weights * &summands).sum();` // without cloning the weights does not compile for a seemingly nonsensical reason. let weights = weights.to_owned(); - let base_and_ext_element = (weights * row).sum(); + let main_and_aux_element = (weights * row).sum(); profiler!(stop "inner product"); - base_and_ext_element + main_and_aux_element } /// Computes the quotient segments in a memory-friendly way, i.e., without ever @@ -1297,9 +1297,9 @@ impl LinearCombinationWeights { } } - fn base_and_ext(&self) -> Array1 { - let base = self.main.clone().into_iter(); - base.chain(self.aux.clone()).collect() + fn main_and_aux(&self) -> Array1 { + let main = self.main.clone().into_iter(); + main.chain(self.aux.clone()).collect() } } @@ -1365,7 +1365,7 @@ pub(crate) mod tests { use super::*; - pub(crate) fn master_base_table_for_low_security_level( + pub(crate) fn master_main_table_for_low_security_level( program_and_input: ProgramAndInput, ) -> (Stark, Claim, MasterMainTable) { let ProgramAndInput { @@ -1380,26 +1380,26 @@ pub(crate) mod tests { let claim = Claim::about_program(&aet.program) .with_input(public_input.individual_tokens) .with_output(stdout); - let master_base_table = construct_master_main_table(stark, &aet); + let master_main_table = construct_master_main_table(stark, &aet); - (stark, claim, master_base_table) + (stark, claim, master_main_table) } pub(crate) fn master_tables_for_low_security_level( program_and_input: ProgramAndInput, ) -> (Stark, Claim, MasterMainTable, MasterAuxTable, Challenges) { - let (stark, claim, mut master_base_table) = - master_base_table_for_low_security_level(program_and_input); + let (stark, claim, mut master_main_table) = + master_main_table_for_low_security_level(program_and_input); let challenges = Challenges::placeholder(&claim); - master_base_table.pad(); - let master_ext_table = master_base_table.extend(&challenges); + master_main_table.pad(); + let master_aux_table = master_main_table.extend(&challenges); ( stark, claim, - master_base_table, - master_ext_table, + master_main_table, + master_aux_table, challenges, ) } @@ -1419,14 +1419,14 @@ pub(crate) mod tests { push 100 read_mem 1 pop 2 // read from address 100 halt ); - let (_, _, master_base_table, _, _) = + let (_, _, master_main_table, _, _) = master_tables_for_low_security_level(ProgramAndInput::new(program)); println!(); println!("Processor Table:\n"); println!("| clk | ci | nia | st0 | st1 | st2 | st3 | st4 | st5 |"); println!("|----:|:----|:----|----:|----:|----:|----:|----:|----:|"); - for row in master_base_table + for row in master_main_table .table(TableId::Processor) .rows() .into_iter() @@ -1453,7 +1453,7 @@ pub(crate) mod tests { println!("RAM Table:\n"); println!("| clk | type | pointer | value | iord |"); println!("|----:|:-----|--------:|------:|-----:|"); - for row in master_base_table + for row in master_main_table .table(TableId::Ram) .rows() .into_iter() @@ -1493,14 +1493,14 @@ pub(crate) mod tests { pop 1 pop 2 pop 3 halt }; - let (_, _, master_base_table) = - master_base_table_for_low_security_level(ProgramAndInput::new(program)); + let (_, _, master_main_table) = + master_main_table_for_low_security_level(ProgramAndInput::new(program)); println!(); println!("Processor Table:"); println!("| clk | ci | nia | st0 | st1 | st2 | st3 | underflow | pointer |"); println!("|----:|:----|----:|----:|----:|----:|----:|:----------|--------:|"); - for row in master_base_table + for row in master_main_table .table(TableId::Processor) .rows() .into_iter() @@ -1544,7 +1544,7 @@ pub(crate) mod tests { println!("Op Stack Table:"); println!("| clk | ib1 | pointer | value |"); println!("|----:|----:|--------:|------:|"); - for row in master_base_table + for row in master_main_table .table(TableId::OpStack) .rows() .into_iter() @@ -1598,10 +1598,10 @@ pub(crate) mod tests { ); let mut program_and_input = ProgramAndInput::new(read_nop_program); program_and_input.public_input = PublicInput::from([3, 5, 7].map(|b| bfe!(b))); - let (_, claim, _, master_ext_table, all_challenges) = + let (_, claim, _, master_aux_table, all_challenges) = master_tables_for_low_security_level(program_and_input); - let processor_table = master_ext_table.table(TableId::Processor); + let processor_table = master_aux_table.table(TableId::Processor); let processor_table_last_row = processor_table.slice(s![-1, ..]); let ptie = processor_table_last_row[InputTableEvalArg.aux_index()]; let ine = EvalArg::compute_terminal( @@ -2087,11 +2087,11 @@ pub(crate) mod tests { macro_rules! check_constraints_fn { (fn $fn_name:ident for $table:ident) => { fn $fn_name( - master_base_trace_table: ArrayView2, - master_ext_trace_table: ArrayView2, + master_main_trace_table: ArrayView2, + master_aux_trace_table: ArrayView2, challenges: &Challenges, ) { - assert!(master_base_trace_table.nrows() == master_ext_trace_table.nrows()); + assert!(master_main_trace_table.nrows() == master_aux_trace_table.nrows()); let challenges = &challenges.challenges; let builder = ConstraintCircuitBuilder::new(); @@ -2101,8 +2101,8 @@ pub(crate) mod tests { .enumerate() { let evaluated_constraint = constraint.evaluate( - master_base_trace_table.slice(s![..1, ..]), - master_ext_trace_table.slice(s![..1, ..]), + master_main_trace_table.slice(s![..1, ..]), + master_aux_trace_table.slice(s![..1, ..]), challenges, ); check!( @@ -2118,10 +2118,10 @@ pub(crate) mod tests { .map(|constraint_monad| constraint_monad.consume()) .enumerate() { - for row_idx in 0..master_base_trace_table.nrows() { + for row_idx in 0..master_main_trace_table.nrows() { let evaluated_constraint = constraint.evaluate( - master_base_trace_table.slice(s![row_idx..=row_idx, ..]), - master_ext_trace_table.slice(s![row_idx..=row_idx, ..]), + master_main_trace_table.slice(s![row_idx..=row_idx, ..]), + master_aux_trace_table.slice(s![row_idx..=row_idx, ..]), challenges, ); check!( @@ -2138,10 +2138,10 @@ pub(crate) mod tests { .map(|constraint_monad| constraint_monad.consume()) .enumerate() { - for row_idx in 0..master_base_trace_table.nrows() - 1 { + for row_idx in 0..master_main_trace_table.nrows() - 1 { let evaluated_constraint = constraint.evaluate( - master_base_trace_table.slice(s![row_idx..=row_idx + 1, ..]), - master_ext_trace_table.slice(s![row_idx..=row_idx + 1, ..]), + master_main_trace_table.slice(s![row_idx..=row_idx + 1, ..]), + master_aux_trace_table.slice(s![row_idx..=row_idx + 1, ..]), challenges, ); check!( @@ -2159,8 +2159,8 @@ pub(crate) mod tests { .enumerate() { let evaluated_constraint = constraint.evaluate( - master_base_trace_table.slice(s![-1.., ..]), - master_ext_trace_table.slice(s![-1.., ..]), + master_main_trace_table.slice(s![-1.., ..]), + master_aux_trace_table.slice(s![-1.., ..]), challenges, ); check!( @@ -2185,15 +2185,15 @@ pub(crate) mod tests { check_constraints_fn!(fn check_cross_table_constraints for GrandCrossTableArg); fn triton_constraints_evaluate_to_zero(program_and_input: ProgramAndInput) { - let (_, _, master_base_table, master_ext_table, challenges) = + let (_, _, master_main_table, master_aux_table, challenges) = master_tables_for_low_security_level(program_and_input); - let num_main_rows = master_base_table.randomized_trace_table().nrows(); - let num_aux_rows = master_ext_table.randomized_trace_table().nrows(); + let num_main_rows = master_main_table.randomized_trace_table().nrows(); + let num_aux_rows = master_aux_table.randomized_trace_table().nrows(); assert!(num_main_rows == num_aux_rows); - let mbt = master_base_table.trace_table(); - let met = master_ext_table.trace_table(); + let mbt = master_main_table.trace_table(); + let met = master_aux_table.trace_table(); assert!(mbt.nrows() == met.nrows()); check_program_table_constraints(mbt, met, &challenges); @@ -2214,15 +2214,15 @@ pub(crate) mod tests { } fn derived_constraints_evaluate_to_zero(program_and_input: ProgramAndInput) { - let (_, _, master_base_table, master_ext_table, challenges) = + let (_, _, master_main_table, master_aux_table, challenges) = master_tables_for_low_security_level(program_and_input); - let master_base_trace_table = master_base_table.trace_table(); - let master_ext_trace_table = master_ext_table.trace_table(); + let master_main_trace_table = master_main_table.trace_table(); + let master_aux_trace_table = master_aux_table.trace_table(); let evaluated_initial_constraints = MasterAuxTable::evaluate_initial_constraints( - master_base_trace_table.row(0), - master_ext_trace_table.row(0), + master_main_trace_table.row(0), + master_aux_trace_table.row(0), &challenges, ); for (constraint_idx, evaluated_constraint) in @@ -2234,11 +2234,11 @@ pub(crate) mod tests { ); } - for row_idx in 0..master_base_trace_table.nrows() { + for row_idx in 0..master_main_trace_table.nrows() { let evaluated_consistency_constraints = MasterAuxTable::evaluate_consistency_constraints( - master_base_trace_table.row(row_idx), - master_ext_trace_table.row(row_idx), + master_main_trace_table.row(row_idx), + master_aux_trace_table.row(row_idx), &challenges, ); for (constraint_idx, evaluated_constraint) in @@ -2251,13 +2251,13 @@ pub(crate) mod tests { } } - for curr_row_idx in 0..master_base_trace_table.nrows() - 1 { + for curr_row_idx in 0..master_main_trace_table.nrows() - 1 { let next_row_idx = curr_row_idx + 1; let evaluated_transition_constraints = MasterAuxTable::evaluate_transition_constraints( - master_base_trace_table.row(curr_row_idx), - master_ext_trace_table.row(curr_row_idx), - master_base_trace_table.row(next_row_idx), - master_ext_trace_table.row(next_row_idx), + master_main_trace_table.row(curr_row_idx), + master_aux_trace_table.row(curr_row_idx), + master_main_trace_table.row(next_row_idx), + master_aux_trace_table.row(next_row_idx), &challenges, ); for (constraint_idx, evaluated_constraint) in @@ -2271,8 +2271,8 @@ pub(crate) mod tests { } let evaluated_terminal_constraints = MasterAuxTable::evaluate_terminal_constraints( - master_base_trace_table.row(master_base_trace_table.nrows() - 1), - master_ext_trace_table.row(master_ext_trace_table.nrows() - 1), + master_main_trace_table.row(master_main_trace_table.nrows() - 1), + master_aux_trace_table.row(master_aux_trace_table.nrows() - 1), &challenges, ); for (constraint_idx, evaluated_constraint) in @@ -2525,9 +2525,9 @@ pub(crate) mod tests { challenges: &Challenges, quotient_weights: &[XFieldElement], ) -> (Array2, Array1>) { - let mut base_quotient_domain_codewords = + let mut main_quotient_domain_codewords = Array2::::zeros([quotient_domain.length, MasterMainTable::NUM_COLUMNS]); - Zip::from(base_quotient_domain_codewords.axis_iter_mut(Axis(1))) + Zip::from(main_quotient_domain_codewords.axis_iter_mut(Axis(1))) .and(main_polynomials.axis_iter(Axis(0))) .for_each(|codeword, polynomial| { Array1::from_vec(quotient_domain.evaluate(&polynomial[()])).move_into(codeword); @@ -2541,7 +2541,7 @@ pub(crate) mod tests { }); let quotient_codeword = all_quotients_combined( - base_quotient_domain_codewords.view(), + main_quotient_domain_codewords.view(), aux_quotient_domain_codewords.view(), trace_domain, quotient_domain, @@ -2624,7 +2624,7 @@ pub(crate) mod tests { prop_assert_eq!(NUM_DEEP_CODEWORD_COMPONENTS, weights.deep.len()); prop_assert_eq!( MasterMainTable::NUM_COLUMNS + MasterAuxTable::NUM_COLUMNS, - weights.base_and_ext().len() + weights.main_and_aux().len() ); } diff --git a/triton-vm/src/table.rs b/triton-vm/src/table.rs index afcb62115..6bb024ed5 100644 --- a/triton-vm/src/table.rs +++ b/triton-vm/src/table.rs @@ -149,9 +149,9 @@ mod tests { let challenges = &challenges.challenges; let num_rows = 2; - let base_shape = [num_rows, MasterMainTable::NUM_COLUMNS]; + let main_shape = [num_rows, MasterMainTable::NUM_COLUMNS]; let aux_shape = [num_rows, MasterAuxTable::NUM_COLUMNS]; - let main_rows = Array2::from_shape_simple_fn(base_shape, || rng.gen::()); + let main_rows = Array2::from_shape_simple_fn(main_shape, || rng.gen::()); let aux_rows = Array2::from_shape_simple_fn(aux_shape, || rng.gen::()); let main_rows = main_rows.view(); let aux_rows = aux_rows.view(); @@ -166,7 +166,7 @@ mod tests { } /// Recursively evaluates the given constraint circuit and its sub-circuits on the given - /// base and extension table, and returns the result of the evaluation. + /// main and auxiliary table, and returns the result of the evaluation. /// At each recursive step, updates the given HashMap with the result of the evaluation. /// If the HashMap already contains the result of the evaluation, panics. /// This function is used to assert that the evaluation of a constraint circuit @@ -250,7 +250,7 @@ mod tests { /// - the given multicircuit prior to degree lowering /// - the multicircuit after degree lowering /// - the new base constraints - /// - the new extension constraints + /// - the new auxiliary constraints /// - the numbers of original and new constraints fn lower_degree_and_assert_properties( multicircuit: &mut [ConstraintCircuitMonad], @@ -282,8 +282,8 @@ mod tests { // Check that the new constraints are simple substitutions. let mut substitution_rules = vec![]; for (constraint_type, constraints) in [ - ("base", &new_main_constraints), - ("ext", &new_aux_constraints), + ("main", &new_main_constraints), + ("aux", &new_aux_constraints), ] { for (i, constraint) in constraints.iter().enumerate() { let expression = constraint.circuit.borrow().expression.clone(); @@ -333,11 +333,11 @@ mod tests { for circuit in multicircuit.iter() { println!(" {circuit}"); } - println!("new base constraints:"); + println!("new main constraints:"); for constraint in &new_main_constraints { println!(" {constraint}"); } - println!("new ext constraints:"); + println!("new aux constraints:"); for constraint in &new_aux_constraints { println!(" {constraint}"); } @@ -368,9 +368,9 @@ mod tests { assert_substitution_rule_uses_legal_variables(new_var, &rhs); } CircuitExpression::Input(old_var) => { - let new_var_is_base = new_var.is_main_table_column(); - let old_var_is_base = old_var.is_main_table_column(); - let legal_substitute = match (new_var_is_base, old_var_is_base) { + let new_var_is_main = new_var.is_main_table_column(); + let old_var_is_main = old_var.is_main_table_column(); + let legal_substitute = match (new_var_is_main, old_var_is_main) { (true, false) => false, (false, true) => true, _ => old_var.column() < new_var.column(), @@ -384,11 +384,11 @@ mod tests { #[test] fn degree_lowering_works_correctly_for_all_tables() { macro_rules! assert_degree_lowering { - ($table:ident ($base_end:ident, $ext_end:ident)) => {{ + ($table:ident ($main_end:ident, $aux_end:ident)) => {{ let degree_lowering_info = DegreeLoweringInfo { target_degree: air::TARGET_DEGREE, - num_main_cols: $base_end, - num_aux_cols: $ext_end, + num_main_cols: $main_end, + num_aux_cols: $aux_end, }; let circuit_builder = ConstraintCircuitBuilder::new(); let mut init = $table::initial_constraints(&circuit_builder); @@ -430,29 +430,29 @@ mod tests { #[ignore = "(probably) requires normalization of circuit expressions"] fn substitution_rules_are_unique() { let challenges = Challenges::default(); - let mut base_table_rows = + let mut main_table_rows = Array2::from_shape_fn((2, MasterMainTable::NUM_COLUMNS), |_| random()); - let mut ext_table_rows = + let mut aux_table_rows = Array2::from_shape_fn((2, MasterAuxTable::NUM_COLUMNS), |_| random()); - DegreeLoweringTable::fill_derived_main_columns(base_table_rows.view_mut()); + DegreeLoweringTable::fill_derived_main_columns(main_table_rows.view_mut()); DegreeLoweringTable::fill_derived_aux_columns( - base_table_rows.view(), - ext_table_rows.view_mut(), + main_table_rows.view(), + aux_table_rows.view_mut(), &challenges, ); let mut encountered_values = HashMap::new(); for col_idx in 0..MasterMainTable::NUM_COLUMNS { - let val = base_table_rows[(0, col_idx)].lift(); + let val = main_table_rows[(0, col_idx)].lift(); let other_entry = encountered_values.insert(val, col_idx); if let Some(other_idx) = other_entry { panic!("Duplicate value {val} in derived main column {other_idx} and {col_idx}."); } } - println!("Now comparing extension columns…"); + println!("Now comparing auxiliary columns…"); for col_idx in 0..MasterAuxTable::NUM_COLUMNS { - let val = ext_table_rows[(0, col_idx)]; + let val = aux_table_rows[(0, col_idx)]; let other_entry = encountered_values.insert(val, col_idx); if let Some(other_idx) = other_entry { panic!("Duplicate value {val} in derived aux column {other_idx} and {col_idx}."); diff --git a/triton-vm/src/table/cascade.rs b/triton-vm/src/table/cascade.rs index 246c5e487..9e9626cd9 100644 --- a/triton-vm/src/table/cascade.rs +++ b/triton-vm/src/table/cascade.rs @@ -110,10 +110,10 @@ impl TraceTable for CascadeTable { lookup_table_log_derivative += (lookup_indeterminate - compressed_row_hi).inverse(); } - let mut extension_row = aux_table.row_mut(row_idx); - extension_row[AuxColumn::HashTableServerLogDerivative.aux_index()] = + let mut auxiliary_row = aux_table.row_mut(row_idx); + auxiliary_row[AuxColumn::HashTableServerLogDerivative.aux_index()] = hash_table_log_derivative; - extension_row[AuxColumn::LookupTableClientLogDerivative.aux_index()] = + auxiliary_row[AuxColumn::LookupTableClientLogDerivative.aux_index()] = lookup_table_log_derivative; } profiler!(stop "cascade table"); diff --git a/triton-vm/src/table/hash.rs b/triton-vm/src/table/hash.rs index ac8b57ae2..717b162d4 100644 --- a/triton-vm/src/table/hash.rs +++ b/triton-vm/src/table/hash.rs @@ -505,43 +505,43 @@ impl TraceTable for HashTable { log_derivative_summand(row, State3LowestLkIn, State3LowestLkOut); } - let mut extension_row = aux_table.row_mut(row_idx); - extension_row[ReceiveChunkRunningEvaluation.aux_index()] = + let mut auxiliary_row = aux_table.row_mut(row_idx); + auxiliary_row[ReceiveChunkRunningEvaluation.aux_index()] = receive_chunk_running_evaluation; - extension_row[HashInputRunningEvaluation.aux_index()] = hash_input_running_evaluation; - extension_row[HashDigestRunningEvaluation.aux_index()] = hash_digest_running_evaluation; - extension_row[SpongeRunningEvaluation.aux_index()] = sponge_running_evaluation; - extension_row[CascadeState0HighestClientLogDerivative.aux_index()] = + auxiliary_row[HashInputRunningEvaluation.aux_index()] = hash_input_running_evaluation; + auxiliary_row[HashDigestRunningEvaluation.aux_index()] = hash_digest_running_evaluation; + auxiliary_row[SpongeRunningEvaluation.aux_index()] = sponge_running_evaluation; + auxiliary_row[CascadeState0HighestClientLogDerivative.aux_index()] = cascade_state_0_highest_log_derivative; - extension_row[CascadeState0MidHighClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState0MidHighClientLogDerivative.aux_index()] = cascade_state_0_mid_high_log_derivative; - extension_row[CascadeState0MidLowClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState0MidLowClientLogDerivative.aux_index()] = cascade_state_0_mid_low_log_derivative; - extension_row[CascadeState0LowestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState0LowestClientLogDerivative.aux_index()] = cascade_state_0_lowest_log_derivative; - extension_row[CascadeState1HighestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState1HighestClientLogDerivative.aux_index()] = cascade_state_1_highest_log_derivative; - extension_row[CascadeState1MidHighClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState1MidHighClientLogDerivative.aux_index()] = cascade_state_1_mid_high_log_derivative; - extension_row[CascadeState1MidLowClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState1MidLowClientLogDerivative.aux_index()] = cascade_state_1_mid_low_log_derivative; - extension_row[CascadeState1LowestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState1LowestClientLogDerivative.aux_index()] = cascade_state_1_lowest_log_derivative; - extension_row[CascadeState2HighestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState2HighestClientLogDerivative.aux_index()] = cascade_state_2_highest_log_derivative; - extension_row[CascadeState2MidHighClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState2MidHighClientLogDerivative.aux_index()] = cascade_state_2_mid_high_log_derivative; - extension_row[CascadeState2MidLowClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState2MidLowClientLogDerivative.aux_index()] = cascade_state_2_mid_low_log_derivative; - extension_row[CascadeState2LowestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState2LowestClientLogDerivative.aux_index()] = cascade_state_2_lowest_log_derivative; - extension_row[CascadeState3HighestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState3HighestClientLogDerivative.aux_index()] = cascade_state_3_highest_log_derivative; - extension_row[CascadeState3MidHighClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState3MidHighClientLogDerivative.aux_index()] = cascade_state_3_mid_high_log_derivative; - extension_row[CascadeState3MidLowClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState3MidLowClientLogDerivative.aux_index()] = cascade_state_3_mid_low_log_derivative; - extension_row[CascadeState3LowestClientLogDerivative.aux_index()] = + auxiliary_row[CascadeState3LowestClientLogDerivative.aux_index()] = cascade_state_3_lowest_log_derivative; } profiler!(stop "hash table"); diff --git a/triton-vm/src/table/jump_stack.rs b/triton-vm/src/table/jump_stack.rs index 8fb59eb20..0d126dc2e 100644 --- a/triton-vm/src/table/jump_stack.rs +++ b/triton-vm/src/table/jump_stack.rs @@ -27,12 +27,12 @@ use crate::table::TraceTable; type MainColumn = ::MainColumn; type AuxColumn = ::AuxColumn; -fn extension_column_running_product_permutation_argument( +fn auxiliary_column_running_product_permutation_argument( main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut running_product = PermArg::default_initial(); - let mut extension_column = Vec::with_capacity(main_table.nrows()); + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); for row in main_table.rows() { let compressed_row = row[MainColumn::CLK.main_index()] * challenges[JumpStackClkWeight] + row[MainColumn::CI.main_index()] * challenges[JumpStackCiWeight] @@ -40,12 +40,12 @@ fn extension_column_running_product_permutation_argument( + row[MainColumn::JSO.main_index()] * challenges[JumpStackJsoWeight] + row[MainColumn::JSD.main_index()] * challenges[JumpStackJsdWeight]; running_product *= challenges[JumpStackIndeterminate] - compressed_row; - extension_column.push(running_product); + auxiliary_column.push(running_product); } - Array2::from_shape_vec((main_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_clock_jump_diff_lookup_log_derivative( +fn auxiliary_column_clock_jump_diff_lookup_log_derivative( main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { @@ -61,10 +61,10 @@ fn extension_column_clock_jump_diff_lookup_log_derivative( .map(|(i, inv)| (bfe!(i), inv)) .collect::>(); - // populate extension column using memoization + // populate auxiliary column using memoization let mut cjd_lookup_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(main_table.nrows()); - extension_column.push(cjd_lookup_log_derivative); + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(cjd_lookup_log_derivative); for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { if previous_row[MainColumn::JSP.main_index()] == current_row[MainColumn::JSP.main_index()] { let previous_clock = previous_row[MainColumn::CLK.main_index()]; @@ -75,9 +75,9 @@ fn extension_column_clock_jump_diff_lookup_log_derivative( .or_insert_with(|| (indeterminate - clock_jump_difference).inverse()); cjd_lookup_log_derivative += inverse; } - extension_column.push(cjd_lookup_log_derivative); + auxiliary_column.push(cjd_lookup_log_derivative); } - Array2::from_shape_vec((main_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } impl TraceTable for JumpStackTable { @@ -208,21 +208,21 @@ impl TraceTable for JumpStackTable { assert_eq!(main_table.nrows(), aux_table.nrows()); // use strum::IntoEnumIterator; - let extension_column_indices = JumpStackAuxColumn::iter() + let auxiliary_column_indices = JumpStackAuxColumn::iter() .map(|column| column.aux_index()) .collect_vec(); - let extension_column_slices = horizontal_multi_slice_mut( + let auxiliary_column_slices = horizontal_multi_slice_mut( aux_table.view_mut(), - &contiguous_column_slices(&extension_column_indices), + &contiguous_column_slices(&auxiliary_column_indices), ); let extension_functions = [ - extension_column_running_product_permutation_argument, - extension_column_clock_jump_diff_lookup_log_derivative, + auxiliary_column_running_product_permutation_argument, + auxiliary_column_clock_jump_diff_lookup_log_derivative, ]; extension_functions .into_par_iter() - .zip_eq(extension_column_slices) + .zip_eq(auxiliary_column_slices) .for_each(|(generator, slice)| { generator(main_table, challenges).move_into(slice); }); diff --git a/triton-vm/src/table/lookup.rs b/triton-vm/src/table/lookup.rs index 228b26636..c3aea5b14 100644 --- a/triton-vm/src/table/lookup.rs +++ b/triton-vm/src/table/lookup.rs @@ -25,8 +25,8 @@ use crate::table::TraceTable; type MainColumn = ::MainColumn; type AuxColumn = ::AuxColumn; -fn extension_column_cascade_running_sum_log_derivative( - base_table: ArrayView2, +fn auxiliary_column_cascade_running_sum_log_derivative( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let look_in_weight = challenges[ChallengeId::LookupTableInputWeight]; @@ -34,8 +34,8 @@ fn extension_column_cascade_running_sum_log_derivative( let indeterminate = challenges[ChallengeId::CascadeLookupIndeterminate]; let mut cascade_table_running_sum_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { if row[MainColumn::IsPadding.main_index()].is_one() { break; } @@ -48,21 +48,21 @@ fn extension_column_cascade_running_sum_log_derivative( cascade_table_running_sum_log_derivative += (indeterminate - compressed_row).inverse() * lookup_multiplicity; - extension_column.push(cascade_table_running_sum_log_derivative); + auxiliary_column.push(cascade_table_running_sum_log_derivative); } // fill padding section - extension_column.resize(base_table.nrows(), cascade_table_running_sum_log_derivative); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), cascade_table_running_sum_log_derivative); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_public_running_evaluation( - base_table: ArrayView2, +fn auxiliary_column_public_running_evaluation( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut running_evaluation = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { if row[MainColumn::IsPadding.main_index()].is_one() { break; } @@ -70,12 +70,12 @@ fn extension_column_public_running_evaluation( running_evaluation = running_evaluation * challenges[ChallengeId::LookupTablePublicIndeterminate] + row[MainColumn::LookOut.main_index()]; - extension_column.push(running_evaluation); + auxiliary_column.push(running_evaluation); } // fill padding section - extension_column.resize(base_table.nrows(), running_evaluation); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), running_evaluation); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } impl TraceTable for LookupTable { @@ -126,21 +126,21 @@ impl TraceTable for LookupTable { assert_eq!(AuxColumn::COUNT, aux_table.ncols()); assert_eq!(main_table.nrows(), aux_table.nrows()); - let extension_column_indices = AuxColumn::iter() + let auxiliary_column_indices = AuxColumn::iter() .map(|column| column.aux_index()) .collect_vec(); - let extension_column_slices = horizontal_multi_slice_mut( + let auxiliary_column_slices = horizontal_multi_slice_mut( aux_table.view_mut(), - &contiguous_column_slices(&extension_column_indices), + &contiguous_column_slices(&auxiliary_column_indices), ); let extension_functions = [ - extension_column_cascade_running_sum_log_derivative, - extension_column_public_running_evaluation, + auxiliary_column_cascade_running_sum_log_derivative, + auxiliary_column_public_running_evaluation, ]; extension_functions .into_par_iter() - .zip_eq(extension_column_slices) + .zip_eq(auxiliary_column_slices) .for_each(|(generator, slice)| { generator(main_table, challenges).move_into(slice); }); diff --git a/triton-vm/src/table/master_table.rs b/triton-vm/src/table/master_table.rs index 8c5f8dd4e..3e772efac 100644 --- a/triton-vm/src/table/master_table.rs +++ b/triton-vm/src/table/master_table.rs @@ -95,8 +95,8 @@ use crate::table::*; /// completely separate from each other. Only the [cross-table arguments][cross_arg] link all tables /// together. /// -/// Conceptually, there are two Master Tables: the [`MasterMainTable`] ("main"), the Master -/// Extension Table ("auxiliary"). The lifecycle of the Master Tables is +/// Conceptually, there are two Master Tables: the [`MasterMainTable`], and the Master Auxiliary +/// Table. The lifecycle of the Master Tables is /// as follows: /// 1. The [`MasterMainTable`] is instantiated and filled using the Algebraic Execution Trace. /// 2. The [`MasterMainTable`] is padded using logic from the individual tables. @@ -692,7 +692,7 @@ impl MasterMainTable { let num_columns = Self::NUM_COLUMNS; let randomized_trace_table = Array2::zeros([num_rows, num_columns].f()); - let mut master_base_table = Self { + let mut master_main_table = Self { num_trace_randomizers, program_table_len: aet.height_of_table(TableId::Program), main_execution_len: aet.height_of_table(TableId::Processor), @@ -713,29 +713,29 @@ impl MasterMainTable { // memory-like tables must be filled in before clock jump differences are known, hence // the break from the usual order let clk_jump_diffs_op_stack = - OpStackTable::fill(master_base_table.table_mut(TableId::OpStack), aet, ()); - let clk_jump_diffs_ram = RamTable::fill(master_base_table.table_mut(TableId::Ram), aet, ()); + OpStackTable::fill(master_main_table.table_mut(TableId::OpStack), aet, ()); + let clk_jump_diffs_ram = RamTable::fill(master_main_table.table_mut(TableId::Ram), aet, ()); let clk_jump_diffs_jump_stack = - JumpStackTable::fill(master_base_table.table_mut(TableId::JumpStack), aet, ()); + JumpStackTable::fill(master_main_table.table_mut(TableId::JumpStack), aet, ()); let clk_jump_diffs = ClkJumpDiffs { op_stack: clk_jump_diffs_op_stack, ram: clk_jump_diffs_ram, jump_stack: clk_jump_diffs_jump_stack, }; - let processor_table = master_base_table.table_mut(TableId::Processor); + let processor_table = master_main_table.table_mut(TableId::Processor); ProcessorTable::fill(processor_table, aet, clk_jump_diffs); - ProgramTable::fill(master_base_table.table_mut(TableId::Program), aet, ()); - HashTable::fill(master_base_table.table_mut(TableId::Hash), aet, ()); - CascadeTable::fill(master_base_table.table_mut(TableId::Cascade), aet, ()); - LookupTable::fill(master_base_table.table_mut(TableId::Lookup), aet, ()); - U32Table::fill(master_base_table.table_mut(TableId::U32), aet, ()); + ProgramTable::fill(master_main_table.table_mut(TableId::Program), aet, ()); + HashTable::fill(master_main_table.table_mut(TableId::Hash), aet, ()); + CascadeTable::fill(master_main_table.table_mut(TableId::Cascade), aet, ()); + LookupTable::fill(master_main_table.table_mut(TableId::Lookup), aet, ()); + U32Table::fill(master_main_table.table_mut(TableId::U32), aet, ()); // Filling the degree-lowering table only makes sense after padding has happened. // Hence, this table is omitted here. - master_base_table + master_main_table } /// Pad the trace to the next power of two using the various, table-specific padding rules. @@ -751,7 +751,7 @@ impl MasterMainTable { .randomized_trace_table .slice_mut(s![..; unit_distance, ..]); - let base_tables: [_; TableId::COUNT] = horizontal_multi_slice_mut( + let main_tables: [_; TableId::COUNT] = horizontal_multi_slice_mut( master_table_without_randomizers, &partial_sums(&[ ProgramMainColumn::COUNT, @@ -782,10 +782,10 @@ impl MasterMainTable { ]; all_pad_functions .into_par_iter() - .zip_eq(base_tables.into_par_iter()) + .zip_eq(main_tables.into_par_iter()) .zip_eq(table_lengths.into_par_iter()) - .for_each(|((pad, base_table), table_length)| { - pad(base_table, table_length); + .for_each(|((pad, main_table), table_length)| { + pad(main_table, table_length); }); profiler!(stop "pad original tables"); @@ -811,7 +811,7 @@ impl MasterMainTable { ] } - /// Create a `MasterAuxTable` from a `MasterMainTable` by `.extend()`ing each individual base + /// Create a `MasterAuxTable` from a `MasterMainTable` by `.extend()`ing each individual main /// table. The `.extend()` for each table is specific to that table, but always involves /// adding some number of columns. pub fn extend(&self, challenges: &Challenges) -> MasterAuxTable { @@ -819,33 +819,33 @@ impl MasterMainTable { let num_rows = self.randomized_trace_table().nrows(); profiler!(start "initialize master table"); let num_aux_columns = MasterAuxTable::NUM_COLUMNS; - let mut randomized_trace_extension_table = + let mut randomized_trace_auxiliary_table = fast_zeros_column_major(num_rows, num_aux_columns); let randomizers_start = MasterAuxTable::NUM_COLUMNS - NUM_RANDOMIZER_POLYNOMIALS; - randomized_trace_extension_table + randomized_trace_auxiliary_table .slice_mut(s![.., randomizers_start..]) .par_mapv_inplace(|_| random::()); profiler!(stop "initialize master table"); - let mut master_ext_table = MasterAuxTable { + let mut master_aux_table = MasterAuxTable { num_trace_randomizers: self.num_trace_randomizers, trace_domain: self.trace_domain(), randomized_trace_domain: self.randomized_trace_domain(), quotient_domain: self.quotient_domain(), fri_domain: self.fri_domain(), - randomized_trace_table: randomized_trace_extension_table, + randomized_trace_table: randomized_trace_auxiliary_table, low_degree_extended_table: None, interpolation_polynomials: None, }; profiler!(start "slice master table"); let unit_distance = self.randomized_trace_domain().length / self.trace_domain().length; - let master_ext_table_without_randomizers = master_ext_table + let master_aux_table_without_randomizers = master_aux_table .randomized_trace_table .slice_mut(s![..; unit_distance, ..randomizers_start]); - let extension_tables: [_; TableId::COUNT] = horizontal_multi_slice_mut( - master_ext_table_without_randomizers, + let auxiliary_tables: [_; TableId::COUNT] = horizontal_multi_slice_mut( + master_aux_table_without_randomizers, &partial_sums(&[ ProgramAuxColumn::COUNT, ProcessorAuxColumn::COUNT, @@ -865,22 +865,22 @@ impl MasterMainTable { profiler!(start "all tables"); Self::all_extend_functions() .into_par_iter() - .zip_eq(self.base_tables_for_extending()) - .zip_eq(extension_tables) - .for_each(|((extend, base_table), ext_table)| { - extend(base_table, ext_table, challenges) + .zip_eq(self.main_tables_for_extending()) + .zip_eq(auxiliary_tables) + .for_each(|((extend, main_table), aux_table)| { + extend(main_table, aux_table, challenges) }); profiler!(stop "all tables"); profiler!(start "fill degree lowering table"); DegreeLoweringTable::fill_derived_aux_columns( self.trace_table(), - master_ext_table.trace_table_mut(), + master_aux_table.trace_table_mut(), challenges, ); profiler!(stop "fill degree lowering table"); - master_ext_table + master_aux_table } fn all_extend_functions() -> [ExtendFunction; TableId::COUNT] { @@ -897,7 +897,7 @@ impl MasterMainTable { ] } - fn base_tables_for_extending(&self) -> [ArrayView2; TableId::COUNT] { + fn main_tables_for_extending(&self) -> [ArrayView2; TableId::COUNT] { [ self.table(TableId::Program), self.table(TableId::Processor), @@ -1077,8 +1077,8 @@ pub fn terminal_quotient_zerofier_inverse( /// [prover]: crate::stark::Stark::prove /// [verifier]: crate::stark::Stark::verify pub fn all_quotients_combined( - quotient_domain_master_base_table: ArrayView2, - quotient_domain_master_ext_table: ArrayView2, + quotient_domain_master_main_table: ArrayView2, + quotient_domain_master_aux_table: ArrayView2, trace_domain: ArithmeticDomain, quotient_domain: ArithmeticDomain, challenges: &Challenges, @@ -1086,11 +1086,11 @@ pub fn all_quotients_combined( ) -> Vec { assert_eq!( quotient_domain.length, - quotient_domain_master_base_table.nrows(), + quotient_domain_master_main_table.nrows(), ); assert_eq!( quotient_domain.length, - quotient_domain_master_ext_table.nrows() + quotient_domain_master_aux_table.nrows() ); assert_eq!(MasterAuxTable::NUM_CONSTRAINTS, quotient_weights.len()); @@ -1119,10 +1119,10 @@ pub fn all_quotients_combined( .map(|row_index| { let unit_distance = quotient_domain.length / trace_domain.length; let next_row_index = (row_index + unit_distance) % quotient_domain.length; - let current_row_main = quotient_domain_master_base_table.row(row_index); - let current_row_aux = quotient_domain_master_ext_table.row(row_index); - let next_row_main = quotient_domain_master_base_table.row(next_row_index); - let next_row_aux = quotient_domain_master_ext_table.row(next_row_index); + let current_row_main = quotient_domain_master_main_table.row(row_index); + let current_row_aux = quotient_domain_master_aux_table.row(row_index); + let next_row_main = quotient_domain_master_main_table.row(next_row_index); + let next_row_aux = quotient_domain_master_aux_table.row(next_row_index); let initial_constraint_values = MasterAuxTable::evaluate_initial_constraints( current_row_main, @@ -1231,88 +1231,88 @@ mod tests { use super::*; #[test] - fn base_table_width_is_correct() { + fn main_table_width_is_correct() { let program = ProgramAndInput::new(triton_program!(halt)); - let (_, _, master_base_table) = master_base_table_for_low_security_level(program); + let (_, _, master_main_table) = master_main_table_for_low_security_level(program); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::Program).ncols() + master_main_table.table(TableId::Program).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::Processor).ncols() + master_main_table.table(TableId::Processor).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::OpStack).ncols() + master_main_table.table(TableId::OpStack).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::Ram).ncols() + master_main_table.table(TableId::Ram).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::JumpStack).ncols() + master_main_table.table(TableId::JumpStack).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::Hash).ncols() + master_main_table.table(TableId::Hash).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::Cascade).ncols() + master_main_table.table(TableId::Cascade).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::Lookup).ncols() + master_main_table.table(TableId::Lookup).ncols() ); assert_eq!( ::MainColumn::COUNT, - master_base_table.table(TableId::U32).ncols() + master_main_table.table(TableId::U32).ncols() ); } #[test] - fn ext_table_width_is_correct() { + fn aux_table_width_is_correct() { let program = ProgramAndInput::new(triton_program!(halt)); - let (_, _, _, master_ext_table, _) = master_tables_for_low_security_level(program); + let (_, _, _, master_aux_table, _) = master_tables_for_low_security_level(program); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::Program).ncols() + master_aux_table.table(TableId::Program).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::Processor).ncols() + master_aux_table.table(TableId::Processor).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::OpStack).ncols() + master_aux_table.table(TableId::OpStack).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::Ram).ncols() + master_aux_table.table(TableId::Ram).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::JumpStack).ncols() + master_aux_table.table(TableId::JumpStack).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::Hash).ncols() + master_aux_table.table(TableId::Hash).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::Cascade).ncols() + master_aux_table.table(TableId::Cascade).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::Lookup).ncols() + master_aux_table.table(TableId::Lookup).ncols() ); assert_eq!( ::AuxColumn::COUNT, - master_ext_table.table(TableId::U32).ncols() + master_aux_table.table(TableId::U32).ncols() ); } @@ -1682,32 +1682,32 @@ mod tests { num_main_cols: table.last_main_column_index, num_aux_cols: table.last_aux_column_index, }; - let (new_base_init, new_ext_init) = ConstraintCircuitMonad::lower_to_degree( + let (new_main_init, new_aux_init) = ConstraintCircuitMonad::lower_to_degree( &mut table.initial_constraints, info, ); - let (new_base_cons, new_ext_cons) = ConstraintCircuitMonad::lower_to_degree( + let (new_main_cons, new_aux_cons) = ConstraintCircuitMonad::lower_to_degree( &mut table.consistency_constraints, info, ); - let (new_base_tran, new_ext_tran) = ConstraintCircuitMonad::lower_to_degree( + let (new_main_tran, new_aux_tran) = ConstraintCircuitMonad::lower_to_degree( &mut table.transition_constraints, info, ); - let (new_base_term, new_ext_term) = ConstraintCircuitMonad::lower_to_degree( + let (new_main_term, new_aux_term) = ConstraintCircuitMonad::lower_to_degree( &mut table.terminal_constraints, info, ); - initial_constraints.extend(new_base_init); - consistency_constraints.extend(new_base_cons); - transition_constraints.extend(new_base_tran); - terminal_constraints.extend(new_base_term); + initial_constraints.extend(new_main_init); + consistency_constraints.extend(new_main_cons); + transition_constraints.extend(new_main_tran); + terminal_constraints.extend(new_main_term); - initial_constraints.extend(new_ext_init); - consistency_constraints.extend(new_ext_cons); - transition_constraints.extend(new_ext_tran); - terminal_constraints.extend(new_ext_term); + initial_constraints.extend(new_aux_init); + consistency_constraints.extend(new_aux_cons); + transition_constraints.extend(new_aux_tran); + terminal_constraints.extend(new_aux_term); } let table_max_degree = [ @@ -1937,14 +1937,14 @@ mod tests { #[test] fn print_all_master_table_indices() { macro_rules! print_columns { - (base $table:ident for $name:literal) => {{ + (main $table:ident for $name:literal) => {{ for column in $table::iter() { let idx = column.master_main_index(); let name = $name; println!("| {idx:>3} | {name:<11} | {column}"); } }}; - (ext $table:ident for $name:literal) => {{ + (aux $table:ident for $name:literal) => {{ for column in $table::iter() { let idx = column.master_aux_index(); let name = $name; @@ -1956,34 +1956,34 @@ mod tests { println!(); println!("| idx | table | main column"); println!("|----:|:------------|:-----------"); - print_columns!(base ProgramMainColumn for "program"); - print_columns!(base ProcessorMainColumn for "processor"); - print_columns!(base OpStackMainColumn for "op stack"); - print_columns!(base RamMainColumn for "ram"); - print_columns!(base JumpStackMainColumn for "jump stack"); - print_columns!(base HashMainColumn for "hash"); - print_columns!(base CascadeMainColumn for "cascade"); - print_columns!(base LookupMainColumn for "lookup"); - print_columns!(base U32MainColumn for "u32"); - print_columns!(base DegreeLoweringMainColumn for "degree low."); + print_columns!(main ProgramMainColumn for "program"); + print_columns!(main ProcessorMainColumn for "processor"); + print_columns!(main OpStackMainColumn for "op stack"); + print_columns!(main RamMainColumn for "ram"); + print_columns!(main JumpStackMainColumn for "jump stack"); + print_columns!(main HashMainColumn for "hash"); + print_columns!(main CascadeMainColumn for "cascade"); + print_columns!(main LookupMainColumn for "lookup"); + print_columns!(main U32MainColumn for "u32"); + print_columns!(main DegreeLoweringMainColumn for "degree low."); println!(); println!("| idx | table | auxiliary column"); println!("|----:|:------------|:----------------"); - print_columns!(ext ProgramAuxColumn for "program"); - print_columns!(ext ProcessorAuxColumn for "processor"); - print_columns!(ext OpStackAuxColumn for "op stack"); - print_columns!(ext RamAuxColumn for "ram"); - print_columns!(ext JumpStackAuxColumn for "jump stack"); - print_columns!(ext HashAuxColumn for "hash"); - print_columns!(ext CascadeAuxColumn for "cascade"); - print_columns!(ext LookupAuxColumn for "lookup"); - print_columns!(ext U32AuxColumn for "u32"); - print_columns!(ext DegreeLoweringAuxColumn for "degree low."); + print_columns!(aux ProgramAuxColumn for "program"); + print_columns!(aux ProcessorAuxColumn for "processor"); + print_columns!(aux OpStackAuxColumn for "op stack"); + print_columns!(aux RamAuxColumn for "ram"); + print_columns!(aux JumpStackAuxColumn for "jump stack"); + print_columns!(aux HashAuxColumn for "hash"); + print_columns!(aux CascadeAuxColumn for "cascade"); + print_columns!(aux LookupAuxColumn for "lookup"); + print_columns!(aux U32AuxColumn for "u32"); + print_columns!(aux DegreeLoweringAuxColumn for "degree low."); } #[test] - fn master_ext_table_mut() { + fn master_aux_table_mut() { let trace_domain = ArithmeticDomain::of_length(1 << 8).unwrap(); let randomized_trace_domain = ArithmeticDomain::of_length(1 << 9).unwrap(); let quotient_domain = ArithmeticDomain::of_length(1 << 10).unwrap(); diff --git a/triton-vm/src/table/op_stack.rs b/triton-vm/src/table/op_stack.rs index 21df5efb1..c8349efb7 100644 --- a/triton-vm/src/table/op_stack.rs +++ b/triton-vm/src/table/op_stack.rs @@ -98,15 +98,15 @@ impl OpStackTableEntry { } } -fn extension_column_running_product_permutation_argument( - base_table: ArrayView2, +fn auxiliary_column_running_product_permutation_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let perm_arg_indeterminate = challenges[OpStackIndeterminate]; let mut running_product = PermArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { if row[MainColumn::IB1ShrinkStack.main_index()] != PADDING_VALUE { let compressed_row = row[MainColumn::CLK.main_index()] * challenges[OpStackClkWeight] + row[MainColumn::IB1ShrinkStack.main_index()] * challenges[OpStackIb1Weight] @@ -115,13 +115,13 @@ fn extension_column_running_product_permutation_argument( * challenges[OpStackFirstUnderflowElementWeight]; running_product *= perm_arg_indeterminate - compressed_row; } - extension_column.push(running_product); + auxiliary_column.push(running_product); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_clock_jump_diff_lookup_log_derivative( - base_table: ArrayView2, +fn auxiliary_column_clock_jump_diff_lookup_log_derivative( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { // - use memoization to avoid recomputing inverses @@ -137,11 +137,11 @@ fn extension_column_clock_jump_diff_lookup_log_derivative( .map(|(i, inv)| (bfe!(i), inv)) .collect::>(); - // populate extension column using memoization + // populate auxiliary column using memoization let mut cjd_lookup_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(cjd_lookup_log_derivative); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(cjd_lookup_log_derivative); + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { if current_row[MainColumn::IB1ShrinkStack.main_index()] == PADDING_VALUE { break; }; @@ -157,12 +157,12 @@ fn extension_column_clock_jump_diff_lookup_log_derivative( .or_insert_with(|| (cjd_lookup_indeterminate - clock_jump_difference).inverse()); cjd_lookup_log_derivative += inverse; } - extension_column.push(cjd_lookup_log_derivative); + auxiliary_column.push(cjd_lookup_log_derivative); } // fill padding section - extension_column.resize(base_table.nrows(), cjd_lookup_log_derivative); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), cjd_lookup_log_derivative); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } impl TraceTable for OpStackTable { @@ -213,21 +213,21 @@ impl TraceTable for OpStackTable { assert_eq!(AuxColumn::COUNT, aux_table.ncols()); assert_eq!(main_table.nrows(), aux_table.nrows()); - let extension_column_indices = OpStackAuxColumn::iter() + let auxiliary_column_indices = OpStackAuxColumn::iter() .map(|column| column.aux_index()) .collect_vec(); - let extension_column_slices = horizontal_multi_slice_mut( + let auxiliary_column_slices = horizontal_multi_slice_mut( aux_table.view_mut(), - &contiguous_column_slices(&extension_column_indices), + &contiguous_column_slices(&auxiliary_column_indices), ); let extension_functions = [ - extension_column_running_product_permutation_argument, - extension_column_clock_jump_diff_lookup_log_derivative, + auxiliary_column_running_product_permutation_argument, + auxiliary_column_clock_jump_diff_lookup_log_derivative, ]; extension_functions .into_par_iter() - .zip_eq(extension_column_slices) + .zip_eq(auxiliary_column_slices) .for_each(|(generator, slice)| { generator(main_table, challenges).move_into(slice); }); @@ -352,13 +352,13 @@ pub(crate) mod tests { stack_pointer_1: u64, clk: u64, ) { - const BASE_WIDTH: usize = ::MainColumn::COUNT; + const MAIN_WIDTH: usize = ::MainColumn::COUNT; - let mut row_0 = Array1::zeros(BASE_WIDTH); + let mut row_0 = Array1::zeros(MAIN_WIDTH); row_0[MainColumn::StackPointer.main_index()] = stack_pointer_0.into(); row_0[MainColumn::CLK.main_index()] = clk.into(); - let mut row_1 = Array1::zeros(BASE_WIDTH); + let mut row_1 = Array1::zeros(MAIN_WIDTH); row_1[MainColumn::StackPointer.main_index()] = stack_pointer_1.into(); row_1[MainColumn::CLK.main_index()] = clk.into(); @@ -374,13 +374,13 @@ pub(crate) mod tests { clk_0: u64, clk_1: u64, ) { - const BASE_WIDTH: usize = ::MainColumn::COUNT; + const MAIN_WIDTH: usize = ::MainColumn::COUNT; - let mut row_0 = Array1::zeros(BASE_WIDTH); + let mut row_0 = Array1::zeros(MAIN_WIDTH); row_0[MainColumn::StackPointer.main_index()] = stack_pointer.into(); row_0[MainColumn::CLK.main_index()] = clk_0.into(); - let mut row_1 = Array1::zeros(BASE_WIDTH); + let mut row_1 = Array1::zeros(MAIN_WIDTH); row_1[MainColumn::StackPointer.main_index()] = stack_pointer.into(); row_1[MainColumn::CLK.main_index()] = clk_1.into(); diff --git a/triton-vm/src/table/processor.rs b/triton-vm/src/table/processor.rs index 5736642b1..271840bb4 100644 --- a/triton-vm/src/table/processor.rs +++ b/triton-vm/src/table/processor.rs @@ -106,17 +106,17 @@ impl TraceTable for ProcessorTable { ); let all_column_generators = [ - extension_column_input_table_eval_argument, - extension_column_output_table_eval_argument, - extension_column_instruction_lookup_argument, - extension_column_op_stack_table_perm_argument, - extension_column_ram_table_perm_argument, - extension_column_jump_stack_table_perm_argument, - extension_column_hash_input_eval_argument, - extension_column_hash_digest_eval_argument, - extension_column_sponge_eval_argument, - extension_column_for_u32_lookup_argument, - extension_column_for_clock_jump_difference_lookup_argument, + auxiliary_column_input_table_eval_argument, + auxiliary_column_output_table_eval_argument, + auxiliary_column_instruction_lookup_argument, + auxiliary_column_op_stack_table_perm_argument, + auxiliary_column_ram_table_perm_argument, + auxiliary_column_jump_stack_table_perm_argument, + auxiliary_column_hash_input_eval_argument, + auxiliary_column_hash_digest_eval_argument, + auxiliary_column_sponge_eval_argument, + auxiliary_column_for_u32_lookup_argument, + auxiliary_column_for_clock_jump_difference_lookup_argument, ]; all_column_generators .into_par_iter() @@ -129,14 +129,14 @@ impl TraceTable for ProcessorTable { } } -fn extension_column_input_table_eval_argument( - base_table: ArrayView2, +fn auxiliary_column_input_table_eval_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut input_table_running_evaluation = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(input_table_running_evaluation); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(input_table_running_evaluation); + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { if let Some(Instruction::ReadIo(st)) = instruction_from_row(previous_row) { for i in (0..st.num_words()).rev() { let input_symbol_column = ProcessorTable::op_stack_column_by_index(i); @@ -146,19 +146,19 @@ fn extension_column_input_table_eval_argument( + input_symbol; } } - extension_column.push(input_table_running_evaluation); + auxiliary_column.push(input_table_running_evaluation); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_output_table_eval_argument( - base_table: ArrayView2, +fn auxiliary_column_output_table_eval_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut output_table_running_evaluation = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(output_table_running_evaluation); - for (previous_row, _) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(output_table_running_evaluation); + for (previous_row, _) in main_table.rows().into_iter().tuple_windows() { if let Some(Instruction::WriteIo(st)) = instruction_from_row(previous_row) { for i in 0..st.num_words() { let output_symbol_column = ProcessorTable::op_stack_column_by_index(i); @@ -168,18 +168,18 @@ fn extension_column_output_table_eval_argument( + output_symbol; } } - extension_column.push(output_table_running_evaluation); + auxiliary_column.push(output_table_running_evaluation); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_instruction_lookup_argument( - base_table: ArrayView2, +fn auxiliary_column_instruction_lookup_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { // collect all to-be-inverted elements for batch inversion let mut to_invert = vec![]; - for row in base_table.rows() { + for row in main_table.rows() { if row[IsPadding.main_index()].is_one() { break; // padding marks the end of the trace } @@ -190,57 +190,57 @@ fn extension_column_instruction_lookup_argument( to_invert.push(challenges[ChallengeId::InstructionLookupIndeterminate] - compressed_row); } - // populate extension column with inverses + // populate auxiliary column with inverses let mut instruction_lookup_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); for inverse in XFieldElement::batch_inversion(to_invert) { instruction_lookup_log_derivative += inverse; - extension_column.push(instruction_lookup_log_derivative); + auxiliary_column.push(instruction_lookup_log_derivative); } // fill padding section - extension_column.resize(base_table.nrows(), instruction_lookup_log_derivative); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), instruction_lookup_log_derivative); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_op_stack_table_perm_argument( - base_table: ArrayView2, +fn auxiliary_column_op_stack_table_perm_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut op_stack_table_running_product = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(op_stack_table_running_product); - for (prev, curr) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(op_stack_table_running_product); + for (prev, curr) in main_table.rows().into_iter().tuple_windows() { op_stack_table_running_product *= factor_for_op_stack_table_running_product(prev, curr, challenges); - extension_column.push(op_stack_table_running_product); + auxiliary_column.push(op_stack_table_running_product); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_ram_table_perm_argument( - base_table: ArrayView2, +fn auxiliary_column_ram_table_perm_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut ram_table_running_product = PermArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(ram_table_running_product); - for (prev, curr) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(ram_table_running_product); + for (prev, curr) in main_table.rows().into_iter().tuple_windows() { if let Some(f) = factor_for_ram_table_running_product(prev, curr, challenges) { ram_table_running_product *= f; }; - extension_column.push(ram_table_running_product); + auxiliary_column.push(ram_table_running_product); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_jump_stack_table_perm_argument( - base_table: ArrayView2, +fn auxiliary_column_jump_stack_table_perm_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut jump_stack_running_product = PermArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { let compressed_row = row[CLK.main_index()] * challenges[ChallengeId::JumpStackClkWeight] + row[CI.main_index()] * challenges[ChallengeId::JumpStackCiWeight] + row[JSP.main_index()] * challenges[ChallengeId::JumpStackJspWeight] @@ -248,14 +248,14 @@ fn extension_column_jump_stack_table_perm_argument( + row[JSD.main_index()] * challenges[ChallengeId::JumpStackJsdWeight]; jump_stack_running_product *= challenges[ChallengeId::JumpStackIndeterminate] - compressed_row; - extension_column.push(jump_stack_running_product); + auxiliary_column.push(jump_stack_running_product); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } /// Hash Table – `hash`'s or `merkle_step`'s input from Processor to Hash Coprocessor -fn extension_column_hash_input_eval_argument( - base_table: ArrayView2, +fn auxiliary_column_hash_input_eval_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let st0_through_st9 = [ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9]; @@ -265,8 +265,8 @@ fn extension_column_hash_input_eval_argument( let merkle_step_right_sibling = [HV0, HV1, HV2, HV3, HV4, ST0, ST1, ST2, ST3, ST4]; let mut hash_input_running_evaluation = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { let current_instruction = row[CI.main_index()]; if current_instruction == Instruction::Hash.opcode_b() || current_instruction == Instruction::MerkleStep.opcode_b() @@ -289,20 +289,20 @@ fn extension_column_hash_input_eval_argument( * challenges[ChallengeId::HashInputIndeterminate] + compressed_row; } - extension_column.push(hash_input_running_evaluation); + auxiliary_column.push(hash_input_running_evaluation); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } /// Hash Table – `hash`'s output from Hash Coprocessor to Processor -fn extension_column_hash_digest_eval_argument( - base_table: ArrayView2, +fn auxiliary_column_hash_digest_eval_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut hash_digest_running_evaluation = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(hash_digest_running_evaluation); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(hash_digest_running_evaluation); + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { let previous_ci = previous_row[CI.main_index()]; if previous_ci == Instruction::Hash.opcode_b() || previous_ci == Instruction::MerkleStep.opcode_b() @@ -318,23 +318,23 @@ fn extension_column_hash_digest_eval_argument( * challenges[ChallengeId::HashDigestIndeterminate] + compressed_row; } - extension_column.push(hash_digest_running_evaluation); + auxiliary_column.push(hash_digest_running_evaluation); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } /// Hash Table – `hash`'s or `merkle_step`'s input from Processor to Hash Coprocessor -fn extension_column_sponge_eval_argument( - base_table: ArrayView2, +fn auxiliary_column_sponge_eval_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let st0_through_st9 = [ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9]; let hash_state_weights = &challenges[ChallengeId::StackWeight0..ChallengeId::StackWeight10]; let mut sponge_running_evaluation = EvalArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(sponge_running_evaluation); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(sponge_running_evaluation); + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { let previous_ci = previous_row[CI.main_index()]; if previous_ci == Instruction::SpongeInit.opcode_b() { sponge_running_evaluation = sponge_running_evaluation @@ -377,18 +377,18 @@ fn extension_column_sponge_eval_argument( + challenges[ChallengeId::HashCIWeight] * Instruction::SpongeSqueeze.opcode_b() + compressed_row; } - extension_column.push(sponge_running_evaluation); + auxiliary_column.push(sponge_running_evaluation); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_for_u32_lookup_argument( - base_table: ArrayView2, +fn auxiliary_column_for_u32_lookup_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { // collect elements to be inverted for more performant batch inversion let mut to_invert = vec![]; - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { let previous_ci = previous_row[CI.main_index()]; if previous_ci == Instruction::Split.opcode_b() { let compressed_row = current_row[ST0.main_index()] @@ -457,9 +457,9 @@ fn extension_column_for_u32_lookup_argument( // populate column with inverses let mut u32_table_running_sum_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(u32_table_running_sum_log_derivative); - for (previous_row, _) in base_table.rows().into_iter().tuple_windows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(u32_table_running_sum_log_derivative); + for (previous_row, _) in main_table.rows().into_iter().tuple_windows() { let previous_ci = previous_row[CI.main_index()]; if Instruction::try_from(previous_ci) .unwrap() @@ -473,19 +473,19 @@ fn extension_column_for_u32_lookup_argument( u32_table_running_sum_log_derivative += inverses.next().unwrap(); } - extension_column.push(u32_table_running_sum_log_derivative); + auxiliary_column.push(u32_table_running_sum_log_derivative); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_for_clock_jump_difference_lookup_argument( - base_table: ArrayView2, +fn auxiliary_column_for_clock_jump_difference_lookup_argument( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { // collect inverses to batch invert let mut to_invert = vec![]; - for row in base_table.rows() { + for row in main_table.rows() { let lookup_multiplicity = row[ClockJumpDifferenceLookupMultiplicity.main_index()]; if !lookup_multiplicity.is_zero() { let clk = row[CLK.main_index()]; @@ -494,18 +494,18 @@ fn extension_column_for_clock_jump_difference_lookup_argument( } let mut inverses = XFieldElement::batch_inversion(to_invert).into_iter(); - // populate extension column with inverses + // populate auxiliary column with inverses let mut cjd_lookup_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { let lookup_multiplicity = row[ClockJumpDifferenceLookupMultiplicity.main_index()]; if !lookup_multiplicity.is_zero() { cjd_lookup_log_derivative += inverses.next().unwrap() * lookup_multiplicity; } - extension_column.push(cjd_lookup_log_derivative); + auxiliary_column.push(cjd_lookup_log_derivative); } - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } fn factor_for_op_stack_table_running_product( @@ -724,8 +724,8 @@ pub(crate) mod tests { #[derive(Debug, Clone)] struct TestRows { pub challenges: Challenges, - pub consecutive_master_base_table_rows: Array2, - pub consecutive_ext_base_table_rows: Array2, + pub consecutive_master_main_table_rows: Array2, + pub consecutive_master_aux_table_rows: Array2, } #[derive(Debug, Clone)] @@ -743,15 +743,15 @@ pub(crate) mod tests { program_and_input: ProgramAndInput, row_num: usize, ) -> TestRows { - let (_, _, master_base_table, master_ext_table, challenges) = + let (_, _, master_main_table, master_aux_table, challenges) = master_tables_for_low_security_level(program_and_input); TestRows { challenges, - consecutive_master_base_table_rows: master_base_table + consecutive_master_main_table_rows: master_main_table .trace_table() .slice(s![row_num..=row_num + 1, ..]) .to_owned(), - consecutive_ext_base_table_rows: master_ext_table + consecutive_master_aux_table_rows: master_aux_table .trace_table() .slice(s![row_num..=row_num + 1, ..]) .to_owned(), @@ -770,8 +770,8 @@ pub(crate) mod tests { ); for (case_idx, rows) in test_rows.iter().enumerate() { - let curr_row = rows.consecutive_master_base_table_rows.slice(s![0, ..]); - let next_row = rows.consecutive_master_base_table_rows.slice(s![1, ..]); + let curr_row = rows.consecutive_master_main_table_rows.slice(s![0, ..]); + let next_row = rows.consecutive_master_main_table_rows.slice(s![1, ..]); println!("Testing all constraints of {instruction} for test case {case_idx}…"); for &c in &debug_info.debug_cols_curr_row { @@ -790,8 +790,8 @@ pub(crate) mod tests { for (constraint_idx, constraint) in transition_constraints.iter().enumerate() { let evaluation_result = constraint.clone().consume().evaluate( - rows.consecutive_master_base_table_rows.view(), - rows.consecutive_ext_base_table_rows.view(), + rows.consecutive_master_main_table_rows.view(), + rows.consecutive_master_aux_table_rows.view(), &rows.challenges.challenges, ); assert!( diff --git a/triton-vm/src/table/program.rs b/triton-vm/src/table/program.rs index 46b2d399d..8b1558079 100644 --- a/triton-vm/src/table/program.rs +++ b/triton-vm/src/table/program.rs @@ -124,7 +124,7 @@ impl TraceTable for ProgramTable { { let row = consecutive_rows.row(0); let next_row = consecutive_rows.row(1); - let mut extension_row = aux_table.row_mut(idx); + let mut auxiliary_row = aux_table.row_mut(idx); // In the Program Table, the logarithmic derivative for the instruction lookup // argument does record the initial in the first row, as an exception to all other @@ -137,7 +137,7 @@ impl TraceTable for ProgramTable { // The logarithmic derivative's final value, allowing for a meaningful cross-table // argument, is recorded in the first padding row. This row is guaranteed to exist // due to the hash-input padding mechanics. - extension_row[InstructionLookupServerLogDerivative.aux_index()] = + auxiliary_row[InstructionLookupServerLogDerivative.aux_index()] = instruction_lookup_log_derivative; instruction_lookup_log_derivative = update_instruction_lookup_log_derivative( @@ -158,9 +158,9 @@ impl TraceTable for ProgramTable { prepare_chunk_running_evaluation, ); - extension_row[PrepareChunkRunningEvaluation.aux_index()] = + auxiliary_row[PrepareChunkRunningEvaluation.aux_index()] = prepare_chunk_running_evaluation; - extension_row[SendChunkRunningEvaluation.aux_index()] = send_chunk_running_evaluation; + auxiliary_row[SendChunkRunningEvaluation.aux_index()] = send_chunk_running_evaluation; } // special treatment for the last row diff --git a/triton-vm/src/table/ram.rs b/triton-vm/src/table/ram.rs index d5807a24e..91f2ce81a 100644 --- a/triton-vm/src/table/ram.rs +++ b/triton-vm/src/table/ram.rs @@ -96,37 +96,37 @@ impl TraceTable for RamTable { } fn extend( - base_table: ArrayView2, - mut ext_table: ArrayViewMut2, + main_table: ArrayView2, + mut aux_table: ArrayViewMut2, challenges: &Challenges, ) { profiler!(start "ram table"); - assert_eq!(Self::MainColumn::COUNT, base_table.ncols()); - assert_eq!(Self::AuxColumn::COUNT, ext_table.ncols()); - assert_eq!(base_table.nrows(), ext_table.nrows()); + assert_eq!(Self::MainColumn::COUNT, main_table.ncols()); + assert_eq!(Self::AuxColumn::COUNT, aux_table.ncols()); + assert_eq!(main_table.nrows(), aux_table.nrows()); - let extension_column_indices = RamAuxColumn::iter() + let auxiliary_column_indices = RamAuxColumn::iter() // RunningProductOfRAMP + FormalDerivative are constitute one // slice and are populated by the same function .filter(|column| *column != RamAuxColumn::FormalDerivative) .map(|column| column.aux_index()) .collect_vec(); - let extension_column_slices = horizontal_multi_slice_mut( - ext_table.view_mut(), - &contiguous_column_slices(&extension_column_indices), + let auxiliary_column_slices = horizontal_multi_slice_mut( + aux_table.view_mut(), + &contiguous_column_slices(&auxiliary_column_indices), ); let extension_functions = [ - extension_column_running_product_of_ramp_and_formal_derivative, - extension_column_bezout_coefficient_0, - extension_column_bezout_coefficient_1, - extension_column_running_product_perm_arg, - extension_column_clock_jump_difference_lookup_log_derivative, + auxiliary_column_running_product_of_ramp_and_formal_derivative, + auxiliary_column_bezout_coefficient_0, + auxiliary_column_bezout_coefficient_1, + auxiliary_column_running_product_perm_arg, + auxiliary_column_clock_jump_difference_lookup_log_derivative, ]; extension_functions .into_par_iter() - .zip_eq(extension_column_slices) + .zip_eq(auxiliary_column_slices) .for_each(|(generator, slice)| { - generator(base_table, challenges).move_into(slice); + generator(main_table, challenges).move_into(slice); }); profiler!(stop "ram table"); @@ -236,21 +236,21 @@ fn make_ram_table_consistent( clock_jump_differences } -fn extension_column_running_product_of_ramp_and_formal_derivative( - base_table: ArrayView2, +fn auxiliary_column_running_product_of_ramp_and_formal_derivative( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let bezout_indeterminate = challenges[RamTableBezoutRelationIndeterminate]; - let mut extension_columns = Vec::with_capacity(2 * base_table.nrows()); + let mut auxiliary_columns = Vec::with_capacity(2 * main_table.nrows()); let mut running_product_ram_pointer = - bezout_indeterminate - base_table.row(0)[RamPointer.main_index()]; + bezout_indeterminate - main_table.row(0)[RamPointer.main_index()]; let mut formal_derivative = xfe!(1); - extension_columns.push(running_product_ram_pointer); - extension_columns.push(formal_derivative); + auxiliary_columns.push(running_product_ram_pointer); + auxiliary_columns.push(formal_derivative); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { let instruction_type = current_row[InstructionType.main_index()]; let is_no_padding_row = instruction_type != PADDING_INDICATOR; @@ -265,47 +265,47 @@ fn extension_column_running_product_of_ramp_and_formal_derivative( } } - extension_columns.push(running_product_ram_pointer); - extension_columns.push(formal_derivative); + auxiliary_columns.push(running_product_ram_pointer); + auxiliary_columns.push(formal_derivative); } - Array2::from_shape_vec((base_table.nrows(), 2), extension_columns).unwrap() + Array2::from_shape_vec((main_table.nrows(), 2), auxiliary_columns).unwrap() } -fn extension_column_bezout_coefficient_0( - base_table: ArrayView2, +fn auxiliary_column_bezout_coefficient_0( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { - extension_column_bezout_coefficient( - base_table, + auxiliary_column_bezout_coefficient( + main_table, challenges, BezoutCoefficientPolynomialCoefficient0, ) } -fn extension_column_bezout_coefficient_1( - base_table: ArrayView2, +fn auxiliary_column_bezout_coefficient_1( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { - extension_column_bezout_coefficient( - base_table, + auxiliary_column_bezout_coefficient( + main_table, challenges, BezoutCoefficientPolynomialCoefficient1, ) } -fn extension_column_bezout_coefficient( - base_table: ArrayView2, +fn auxiliary_column_bezout_coefficient( + main_table: ArrayView2, challenges: &Challenges, bezout_cefficient_column: RamMainColumn, ) -> Array2 { let bezout_indeterminate = challenges[RamTableBezoutRelationIndeterminate]; - let mut bezout_coefficient = base_table.row(0)[bezout_cefficient_column.main_index()].lift(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(bezout_coefficient); + let mut bezout_coefficient = main_table.row(0)[bezout_cefficient_column.main_index()].lift(); + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(bezout_coefficient); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { if current_row[InstructionType.main_index()] == PADDING_INDICATOR { break; // padding marks the end of the trace } @@ -316,21 +316,21 @@ fn extension_column_bezout_coefficient( bezout_coefficient *= bezout_indeterminate; bezout_coefficient += current_row[bezout_cefficient_column.main_index()]; } - extension_column.push(bezout_coefficient); + auxiliary_column.push(bezout_coefficient); } // fill padding section - extension_column.resize(base_table.nrows(), bezout_coefficient); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), bezout_coefficient); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_running_product_perm_arg( - base_table: ArrayView2, +fn auxiliary_column_running_product_perm_arg( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let mut running_product_for_perm_arg = PermArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - for row in base_table.rows() { + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + for row in main_table.rows() { let instruction_type = row[InstructionType.main_index()]; if instruction_type == PADDING_INDICATOR { break; // padding marks the end of the trace @@ -344,25 +344,25 @@ fn extension_column_running_product_perm_arg( + current_ram_pointer * challenges[RamPointerWeight] + ram_value * challenges[RamValueWeight]; running_product_for_perm_arg *= challenges[RamIndeterminate] - compressed_row; - extension_column.push(running_product_for_perm_arg); + auxiliary_column.push(running_product_for_perm_arg); } // fill padding section - extension_column.resize(base_table.nrows(), running_product_for_perm_arg); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), running_product_for_perm_arg); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } -fn extension_column_clock_jump_difference_lookup_log_derivative( - base_table: ArrayView2, +fn auxiliary_column_clock_jump_difference_lookup_log_derivative( + main_table: ArrayView2, challenges: &Challenges, ) -> Array2 { let indeterminate = challenges[ClockJumpDifferenceLookupIndeterminate]; let mut cjd_lookup_log_derivative = LookupArg::default_initial(); - let mut extension_column = Vec::with_capacity(base_table.nrows()); - extension_column.push(cjd_lookup_log_derivative); + let mut auxiliary_column = Vec::with_capacity(main_table.nrows()); + auxiliary_column.push(cjd_lookup_log_derivative); - for (previous_row, current_row) in base_table.rows().into_iter().tuple_windows() { + for (previous_row, current_row) in main_table.rows().into_iter().tuple_windows() { if current_row[InstructionType.main_index()] == PADDING_INDICATOR { break; // padding marks the end of the trace } @@ -376,12 +376,12 @@ fn extension_column_clock_jump_difference_lookup_log_derivative( let log_derivative_summand = (indeterminate - clock_jump_difference).inverse(); cjd_lookup_log_derivative += log_derivative_summand; } - extension_column.push(cjd_lookup_log_derivative); + auxiliary_column.push(cjd_lookup_log_derivative); } // fill padding section - extension_column.resize(base_table.nrows(), cjd_lookup_log_derivative); - Array2::from_shape_vec((base_table.nrows(), 1), extension_column).unwrap() + auxiliary_column.resize(main_table.nrows(), cjd_lookup_log_derivative); + Array2::from_shape_vec((main_table.nrows(), 1), auxiliary_column).unwrap() } #[cfg(test)] diff --git a/triton-vm/src/table/u32.rs b/triton-vm/src/table/u32.rs index 85f4bb2b7..15fa7e796 100644 --- a/triton-vm/src/table/u32.rs +++ b/triton-vm/src/table/u32.rs @@ -119,14 +119,14 @@ impl TraceTable for U32Table { } fn extend( - base_table: ArrayView2, - mut ext_table: ArrayViewMut2, + main_table: ArrayView2, + mut aux_table: ArrayViewMut2, challenges: &Challenges, ) { profiler!(start "u32 table"); - assert_eq!(MainColumn::COUNT, base_table.ncols()); - assert_eq!(AuxColumn::COUNT, ext_table.ncols()); - assert_eq!(base_table.nrows(), ext_table.nrows()); + assert_eq!(MainColumn::COUNT, main_table.ncols()); + assert_eq!(AuxColumn::COUNT, aux_table.ncols()); + assert_eq!(main_table.nrows(), aux_table.nrows()); let ci_weight = challenges[U32CiWeight]; let lhs_weight = challenges[U32LhsWeight]; @@ -135,8 +135,8 @@ impl TraceTable for U32Table { let lookup_indeterminate = challenges[U32Indeterminate]; let mut running_sum_log_derivative = LookupArg::default_initial(); - for row_idx in 0..base_table.nrows() { - let current_row = base_table.row(row_idx); + for row_idx in 0..main_table.nrows() { + let current_row = main_table.row(row_idx); if current_row[MainColumn::CopyFlag.main_index()].is_one() { let lookup_multiplicity = current_row[MainColumn::LookupMultiplicity.main_index()]; let compressed_row = ci_weight * current_row[MainColumn::CI.main_index()] @@ -147,8 +147,8 @@ impl TraceTable for U32Table { lookup_multiplicity * (lookup_indeterminate - compressed_row).inverse(); } - let mut extension_row = ext_table.row_mut(row_idx); - extension_row[AuxColumn::LookupServerLogDerivative.aux_index()] = + let mut auxiliary_row = aux_table.row_mut(row_idx); + auxiliary_row[AuxColumn::LookupServerLogDerivative.aux_index()] = running_sum_log_derivative; } profiler!(stop "u32 table");