fix: Discharge hbody hypothesis via fuel adequacy axiom (closes #159)#206
Merged
fix: Discharge hbody hypothesis via fuel adequacy axiom (closes #159)#206
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ir_function_body_equivtheorem that fully instantiates the proof chain fromall_stmts_equivthrough fuel adequacy to function-level IR↔Yul equivalenceexecIRStmtsFuel_adequateaxiom to bridge thepartialIR evaluator with the fuel-parametric version used in proofshbodyhypothesis is now dischargeable for any contractDetails
Issue: #159 — Layer 3 preservation theorem has undischarged
hbodyhypothesisProblem:
yulCodegen_preserves_semanticsrequiredhbody : ∀ 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 tohbodybecause of two gaps:execIRFunctionusespartialexecIRStmts, while proofs use fuel-parametricexecIRStmtsFuelFix: Add
execIRStmtsFuel_adequateaxiom (standard fuel adequacy pattern) and compose it with the proven statement equivalence chain to produceir_function_body_equiv.Proof chain:
Files changed:
Equivalence.leanexecIRStmtsFuel_adequateaxiom +execIRFunctionFuel_adequatetheoremPreservation.leanir_function_body_equivtheorem, import StatementEquivalenceAXIOMS.mdREADME.md,TRUST_ASSUMPTIONS.md,compiler.mdx,verification.mdx,llms.txtTest plan
check_doc_counts.pypasses (5 axioms)check_axiom_locations.pypasses (all 5 axiom locations correct)🤖 Generated with Claude Code
Note
Medium Risk
Introduces a new axiom bridging
partialand 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 externalhbodyassumption by introducing a fuel-adequacy bridge from totalexecIRStmtsFueltopartialexecIRStmts, and composing it with existing statement equivalence to produce a self-containedir_function_body_equivtheorem.Adds a new axiom
execIRStmtsFuel_adequate(plusexecIRFunctionFuel_adequate) and updates axiom/trust-model documentation acrossAXIOMS.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.