From 613e08486467624018e7c0bbaf5c789257afb593 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Mon, 14 Nov 2022 23:31:59 +0100 Subject: [PATCH] perform low-degree extension over two domains: arithmetic and fri (#114) --- triton-vm/src/stark.rs | 33 ++++-- triton-vm/src/table/base_table.rs | 36 +++++-- triton-vm/src/table/hash_table.rs | 53 ++++++--- triton-vm/src/table/instruction_table.rs | 48 ++++++--- triton-vm/src/table/jump_stack_table.rs | 50 ++++++--- triton-vm/src/table/op_stack_table.rs | 48 ++++++--- triton-vm/src/table/processor_table.rs | 54 ++++++---- triton-vm/src/table/program_table.rs | 48 ++++++--- triton-vm/src/table/ram_table.rs | 49 ++++++--- triton-vm/src/table/table_collection.rs | 132 +++++++++++++++-------- 10 files changed, 395 insertions(+), 156 deletions(-) diff --git a/triton-vm/src/stark.rs b/triton-vm/src/stark.rs index 04cec1877..3eea7eb09 100644 --- a/triton-vm/src/stark.rs +++ b/triton-vm/src/stark.rs @@ -24,6 +24,7 @@ use triton_profiler::{prof_itr0, prof_start, prof_stop}; use crate::cross_table_arguments::{ CrossTableArg, EvalArg, GrandCrossTableArg, NUM_CROSS_TABLE_ARGS, NUM_PUBLIC_EVAL_ARGS, }; +use crate::domain::Domain; use crate::fri::{Fri, FriValidationError}; use crate::proof::{Claim, Proof}; use crate::proof_item::ProofItem; @@ -147,13 +148,17 @@ impl Stark { let (x_rand_codeword, b_rand_codewords) = self.get_randomizer_codewords(); - prof_start!(maybe_profiler, "LDE 1"); - let base_fri_domain_tables = base_trace_tables - .to_fri_domain_tables(&self.fri.domain, self.parameters.num_trace_randomizers); + prof_start!(maybe_profiler, "dual LDE 1"); + let arithmetic_domain = self.arithmetic_domain(); + let base_fri_domain_tables = base_trace_tables.to_arithmetic_and_fri_domain_tables( + &arithmetic_domain, + &self.fri.domain, + self.parameters.num_trace_randomizers, + ); let base_fri_domain_codewords = base_fri_domain_tables.get_all_base_columns(); let randomizer_and_base_fri_domain_codewords = vec![b_rand_codewords, base_fri_domain_codewords.clone()].concat(); - prof_stop!(maybe_profiler, "LDE 1"); + prof_stop!(maybe_profiler, "dual LDE 1"); prof_start!(maybe_profiler, "Merkle tree 1"); let transposed_base_codewords = transpose(&randomizer_and_base_fri_domain_codewords); @@ -182,12 +187,14 @@ impl Stark { ); prof_stop!(maybe_profiler, "extend"); - prof_start!(maybe_profiler, "LDE 2"); - let ext_fri_domain_tables = ext_trace_tables - .to_fri_domain_tables(&self.fri.domain, self.parameters.num_trace_randomizers); + prof_start!(maybe_profiler, "dual LDE 2"); + let ext_fri_domain_tables = ext_trace_tables.to_arithmetic_and_fri_domain_tables( + &arithmetic_domain, + &self.fri.domain, + self.parameters.num_trace_randomizers, + ); let extension_fri_domain_codewords = ext_fri_domain_tables.collect_all_columns(); - - prof_stop!(maybe_profiler, "LDE 2"); + prof_stop!(maybe_profiler, "dual LDE 2"); prof_start!(maybe_profiler, "Merkle tree 2"); let transposed_ext_codewords = transpose(&extension_fri_domain_codewords); @@ -384,6 +391,14 @@ impl Stark { proof_stream.to_proof() } + fn arithmetic_domain(&self) -> Domain { + let offset = self.fri.domain.offset; + let expansion_factor = self.fri.expansion_factor; + let generator = self.fri.domain.generator.mod_pow(expansion_factor as u64); + let length = self.fri.domain.length / expansion_factor; + Domain::new(offset, generator, length) + } + fn get_revealed_indices( &self, unit_distance: usize, diff --git a/triton-vm/src/table/base_table.rs b/triton-vm/src/table/base_table.rs index 0f3c74b50..11bd73043 100644 --- a/triton-vm/src/table/base_table.rs +++ b/triton-vm/src/table/base_table.rs @@ -267,18 +267,36 @@ where self.inherited_table().name.clone() } - fn low_degree_extension( + /// Low-degree extends the trace that is `self` over the indicated columns `columns` and + /// returns two codewords per column: + /// - one codeword evaluated on the `arithmetic_domain`, and + /// - one codeword evaluated on the `fri_domain`, + /// in that order. + fn dual_low_degree_extension( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, - omicron: BFieldElement, + trace_domain_generator: BFieldElement, num_trace_randomizers: usize, columns: Range, - ) -> Vec> { - // FIXME: Table<> supports Vec<[FF; WIDTH]>, but FriDomain does not (yet). - self.interpolate_columns(omicron, num_trace_randomizers, columns) + ) -> (Table, Table) { + // FIXME: Table<> supports Vec<[FF; WIDTH]>, but Domain does not (yet). + let interpolated_columns = + self.interpolate_columns(trace_domain_generator, num_trace_randomizers, columns); + let arithmetic_domain_codewords = interpolated_columns + .par_iter() + .map(|polynomial| arithmetic_domain.evaluate(polynomial)) + .collect(); + let arithmetic_domain_codeword_table = self + .inherited_table() + .with_data(arithmetic_domain_codewords); + let fri_domain_codewords = interpolated_columns .par_iter() .map(|polynomial| fri_domain.evaluate(polynomial)) - .collect() + .collect(); + let fri_domain_codeword_table = self.inherited_table().with_data(fri_domain_codewords); + + (arithmetic_domain_codeword_table, fri_domain_codeword_table) } /// Return the interpolation of columns. The `column_indices` variable @@ -286,7 +304,7 @@ where /// if it is called with a subset, it *will* fail. fn interpolate_columns( &self, - omicron: BFieldElement, + trace_domain_generator: BFieldElement, num_trace_randomizers: usize, columns: Range, ) -> Vec> { @@ -302,8 +320,8 @@ where self.name() ); - let trace_domain = - Domain::new(BFieldElement::one(), omicron, padded_height).domain_values(); + let trace_domain = Domain::new(BFieldElement::one(), trace_domain_generator, padded_height) + .domain_values(); let randomizer_domain = disjoint_domain(num_trace_randomizers, &trace_domain); let interpolation_domain = vec![trace_domain, randomizer_domain].concat(); diff --git a/triton-vm/src/table/hash_table.rs b/triton-vm/src/table/hash_table.rs index b5d35d2a9..f04a0f436 100644 --- a/triton-vm/src/table/hash_table.rs +++ b/triton-vm/src/table/hash_table.rs @@ -631,22 +631,34 @@ impl ExtHashTable { } impl HashTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new(BASE_WIDTH, FULL_WIDTH, matrix, "HashTable".to_string()); Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, - omicron: BFieldElement, + trace_domain_generator: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + trace_domain_generator, + num_trace_randomizers, + base_columns, + ); + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -784,18 +796,29 @@ impl HashTable { } impl ExtHashTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, - omicron: BFieldElement, + trace_domain_generator: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); - - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - ExtHashTable { inherited_table } + let (arithmetic_domain_table_ext, fri_domain_table_ext) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + trace_domain_generator, + num_trace_randomizers, + ext_columns, + ); + ( + Self::new(arithmetic_domain_table_ext), + Self::new(fri_domain_table_ext), + ) } } diff --git a/triton-vm/src/table/instruction_table.rs b/triton-vm/src/table/instruction_table.rs index 115270fb6..91d7b5301 100644 --- a/triton-vm/src/table/instruction_table.rs +++ b/triton-vm/src/table/instruction_table.rs @@ -330,6 +330,10 @@ impl ExtInstructionTable { } impl InstructionTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new( BASE_WIDTH, @@ -340,17 +344,25 @@ impl InstructionTable { Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + base_columns, + ); + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -469,18 +481,30 @@ impl InstructionTable { } impl ExtInstructionTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ext_columns, + ); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - ExtInstructionTable { inherited_table } + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } } diff --git a/triton-vm/src/table/jump_stack_table.rs b/triton-vm/src/table/jump_stack_table.rs index ecf92c18a..119d22d99 100644 --- a/triton-vm/src/table/jump_stack_table.rs +++ b/triton-vm/src/table/jump_stack_table.rs @@ -320,23 +320,36 @@ impl ExtJumpStackTable { } impl JumpStackTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new(BASE_WIDTH, FULL_WIDTH, matrix, "JumpStackTable".to_string()); Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + base_columns, + ); + + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -448,18 +461,29 @@ impl JumpStackTable { } impl ExtJumpStackTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); - - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - ExtJumpStackTable { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ext_columns, + ); + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } } diff --git a/triton-vm/src/table/op_stack_table.rs b/triton-vm/src/table/op_stack_table.rs index 43f8d8d27..c1f11b883 100644 --- a/triton-vm/src/table/op_stack_table.rs +++ b/triton-vm/src/table/op_stack_table.rs @@ -278,23 +278,35 @@ impl ExtOpStackTable { } impl OpStackTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new(BASE_WIDTH, FULL_WIDTH, matrix, "OpStackTable".to_string()); Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + base_columns, + ); + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -394,18 +406,30 @@ impl OpStackTable { } impl ExtOpStackTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ext_columns, + ); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - ExtOpStackTable { inherited_table } + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } } diff --git a/triton-vm/src/table/processor_table.rs b/triton-vm/src/table/processor_table.rs index 6ab434364..7c1f5e923 100644 --- a/triton-vm/src/table/processor_table.rs +++ b/triton-vm/src/table/processor_table.rs @@ -52,23 +52,35 @@ impl InheritsFromTable for ProcessorTable { } impl ProcessorTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new(BASE_WIDTH, FULL_WIDTH, matrix, "ProcessorTable".to_string()); Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + base_columns, + ); + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -350,24 +362,30 @@ impl ProcessorTable { } impl ExtProcessorTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); - - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - Self::new(inherited_table) - } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ext_columns, + ); - pub fn new(base: Table) -> ExtProcessorTable { - Self { - inherited_table: base, - } + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } /// Instruction-specific transition constraints are combined with deselectors in such a way diff --git a/triton-vm/src/table/program_table.rs b/triton-vm/src/table/program_table.rs index a6219f45b..4515ff9db 100644 --- a/triton-vm/src/table/program_table.rs +++ b/triton-vm/src/table/program_table.rs @@ -185,23 +185,35 @@ impl ExtProgramTable { } impl ProgramTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new(BASE_WIDTH, FULL_WIDTH, matrix, "ProgramTable".to_string()); Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + base_columns, + ); + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -291,18 +303,30 @@ impl ProgramTable { } impl ExtProgramTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ext_columns, + ); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - ExtProgramTable { inherited_table } + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } } diff --git a/triton-vm/src/table/ram_table.rs b/triton-vm/src/table/ram_table.rs index 322f91ab2..25cc4160f 100644 --- a/triton-vm/src/table/ram_table.rs +++ b/triton-vm/src/table/ram_table.rs @@ -79,22 +79,35 @@ impl InheritsFromTable for ExtRamTable { } impl RamTable { + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + pub fn new_prover(matrix: Vec>) -> Self { let inherited_table = Table::new(BASE_WIDTH, FULL_WIDTH, matrix, "RamTable".to_string()); Self { inherited_table } } - pub fn to_fri_domain_table( + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let base_columns = 0..self.base_width(); - let fri_domain_codewords = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, base_columns); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords); - Self { inherited_table } + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + base_columns, + ); + + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } pub fn extend( @@ -213,18 +226,30 @@ impl RamTable { } impl ExtRamTable { - pub fn to_fri_domain_table( + pub fn new(inherited_table: Table) -> Self { + Self { inherited_table } + } + + pub fn to_arithmetic_and_fri_domain_table( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, omicron: BFieldElement, num_trace_randomizers: usize, - ) -> Self { + ) -> (Self, Self) { let ext_columns = self.base_width()..self.full_width(); - let fri_domain_codewords_ext = - self.low_degree_extension(fri_domain, omicron, num_trace_randomizers, ext_columns); + let (arithmetic_domain_table, fri_domain_table) = self.dual_low_degree_extension( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ext_columns, + ); - let inherited_table = self.inherited_table.with_data(fri_domain_codewords_ext); - ExtRamTable { inherited_table } + ( + Self::new(arithmetic_domain_table), + Self::new(fri_domain_table), + ) } } diff --git a/triton-vm/src/table/table_collection.rs b/triton-vm/src/table/table_collection.rs index a3bba3835..d0276c2ae 100644 --- a/triton-vm/src/table/table_collection.rs +++ b/triton-vm/src/table/table_collection.rs @@ -132,35 +132,57 @@ impl BaseTableCollection { roundup_npo2(max_height as u64) as usize } - pub fn to_fri_domain_tables( + pub fn to_arithmetic_and_fri_domain_tables( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, num_trace_randomizers: usize, ) -> BaseTableCollection { let padded_height = self.padded_height; let omicron = derive_omicron(padded_height as u64); - let program_table = - self.program_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let instruction_table = - self.instruction_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let processor_table = - self.processor_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let op_stack_table = - self.op_stack_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let ram_table = - self.ram_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let jump_stack_table = - self.jump_stack_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let hash_table = - self.hash_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); + let (_, program_table) = self.program_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, instruction_table) = self.instruction_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, processor_table) = self.processor_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, op_stack_table) = self.op_stack_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, ram_table) = self.ram_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, jump_stack_table) = self.jump_stack_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, hash_table) = self.hash_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); BaseTableCollection { padded_height, @@ -347,35 +369,57 @@ impl ExtTableCollection { } /// Heads up: only extension columns are being low degree extended. todo: better naming. - pub fn to_fri_domain_tables( + pub fn to_arithmetic_and_fri_domain_tables( &self, + arithmetic_domain: &Domain, fri_domain: &Domain, num_trace_randomizers: usize, ) -> Self { let padded_height = self.padded_height; let omicron = derive_omicron(padded_height as u64); - let program_table = - self.program_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let instruction_table = - self.instruction_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let processor_table = - self.processor_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let op_stack_table = - self.op_stack_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let ram_table = - self.ram_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let jump_stack_table = - self.jump_stack_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); - let hash_table = - self.hash_table - .to_fri_domain_table(fri_domain, omicron, num_trace_randomizers); + let (_, program_table) = self.program_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, instruction_table) = self.instruction_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, processor_table) = self.processor_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, op_stack_table) = self.op_stack_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, ram_table) = self.ram_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, jump_stack_table) = self.jump_stack_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); + let (_, hash_table) = self.hash_table.to_arithmetic_and_fri_domain_table( + arithmetic_domain, + fri_domain, + omicron, + num_trace_randomizers, + ); ExtTableCollection { padded_height,