Recursive2: Tree Aggregation (Stage 4)#
Recursive2 aggregates proofs within the same airgroup using a 3-to-1 tree reduction.
Aggregation Structure#
Fan-in. Each Recursive2 circuit takes up to \(N_{\mathrm{agg}} = 3\) input proofs. These may be Recursive1 proofs or other Recursive2 proofs from the same airgroup.
Null-proof padding. If the number of proofs is not divisible by 3, null proofs are used as padding. The circuit distinguishes null proofs via a circuit type flag (circuit type \(= 0\) indicates a null proof that is not verified).
Verification key selection. The circuit selects the appropriate verification key based on the circuit type of each input:
Type 0: null proof (skip verification).
Type 1: aggregated proof (Recursive2 verification key).
Type \(\geq 2\): basic proof (Recursive1 verification key, with type encoding the specific AIR).
Airgroup Value Aggregation#
Each input proof carries airgroup values (accumulated \(\mathrm{gsum}\) and \(\mathrm{gprod}\) boundary values). Recursive2 aggregates these:
stage1Hash Chaining#
The stage1Hash values from input proofs are chained using Poseidon2:
For three inputs \(A, B, C\): first combine \(A\) and \(B\), then combine the result with \(C\). Null proofs contribute a zero hash.
Tree Depth#
For an airgroup with \(N_{\mathrm{AIR}}\) instances, the tree has depth
The output is a single proof \(\pi^{(g)}_{\mathrm{R2}}\) per airgroup \(g\).