Skip to content

fix: Discharge hbody hypothesis via fuel adequacy axiom (closes #159)#206

Merged
Th0rgal merged 1 commit intomainfrom
fix/discharge-hbody-hypothesis
Feb 16, 2026
Merged

fix: Discharge hbody hypothesis via fuel adequacy axiom (closes #159)#206
Th0rgal merged 1 commit intomainfrom
fix/discharge-hbody-hypothesis

Conversation

@Th0rgal
Copy link
Member

@Th0rgal Th0rgal commented Feb 16, 2026

Summary

  • Add ir_function_body_equiv theorem that fully instantiates the proof chain from all_stmts_equiv through fuel adequacy to function-level IR↔Yul equivalence
  • Add execIRStmtsFuel_adequate axiom to bridge the partial IR evaluator with the fuel-parametric version used in proofs
  • The Layer 3 preservation theorem's hbody hypothesis is now dischargeable for any contract
  • Axiom count increases from 4→5 (all 3 new IR axioms are eliminable by a single ~500 LOC refactor)

Details

Issue: #159 — Layer 3 preservation theorem has undischarged hbody hypothesis

Problem: yulCodegen_preserves_semantics required hbody : ∀ fn, fn ∈ contract.functions → resultsMatch (execIRFunction fn ...) (interpretYulBody fn ...) but no theorem supplied this proof. The existing statement-level equivalence proofs (all_stmts_equiv) couldn't bridge to hbody because of two gaps:

  1. execIRFunction uses partial execIRStmts, while proofs use fuel-parametric execIRStmtsFuel
  2. No adequacy proof connected these two execution modes

Fix: Add execIRStmtsFuel_adequate axiom (standard fuel adequacy pattern) and compose it with the proven statement equivalence chain to produce ir_function_body_equiv.

Proof chain:

all_stmts_equiv (proven, 8 statement types)
    ↓
execIRStmtsFuel_equiv_execYulStmtsFuel_of_stmt_equiv (proven, list composition)
    ↓
ir_yul_function_equiv_fuel_goal_of_stmt_equiv (proven, function-level fuel equiv)
    ↓
execIRStmtsFuel_adequate (NEW AXIOM, bridges partial ↔ fuel)
    ↓
ir_function_body_equiv (NEW THEOREM, fully instantiated)

Files changed:

File Change
Equivalence.lean Add execIRStmtsFuel_adequate axiom + execIRFunctionFuel_adequate theorem
Preservation.lean Add ir_function_body_equiv theorem, import StatementEquivalence
AXIOMS.md Document new axiom #3, renumber #3#4, #4#5
README.md, TRUST_ASSUMPTIONS.md, compiler.mdx, verification.mdx, llms.txt Update axiom count 4→5

Test plan

  • Lean build passes (76/76 modules, no new sorry)
  • check_doc_counts.py passes (5 axioms)
  • check_axiom_locations.py passes (all 5 axiom locations correct)
  • Full CI green

🤖 Generated with Claude Code


Note

Medium Risk
Introduces a new axiom bridging partial and fuel-based IR execution; while localized to proofs/docs, it expands the trusted base for core compiler-correctness results.

Overview
Discharges Layer 3 yulCodegen_preserves_semantics’s previously external hbody assumption by introducing a fuel-adequacy bridge from total execIRStmtsFuel to partial execIRStmts, and composing it with existing statement equivalence to produce a self-contained ir_function_body_equiv theorem.

Adds a new axiom execIRStmtsFuel_adequate (plus execIRFunctionFuel_adequate) and updates axiom/trust-model documentation across AXIOMS.md, README.md, TRUST_ASSUMPTIONS.md, and docs to reflect the axiom count increase from 4→5.

Written by Cursor Bugbot for commit 9bac89a. This will update automatically on new commits. Configure here.

The Layer 3 preservation theorem (yulCodegen_preserves_semantics) had an
undischarged hbody hypothesis — it required proving that each function's
IR execution matches its Yul execution, but no theorem supplied this.

Fix: Add ir_function_body_equiv theorem that composes:
1. all_stmts_equiv (proven: all 8 statement types are equivalent)
2. execIRStmtsFuel_equiv_execYulStmtsFuel_of_stmt_equiv (list composition)
3. execIRStmtsFuel_adequate (new axiom: fuel-based = partial execution)

The new axiom bridges the partial `execIRStmts` with the fuel-parametric
`execIRStmtsFuel`. This is the standard adequacy pattern — both functions
have identical structure, validated by 70k+ differential tests.

Axiom count: 4→5 (eliminable by refactoring IR execution to use fuel).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dumbcontracts Ready Ready Preview, Comment Feb 16, 2026 8:00am

Request Review

@Th0rgal Th0rgal merged commit 016d959 into main Feb 16, 2026
20 checks passed
@Th0rgal Th0rgal deleted the fix/discharge-hbody-hypothesis branch February 16, 2026 08:04
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