Skip to content

Dialect/EVM: split opcode frontend + executable interpreter from meta theory - #39

Merged
chriseth merged 1 commit into
powdr-labs:mainfrom
chris-ai1:agent/split-evm-dialect-mathlib-free
Jul 27, 2026
Merged

Dialect/EVM: split opcode frontend + executable interpreter from meta theory#39
chriseth merged 1 commit into
powdr-labs:mainfrom
chris-ai1:agent/split-evm-dialect-mathlib-free

Conversation

@chris-ai1

Copy link
Copy Markdown
Contributor

Blanket import Mathlib in Dialect/EVM.lean forced the entire Mathlib library onto the import path of anything using the EVM dialect — including a compiler executable that only needs to build/run the dialect, not reason about it. Statically linking Mathlib made yulc ~158 MB.

Split the module three ways along the Mathlib boundary:

  • Dialect/EVMOp.lean — opcode enum Op, U256, opName/parse/mkCall,
    litValue/litWF, effects. Mathlib-free (builds in 13 jobs).
  • Dialect/EVMExec.lean — the executable interpreter: EvmState, stepOp,
    state helpers, and the evm/evmWithExternal/exec dialect instances.
    Mathlib-free (14 jobs); imports EVMOp.
  • Dialect/EVM.lean — metatheory only (effects_sound, exec_lawful,
    @[simp] state lemmas, worked examples). Imports EVMExec + Mathlib.

Syntax/ObjectRun now import the lighter EVMExec (they need only the frontend/interpreter). No proof content changed; the full library still builds.

…theory

Blanket `import Mathlib` in `Dialect/EVM.lean` forced the entire Mathlib
library onto the import path of anything using the EVM dialect — including a
compiler executable that only needs to build/run the dialect, not reason about
it. Statically linking Mathlib made a downstream `yulc` binary ~158 MB.

Split the module three ways along the Mathlib boundary:

* `Dialect/EVMOp.lean`   — opcode enum `Op`, `U256`, `opName`/`parse`/`mkCall`,
  `litValue`/`litWF`, `effects`. Mathlib-free (builds in 13 jobs).
* `Dialect/EVMExec.lean` — the executable interpreter: `EvmState`, `stepOp`,
  state helpers, and the `evm`/`evmWithExternal`/`exec` dialect instances.
  Mathlib-free (14 jobs); imports EVMOp.
* `Dialect/EVM.lean`     — metatheory only (`effects_sound`, `exec_lawful`,
  `@[simp]` state lemmas, worked examples). Imports EVMExec + Mathlib.

Purely additive: `import YulSemantics.Dialect.EVM` still re-exports the whole
`YulSemantics.EVM` namespace, so every existing downstream module builds
unchanged. Downstream code that wants a Mathlib-free path can now import
`Dialect.EVMExec` (interpreter) or `Dialect.EVMOp` (opcodes) instead. Full
library builds; no proof content changed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chris-ai1
chris-ai1 force-pushed the agent/split-evm-dialect-mathlib-free branch from 9600a4b to dc92e2c Compare July 27, 2026 12:22
@chriseth
chriseth merged commit a5eabdf into powdr-labs:main Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants