Skip to content

Phase 1C #2: Prove spec-functions-aware helper-call preservation (StmtListDirectInternalHelperCallStepInterfaceWithInternals) - #2223

Merged
Th0rgal merged 3 commits into
mainfrom
proof/phase1c/helper-exactness-2
Aug 1, 2026
Merged

Phase 1C #2: Prove spec-functions-aware helper-call preservation (StmtListDirectInternalHelperCallStepInterfaceWithInternals)#2223
Th0rgal merged 3 commits into
mainfrom
proof/phase1c/helper-exactness-2

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

Phase 1C case 2/4. Proves the WithInternals (spec-functions-aware) counterpart of the void helper-call list interface merged in #2222:

  • stmtListDirectInternalHelperCallStepInterfaceWithInternals_of_headStepCatalog

Why a new catalog rather than rewrapping the existing one

Direct internal-call heads compile their arguments through compileInternalCallArgs ... spec.functions, so their compiled IR is not determined by the default empty internal-function compiler argument recorded by DirectInternalHelperHeadStepCatalog. The legacy .call witness therefore cannot be rewrapped into the WithInternals interface — the dependency on the supplied internal-function list is visible at the type level.

This PR adds the spec-functions-aware sibling DirectInternalHelperHeadStepCatalogWithInternals, which carries CompiledStmtStepWithHelpersAndHelperIRWithInternals witnesses directly (both the void call and the return-binding assign halves), and assembles the exact list interface from it through the existing helperCallNames-indexed list recursion stmtListDirectInternalHelperCallStepInterfaceWithInternals_of_internalCallSteps_of_helperCallNames.

No interface weakening: the conclusion is the full StmtListDirectInternalHelperCallStepInterfaceWithInternals, mirroring the merged case-1 theorem's shape.

Axiom audit updated: 6032 -> 6033 theorems (4179 -> 4180 public), regenerated with scripts/generate_print_axioms.py.

Test plan

  • lake build passes
  • lake build PrintAxioms passes (fresh remote build, 2569 jobs, exit 0)
  • scripts/generate_print_axioms.py reproduces PrintAxioms.lean byte-identically
  • scripts/check_lean_hygiene.py passes (0 sorry, 0 native_decide, 0 allowUnsafeReducibility)
  • Compiler / layer / package import-boundary checks pass
  • No sorry, admit, axiom, or unsafe escapes in changed source

Note

Low Risk
Proof-only additions in IR generation generic induction; no runtime, auth, or compiler behavior changes—only new Lean structures and one assembly theorem plus axiom audit.

Overview
Phase 1C case 2/4: proves the WithInternals counterpart of assembling StmtListDirectInternalHelperCallStepInterface from a head-step catalog, without weakening the conclusion.

Because direct internal-call heads compile arguments via compileInternalCallArgs ... spec.functions, the existing DirectInternalHelperHeadStepCatalog witnesses (empty internal-function compiler path) cannot be rewrapped. The PR introduces DirectInternalHelperCallHeadStepCatalogWithInternals, indexed by StmtOccursAtScope so the catalog only supplies CompiledStmtStepWithHelpersAndHelperIRWithInternals for void Stmt.internalCall sites at the scopes that actually occur in the function body.

stmtListDirectInternalHelperCallStepInterfaceWithInternals_of_headStepCatalog walks the body list while tracking currentScope, pulling catalog witnesses only when the head is a direct internal call at an embedded occurrence. PrintAxioms.lean registers the new public theorem (6032 → 6033 total).

Reviewed by Cursor Bugbot for commit ed9e1cc. Bugbot is set up for automated code reviews on this repo. Configure here.

…tListDirectInternalHelperCallStepInterfaceWithInternals)

Direct internal-call heads compile their arguments through
compileInternalCallArgs ... spec.functions, so the legacy
DirectInternalHelperHeadStepCatalog witnesses — which record the default
empty internal-function compiler argument — cannot be rewrapped into the
WithInternals list interface. Add the spec-functions-aware sibling catalog
DirectInternalHelperHeadStepCatalogWithInternals, which carries
CompiledStmtStepWithHelpersAndHelperIRWithInternals witnesses directly, and
assemble the exact WithInternals void-helper-call list interface from it via
the existing helperCallNames-indexed list recursion.

Registers the new theorem in the axiom audit (6032 -> 6033).
@vercel

vercel Bot commented Aug 1, 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 Aug 1, 2026 10:29pm

Request Review

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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_a4fdd157-8bac-4088-bc19-8e158c63f6e6)

@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: 3e4b640e1a

ℹ️ 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/GenericInduction/Calls.lean Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OpenCodeReview first-pass review

🟢 No findings from the OCR first pass. Advisory only.

No comments generated. Looks good to me.

OCR pilot metrics & packet coverage

OCR pilot metrics

  • Routing: medium-lean (router-v10)
  • Changed files: 2 supported / 2 total; Lean 2, trust docs 0, workflow/scripts 0, contracts 0, docs 0
  • Changed lines: 65 supported; thresholds large Lean >=3 files or >800 lines
  • OCR: status success; comments 0; files 2; tokens 111265; tool calls 21; warnings 0; duration 243s
  • Largest changed files: Compiler/Proofs/IRGeneration/GenericInduction/Calls.lean (+62/-0), PrintAxioms.lean (+2/-1)

Pilot mode: advisory only. Codex Review remains the merge gate.

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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_c5578418-8cd8-4493-8f34-e8cbf8d4172c)

@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: 201b7b5320

ℹ️ 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/GenericInduction/Calls.lean Outdated
Comment thread Compiler/Proofs/IRGeneration/GenericInduction/Calls.lean Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OpenCodeReview first-pass review

🟠 1 finding(s) (1 low) — see inline comments.

✅ Posted 1 inline comment(s).

OCR pilot metrics & packet coverage

OCR pilot metrics

  • Routing: medium-lean (router-v10)
  • Changed files: 2 supported / 2 total; Lean 2, trust docs 0, workflow/scripts 0, contracts 0, docs 0
  • Changed lines: 86 supported; thresholds large Lean >=3 files or >800 lines
  • OCR: status success; comments 1; files 2; tokens 185623; tool calls 27; warnings 0; duration 371s
  • Largest changed files: Compiler/Proofs/IRGeneration/GenericInduction/Calls.lean (+83/-0), PrintAxioms.lean (+2/-1)

Pilot mode: advisory only. Codex Review remains the merge gate.

Comment thread PrintAxioms.lean
@github-actions

github-actions Bot commented Aug 1, 2026

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

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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_80240b17-5b74-401f-aab3-f20eac5d73c4)

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

OpenCodeReview first-pass review

🔁 Incomplete — this run did not finish and will retry on the same commit. Do not count it as review coverage.

OCR produced no JSON output

OCR stderr highlights
Error: review failed: all 2 file review(s) failed — check your LLM configuration and API key
OCR pilot metrics & packet coverage

OCR pilot metrics

  • Routing: medium-lean (router-v10)
  • Changed files: 2 supported / 2 total; Lean 2, trust docs 0, workflow/scripts 0, contracts 0, docs 0
  • Changed lines: 89 supported; thresholds large Lean >=3 files or >800 lines
  • OCR: status error; comments 0; files unknown; tokens 0; tool calls 0; warnings 0; duration 698s
  • Largest changed files: Compiler/Proofs/IRGeneration/GenericInduction/Calls.lean (+86/-0), PrintAxioms.lean (+2/-1)

Pilot mode: advisory only. Codex Review remains the merge gate.

@Th0rgal
Th0rgal merged commit 9e8bb82 into main Aug 1, 2026
18 of 20 checks passed
Th0rgal added a commit that referenced this pull request Aug 2, 2026
….internalCall via Stmt.letVar) (#2225)

* Phase 1C #4: prove expression-position helper-call preservation (Expr.internalCall via Stmt.letVar) + PrintAxioms counter

References #2080 and predecessor cases #2222/#2223/#2224.

* Fix expression helper interface assembly
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