-
Notifications
You must be signed in to change notification settings - Fork 163
feat: basic defs of collections of labelled transition systems #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Shreyas4991
wants to merge
8
commits into
leanprover:main
Choose a base branch
from
Shreyas4991:vector_LTSes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e5e92d9
Basic defs of vector LTSes
Shreyas4991 79b9c5c
Fix
Shreyas4991 3f7c56c
Undo modulizing CslibTests
Shreyas4991 4c86e3a
Undo modulizing CslibTests
Shreyas4991 3598c6a
Add docstrings
Shreyas4991 e4c062e
remove needless type annotation
Shreyas4991 5959f80
remove needless type annotation
Shreyas4991 2c98117
Let's try not using abbrevs
Shreyas4991 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /- | ||
| Copyright (c) 2026 Shreyas Srinivas. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Shreyas Srinivas | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Foundations.Semantics.LTS.Basic | ||
|
|
||
| /-! | ||
| # Vectors Labelled Transition System (LTS) | ||
|
|
||
| Defined vectors of labelled transition systems, an abstraction that frequently | ||
| pops up in the semantics of cryptography, distributed computing, game theory,and concurrency theory. | ||
|
|
||
| In particular, there are two "views" of a vector LTSes, | ||
| 1. As a vector of many `Entity → LTS State Label` representing multiple | ||
| labelled transition systems, each of which corresponds to the local view | ||
| of a node/entity `e : Entity`. | ||
|
|
||
| 2. As a single LTS with a state vector `LTS (Fin n → State) (Fin n → Label)`. | ||
| This is the global view of the system in operation | ||
|
|
||
| We prove theorems to transition between these two views. This is a common | ||
| theme that occurs in all the aforementioned areas where such labelled transition | ||
| systems are used. Further we provide notions of fair executions, step | ||
| transitions of individual nodes, scheduling, and fairness. | ||
|
|
||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib | ||
|
|
||
| /-- | ||
| An indexed collection of LTSes. Each component LTS represents | ||
| the local view of an entity. | ||
| -/ | ||
| abbrev LTSVec (Entity : Type u) (State Label : Entity → Type*) := | ||
| (e : Entity) → LTS (State e) (Label e) | ||
|
|
||
| /-- | ||
| An LTS of vector states and vector labels. A labelled transition system | ||
| which represents the global view of a collection of LTSes, collectively | ||
| transition for each input vector label to their next states. This | ||
| matches how synchronous distributed systems behave | ||
| -/ | ||
| abbrev SynchronousVecLTS (Entity : Type u) (State Label : Entity → Type*) := | ||
| LTS ((e : Entity) → State e) ((e : Entity) → Label e) | ||
|
|
||
| def LTSVec.toSynchronousVecLTS {Entity} {State Label : Entity → Type*} | ||
| (l : LTSVec Entity State Label) : SynchronousVecLTS Entity State Label where | ||
| Tr s μ s' := ∀ e, (l e).Tr (s e) (μ e) (s' e) | ||
|
|
||
| def AsynchronousVecLTS (Entity : Type u) (State Label : Entity → Type*) := | ||
| LTS ((e : Entity) → State e) (Σ (e : Entity), Label e) | ||
| /-- | ||
| A model of an asynchronously advancing collection of LTSes. This abstracts | ||
| the behaviour of asynchronous distributed systems. | ||
| -/ | ||
| abbrev LTSVec.toAsynchronousVecLTS (Entity : Type u) | ||
| (State Label : Entity → Type*) | ||
| (l : LTSVec Entity State Label) : | ||
| AsynchronousVecLTS Entity State Label where | ||
| Tr := fun s ⟨e, μe⟩ s' => | ||
| (l e).Tr (s e) μe (s' e) ∧ ∀ e' ≠ e, s e = s' e | ||
|
ctchou marked this conversation as resolved.
Outdated
|
||
|
|
||
| end Cslib | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason
Entityhas typeType urather thanType*?Same comment for occurrences of
Entitybelow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Universe resolution only succeeds with at least one explicit universe parameter. That's basically the reason in both instances, but I recall the error being thrown up only in the second occurrence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried replacing every
Type ubyType*. It didn't seem to break anything.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even in line 56? That's the definition I got an error in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all needless
Type uandType*annotations now.