Skip to content

Commit 5245717

Browse files
ctchouchenson2018
andauthored
chore: split LTS/Basic.lean into more manageable pieces (#453)
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>
1 parent 225c4b1 commit 5245717

27 files changed

Lines changed: 979 additions & 802 deletions

Cslib.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,17 @@ public import Cslib.Foundations.Semantics.FLTS.LTSToFLTS
6262
public import Cslib.Foundations.Semantics.FLTS.Prod
6363
public import Cslib.Foundations.Semantics.LTS.Basic
6464
public import Cslib.Foundations.Semantics.LTS.Bisimulation
65+
public import Cslib.Foundations.Semantics.LTS.Divergence
66+
public import Cslib.Foundations.Semantics.LTS.Execution
67+
public import Cslib.Foundations.Semantics.LTS.HasTau
68+
public import Cslib.Foundations.Semantics.LTS.Notation
69+
public import Cslib.Foundations.Semantics.LTS.OmegaExecution
70+
public import Cslib.Foundations.Semantics.LTS.Relation
6571
public import Cslib.Foundations.Semantics.LTS.Simulation
72+
public import Cslib.Foundations.Semantics.LTS.Termination
73+
public import Cslib.Foundations.Semantics.LTS.Total
6674
public import Cslib.Foundations.Semantics.LTS.TraceEq
75+
public import Cslib.Foundations.Semantics.LTS.Union
6776
public import Cslib.Foundations.Syntax.Congruence
6877
public import Cslib.Foundations.Syntax.Context
6978
public import Cslib.Foundations.Syntax.HasAlphaEquiv

Cslib/Computability/Automata/EpsilonNA/Basic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Authors: Fabrizio Montesi, Ching-Tsun Chou
77
module
88

99
public import Cslib.Computability.Automata.NA.Basic
10+
public import Cslib.Foundations.Semantics.LTS.HasTau
1011

1112
@[expose] public section
1213

Cslib/Computability/Automata/NA/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module
99
public import Cslib.Computability.Automata.Acceptors.Acceptor
1010
public import Cslib.Computability.Automata.Acceptors.OmegaAcceptor
1111
public import Cslib.Foundations.Data.OmegaSequence.InfOcc
12-
public import Cslib.Foundations.Semantics.LTS.Basic
12+
public import Cslib.Foundations.Semantics.LTS.OmegaExecution
1313

1414
@[expose] public section
1515

Cslib/Computability/Automata/NA/Concat.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ theorem concat_run_exists {xs1 : List Symbol} {xs2 : ωSequence Symbol} {ss2 :
9999
· obtain ⟨rfl⟩ : xs1 = [] := List.eq_nil_iff_length_eq_zero.mpr h_xs1
100100
refine ⟨ss2.map inr, by simp only [concat]; grind [Run, LTS.OmegaExecution], by simp⟩
101101
· obtain ⟨s0, _, _, _, h_mtr⟩ := h1
102-
obtain ⟨ss1, _, _, _, _⟩ := LTS.execution_of_mTr h_mtr
102+
obtain ⟨ss1, _, _, _, _⟩ := LTS.Execution.of_mTr h_mtr
103103
let ss := (ss1.map inl).take xs1.length ++ω ss2.map inr
104104
refine ⟨ss, Run.mk ?_ ?_, ?_⟩
105105
· grind [concat, get_append_left]
@@ -156,7 +156,7 @@ theorem finConcat_language_eq [Inhabited Symbol] :
156156
ext xl
157157
constructor
158158
· rintro ⟨s, _, t, h_acc, h_mtr⟩
159-
obtain ⟨xs, ss, h_ωtr, rfl, rfl⟩ := LTS.Total.mTr_omegaExecution h_mtr
159+
obtain ⟨xs, ss, h_ωtr, rfl, rfl⟩ := LTS.Total.extend_omegaExecution h_mtr
160160
have hc : (finConcat na1 na2).Run (xl ++ω xs) ss := by grind [Run]
161161
have hr : (ss xl.length).isRight := by grind
162162
obtain ⟨n, _⟩ := concat_run_proj hc hr

Cslib/Computability/Automata/NA/Loop.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ theorem loop_fin_run_exists {xl : List Symbol} (h : xl ∈ language na) :
9999
sl[0] = inl () ∧ sl[xl.length] = inl () ∧
100100
∀ k, (_ : k < xl.length) → na.loop.Tr sl[k] xl[k] sl[k + 1] := by
101101
obtain ⟨_, _, _, _, h_mtr⟩ := h
102-
obtain ⟨sl, _, _, _, _⟩ := LTS.execution_of_mTr h_mtr
102+
obtain ⟨sl, _, _, _, _⟩ := LTS.Execution.of_mTr h_mtr
103103
by_cases xl.length = 0
104104
· use [inl ()]
105105
grind
@@ -186,7 +186,7 @@ theorem loop_language_eq [Inhabited Symbol] (h : ¬ language na = 0) :
186186
· have : Nonempty na.start := by
187187
obtain ⟨_, s0, _, _⟩ := nonempty_iff_ne_empty.mpr h
188188
use s0
189-
obtain ⟨xs, ss, h_ωtr, rfl, rfl⟩ := LTS.Total.mTr_omegaExecution h_mtr
189+
obtain ⟨xs, ss, h_ωtr, rfl, rfl⟩ := LTS.Total.extend_omegaExecution h_mtr
190190
have h_run : na.finLoop.Run (xl ++ω xs) ss := by grind [Run]
191191
obtain ⟨h1, h2⟩ : 0 < xl.length ∧ (ss xl.length).isLeft := by
192192
simp only [mem_singleton_iff] at h_acc

Cslib/Computability/Automata/NA/Total.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Authors: Ching-Tsun Chou
77
module
88

99
public import Cslib.Computability.Automata.NA.Basic
10+
public import Cslib.Foundations.Semantics.LTS.Total
1011

1112
@[expose] public section
1213

@@ -37,15 +38,15 @@ theorem totalize_run_mtr {xs : ωSequence Symbol} {ss : ωSequence (State ⊕ Un
3738
use s, t
3839
refine ⟨?_, by grind⟩
3940
-- TODO: `grind` does not use congruence relations with `na.totalize.MTr`
40-
rw [← LTS.totalize.mtr_left_iff, ← extract_eq_take, eq₁, ← eq₂]
41+
rw [← LTS.totalize.nonsink_mtr_iff, ← extract_eq_take, eq₁, ← eq₂]
4142
exact LTS.OmegaExecution.extract_mTr h.trans (by grind)
4243

4344
/-- Any finite execution of the original NA can be extended to an infinite execution of
4445
`NA.totalize`, provided that the alphabet is inbabited. -/
4546
theorem totalize_mtr_run [Inhabited Symbol] {xl : List Symbol} {s t : State}
4647
(hs : s ∈ na.start) (hm : na.MTr s xl t) :
4748
∃ xs ss, na.totalize.Run (xl ++ω xs) ss ∧ ss 0 = inl s ∧ ss xl.length = inl t := by
48-
grind [totalize, Run, LTS.Total.mTr_omegaExecution <| LTS.totalize.mtr_left_iff.mpr hm]
49+
grind [totalize, Run, LTS.Total.extend_omegaExecution <| LTS.totalize.nonsink_mtr_iff.mpr hm]
4950

5051
namespace FinAcc
5152

Cslib/Computability/Languages/Congruences/BuchiCongruence.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ lemma buchiCongruence_transfer
8787
grind
8888
have := h_eq s t
8989
have h_yl : yl ∈ na.pairLang s t := by grind
90-
have := LTS.execution_of_mTr h_yl
90+
have := LTS.Execution.of_mTr h_yl
9191
grind [LTS.mem_pairViaLang, LTS.Execution, → LTS.Execution.comp,
92-
→ LTS.execution_of_mTr]
92+
→ LTS.Execution.of_mTr]
9393

9494
/-- `na.buchiFamily` is a family of ω-languages indexed by a pair of equivalence classes
9595
of `na.BuchiCongruence` which will turn out to saturate the ω-language accepted by `na`
@@ -148,7 +148,7 @@ private lemma frequently_via_accept [Inhabited Symbol]
148148
use ss (f n + k), by grind, (xls n).take k, (xls n).drop k
149149
have := extract_flatten h_xls_p n
150150
have exec {m n} (h : m ≤ n) :=
151-
LTS.mTr_of_execution na.toLTS <| LTS.OmegaExecution.extract_execution h_exec h
151+
LTS.Execution.to_mTr <| LTS.OmegaExecution.extract_execution h_exec h
152152
split_ands
153153
· have h : f n ≤ f n + k := by lia
154154
specialize exec h
@@ -179,7 +179,7 @@ theorem buchiFamily_saturation [Inhabited Symbol] : Saturates na.buchiFamily (la
179179
grind [LTS.OmegaExecution.extract_mTr h_exec (?_ : 0 ≤ xl.length),
180180
extract_append_zero_right, LTS.mem_pairLang]
181181
have h_yl_e : yl ∈ na.pairLang (ss 0) (ts 0) := by
182-
grind [buchiCongruence_transfer h_xl_c h_yl_c h_xl_e, LTS.mem_pairLang, LTS.mTr_of_execution]
182+
grind [buchiCongruence_transfer h_xl_c h_yl_c h_xl_e, LTS.mem_pairLang, LTS.Execution.to_mTr]
183183
have h_ss1_ts : ss1 0 = ts 0 := by
184184
have h : 0 < yls.cumLen 1 - yls.cumLen 0 := by grind
185185
have : 0 < (sls 0).length := by grind

Cslib/Foundations/Semantics/FLTS/FLTSToLTS.lean

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

77
module
88

9+
public import Cslib.Foundations.Semantics.FLTS.Basic
910
public import Cslib.Foundations.Semantics.LTS.Basic
1011

1112
@[expose] public section

Cslib/Foundations/Semantics/FLTS/LTSToFLTS.lean

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

77
module
88

9+
public import Cslib.Foundations.Semantics.FLTS.Basic
910
public import Cslib.Foundations.Semantics.LTS.Basic
1011

1112
@[expose] public section

0 commit comments

Comments
 (0)