Skip to content

feat: expand proven fragment with assignStorage constructors#1732

Open
Th0rgal wants to merge 5 commits intomainfrom
feat/issue-1723-expand-proven-fragment
Open

feat: expand proven fragment with assignStorage constructors#1732
Th0rgal wants to merge 5 commits intomainfrom
feat/issue-1723-expand-proven-fragment

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented Apr 14, 2026

Summary

  • Adds assignStorageField and assignStorageAddrField constructors to SupportedStmtList, covering Stmt.assignVar with Expr.storage / Expr.storageAddr reads
  • Mirrors the existing letStorageField / letStorageAddrField constructors (same semantics via bindValue, only IR instruction differs: assign vs let_)
  • Full step proofs, singleton wrappers, surface bridges, and assembly chain match cases — zero new sorries

Closes #1723 (partial — first two constructors of many needed)

Test plan

  • lake build passes (full project, 99/100 modules)
  • python3 scripts/check_lean_hygiene.py passes (0 sorries, 0 debug commands)
  • No new linter warnings introduced

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it expands the proven supported-statement fragment and updates source semantics/spec “unsupported surface” classifiers (including emit), which can affect what programs are considered provable/executable under the proof framework.

Overview
Extends the proven supported statement fragment to cover Stmt.assignVar that reads from storage via Expr.storage and Expr.storageAddr, including new compilation-step proofs that these compile to sload and preserve the source/IR state relation.

Adds minimal source semantics for Stmt.emit (evaluate args; no state change) and threads emit through the various “unsupported surface” predicates and related lemmas/induction machinery, including a small refactor to factor out stmtTouchesUnsupportedCallSurface_eq_featureOr.

Adds macro generation of per-function @[simp] theorems *_is_view for view functions, a new viewPreservesState frame predicate, and a smoke test that references an auto-generated _is_view theorem to ensure it is emitted.

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

claude and others added 4 commits April 14, 2026 17:14
)

Add `assignStorageField` and `assignStorageAddrField` constructors to
`SupportedStmtList`, extending the proven fragment to cover `assignVar`
with `Expr.storage` and `Expr.storageAddr` — mirroring the existing
`letStorageField` / `letStorageAddrField` constructors.

Each constructor includes:
- Full `compiledStmtStep_*` proof in GenericInduction.lean
- Singleton wrapper and surface bridge theorems
- Match cases in all 3 assembly chain theorems
- Helper surface closed theorems and 5 match cases in SupportedSpec.lean

Zero new sorries. Lean hygiene check passes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
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```

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: 1023eea583

ℹ️ 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 on lines +47 to +49
def mkViewTheoremCommand (fnDecl : FunctionDecl) : CommandElabM Cmd := do
let viewName ← mkSuffixedIdent fnDecl.ident "_is_view"
let modelName ← mkSuffixedIdent fnDecl.ident "_model"
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 Reserve _is_view helper names in name validation

mkViewTheoremCommand now generates a declaration named <function>_is_view, but validateGeneratedDefNamesPublic still only reserves _modelBody, _model, _bridge, and _semantic_preservation. That means a contract can pass validation with a user declaration like currentOwner_is_view and then fail later during elaboration when this theorem is emitted as a duplicate declaration. Please add _is_view to the generated-name collision checks so this is caught deterministically at validation time.

Useful? React with 👍 / 👎.

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.

Extend proven fragment to cover the full CompilationModel language surface

2 participants