V2 · alpha · Lean 4

One portable program. Many verifiable targets.

ProofForge V2 is a Lean 4 multi-target compiler. Authors write one program; the compiler infers semantic requirements, then --target selects materialization for EVM, Solana, NEAR and Noir. Changing target must not change meaning.

30-second look

The whole program.

No target keywords, no chain-specific syntax. State, init, entry, view — same source compiles to bytecode, sBPF plan, Wasm, or a Noir circuit.

import ProofForgeV2
open ProofForgeV2.Language

program Counter where
  state count : UInt64

  init(initial : UInt64) do
    count := initial

  entry increment(delta : UInt64) : UInt64 do
    count := count + delta
    return count

  view get() : UInt64 do
    return count
One source · four targets

Materialize honestly.

Compilation pipeline

Parse → Typed → Semantic → Resolve → Materialize

Any failure fails closed. No best-effort downgrade, no legacy fallback path. Source, Typed and Semantic layers never branch on TargetId.

programParseTypedSemanticResolveMaterializeEVMSolanaNEARNoir
--target evm

EVM

Contract VM
Phase 1 · runtime

Counter bytecode + Anvil init/increment/overflow.

--target sol

Solana

Explicit-account SVM
Phase 1 · plan-only

Typed .sbpf-plan + IDL. No sBPF object yet.

--target near

NEAR

Wasm host
Phase 1 · wasm

raw-u64 Counter/Accumulator WAT/Wasm via wat2wasm.

--target noir

Noir

Circuit
Phase 1 · source-only

Target-owned Plan → .nr packages. No proof/VK.

INV-005

No silent fallback.

A failure never becomes a success. Stable diagnostics over guessing.

Principles

A compiler, not a runtime.

01

Equivalent materialization

Target only changes artifacts and encoding. Integer semantics, state transitions, revert, call order, authorization and disclosure stay identical.

02

Fail closed

When semantics cannot be preserved, refuse with a stable diagnostic. No best-effort, no legacy path.

03

No implicit network

Build performs no network or key IO. Deploy, prove and verify are explicit commands only.

Invariants

What the compiler will not do.

INV-001
Source / Typed / Semantic layers do not branch on TargetId.
INV-002
Target may only perform equivalent materialization; otherwise refuse.
INV-005
A failure must not turn into success or a legacy fallback.
INV-008
build has no network or key side effects; deploy/prove/verify are explicit.
INV-010
Clean-room build does not depend on active/ or legacy v1 paths.