This document states what Verity proves and what it still trusts.
EDSL (Lean)
↓ [Layer 1: PROVEN FOR CURRENT CONTRACTS, generic core, contract bridges]
CompilationModel
↓ [Layer 2: SUPPORTED-FRAGMENT GENERIC THEOREM -- CompilationModel → IR]
IR
↓ [Layer 3: GENERIC SURFACE, explicit bridge hypothesis, IR → Yul]
Yul
↓ [trusted: solc]
EVM Bytecode
The repository currently has 0 sorry placeholders across the Compiler/**/*.lean and Verity/**/*.lean proof modules that participate in the verified compiler stack. Layer 2 (Source → IR) and Layer 3 (IR → Yul) proof scripts are fully discharged, and it now has 0 documented Lean axioms. See AXIOMS.md for details. Audit evidence and generated trust-boundary artifacts are indexed in AUDIT.md.
- Layer 1: A generic typed-IR compilation-correctness core exists, but the active contract-level bridges are still instantiated per contract and internal-helper proof reuse is not yet a first-class generic interface.
This names the frontend EDSL-to-
CompilationModelbridge only; the contract-specific specification theorems inContracts/<Name>/Proofs/are a separate proof layer about human-readable contract behavior. - Layer 2: A generic whole-contract theorem is proved for the current supported
CompilationModelfragment.supported_function_correctis now a real theorem, the initial-state normalization step is proved, the former generic body-simulation axiom has been eliminated, and the theorem surface makes explicit that the observed transaction-context fields must already be normalized to the bounded source-sideAddress/Uint256domains. Remaining Layer 2 work is now about widening the supported fragment and helper-aware completeness, not repairingsorryplaceholders. - Layer 3: IR → Yul preservation is generic at the proof surface, and the remaining dispatch bridge now lives as an explicit theorem hypothesis rather than a Lean axiom. The checked contract-level theorem surface makes the dispatch-guard safety preconditions explicit: non-payable cases must see word-level zero
msg.value, and each selected function case must have a non-wrapping calldata-width guard.
Current theorem totals, property-test coverage, and proof status live in docs/VERIFICATION_STATUS.md.
- Role: Compiles Yul → EVM bytecode.
- Version: 0.8.33+commit.64118f21 (pinned).
- Mitigation: CI enforces pin and Yul compileability checks.
- Role: Bridge remaining proof obligations not yet fully discharged.
- Status: 0 documented axioms in AXIOMS.md. The mapping-slot range axiom has been eliminated via the kernel-computable Keccak engine. Selector computation is kernel-computable, the Layer 2 generic body-simulation axiom has been eliminated, and the Layer 3 dispatch bridge remains an explicit theorem hypothesis rather than a Lean axiom.
- Mitigation: CI axiom reporting and location checks enforce explicit tracking.
- Role: Function selector derivation (
bytes4(keccak256(signature))). - Status: kernel-computable in
Compiler/Selectors.leanvia the vendored unrolled Keccak engine inCompiler/Keccak/. - Mitigation: CI cross-checks against
solc --hashes, selector fixtures, and fixed selector examples.
- Role: External functions injected at compile time (e.g., Poseidon hash).
- Trust: Semantic correctness of linked code. Compiler validates names, arities, collisions.
- Role:
keccak256(abi.encode(key, baseSlot))for Solidity-compatible storage (activeMappingSlotBackend = .keccak). - Trust: external keccak implementation (
ffi.KECvia EVMYul FFI) + standard collision-resistance assumptions (same trust class as Solidity/EVM). - Mitigation: Abstraction-boundary CI, selector/hash cross-checks.
- Audit surface: machine-readable trust reports now emit the explicit primitive assumption
keccak256_memory_slice_matches_evmwhenever a contract usesExpr.keccak256.
- Role: Runtime execution model.
- Status (Phase 4: full semantic integration for safe compiler-produced bodies): 25 universal pure bridge theorems (all fully proven) in
Compiler/Proofs/YulGeneration/Backends/EvmYulLeanBridgeLemmas.lean. All pure bridge cases are now covered by universal symbolic lemmas. Additionally, 11 context/env/storage/helper builtin bridge theorems bring the total to 36 of 36 builtins bridged, andsmod/sarno longer depend on admitted bridge lemmas. The retargeting moduleEvmYulLeanRetarget.leanproves the pointwise theorembackends_agree_on_bridged_builtins, the expression-level theoremevalYulExpr_evmYulLean_eq_on_bridged, statement-fragment helpers for straight-line, block, if, switch, and for cases, the recursive target theoremexecYulFuelWithBackend_eq_on_bridged_target, emitted-runtime closure/equality theorems, andyulCodegen_preserves_semantics_evmYulLean, which retargets the existing Layer-3 IR→Yul preservation theorem tointerpretYulRuntimeWithBackend .evmYulLeanunder bridged-body hypotheses.EvmYulLeanBodyClosure.leanprovescompileStmtList_always_bridged, a universal aggregation theorem forBridgedSafeStmts; the external-call family (internalCall,internalCallAssign,externalCallBind, andecm) remains carved out behind explicit function-table hypotheses.EndToEnd.leannow exposeslayers2_3_ir_matches_yul_evmYulLeanwithout rawBridgedStmtsbody hypotheses by deriving them fromSupportedSpec, static-parameter witnesses, andBridgedSafeStmtssource-body witnesses. Gas is not modeled. - Trust boundary (EVMYulLean EndToEnd target): For
BridgedExprexpressions,BridgedStraightStmtsstatement lists (including mapping-slot, literal-slot, and identifier-slotsstore), recursiveBridgedTargetexecutions, source statement lists admitted byBridgedSafeStmts, emitted runtime wrappers whose embedded bodies satisfyBridgedStmt, Layer-3 contract executions whose body hypotheses are discharged, and the public EndToEnd wrapper that derives raw body bridges from source-level safe-body/static-param witnesses, the trust assumption moves from "Verity's custom builtin implementations are correct" to "EVMYulLean's execution model matches the EVM" (backed by upstream Ethereum conformance tests) with fully proven builtin bridge dependencies. - Fork dependency: Verity pins
lfglabs-dev/EVMYulLean, a fork ofNethermindEth/EVMYulLean. The pinned commit is recorded inlake-manifest.jsonunder theevmyulpackage. The exact divergence from upstream is enumerated inartifacts/evmyullean_fork_audit.json, regenerated byscripts/generate_evmyullean_fork_audit.pyand validated bymake check. As of the current pin, the fork is 2 commits ahead ofupstream/mainand 0 behind; both commits are non-semantic (one visibility change on an exponentiation accumulator, one Lean 4.22.0 deprecation fix), so upstream Ethereum conformance test coverage applies transitively. In addition to themake checkvalidation, a weekly scheduled GitHub Actions workflow (.github/workflows/evmyullean-fork-conformance.yml) runsmake test-evmyullean-fork, which re-verifies the fork audit artifact againstlake-manifest.json, checks the EVMYulLean adapter report, rebuilds adapter correctness, rebuilds the native transition harness and smoke tests, rebuilds the public EndToEnd EVMYulLean target, and rebuilds the universal bridge lemmas (25 proven) together with the 123 concretenative_decidebridge-equivalence tests (EvmYulLeanBridgeTest), surfacing any upstream drift as a run annotation during the two-weekcontinue-on-errorburn-in ending 2026-05-04 and then as a red workflow plus an automatically opened or updated GitHub issue for scheduled/manual failures. - Remaining gap for whole-program retargeting: The report generator now records status
full_semantic_integration:compileStmtList_always_bridgedis proven for the safe source-body whitelist, andEndToEnd.leandischarges the public theorem's raw external-functionBridgedStmtsbody hypotheses for supported compiler-produced contracts. The remaining scope limit is the external-call/function-table family, which stays carved out ofBridgedSafeStmts. - Implication: Semantic correctness does not imply gas-safety.
- Proxy note:
delegatecall-based proxy / upgradeability flows still sit outside the current proof-interpreter model. Archive--trust-reportand use--deny-proxy-upgradeabilitywhen proxy semantics must remain outside the selected verified subset (issue#1420).
- Role: Reusable typed external call patterns (ERC-20 writes/reads including
totalSupply, ERC-4626 preview/conversion helpers plustotalAssets,asset,max*limit reads, anddeposit, oracle reads, precompiles, callbacks). - Trust: Each module's
compileproduces correct Yul. Bug in one module doesn't affect others. - Mitigation: Axiom aggregation at compile time (
--verbose), machine-readable trust-surface emission via--trust-report <path>, and a fail-closed verification gate via--deny-unchecked-dependencieswhen unchecked foreign surfaces must be excluded. See docs/EXTERNAL_CALL_MODULES.md.
- Role: Proof checker soundness. Foundational assumption for all Lean-based verification.
- Role: Generates both EDSL
Contractmonad value andCompilationModelfrom one syntax tree. - Status: Trusted unverified metaprogram (Verity/Macro/Translate.lean).
- Risk: A translation bug would silently cause EDSL and CompilationModel to diverge.
- Mitigation: The generic Layer 2 whole-contract theorem, macro-generated
_semantic_preservationbody-alignment checks, and differential tests catch divergence on the current contract set.
- Role: Let a function or constructor declare a localized proof obligation for an unsafe/assembly-shaped boundary without marking the whole contract as opaque.
- Status: Surfaced explicitly in
--trust-report,--verbose, andproofStatus.*.localObligations. - Mitigation:
verity-compiler --deny-local-obligationsfails closed on any obligation that remainsassumedorunchecked.
Uint256 arithmetic is wrapping modulo 2^256, matching the EVM. This is proven, not assumed (see Compiler/Proofs/ArithmeticProfile.lean). Checked operations (safeAdd, safeSub, safeMul) are available for overflow protection. See docs/ARITHMETIC_PROFILE.md.
High-level semantics can expose intermediate state in reverted computations. EVM reverts discard state. Contracts should use checks-before-effects. See docs/REVERT_STATE_MODEL.md.
- Confirm deployment uses the supported EDSL CLI path.
- Review AXIOMS.md; ensure the axiom list is unchanged and justified.
- If linked libraries are used, audit each linked Yul file as trusted code.
- Validate selector, Yul compile, and storage-layout CI checks.
- Confirm arithmetic and revert assumptions are acceptable for the target contract.
- Review the low-level mechanics / external assumption report (
--verbose) and archive--trust-report <path>for audit evidence when external calls or linked externals are used. For verification-oriented builds, also pass--deny-unchecked-dependenciesso any remaining unchecked foreign surface fails closed.
- Issue #967: Proof-carrying Yul rewrite rules, versioned parity packs, AST identity gates.
- Issue #998: Per-function machine-checked
EDSL execution ≡ EVMYulLean(compile(CompilationModel))theorems.
- AUDIT.md | AXIOMS.md | docs/ARITHMETIC_PROFILE.md | docs/REVERT_STATE_MODEL.md
- docs/EXTERNAL_CALL_MODULES.md | docs/ROADMAP.md | docs/VERIFICATION_STATUS.md
Last Updated: 2026-04-20 Maintainer Rule: Update on every trust-boundary-relevant code change.