Skip to main content

zinc_uair/
lookup_types.rs

1//! Lookup specification types.
2//!
3//! Pure data types describing which trace columns need lookup verification
4//! and against which table type. These live in `zinc-uair` because they
5//! belong to the AIR's structural interface — UAIRs declare them as part
6//! of [`UairSignature`] via `UairSignature::new(..., lookup_specs)`, the
7//! same way shifts are declared.
8
9/// Describes the type of lookup table a column should be checked against.
10/// Full table size = `2^width` for each type; decomposed into chunks of
11/// `chunk_width`
12#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
13pub enum LookupTableType {
14    /// Binary polynomials of degree less than `width`, projected into the prime
15    /// field.
16    BitPoly {
17        width: usize,
18        chunk_width: Option<usize>,
19    },
20    /// Unsigned integers fitting in `width` bits.
21    Word {
22        width: usize,
23        chunk_width: Option<usize>,
24    },
25}
26
27/// Specifies that a trace column should be looked up against a prescribed
28/// table.
29#[derive(Clone, Debug)]
30pub struct LookupColumnSpec {
31    /// 0-based index into the projected field-element trace.
32    pub column_index: usize,
33    /// The lookup table type this column should be checked against.
34    pub table_type: LookupTableType,
35}