proof(#2080): derive contract naming invariant from compiled internal table#2118
Conversation
Adds the structural lemmas that let the whole-contract dispatch seam discharge the internal-table naming invariant instead of taking it as an opaque premise: - internalFunctionYulName_take_prefix: a compiled internal helper's Yul name carries the `internal_` prefix. - compileInternalFunction_isFuncDef_internalNamed: a compileInternalFunction output is a FunctionDefinition whose name is internal_-prefixed. - InternalTableNamesInternalPrefixed_of_all_compiledInternal: lifts those to the whole runtime internal table. Contract.lean gains the consumer seam compileFunctionSpec_correct_generic_with_helper_proofs_and_helper_ir_of_body_goal_of_compiledInternalTable, which derives the naming invariant from the structural fact that every internal-table statement is a compileInternalFunction output, then delegates to the _of_internalNamesPrefixed sibling. Body is a single term application; allowlisted in check_proof_length.py for the mirrored premise list. PrintAxioms.lean regenerated: 5551 -> 5555 theorems, 0 sorry'd.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_92a49885-92f5-4b23-b053-80ff107b34ad) |
Review (automated) — commit
|
58b02cf
into
paloma/issue-2080-selector-dispatch-withinternals
#2119) Package the structural premise that a runtime contract's internal-function table is generated by `compileInternalFunction`, then feed PR #2118's `_of_body_goal_of_compiledInternalTable` seam with that premise derived from the real compilation pipeline instead of taken as a hypothesis. New lemmas (Compiler/Proofs/IRGeneration/Contract.lean): - `compileInternalFunction_mapM_mem_exists`: every statement in the `internalFns.mapM compileInternalFunction` image is a `compileInternalFunction` output. Non-vacuous for a populated `internalFns`; no `internalFunctions = []` default-empty helper-world assumption. - `compiledInternalTable_of_internalFunctions_eq_mapM`: packages that image into the exact existential shape of the seam's `hcompiledTable` premise. - `compiledInternalTable_of_compileValidatedCore`: discharges the premise from a real `compileValidatedCore` output (currently via the SupportedSpec nil table). - `compileFunctionSpec_correct_generic_with_helper_proofs_and_helper_ir_of_body_goal_of_compileValidatedCore`: whole-contract dispatch consumer that invokes the #2118 seam with `hcompiledTable` discharged from the pipeline, so the runtime contract whose `execIRFunctionWithInternals` dispatch is proven is exactly the compiled one. Regenerated PrintAxioms.lean and allowlisted the signature-dominated consumer in check_proof_length.py (matching its `_of_compiledInternalTable` sibling). Refs #2080
Summary
Threads the runtime contract's internal-table naming invariant into the whole-contract dispatch seam by deriving it from the structural compilation fact — every internal-table statement is a
compileInternalFunctionoutput — instead of takingInternalTableNamesInternalPrefixedas an opaque hypothesis.Stacked on top of
paloma/issue-2080-selector-dispatch-withinternals(PR #2117'sWithInternalsselector seam).New lemmas (
Compiler/Proofs/IRGeneration/Function.lean)internalFunctionYulName_take_prefix— a compiled internal helper's Yul name carries theinternal_prefix.compileInternalFunction_isFuncDef_internalNamed— acompileInternalFunctionoutput is aFunctionDefinitionwhose name isinternal_-prefixed.InternalTableNamesInternalPrefixed_of_all_compiledInternal— lifts the above to the whole runtime internal table.New consumer seam (
Compiler/Proofs/IRGeneration/Contract.lean)compileFunctionSpec_correct_generic_with_helper_proofs_and_helper_ir_of_body_goal_of_compiledInternalTable— takes the structural "all internal-table stmts are compiled internal helpers" premise, derives the naming invariant, and delegates to the_of_internalNamesPrefixedsibling. The body is a single term application; the length is entirely the mirrored premise list (allowlisted incheck_proof_length.py).Validation
lean-slot lake build Compiler.Proofs.IRGeneration.Function— greenlean-slot lake build Compiler.Proofs.IRGeneration.Contract— green (1144/1144, with the new seam)lean-slot lake build Compiler.Proofs.HelperStepProofs— green (1139/1139)python3 scripts/generate_print_axioms.py --check— OK (5551 -> 5555 theorems, 0 sorry'd)python3 scripts/check_proof_length.py— passgit diff --check— cleansorry/admit/axiomin touched proof fileslake build PrintAxioms— running in CI (constructive proofs only; no new axioms expected)Test plan
lake build, PrintAxioms axiom footprint, proof-length gate)Do not merge until the base PR lands.
Note
Low Risk
Lean proof-only changes with no runtime or auth logic; risk is limited to proof maintenance and CI gates (PrintAxioms, proof length).
Overview
Adds proof plumbing so whole-contract helper-aware correctness can assume every runtime internal-table stmt came from
compileInternalFunction, instead of supplyingInternalTableNamesInternalPrefixedby hand.In Function.lean, three lemmas chain compilation shape to naming:
internalFunctionYulName_take_prefix,compileInternalFunction_isFuncDef_internalNamed, andInternalTableNamesInternalPrefixed_of_all_compiledInternal.In Contract.lean,
compileFunctionSpec_correct_generic_with_helper_proofs_and_helper_ir_of_body_goal_of_compiledInternalTablemirrors the_of_internalNamesPrefixedwrapper but takeshcompiledTableand derives the naming invariant before delegating toexecIRFunctionWithInternals(no manual param-load disjointness witness).PrintAxioms.lean and
check_proof_length.pyregister the new public theorem (+4 lemmas, allowlist entry).Reviewed by Cursor Bugbot for commit 455906f. Bugbot is set up for automated code reviews on this repo. Configure here.