<!-- Canonical: https://docs.linea.build/protocol/architecture/prover/trace-expansion -->

> For the complete Linea documentation index, see [llms.txt](/llms.txt).
> Agents can fetch this page as Markdown at [https://docs.linea.build/protocol/architecture/prover/trace-expansion.md](https://docs.linea.build/protocol/architecture/prover/trace-expansion.md).

# Proving: Circuit building

Corset is part of the [Lineth](/protocol/reference/zero-knowledge-glossary#lineth)**Lineth** (Formerly the Linea Stack) The open-source ZK-rollup stack, codebase, and technical protocol that's the foundation of Linea Mainnet. Operators can deploy this stack to launch their own Ethereum-compatible L2 or L3 networks. [prover](/protocol/architecture/prover). It performs the first stage of the proving system: it compiles Lineth's [zkEVM](/protocol/reference/zero-knowledge-glossary#zkevm)**zkEVM** A virtual machine that executes smart contracts and proves the correctness of execution using zero-knowledge proofs. zkEVMs recreate aspects of Ethereum's design, which provides an "Ethereum-like" experience for developers and users. rules into a constraint system, and prepares each batch's execution traces so the prover can check them against that system.

A _constraint system_ is a set of rules that a computation must satisfy. Proving in zero knowledge means showing that some data satisfies every rule in the system, without revealing the data itself.

## How it works

Corset runs at two different times.

At build time, it compiles Lineth's arithmetization: the constraint definitions, written in a Lisp domain-specific language, that describe what correct zkEVM execution looks like. The compiled constraint system is bundled into the prover, so a change to the arithmetization reaches the prover as a new build rather than at runtime.

At runtime, it expands the conflated traces that the [tracer](/protocol/architecture/sequencer/traces-generator) produced for a batch. Trace expansion derives the columns the constraint system checks from the columns the tracer recorded, producing the complete data set, or witness, that the prover proves against.

## See also

-   See [Circuit execution and runtime](/protocol/architecture/prover/proving) for the second stage of the proving system, where [gnark](/protocol/reference/zero-knowledge-glossary#gnark)**gnark** A software library that offers users the ability to design and run computational circuits in zk-SNARKs through a high-level API. turns the witness into a proof.
-   See [Module limits](/protocol/architecture/prover/prover-limits) for the per-module trace line limits that keep an expanded trace within what the prover can handle.
-   See the [`go-corset` source code](https://github.com/consensys/go-corset), and Lineth's [constraint definitions](https://github.com/LFDT-Lineth/lineth-monorepo/tree/main/tracer-constraints) in the `lineth-monorepo`.
