stwo_gpu/core/air/mod.rs
1use std_shims::Vec;
2
3use self::accumulation::PointEvaluationAccumulator;
4use super::circle::CirclePoint;
5use super::fields::qm31::SecureField;
6use super::pcs::TreeVec;
7use super::ColumnVec;
8
9pub mod accumulation;
10mod components;
11pub use components::Components;
12
13/// Arithmetic Intermediate Representation (AIR).
14///
15/// An Air instance is assumed to already contain all the information needed to evaluate the
16/// constraints. For instance, all interaction elements are assumed to be present in it. Therefore,
17/// an AIR is generated only after the initial trace commitment phase.
18pub trait Air {
19 fn components(&self) -> Vec<&dyn Component>;
20}
21
22/// A component is a set of trace columns of various sizes along with a set of
23/// constraints on them.
24pub trait Component {
25 fn n_constraints(&self) -> usize;
26
27 fn max_constraint_log_degree_bound(&self) -> u32;
28
29 /// Returns the degree bounds of each trace column. The returned TreeVec should be of size
30 /// `n_interaction_phases`.
31 fn trace_log_degree_bounds(&self) -> TreeVec<ColumnVec<u32>>;
32
33 /// Returns the mask points for each trace column. The returned TreeVec should be of size
34 /// `n_interaction_phases`.
35 /// The parameter `max_log_degree_bound` is the maximum log degree of a committed polynomial
36 /// in the pcs (this number is known to both prover and verifier). The mask points are
37 /// translations of `point` by a multiple of the generator of the canonical coset of log size
38 /// `max_log_degree_bound`.
39 fn mask_points(
40 &self,
41 point: CirclePoint<SecureField>,
42 max_log_degree_bound: u32,
43 ) -> TreeVec<ColumnVec<Vec<CirclePoint<SecureField>>>>;
44
45 fn preprocessed_column_indices(&self) -> ColumnVec<usize>;
46
47 /// Evaluates the lifted constraint quotients accumulation of the component at `point`.
48 fn evaluate_constraint_quotients_at_point(
49 &self,
50 point: CirclePoint<SecureField>,
51 mask: &TreeVec<ColumnVec<Vec<SecureField>>>,
52 evaluation_accumulator: &mut PointEvaluationAccumulator,
53 max_log_degree_bound: u32,
54 );
55}