Skip to content
Open
Changes from 7 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
99efff2
Write down the structure of the category of LTSs
ayberkt Mar 2, 2026
ec7b48e
Prove that these form a category
ayberkt Mar 2, 2026
28840c2
Replace unused variable names with underscores
ayberkt Mar 2, 2026
33d6785
Improve cosmetics
ayberkt Mar 2, 2026
528040d
Add comment
ayberkt Mar 2, 2026
691b443
Add Markdown sections
ayberkt Mar 2, 2026
3a7993f
Improve naming
ayberkt Mar 2, 2026
dc216e3
Re-order variables
ayberkt Mar 3, 2026
2d068c3
Put `LTSMorphism` under the `LTS` namespace
ayberkt Mar 3, 2026
487c4f3
Fix the definition of the category of LTSs
ayberkt Mar 3, 2026
c942d95
Use the notion of `BundledLTS` everywhere
ayberkt Mar 3, 2026
dc6ba49
Tweak
ayberkt Mar 3, 2026
f8a6c32
Change name from `BundledLTS` to `LTSCat`
ayberkt Mar 6, 2026
33aec96
Propagate name change
ayberkt Mar 6, 2026
d24bfbf
Unalign code
ayberkt Mar 6, 2026
3b06814
Unalign code
ayberkt Mar 6, 2026
aca5ea3
Remove critique of Lean/CSLib naming conventions
ayberkt Mar 6, 2026
687e74a
Use `where` with `def`
ayberkt Mar 6, 2026
270fbbf
Unalign
ayberkt Mar 6, 2026
1d026fe
Generalize universes
ayberkt Mar 6, 2026
d38dc1a
Chang name `toFun` to `stateMap`
ayberkt Mar 6, 2026
7ccee71
Rename `fun_preserves_transitions` to `labelMap_tr`
ayberkt Mar 6, 2026
af1435b
Make universe explicit
ayberkt Mar 6, 2026
3424e83
Avoid a separate `CategoryStruct` instance
ayberkt Mar 6, 2026
f5991cf
Improve cosmetics of type
ayberkt Mar 6, 2026
c5b6427
rename Category.lean -> LTSCat/Basic.lean
ayberkt Mar 6, 2026
ad87aaf
Define the category like Winskel and Nielsen do
ayberkt Mar 6, 2026
4021718
Add reference to the handbook chapter
ayberkt Mar 6, 2026
5598696
Update comment and add reference
ayberkt Mar 6, 2026
be34cae
Update comments
ayberkt Mar 6, 2026
3cdb022
Merge remote-tracking branch 'upstream/main'
ayberkt Mar 8, 2026
b631a2a
Clean up
ayberkt Mar 8, 2026
c0e8fad
Fix the definition of `lift`
ayberkt Mar 8, 2026
628147f
Propagate change to proofs
ayberkt Mar 8, 2026
9aae6b4
Wrap up cleaning
ayberkt Mar 8, 2026
2e516b0
lake exe mk_all --module
chenson2018 Mar 9, 2026
5d2a411
Improve cosmetics of type
ayberkt Mar 20, 2026
e229112
Eta reduce definition
ayberkt Mar 20, 2026
66473c2
Simplify proof
ayberkt Mar 20, 2026
ade5fe5
Simplify proof
ayberkt Mar 20, 2026
3269cf7
Simplify proof
ayberkt Mar 20, 2026
b8805fe
Use `unfold` instead of `simp`
ayberkt Mar 20, 2026
7fb81a2
Implement @chenson2018’s suggestion
ayberkt Mar 20, 2026
2c1d984
Fix preamble and use `Cslib` namespace
ayberkt Mar 20, 2026
1deab70
Merge branch 'main' of github.com:ayberkt/cslib
ayberkt Mar 20, 2026
d1e143e
Add doc strings
ayberkt Mar 20, 2026
fcf30a1
Add doc strings
ayberkt Mar 20, 2026
9a44e4c
Add copyright notice
ayberkt Mar 20, 2026
338acc0
Mention employer
ayberkt Mar 20, 2026
bcd9a65
Merge remote-tracking branch 'origin/main' into ayberkt/main
chenson2018 Mar 20, 2026
c98f004
remove some change
chenson2018 Mar 20, 2026
1c1489a
use _root_.id consistently
chenson2018 Mar 20, 2026
b5814a1
nolint checkUnivs (not 100% sure, but it's not uncommon in category t…
chenson2018 Mar 20, 2026
621931d
Rename `lift` to `LTS.lift`
ayberkt Mar 20, 2026
bd289fb
Merge branch 'main' of github.com:ayberkt/cslib
ayberkt Mar 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions Cslib/Foundations/Semantics/LTS/Category.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/-
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ayberk Tosun
-/

module

public import Cslib.Foundations.Semantics.LTS.Basic
public import Mathlib.CategoryTheory.Category.Basic
open Cslib

@[expose] public section

variable {State Label State₃ Label₃ State₁ State₂ Label₁ Label₂ : Type}
variable (lts₁ : LTS State₁ Label₁)
variable (lts₂ : LTS State₂ Label₂)
variable (lts₃ : LTS State₃ Label₃)

/-!
# Category of Labelled Transition Systems
-/

/-! ## Definition of LTS morphism -/

/-- A morphism between two labelled transition systems, consisting of a function on states, a
function on labels, and a proof that transitions are preserved. -/
structure LTSMorphism (lts₁ : LTS State₁ Label₁) (lts₂ : LTS State₂ Label₂) : Type where
toFun : State₁ → State₂
labelMap : Label₁ → Label₂
fun_preserves_transitions : (s s' : State₁)
→ (l : Label₁)
→ lts₁.Tr s l s'
→ lts₂.Tr (toFun s) (labelMap l) (toFun s')

/-- The identity LTS morphism. -/
def LTSMorphism.id (lts : LTS State Label) : LTSMorphism lts lts :=
{ toFun := _root_.id
, labelMap := _root_.id
, fun_preserves_transitions := fun _ _ _ h => h
}

/-- Composition of LTS morphisms. -/
def LTSMorphism.comp : LTSMorphism lts₁ lts₂ → LTSMorphism lts₂ lts₃ → LTSMorphism lts₁ lts₃ :=
fun ⟨f, μ, p⟩ ⟨g, ν, q⟩ =>
let r := by intros _ _ _ h
apply q
apply p
exact h
⟨g ∘ f, ν ∘ μ, r⟩

/-! ## LTSs and LTS morphisms form a category -/

/-- `LTSMorphism` provides a category structure on the `LTS` type. -/
instance {State Label : Type} : CategoryTheory.CategoryStruct (LTS State Label) where
Hom := LTSMorphism
id := LTSMorphism.id
comp {lts₁} {lts₂} {lts₃} := LTSMorphism.comp lts₁ lts₂ lts₃

/-- Proof that the above structure actually forms a category. -/
instance {State Label : Type} : CategoryTheory.Category (LTS State Label) where
id_comp := by
intro _ _ f
cases f
rfl
comp_id := by
intro _ _ f
cases f
rfl
assoc := by
intro _ _ _ _ f g h
cases f
cases g
cases h
rfl