Skip to content

Support constructorArg in core proof surface#2149

Draft
Th0rgal wants to merge 12 commits into
mainfrom
codex/2083-constructor-arg
Draft

Support constructorArg in core proof surface#2149
Th0rgal wants to merge 12 commits into
mainfrom
codex/2083-constructor-arg

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Treat Expr.constructorArg as core-supported without removing any other unsupported constructor gates.
  • Add constructor arg alias names to constructor body scope and prove alias bindings are present.
  • Wire constructorArg through expression compilation/evaluation and constructor-body proof consumers.

Validation

  • lean-slot lake build Compiler.Proofs.IRGeneration.SupportedSpec Compiler.Proofs.IRGeneration.FunctionBody Compiler.Proofs.IRGeneration.Function Compiler.Proofs.IRGeneration.DenoteAgreement: passed.
  • rg -n "sorry|admit|axiom " over changed files: no proof-hole/axiom hits; only existing comment prose matched words like admit/admitted.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
verity Ready Ready Preview, Comment Jul 11, 2026 1:47pm

Request Review

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
\n### CI Failure Hints\n\nFailed jobs: `build`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n```

@Th0rgal

Th0rgal commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

CI correction needed for head 0360db1b2a11dbda8d2979fa14d5177b75b35ce7.

The branch-head Verify proofs workflow_dispatch run failed after the main proof build passed, in step Prebuild shared audit Lean targets while building PrintAxioms:
https://github.com/lfglabs-dev/verity/actions/runs/29114717952/job/86435461155

This is not a runner flake. The audit import closure exposes stale constructor-body scope consumers after this PR changed constructor bodies to compile/support under constructorBodyScope ctor.params:

  • Compiler/Proofs/IRGeneration/ContractFeatureTest.lean
    • around line 642: proof of compileConstructor_ok_components still simplifies with a body compile hypothesis over ctor.params.map (·.name).
    • line 654: Function.compileConstructor_some_ok_of_body now expects compileStmtList ... (constructorBodyScope constructorOnlyCtor.params) ....
    • lines 978 and 1045: Function.supported_constructor_body_correct_with_body_interface now expects the same constructorBodyScope compile witness.
  • Compiler/Proofs/EndToEnd/Base.lean
    • line 5856: generatedConstructorSupportedStmtList_of_supported still returns SupportedStmtList spec.fields (ctor.params.map (·.name)) ctor.body, but the branch now has the matching supported constructor witness under constructorBodyScope ctor.params.

Suggested bounded correction scope:

  • Update only those stale audit consumers to use the new constructor body scope/witnesses.
  • Do not weaken the new constructorArg support theorem statements or reintroduce old scope assumptions.
  • Validate with at least:
lean-slot lake build PrintAxioms
python3 scripts/lean_lint.py --only proof_length
rg -n "sorry|admit|axiom |unsafe|allowlist" Compiler/Proofs/IRGeneration/ContractFeatureTest.lean Compiler/Proofs/EndToEnd/Base.lean Compiler/Proofs/IRGeneration/Function.lean Compiler/Proofs/IRGeneration/SupportedSpec.lean

The narrower local build already passed; this failure is specifically from the audit/PrintAxioms closure.

@Th0rgal

Th0rgal commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Follow-up with local reproduction details for head 0360db1b2a11dbda8d2979fa14d5177b75b35ce7.

I reproduced the audit failure locally with:

lean-slot lake build PrintAxioms
lean-slot lake build Compiler.Proofs.EndToEnd.Base
lean-slot lake build Compiler.Proofs.IRGeneration.ContractFeatureTest

PrintAxioms fails because these two imports fail:

  • Compiler.Proofs.EndToEnd.Base
  • Compiler.Proofs.IRGeneration.ContractFeatureTest

Concrete failures:

  1. Compiler/Proofs/EndToEnd/Base.lean:5856

The proof still expects:

SupportedStmtList spec.fields (ctor.params.map (·.name)) ctor.body

but hSupported.constructor now gives support for:

SupportedStmtList spec.fields ((constructorAsFunctionSpec ctor).params.map (·.name)) (constructorAsFunctionSpec ctor).body

This needs the same constructorAsFunctionSpec / constructorBodyScope bridge used in SupportedSpec.lean, not the old raw ctor.params.map scope.

  1. Compiler/Proofs/IRGeneration/ContractFeatureTest.lean:978 and :1045

Both hbodyCompile witnesses still compile under:

ctor.params.map (·.name)

but Function.supported_constructor_body_correct_with_body_interface now expects:

constructorBodyScope ctor.params

So the local fix should update those body compile witnesses and the nearby bodyStmts extraction/simp blocks to use constructorBodyScope constructorOnlyCtor.params. The warning at :645 is just fallout from the mismatch (hbodyCompile becomes unused in the old simp form).

Please keep the correction scoped to these stale consumers, then re-run:

lean-slot lake build Compiler.Proofs.EndToEnd.Base
lean-slot lake build Compiler.Proofs.IRGeneration.ContractFeatureTest
lean-slot lake build PrintAxioms
python3 scripts/lean_lint.py --only proof_length
rg -n "sorry|admit|axiom |unsafe|allowlist" Compiler/Proofs/IRGeneration/ContractFeatureTest.lean Compiler/Proofs/EndToEnd/Base.lean Compiler/Proofs/IRGeneration/Function.lean Compiler/Proofs/IRGeneration/SupportedSpec.lean

@Th0rgal

Th0rgal commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d260c4c53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Compiler/Proofs/EndToEnd/Base.lean
@Th0rgal

Th0rgal commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a05390a9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Compiler/Proofs/IRGeneration/SourceSemantics.lean
@Th0rgal

Th0rgal commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1056f078a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

private def validateConstructorArgAliasNameCollisions (params : List Param) :
Except String Unit := do
let generated := constructorArgAliasNames params
match params.find? (fun param => generated.contains param.name) with

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject locals that shadow constructor arg aliases

For constructors that declare a local/binder named arg<i> (for example Stmt.letVar "arg0" ...) this check still passes because it only scans formal parameter names, while genConstructorArgLoads now reserves those same arg<i> identifiers and Expr.constructorArg i lowers to them. That lets a constructor body shadow the generated alias (or emit duplicate Yul let declarations) so later constructorArg reads the local instead of the deploy argument; mirror the ADT collision check by including collectStmtListBindNames body or pass the alias names into constructor scope validation.

Useful? React with 👍 / 👎.

@Th0rgal

Th0rgal commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 082dd8c08d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Th0rgal

Th0rgal commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: c057821775

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant