Skip to main content

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 T∈Fpn×wT \in \mathbb{F}_p^{n \times w} with nn rows (steps) and ww columns (registers)
  • Transition constraints: multivariate polynomials pjp_j such that for every row ii:
pj(T[i,0],…,T[i,w−1],T[i+1,0],…,T[i+1,w−1])=0p_j(T[i, 0], \ldots, T[i, w-1], T[i+1, 0], \ldots, T[i+1, w-1]) = 0
  • Boundary constraints: fix specific cells to known values (input/output)

Cost model​

The cost of an AIR proof depends on:

  1. Trace width ww: number of columns (registers)
  2. Trace length nn: number of rows (steps), must be a power of 2
  3. Constraint degree dd: maximum degree of transition polynomials
  4. Blowup factor: typically 2d2d or more, determined by constraint degree

The proof size and verifier time scale with w⋅n⋅log⁡(n)w \cdot n \cdot \log(n). 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: xαx^{\alpha} for small α\alpha can be a single transition constraint of degree α\alpha (if α≤d\alpha \leq d)
  • Addition and scalar multiplication: absorbed into polynomials, free
  • Intermediate variables: can be added as extra trace columns to reduce constraint degree

Example: x5x^5 in AIR​

If the maximum allowed constraint degree is d≥5d \geq 5, then x5x^5 is verified with a single transition constraint:

T[i+1,0]=T[i,0]5T[i+1, 0] = T[i, 0]^5

No extra columns needed. If d<5d < 5, auxiliary columns split the computation:

Column 0Column 1Constraint
xxx2x^2col1=col02\text{col}_1 = \text{col}_0^2
......T[i+1,0]=col12⋅col0T[i+1, 0] = \text{col}_1^2 \cdot \text{col}_0

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 x↦x1/αx \mapsto x^{1/\alpha}.

In R1CS, the prover supplies y=x1/αy = x^{1/\alpha} as a witness and proves yα=xy^{\alpha} = x, which costs the same as a forward S-box.

In AIR, the transition constraint is identical:

T[i+1,j]α=T[i,j]T[i+1, j]^{\alpha} = T[i, j]

This is a degree-α\alpha 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 xαx^{\alpha} / x1/αx^{1/\alpha} structure provides twice the nonlinearity per constraint in AIR compared to applying xαx^{\alpha} 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 tt columns. Transition constraints:

  • Full round: tt constraints of degree α\alpha (one per S-box)
  • Partial round: 1 constraint of degree α\alpha + (t−1)(t-1) linear constraints

The partial round savings in AIR are less significant than in R1CS because degree-α\alpha constraints are not much more expensive than linear ones in the STARK framework.

Rescue-Prime in AIR​

Each round applies xαx^{\alpha} then x1/αx^{1/\alpha} (or vice versa). Both directions use degree-α\alpha constraints:

  • Each full round: tt constraints per half-round, 2t2t total
  • Total constraints per round: 2t2t of degree α\alpha

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 E(x)=x2+βx\mathcal{E}(x) = x^2 + \beta x is degree 2, and the Flystel combines it with a power map, keeping the overall constraint degree at α\alpha.

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