binius_verifier/protocols/shift/mod.rs
1// Copyright 2025 Irreducible Inc.
2// Copyright 2026 The Binius Developers
3
4use binius_core::word::Word;
5
6/// The base-2 logarithm of [`SHIFT_VARIANT_COUNT`].
7///
8/// Phase 1 folds the shift variant with this many sumcheck variables, in the high index
9/// positions of its two multilinears.
10pub const LOG_SHIFT_VARIANT_COUNT: usize = 3;
11pub const SHIFT_VARIANT_COUNT: usize = 1 << LOG_SHIFT_VARIANT_COUNT;
12
13/// The number of variables the shift reduction's sumcheck binds outside the word index.
14///
15/// A shifted value index names two shifts applied in sequence, so the claim sums over two shift
16/// slots — a variant and an amount each — and three bit indices: the witness bit the inner shift
17/// reads, the intermediate-word bit the two indicators meet at, and the output bit the oblong
18/// weights attach to. This counts all of those; the word index is sized by the constraint system.
19pub const SHIFT_LOG_VARS: usize = Word::LOG_BITS * 3 + 2 * LOG_SHIFT_COUNT;
20
21/// The number of index bits one shift slot occupies: the variant above the amount.
22///
23/// A reduction axis over one slot is this many variables wide, which is what
24/// [`Shift::index`](binius_core::constraint_system::Shift::index) addresses.
25pub const LOG_SHIFT_COUNT: usize = LOG_SHIFT_VARIANT_COUNT + Word::LOG_BITS;
26
27/// The number of `(variant, amount)` spellings one shift slot can take.
28///
29/// A shift is a variant paired with an amount below the word width.
30/// One weight table per shift slot has this many entries.
31///
32/// A term carries two slots, so the sequences it could name number the square of this.
33/// The weight factorizes across the slots, so two tables of this size replace one of that square.
34pub const SHIFT_COUNT: usize = 1 << LOG_SHIFT_COUNT;
35
36mod shift_ind;
37
38mod error;
39mod verify;
40mod wiring;
41
42pub use error::Error;
43pub use shift_ind::evaluate_shift_inds;
44pub use verify::{
45 DeferredWiringClaim, VerifyOutput, WiringEvalClaim, check_eval, evaluate_words_mle, verify,
46};
47pub use wiring::WiringInfo;