AIR (Algebraic Intermediate Representation)
Overview
AIR is the constraint language used by STARKs. Instead of encoding a computation as individual gates (like R1CS), AIR represents it as a table of values (the execution trace) together with transition constraints that relate consecutive rows.
Structure
An AIR instance consists of:
- An execution trace: a matrix with rows (steps) and columns (registers)
- Transition constraints: multivariate polynomials such that for every row :
- Boundary constraints: fix specific cells to known values (input/output)
Cost model
The cost of an AIR proof depends on:
- Trace width : number of columns (registers)
- Trace length : number of rows (steps), must be a power of 2
- Constraint degree : maximum degree of transition polynomials
- Blowup factor: typically or more, determined by constraint degree
The proof size and verifier time scale with . Lower degree constraints allow a smaller blowup factor, reducing proof size.
What costs what in AIR
- Multiplication: does not cost an extra constraint if it fits within the allowed constraint degree
- High-degree operations: for small can be a single transition constraint of degree (if )
- Addition and scalar multiplication: absorbed into polynomials, free
- Intermediate variables: can be added as extra trace columns to reduce constraint degree
Example: in AIR
If the maximum allowed constraint degree is , then is verified with a single transition constraint:
No extra columns needed. If , auxiliary columns split the computation:
| Column 0 | Column 1 | Constraint |
|---|---|---|
| ... | ... |
Advantage for inverse S-boxes
The key advantage of AIR for hash functions like Rescue and Griffin is the handling of the inverse S-box .
In R1CS, the prover supplies as a witness and proves , which costs the same as a forward S-box.
In AIR, the transition constraint is identical:
This is a degree- constraint regardless of which direction is "forward." The inverse S-box costs exactly the same as the forward S-box: one transition constraint per element.
This means Rescue's alternating / structure provides twice the nonlinearity per constraint in AIR compared to applying twice. This is why Rescue was designed with STARKs in mind.
Cost analysis for AO primitives
Poseidon in AIR
Each round occupies one trace row with columns. Transition constraints:
- Full round: constraints of degree (one per S-box)
- Partial round: 1 constraint of degree + linear constraints
The partial round savings in AIR are less significant than in R1CS because degree- constraints are not much more expensive than linear ones in the STARK framework.
Rescue-Prime in AIR
Each round applies then (or vice versa). Both directions use degree- constraints:
- Each full round: constraints per half-round, total
- Total constraints per round: of degree
Despite having twice as many S-box applications as Poseidon per round, Rescue needs fewer rounds (e.g., 14 vs 65 for comparable parameters), so the total trace length can be shorter.
Anemoi in AIR
The Flystel structure has components that decompose into low-degree transition constraints. The quadratic subfunction is degree 2, and the Flystel combines it with a power map, keeping the overall constraint degree at .
Proof systems using AIR
- STARKs (Winterfell, Stone, Stwo): transparent setup, post-quantum (hash-based), large proof size
- eSTARK (Polygon): batched AIR with lookup arguments
- DEEP-FRI: used for low-degree testing in STARK provers
References
- Ben-Sasson, Bentov, Horesh, Riabzev. "Scalable, transparent, and post-quantum secure computational integrity" (2018) ePrint 2018/046
- Aly, Ashur, Ben-Sasson, Dhooghe, Szepieniec. "Efficient Symmetric Primitives for Advanced Cryptographic Protocols (Rescue)" (2020) ePrint 2020/1143
- StarkWare. "ethSTARK Documentation" (2021) ePrint 2021/582