Skip to content

chore: split LTS/Basic.lean into more manageable pieces#453

Merged
fmontesi merged 10 commits intoleanprover:mainfrom
ctchou:lts-split
Mar 26, 2026
Merged

chore: split LTS/Basic.lean into more manageable pieces#453
fmontesi merged 10 commits intoleanprover:mainfrom
ctchou:lts-split

Conversation

@ctchou
Copy link
Copy Markdown
Collaborator

@ctchou ctchou commented Mar 24, 2026

This PR splits Cslib/Foundations/Semantics/LTS/Basic.lean into 7 files with the following dependencies among them:

  • Basic.lean
  • Execution.lean, which imports Basic.lean
  • OmegaExecution.lean, which imports Execution.lean
  • Total.lean, which imports OmegaExecution.lean
  • HasTau.lean, which imports Basic.lean
  • Divergence.lean, which imports HasTau.lean and OmegaExecution.lean
  • Union.lean, which imports Basic.lean

Other files which formerly import LTS/Basic.lean now import only the "lowest" necessary file in the above hierarchy. LTS/Basic.lean now imports only Cslib.Init and some mathlib files.

I also took the opportunity to rename a few theorems to more rational and systematic names.

Copy link
Copy Markdown
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

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

Two very small comments, thanks for starting this!

Comment thread Cslib/Foundations/Semantics/LTS/Basic.lean Outdated
Comment thread Cslib/Foundations/Semantics/LTS/Divergence.lean Outdated
@chenson2018
Copy link
Copy Markdown
Collaborator

One more thought. I think in splitting this up, we should do two more things:

  • create a LTS/Defs.lean module that only has definitions
  • move the meta section at the bottom into its own module (LTS/Attr.lean, LTS/Meta.lean?). My understanding from discussion on Zulip is that this is preferable for isolating meta imports

@fmontesi
Copy link
Copy Markdown
Collaborator

One more thought. I think in splitting this up, we should do two more things:

  • create a LTS/Defs.lean module that only has definitions
  • move the meta section at the bottom into its own module (LTS/Attr.lean, LTS/Meta.lean?). My understanding from discussion on Zulip is that this is preferable for isolating meta imports

What would go in LTS/Defs.lean exactly? I'm not sure myself.

@chenson2018
Copy link
Copy Markdown
Collaborator

What would go in LTS/Defs.lean exactly? I'm not sure myself.

I just had the impression that maybe the couple of remaining sections (Termination, Classes) in LTSD/Basic.lean might also be split off. I might be missing how they're interconnected.

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Mar 24, 2026

One of my goals is to remove the dependency on OmegaSequence as much as possible from all files that uses LTS (including LTS files themselves). There are quite a few definitions that need OmegaSequence, so I don't think putting all definitions in the single file is a good idea. (BTW, only 3 LTS files uses OmegaSequence now: OmegaExecution.lean, Total.lean, and Divergence.lean. Outside LTS, the first two are imported only by Automata/NA/{Basic,Total}.lean, respectively. Divergence.lean is not used anywhere.)

I'll go ahead with putting Termination and the meta section in its own file. I'm not sure about Classes, because it does not seem to have a coherent theme. Actually I think splitting out Relation related stuff into its own file may make more sense.

Comment thread Cslib/Foundations/Semantics/LTS/Notation.lean Outdated
Comment thread Cslib/Foundations/Semantics/LTS/Notation.lean Outdated
@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Mar 24, 2026

@chenson2018 Thanks for the fix. I'll try to see if I can split out Relation.

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Mar 24, 2026

LTS/Relation.lean has been split out. LTS/Basic.lean is now about 300 lines long. This is about as far as I want to go.

Comment thread Cslib/Foundations/Semantics/LTS/Notation.lean Outdated
@chenson2018
Copy link
Copy Markdown
Collaborator

!radar

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Mar 25, 2026

Benchmark results for a8a45a5 against 1119f31 are in. There are no significant changes. @chenson2018

  • 🟥 build//instructions: +26.5G (+1.41%)

Small changes (2✅, 11🟥)

  • build/module/Cslib.Foundations.Semantics.LTS.Basic//instructions: -104.6G (-92.17%) (reduced significance based on *//lines)
  • build/module/Cslib.Logics.HML.LogicalEquivalence//instructions: -236.7M (-3.12%)
  • 🟥 build/profile/.olean serialization//wall-clock: +425ms (+10.69%)
  • 🟥 build/profile/compilation (LCNF base)//wall-clock: +168ms (+15.07%)
  • 🟥 build/profile/compilation (LCNF impure)//wall-clock: +38ms (+16.49%)
  • 🟥 build/profile/compilation (LCNF mono)//wall-clock: +81ms (+15.82%)
  • 🟥 build/profile/elaboration//wall-clock: +974ms (+16.37%)
  • 🟥 build/profile/import//wall-clock: +8s (+16.10%)
  • 🟥 build/profile/initialization//wall-clock: +300ms (+13.75%)
  • 🟥 build/profile/interpretation//wall-clock: +4s (+15.48%)
  • 🟥 build/profile/lazy discriminator local search//wall-clock: +0s (+90.00%)
  • 🟥 build/profile/parsing//wall-clock: +108ms (+14.43%)
  • 🟥 build/profile/process pre-definitions//wall-clock: +155ms (+16.74%)

@chenson2018
Copy link
Copy Markdown
Collaborator

(I think the benchmarking is mostly noise here, just wanted to check to be sure)

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Mar 25, 2026

I made the change of using namespace LTS and removing the LTS. prefix as much as possible. Note that some identifiers in TraceEq.lean, Simulation.lean, and Bisimulation.lean were not in the LTS namespace but are now in it. This leads to several other changes elsewhere outside LTS.

@ctchou
Copy link
Copy Markdown
Collaborator Author

ctchou commented Mar 25, 2026

Also, I made the decision of not putting HasTau in the LTS namespace. If you think it should be, let me know.

@fmontesi
Copy link
Copy Markdown
Collaborator

LGTM, thanks!

@fmontesi fmontesi enabled auto-merge March 25, 2026 17:57
@fmontesi fmontesi added this pull request to the merge queue Mar 26, 2026
Merged via the queue into leanprover:main with commit 5245717 Mar 26, 2026
2 checks passed
@ctchou ctchou deleted the lts-split branch March 27, 2026 00:27
thomaskwaring pushed a commit to thomaskwaring/cslib_SKI that referenced this pull request Apr 6, 2026
This PR splits `Cslib/Foundations/Semantics/LTS/Basic.lean` into 7 files
with the following dependencies among them:
- Basic.lean
- Execution.lean, which imports Basic.lean
- OmegaExecution.lean, which imports Execution.lean
- Total.lean, which imports OmegaExecution.lean
- HasTau.lean, which imports Basic.lean
- Divergence.lean, which imports HasTau.lean and OmegaExecution.lean
- Union.lean, which imports Basic.lean

Other files which formerly import LTS/Basic.lean now import only the
"lowest" necessary file in the above hierarchy. LTS/Basic.lean now
imports only Cslib.Init and some mathlib files.

I also took the opportunity to rename a few theorems to more rational
and systematic names.

---------

Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
tannerduve pushed a commit to tannerduve/cslib that referenced this pull request Apr 22, 2026
This PR splits `Cslib/Foundations/Semantics/LTS/Basic.lean` into 7 files
with the following dependencies among them:
- Basic.lean
- Execution.lean, which imports Basic.lean
- OmegaExecution.lean, which imports Execution.lean
- Total.lean, which imports OmegaExecution.lean
- HasTau.lean, which imports Basic.lean
- Divergence.lean, which imports HasTau.lean and OmegaExecution.lean
- Union.lean, which imports Basic.lean

Other files which formerly import LTS/Basic.lean now import only the
"lowest" necessary file in the above hierarchy. LTS/Basic.lean now
imports only Cslib.Init and some mathlib files.

I also took the opportunity to rename a few theorems to more rational
and systematic names.

---------

Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
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.

4 participants