Skip to content

Convert remaining Lean files under /Strata to modules#982

Merged
shigoel merged 2 commits into
mainfrom
jhx/strata_module
Apr 21, 2026
Merged

Convert remaining Lean files under /Strata to modules#982
shigoel merged 2 commits into
mainfrom
jhx/strata_module

Conversation

@joehendrix
Copy link
Copy Markdown
Contributor

Summary

Convert 49 of the 50 remaining non-module .lean files to use the Lean module keyword,
making StrataMain and nearly all files under Strata/ proper Lean modules.

Changes

  • Added module keyword to 49 files across all subsystems (CBMC, B3, Boole, C_Simp,
    Core, Dyn, DL, Transform, Util, MetaVerifier, StrataMain).

  • Added public section blocks for files that export types or functions used by
    downstream consumers. Used public import with minimal scope (e.g.
    public import Lean.Data.Json.Basic rather than public import Lean.Data.Json) to
    keep transitive exports narrow.

  • Added @[expose] annotations to a handful of upstream definitions
    (ListUtils.lean, CmdSemantics.lean, StatementSemantics.lean, ProcBodyVerify.lean,
    CoreSpecification.lean, Specification.lean) where proof files needed to unfold
    definitions across module boundaries.

  • MetaVerifier: Moved meta tactic registration outside the main public section
    into its own public section to satisfy the requirement that tactic elaboration
    attributes are public.

  • StrataMain: Added explicit imports for modules that were previously accessible
    transitively but became inaccessible once StrataMain became a module.

Not converted

  • Strata.Languages.C_Simp.StrataToCBMC — has pre-existing build errors (references
    non-existent CProverJson namespace). Nothing imports this file.

Files changed by subsystem

Subsystem Files converted
Strata.Backends.CBMC 10
Strata.DL.Imperative 3
Strata.DL.Lambda 1
Strata.DL.SMT 2
Strata.Languages.B3 10
Strata.Languages.Boole 3
Strata.Languages.C_Simp 4
Strata.Languages.Core 3
Strata.Languages.Dyn 4
Strata.MetaVerifier 1
Strata.Transform 4
Strata.Util 2
StrataMain 1
Total 49

By submitting this pull request, I confirm that you can use, modify, copy, and
redistribute this contribution, under the terms of your choice.

Base automatically changed from jhx/lean-4.29 to main April 21, 2026 14:07
@joehendrix joehendrix changed the title Convert remaining non-module files to use Lean module keyword Convert all remaining Strata Lean files to modules Apr 21, 2026
@joehendrix joehendrix changed the title Convert all remaining Strata Lean files to modules Convert remaining Lean files under /Strata to modules Apr 21, 2026
Add public visibility annotations to definitions and instances in
TestGen.lean and Verifier.lean that are needed by test files.
Add Strata.Util.Random import to TestGenTests.lean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joehendrix joehendrix marked this pull request as ready for review April 21, 2026 17:30
@joehendrix joehendrix requested a review from a team April 21, 2026 17:30
Copy link
Copy Markdown
Contributor

@shigoel shigoel left a comment

Choose a reason for hiding this comment

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

Looks good — thorough, well-documented mechanical migration. CI is green, import all / public section / @[expose] usage is consistent with existing codebase patterns. No functional changes, no new API surface concerns. Nice work.

Copy link
Copy Markdown
Contributor

@joscoh joscoh left a comment

Choose a reason for hiding this comment

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

Nothing blocking, just have a few questions about how public and private modifiers work in certain cases.

Comment thread Strata/Backends/CBMC/GOTO/CoreToCProverGOTO.lean
Comment thread Strata/Backends/CBMC/CollectSymbols.lean
Comment thread Strata/Languages/B3/Verifier.lean
@shigoel shigoel added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit 39e39fd Apr 21, 2026
24 checks passed
@shigoel shigoel deleted the jhx/strata_module branch April 21, 2026 18:42
keyboardDrummer pushed a commit to keyboardDrummer/Strata that referenced this pull request May 21, 2026
Migrate 241 of 282 non-Boole StrataTest files to be Lean modules,
completing the module migration started in strata-org#982.

- **Added `module` keyword** to 241 test files. The Boole test files are
excluded because `gen_smt_vcs` produces proof terms that fail kernel
type-checking when the file is a module.

- **Added `meta import`** for Strata/StrataTest dependencies where
`#eval`, `#guard_msgs`, or `#guard` need native implementations from the
imported module.

- **Added `meta import all`** where proofs use `simp`, `rfl`, or
`native_decide` on definitions whose bodies must be visible across the
module boundary.

- **Added `import all`** where non-meta definitions (types, instances)
need access to definition bodies from other StrataTest modules.

- **Added `meta section` wrappers** around test code that exercises
native implementations, since `#eval`/`#guard_msgs`/`#guard` require
meta context to call into compiled code from another module.

- **Added `import Strata.DDM.Integration.Lean.HashCommands`** (non-meta)
in files using `#strata`/`#dialect` syntax, since the syntax extension
must be available at parse time regardless of meta context.

- **Updated byte offsets** in `#guard_msgs` docstrings where expected
output includes position-dependent labels (e.g., invariant names derived
from source positions shifted by added import lines).

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants