Skip to content

fix: allowlist proof-length violations + reduce sorries pass 4#1668

Merged
Th0rgal merged 14 commits into
mainfrom
codex/fix-ci-and-reduce-sorries-pass-4
Mar 26, 2026
Merged

fix: allowlist proof-length violations + reduce sorries pass 4#1668
Th0rgal merged 14 commits into
mainfrom
codex/fix-ci-and-reduce-sorries-pass-4

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented Mar 25, 2026

Summary

  • Fix CI failure from PR proofs: continue reducing sorry cleanly (next pass 3) #1659 merge: 6 newly proven theorems exceed the 50-line proof-length limit but were not added to the allowlist in scripts/check_proof_length.py
  • Future commits will continue sorry reduction (corrected ite downstream theorems, eval_compileRequireFailCond, setMappingUint preserves, big induction proofs)

CI Fix Details

Theorems added to allowlist:

  • compiledStmtStep_letVar (93 lines)
  • compiledStmtStep_assignVar (147 lines)
  • compiledStmtStep_return (62 lines)
  • execStmtList_terminal_core_ite_else_eq (356 lines)
  • SupportedBodyInterface (54 lines)
  • legacyCompatibleExternalStmtList_of_compileSetStructMember2_ok (89 lines)

Test plan

  • make check passes
  • lake build PrintAxioms passes
  • python3 scripts/check_proof_length.py passes
  • python3 scripts/generate_print_axioms.py --check passes
  • python3 scripts/generate_verification_status.py --check passes

🤖 Generated with Claude Code


Note

Low Risk
Mostly proof-only Lean changes plus CI script baseline updates; low runtime risk, but moderate chance of proof-check or tooling regressions if fuel/Option-migration reasoning is incomplete.

Overview
Replaces multiple sorry placeholders in Layer-2 IR-generation proofs with full constructive proofs, including eval_compileRequireFailCond_core_onExpr, exec_compileStmtList_core(_extraFuel), and terminal ite branch-matching lemmas; also exposes execIRStmts_revertWithMessage_revert for downstream use.

Updates GenericInduction to prove compiledStmtStep_require and compiledStmtStep_ite, adds scope-inclusion helper lemmas, and adjusts PrintAxioms/verification artifacts to reflect fewer remaining sorrys.

Fixes CI hygiene tooling by expanding the long-proof allowlist, lowering the expected sorry baseline (52→46), and allowing dotted theorem names in property_utils.py regexes.

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

claude and others added 7 commits March 25, 2026 22:41
The sorry-reduction pass 3 (PR #1659) introduced several newly proven
theorems that exceed the 50-line proof-length limit but were not added
to the ALLOWLIST in check_proof_length.py, breaking CI after merge.

Theorems added:
- compiledStmtStep_letVar (93 lines)
- compiledStmtStep_assignVar (147 lines)
- compiledStmtStep_return (62 lines)
- execStmtList_terminal_core_ite_else_eq (356 lines)
- SupportedBodyInterface (54 lines)
- legacyCompatibleExternalStmtList_of_compileSetStructMember2_ok (89 lines)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Write corrected versions of these theorems that split the condition
hypothesis into separate hcondEval/hcondTrue (or hcondFalse) parts,
avoiding the OfNat (Option Nat) 0 type error. The proofs use the
already-proven execStmtList_terminal_core_ite_{then,else}_eq,
stmtResultMatchesIRExec_ir_not_continue_of_terminal_core, and
execIRStmts_compiled_terminal_ite_{then,else}_of_irExec helpers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Proves that compileRequireFailCond produces correct IR for all
ExprCompileCore cases. For ge/le expressions, the compilation
produces lt/gt IR ops respectively, with correctness shown via
case analysis on the comparison predicate. For all other expression
types, the proof uses iszero(compileExpr) via a shared helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replaces the sorry in exec_compileStmtList_core with a complete proof
handling all 6 StmtListCompileCore cases (nil, letVar, assignVar,
require_, return_, stop). The key change from the previously sorry'd
code is proper handling of evalExpr returning Option Nat: each case
that uses evalExpr first establishes the result is some via
eval_compileExpr_core, then case-splits to extract the Nat value.

The require_ case uses eval_compileRequireFailCond_core_onExpr
(proven in the previous commit) instead of the broken
eval_compileRequireFailCond_core whose type signature had = 0
instead of = some 0 for Option Nat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds the scope-based variant of eval_compileRequireFailCond that uses
the corrected = some 0 conclusion (instead of the broken = 0 in the
TYPESIG_SORRY). Delegates to eval_compileRequireFailCond_core_onExpr
via bindingsExactlyMatchIRVarsOnScope_implies_onExpr, following the
same pattern as eval_compileExpr_core_of_scope.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adapts the exec_compileStmtList_core proof to the extraFuel variant
by threading extraFuel through all fuel arithmetic. Uses the
Option-Nat-correct patterns (rcases on evalIRExpr, eval_compileRequireFailCond_core_onExpr)
and the _extraFuel helper lemmas for execIRStmts cons/revert/return.

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

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

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: c35078017b

ℹ️ 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 scripts/check_proof_length.py Outdated
"compiledStmtStep_assignVar",
"compiledStmtStep_return",
"execStmtList_terminal_core_ite_else_eq",
"SupportedBodyInterface",
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 Avoid allowlisting ambiguous theorem names

check_proof_length.py matches allowlist entries against unqualified theorem names (if name in ALLOWLIST), so adding "SupportedBodyInterface" here allowlists all declarations with that identifier, not just the long one in GenericInduction.lean. There are already two other SupportedBodyInterface theorems in Compiler/Proofs/IRGeneration/SupportedSpec.lean; if either grows past 50 lines, CI will now miss that regression. This weakens the hard-limit guard beyond the intended scope of this PR.

Useful? React with 👍 / 👎.

claude and others added 5 commits March 26, 2026 00:31
Update THEOREM_RE regex to capture full dot-separated Lean theorem names
(e.g. SupportedBodyInterface.helperFreeStepInterface) instead of only
the prefix before the first dot. Replace ambiguous allowlist entries
with their specific dotted names so each entry targets exactly one proof.

Addresses Codex review comment on PR #1668.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t sorry in FunctionBody.lean)

Complete proof of the terminal statement list compilation theorem covering
all StmtListTerminalCore cases: letVar, assignVar, require_ (pass/fail),
return_, stop, and ite (then/else branches). The ITE case required careful
fuel arithmetic using sizeOf_spec lemmas with an intermediate subtraction
elimination technique to work around omega's limitations with Nat subtraction
over many variables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tness

Eliminates one sorry from GenericInduction.lean (49 → 48 sorry warnings).
Proves that compiling an ITE statement with terminal branches produces
correct IR by bridging source-level execStmt with IR-level block execution
via stmtResultMatchesIRExec_compiled_terminal_ite_{then,else}.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prove the compilation-step theorem for `require` statements by following
the pattern from `compiledStmtStep_letVar`. The key insight is that for
`ExprCompileCore` conditions, `collectExprNames` only contains variable
names (not storage field names), so `scopeNamesPresent (stmtNextScope ...)`
can be proved via `scopeNamesPresent_of_included`.

Also make `execIRStmts_revertWithMessage_revert` non-private so it can be
used cross-file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Included

Prove both scope-weakening conversion theorems that convert
StmtListCompileCore/StmtListTerminalCore proofs into StmtListGenericCore.
This eliminates 2 active sorries (48 → 46).

Key additions:
- scopeNamesIncluded_cons: scope inclusion lifts through cons
- stmtListCompileCore_of_scopeNamesIncluded: CompileCore scope weakening
- stmtListTerminalCore_of_scopeNamesIncluded: TerminalCore scope weakening

These were blocked on compiledStmtStep_require (proven in previous commit)
and compiledStmtStep_ite (proven earlier).

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

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread Compiler/Proofs/IRGeneration/FunctionBody.lean
claude added 2 commits March 26, 2026 08:47
- Regenerate PrintAxioms.lean to reflect visibility/sorry changes:
  execIRStmts_revertWithMessage_revert (private -> public),
  exec_compileStmtList_core and _extraFuel (sorry -> proven),
  exec_compileStmtList_terminal_core_sizeOf_extraFuel (sorry -> proven),
  compiledStmtStep_ite (sorry -> proven), plus new public theorems.
- Update verification_status.json, VERIFICATION_STATUS.md, and
  check_lean_hygiene.py sorry count (52 -> 46).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve PrintAxioms.lean conflict by regenerating from source.
All make check passes.

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

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

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: ca0cd4d095

ℹ️ 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 scripts/property_utils.py
THEOREM_RE = re.compile(
r"^\s*(?P<attrs>(?:@\[[^\]]*\]\s*)*)(?P<visibility>(?:(?:private|protected)\s+)*)"
r"(?P<kind>theorem|lemma)\s+(?P<name>[A-Za-z_][A-Za-z0-9_']*)\b"
r"(?P<kind>theorem|lemma)\s+(?P<name>[A-Za-z_][A-Za-z0-9_.']*)\b"
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 Keep property tag parsing consistent with dotted theorem names

Allowing . in theorem identifiers here means manifest extraction can now produce names like Foo.bar, but extract_property_names still relies on PROPERTY_WITH_NUM_RE / PROPERTY_SIMPLE_RE, which only accept [A-Za-z0-9_']+. In that scenario, a test annotation such as /// Property: Foo.bar is ignored, so coverage checks (check_property_coverage.py and verification metrics) will report the theorem as uncovered even when the test exists. Please update the property-tag regexes to accept dotted identifiers so manifest and coverage parsing stay aligned.

Useful? React with 👍 / 👎.

@Th0rgal Th0rgal merged commit 7267d7f into main Mar 26, 2026
29 checks passed
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