Skip to content

Commit 61c9ae2

Browse files
authored
feat: product of FLTS (#218)
This PR introduces the product of two FLTS and refactors DA.prod to use that definition and its theorems (currently only one).
1 parent f217e8c commit 61c9ae2

9 files changed

Lines changed: 44 additions & 14 deletions

File tree

Cslib.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ import Cslib.Foundations.Data.OmegaSequence.Init
3333
import Cslib.Foundations.Data.OmegaSequence.Temporal
3434
import Cslib.Foundations.Data.Relation
3535
import Cslib.Foundations.Lint.Basic
36+
import Cslib.Foundations.Semantics.FLTS.Basic
37+
import Cslib.Foundations.Semantics.FLTS.FLTSToLTS
38+
import Cslib.Foundations.Semantics.FLTS.LTSToFLTS
39+
import Cslib.Foundations.Semantics.FLTS.Prod
3640
import Cslib.Foundations.Semantics.LTS.Basic
3741
import Cslib.Foundations.Semantics.LTS.Bisimulation
38-
import Cslib.Foundations.Semantics.LTS.FLTS
39-
import Cslib.Foundations.Semantics.LTS.FLTSToLTS
40-
import Cslib.Foundations.Semantics.LTS.LTSToFLTS
4142
import Cslib.Foundations.Semantics.LTS.Simulation
4243
import Cslib.Foundations.Semantics.LTS.TraceEq
4344
import Cslib.Foundations.Semantics.ReductionSystem.Basic

Cslib/Computability/Automata/DA/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Authors: Fabrizio Montesi, Ching-Tsun Chou
77
import Cslib.Computability.Automata.Acceptors.Acceptor
88
import Cslib.Computability.Automata.Acceptors.OmegaAcceptor
99
import Cslib.Foundations.Data.OmegaSequence.InfOcc
10-
import Cslib.Foundations.Semantics.LTS.FLTS
10+
import Cslib.Foundations.Semantics.FLTS.Basic
1111

1212
/-! # Deterministic Automata
1313

Cslib/Computability/Automata/DA/Prod.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Ching-Tsun Chou
55
-/
66

77
import Cslib.Computability.Automata.DA.Basic
8+
import Cslib.Foundations.Semantics.FLTS.Prod
89

910
/-! # Product of deterministic automata. -/
1011

@@ -17,20 +18,19 @@ variable {State1 State2 Symbol : Type*}
1718

1819
namespace DA
1920

20-
/-- The product of two deterministic automata.
21-
TODO: This operation could be generalised to FLTS and lifted here. -/
21+
/-- The product of two deterministic automata. -/
2222
@[scoped grind =]
2323
def prod (da1 : DA State1 Symbol) (da2 : DA State2 Symbol) : DA (State1 × State2) Symbol where
24+
toFLTS := da1.toFLTS.prod da2.toFLTS
2425
start := (da1.start, da2.start)
25-
tr := fun (s1, s2) x ↦ (da1.tr s1 x, da2.tr s2 x)
2626

2727
/-- A state is reachable by the product automaton iff its components are reachable by
28-
the respective component automata. -/
28+
the respective automaton components. -/
2929
@[simp, scoped grind =]
3030
theorem prod_mtr_eq (da1 : DA State1 Symbol) (da2 : DA State2 Symbol)
3131
(s : State1 × State2) (xs : List Symbol) :
32-
(da1.prod da2).mtr s xs = (da1.mtr s.fst xs, da2.mtr s.snd xs) := by
33-
induction xs generalizing s <;> grind
32+
(da1.prod da2).mtr s xs = (da1.mtr s.fst xs, da2.mtr s.snd xs) :=
33+
FLTS.prod_mtr_eq da1.toFLTS da2.toFLTS s xs
3434

3535
end DA
3636

Cslib/Computability/Automata/DA/ToNA.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authors: Fabrizio Montesi
66

77
import Cslib.Computability.Automata.DA.Basic
88
import Cslib.Computability.Automata.NA.Basic
9-
import Cslib.Foundations.Semantics.LTS.FLTSToLTS
9+
import Cslib.Foundations.Semantics.FLTS.FLTSToLTS
1010

1111
/-! # Translation of Deterministic Automata into Nonodeterministic Automata.
1212

Cslib/Computability/Automata/NA/ToDA.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authors: Fabrizio Montesi
66

77
import Cslib.Computability.Automata.DA.Basic
88
import Cslib.Computability.Automata.NA.Basic
9-
import Cslib.Foundations.Semantics.LTS.LTSToFLTS
9+
import Cslib.Foundations.Semantics.FLTS.LTSToFLTS
1010

1111
/-! # Translation of Nondeterministic Automata for finite strings into Deterministic Automata
1212
File renamed without changes.

Cslib/Foundations/Semantics/LTS/FLTSToLTS.lean renamed to Cslib/Foundations/Semantics/FLTS/FLTSToLTS.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Fabrizio Montesi
55
-/
66

77
import Cslib.Foundations.Semantics.LTS.Basic
8-
import Cslib.Foundations.Semantics.LTS.FLTS
8+
import Cslib.Foundations.Semantics.FLTS.Basic
99

1010
variable {State Label : Type*}
1111

Cslib/Foundations/Semantics/LTS/LTSToFLTS.lean renamed to Cslib/Foundations/Semantics/FLTS/LTSToFLTS.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Fabrizio Montesi
55
-/
66

77
import Cslib.Foundations.Semantics.LTS.Basic
8-
import Cslib.Foundations.Semantics.LTS.FLTS
8+
import Cslib.Foundations.Semantics.FLTS.Basic
99

1010
variable {State Label : Type*}
1111

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/-
2+
Copyright (c) 2025 Fabrizio Montesi. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Ching-Tsun Chou, Fabrizio Montesi
5+
-/
6+
7+
import Cslib.Foundations.Semantics.FLTS.Basic
8+
9+
/-! # Product of functional labelled transition systems -/
10+
11+
namespace Cslib.FLTS
12+
13+
variable {State Label : Type*}
14+
15+
/-- The product of two FLTS with the same label type. -/
16+
@[scoped grind =]
17+
def prod (flts1 : FLTS State1 Label) (flts2 : FLTS State2 Label) :
18+
FLTS (State1 × State2) Label where
19+
tr := fun (s1, s2) μ ↦ (flts1.tr s1 μ, flts2.tr s2 μ)
20+
21+
/-- A state is reachable by the product FLTS iff its components are reachable by
22+
the respective FLTS components. -/
23+
@[simp, scoped grind =]
24+
theorem prod_mtr_eq (flts1 : FLTS State1 Label) (flts2 : FLTS State2 Label)
25+
(s : State1 × State2) (μs : List Label) :
26+
(flts1.prod flts2).mtr s μs = (flts1.mtr s.fst μs, flts2.mtr s.snd μs) := by
27+
induction μs generalizing s <;> grind
28+
29+
end Cslib.FLTS

0 commit comments

Comments
 (0)