@@ -53,17 +53,17 @@ const MIN_CYCLE_LENGTH: usize = 2;
5353/// [math::fields] for available field options).
5454/// 2. Define a set of public inputs which are required for your computation via the
5555/// [Air::PublicInputs] associated type.
56- /// 3. Implement [Air::new()] function. As a part of this function you should create a
57- /// [AirContext] struct which takes degrees for all transition constraints as one of
58- /// the constructor parameters.
59- /// 4. Implement [Air::context()] method which should return a reference to the
60- /// [AirContext] struct created in [Air::new()] function.
61- /// 5. Implement [Air::evaluate_transition()] method which should evaluate
62- /// [transition constraints](#transition-constraints) over a given evaluation frame.
56+ /// 3. Implement [Air::new()] function. As a part of this function you should create a [AirContext]
57+ /// struct which takes degrees for all transition constraints as one of the constructor
58+ /// parameters.
59+ /// 4. Implement [Air::context()] method which should return a reference to the [AirContext] struct
60+ /// created in [Air::new()] function.
61+ /// 5. Implement [Air::evaluate_transition()] method which should evaluate [transition
62+ /// constraints](#transition-constraints) over a given evaluation frame.
6363/// 6. Implement [Air::get_assertions()] method which should return a vector of
6464/// [assertions](#trace-assertions) for a given instance of your computation.
65- /// 7. If your computation requires [periodic values](#periodic-values), you can also override
66- /// the default [Air::get_periodic_column_values()] method.
65+ /// 7. If your computation requires [periodic values](#periodic-values), you can also override the
66+ /// default [Air::get_periodic_column_values()] method.
6767///
6868/// If your computation uses [Randomized AIR](#randomized-air), you will also need to override
6969/// [Air::evaluate_aux_transition()] and [Air::get_aux_assertions()] methods.
@@ -73,21 +73,20 @@ const MIN_CYCLE_LENGTH: usize = 2;
7373/// computation. In Winterfell, transition constraints are evaluated inside
7474/// [Air::evaluate_transition()] function which takes the following parameters:
7575///
76- /// - [EvaluationFrame] which contains vectors with current and next states of the
76+ /// - [EvaluationFrame] which contains vectors with current and next states of the computation.
77+ /// - A list of periodic values. When periodic columns are defined for a computation, this will
78+ /// contain values of periodic columns at the current step of the computation. Otherwise, this
79+ /// will be an empty list.
80+ /// - A mutable `result` slice. This is the slice where constraint evaluations should be written to.
81+ /// The length of this slice will be equal to the number of transition constraints defined for the
7782/// computation.
78- /// - A list of periodic values. When periodic columns are defined for a computation,
79- /// this will contain values of periodic columns at the current step of the computation.
80- /// Otherwise, this will be an empty list.
81- /// - A mutable `result` slice. This is the slice where constraint evaluations should be
82- /// written to. The length of this slice will be equal to the number of transition
83- /// constraints defined for the computation.
8483///
8584/// The constraints are considered to be satisfied if and only if, after the function returns,
8685/// the `result` slice contains all zeros. In general, it is important for the transition
8786/// constraint evaluation function to work as follows:
8887///
89- /// * For all valid transitions between consecutive computation steps, transition constraints
90- /// should evaluation to all zeros.
88+ /// * For all valid transitions between consecutive computation steps, transition constraints should
89+ /// evaluation to all zeros.
9190/// * For any invalid transition, at least one constraint must evaluate to a non-zero value.
9291///
9392/// **Note:** since transition constraints define algebraic relations, they should be
@@ -102,16 +101,16 @@ const MIN_CYCLE_LENGTH: usize = 2;
102101///
103102/// * All trace columns have degree `1`.
104103/// * When multiplying trace columns together, the degree increases by `1`. For example, if our
105- /// constraint involves multiplication of two columns, the degree of this constraint will be
106- /// `2`. We can describe this constraint using [TransitionConstraintDegree] struct as follows:
104+ /// constraint involves multiplication of two columns, the degree of this constraint will be `2`.
105+ /// We can describe this constraint using [TransitionConstraintDegree] struct as follows:
107106/// `TransitionConstraintDegree::new(2)`.
108107/// * Degrees of periodic columns depend on the length of their cycles, but in most cases, these
109108/// degrees are very close to `1`.
110- /// * To describe a degree of a constraint involving multiplication of trace columns and
111- /// periodic columns, use the [TransitionConstraintDegree::with_cycles()] constructor. For
112- /// example, if our constraint involves multiplication of one trace column and one periodic
113- /// column with a cycle of 32 steps, the degree can be described as:
114- /// `TransitionConstraintDegree::with_cycles(1, vec![32])`.
109+ /// * To describe a degree of a constraint involving multiplication of trace columns and periodic
110+ /// columns, use the [TransitionConstraintDegree::with_cycles()] constructor. For example, if our
111+ /// constraint involves multiplication of one trace column and one periodic column with a cycle of
112+ /// 32 steps, the degree can be described as: `TransitionConstraintDegree::with_cycles(1,
113+ /// vec![32])`.
115114///
116115/// In general, multiplications should be used judiciously - though, there are ways to ease this
117116/// restriction a bit at the expense of wider execution trace.
@@ -126,16 +125,14 @@ const MIN_CYCLE_LENGTH: usize = 2;
126125/// function which should return a vector of [Assertion] structs. Every computation must have at
127126/// least one assertion. Assertions can be of the following types:
128127///
129- /// * A single assertion - such assertion specifies that a single cell of an execution trace must
130- /// be equal to a specific value. For example: *value in column 0, at step 0, must be equal
131- /// to 1*.
128+ /// * A single assertion - such assertion specifies that a single cell of an execution trace must be
129+ /// equal to a specific value. For example: *value in column 0, at step 0, must be equal to 1*.
132130/// * A periodic assertion - such assertion specifies that values in a given column at specified
133- /// intervals should be equal to some value. For example: *values in column 0, at steps 0, 8,
134- /// 16, 24 etc. must be equal to 2*.
131+ /// intervals should be equal to some value. For example: *values in column 0, at steps 0, 8, 16,
132+ /// 24 etc. must be equal to 2*.
135133/// * A sequence assertion - such assertion specifies that values in a given column at specific
136- /// intervals must be equal to a sequence of provided values. For example: *values in column 0,
137- /// at step 0 must be equal to 1, at step 8 must be equal to 2, at step 16 must be equal to 3
138- /// etc.*
134+ /// intervals must be equal to a sequence of provided values. For example: *values in column 0, at
135+ /// step 0 must be equal to 1, at step 8 must be equal to 2, at step 16 must be equal to 3 etc.*
139136///
140137/// ### Periodic values
141138/// Sometimes, it may be useful to define a column in an execution trace which contains a set of
@@ -164,8 +161,8 @@ const MIN_CYCLE_LENGTH: usize = 2;
164161/// To describe Randomized AIR, you will need to do the following when implementing the [Air]
165162/// trait:
166163/// * The [AirContext] struct returned from [Air::context()] method must be instantiated using
167- /// [AirContext::new_multi_segment()] constructor. When building AIR context in this way, you
168- /// will need to provide a [`crate::TraceInfo`] which describes the shape of a multi-segment execution
164+ /// [AirContext::new_multi_segment()] constructor. When building AIR context in this way, you will
165+ /// need to provide a [`crate::TraceInfo`] which describes the shape of a multi-segment execution
169166/// trace.
170167/// * Override [Air::evaluate_aux_transition()] method. This method is similar to the
171168/// [Air::evaluate_transition()] method but it also accepts two extra parameters:
@@ -193,8 +190,8 @@ pub trait Air: Send + Sync {
193190 /// described by this AIR, including trace width, trace length length, and optionally,
194191 /// additional custom parameters in `meta` field.
195192 /// - `public_inputs` specifies public inputs for this instance of the computation.
196- /// - `options` defines proof generation options such as blowup factor, hash function etc.
197- /// these options define security level of the proof and influence proof generation time.
193+ /// - `options` defines proof generation options such as blowup factor, hash function etc. these
194+ /// options define security level of the proof and influence proof generation time.
198195 fn new ( trace_info : TraceInfo , pub_inputs : Self :: PublicInputs , options : ProofOptions ) -> Self ;
199196
200197 /// Returns context for this instance of the computation.
@@ -235,10 +232,10 @@ pub trait Air: Send + Sync {
235232 /// describing computations which require multiple trace segments.
236233 ///
237234 /// The types for main and auxiliary trace evaluation frames are defined as follows:
238- /// * When the entire protocol is executed in a prime field, types `F` and `E` are the same,
239- /// and thus, both the main and the auxiliary trace frames are defined over the base field.
240- /// * When the protocol is executed in an extension field, the main trace frame is defined
241- /// over the base field, while the auxiliary trace frame is defined over the extension field.
235+ /// * When the entire protocol is executed in a prime field, types `F` and `E` are the same, and
236+ /// thus, both the main and the auxiliary trace frames are defined over the base field.
237+ /// * When the protocol is executed in an extension field, the main trace frame is defined over
238+ /// the base field, while the auxiliary trace frame is defined over the extension field.
242239 ///
243240 /// We define type `F` separately from `Self::BaseField` to allow evaluation of constraints
244241 /// over the out-of-domain evaluation frame, which may be defined over an extension field
@@ -410,7 +407,7 @@ pub trait Air: Send + Sync {
410407 /// Returns length of the execution trace for an instance of the computation described by
411408 /// this AIR.
412409 ///
413- // This is guaranteed to be a power of two greater than or equal to 8.
410+ /// This is guaranteed to be a power of two greater than or equal to 8.
414411 fn trace_length ( & self ) -> usize {
415412 self . context ( ) . trace_info . length ( )
416413 }
0 commit comments