@@ -10,13 +10,13 @@ open Computability List Trace
1010
1111variable {α : Type *} {I : Independence α}
1212
13- section LexNf
13+ section LexNF
1414
1515variable [LinearOrder α] (I : Independence α)
1616
1717/-- Lexicographic Normal Form.
1818 A word x is in normal form if it is minimal among all words equivalent to it. -/
19- def IsLexNf (x : List α) : Prop :=
19+ def IsLexNF (x : List α) : Prop :=
2020 ∀ w, TraceEqv I x w → x ≤ w
2121
2222/-- The condition to be in Lexicographic Normal Form.
@@ -29,11 +29,11 @@ def SatisfiesFactorCondition (x : List α) : Prop :=
2929 a < b →
3030 ∃ c ∈ u, ¬ I.rel a c
3131
32- lemma factorCondition_of_lexNf (x : List α) (h : IsLexNf I x) :
32+ lemma factorCondition_of_lexNF (x : List α) (h : IsLexNF I x) :
3333 SatisfiesFactorCondition I x := by
3434 intro y u z a b hx h_indep hlt
3535 contrapose! h
36- unfold IsLexNf
36+ unfold IsLexNF
3737 push_neg
3838 use y ++ [a] ++ [b] ++ u ++ z
3939 rw [hx]
@@ -56,9 +56,9 @@ lemma factorCondition_of_lexNf (x : List α) (h : IsLexNf I x) :
5656 left
5757 exact hlt
5858
59- lemma lexNf_of_factorCondition (x : List α) (h : SatisfiesFactorCondition I x) :
60- IsLexNf I x := by
61- unfold IsLexNf
59+ lemma lexNF_of_factorCondition (x : List α) (h : SatisfiesFactorCondition I x) :
60+ IsLexNF I x := by
61+ unfold IsLexNF
6262 contrapose! h
6363 have ⟨w, h_equiv, hlt⟩ := h
6464 have ⟨p, a, b, w', x', hw, hx, hlt'⟩ :=
@@ -77,11 +77,11 @@ lemma lexNf_of_factorCondition (x : List α) (h : SatisfiesFactorCondition I x)
7777 exact hu
7878
7979/-- The characterization of strings in Lexicographic Normal Form. -/
80- theorem isLexNf_iff_factorCondition (x : List α) :
81- IsLexNf I x ↔ SatisfiesFactorCondition I x := by
80+ theorem isLexNF_iff_factorCondition (x : List α) :
81+ IsLexNF I x ↔ SatisfiesFactorCondition I x := by
8282 constructor
83- · apply factorCondition_of_lexNf
84- · apply lexNf_of_factorCondition
83+ · apply factorCondition_of_lexNF
84+ · apply lexNF_of_factorCondition
8585
8686variable [Fintype α] [DecidableRel I.rel]
8787
@@ -90,39 +90,39 @@ def Letter (a : α) : Language α :=
9090 { [a] }
9191
9292/-- The set of all symbols. -/
93- def Sigma : Language α :=
93+ def sigma : Language α :=
9494 ⊤
9595
9696/-- The language consisting of single letters that are independent of `a`. -/
97- def IndependentLetters (a : α) : Language α :=
97+ def independentLetters (a : α) : Language α :=
9898 ∑ c ∈ (Finset.univ.filter (fun c => I.rel a c)), Letter c
9999
100100/-- The "Forbidden Pattern" for a specific pair (a, b).
101101Pattern: Σ* b (independent of a)* a Σ* -/
102- def ForbiddenPattern (a b : α) : Language α :=
103- Sigma ∗ * Letter b * (IndependentLetters I a)∗ * Letter a * Sigma ∗
102+ def forbiddenPattern (a b : α) : Language α :=
103+ sigma ∗ * Letter b * (independentLetters I a)∗ * Letter a * sigma ∗
104104
105105/-- Union of all forbidden patterns for (a,b) ∈ I with a < b. -/
106- def AllForbiddenPatterns : Language α :=
106+ def allForbiddenPatterns : Language α :=
107107 ∑ p ∈ (Finset.univ.filter (fun (p : α × α) => p.1 < p.2 ∧ I.rel p.1 p.2 )),
108- ForbiddenPattern I p.1 p.2
108+ forbiddenPattern I p.1 p.2
109109
110110/-- LexNF is the complement of the forbidden patterns. -/
111- def LexNfLanguage : Language α :=
112- (AllForbiddenPatterns I)ᶜ
111+ def lexNFLanguage : Language α :=
112+ (allForbiddenPatterns I)ᶜ
113113
114114omit [LinearOrder α] in
115- lemma isRegular_independentLetters (a : α) : Language.IsRegular (IndependentLetters I a) := by
116- unfold IndependentLetters
115+ lemma isRegular_independentLetters (a : α) : Language.IsRegular (independentLetters I a) := by
116+ unfold independentLetters
117117 apply Finset.sum_induction
118118 · apply Language.IsRegular.add
119119 · apply Language.IsRegular.zero
120120 · intro b _
121121 exact Language.IsRegular.singleton
122122
123123omit [LinearOrder α] in
124- lemma isRegular_forbiddenPattern (a b : α) : Language.IsRegular (ForbiddenPattern I a b) := by
125- unfold ForbiddenPattern Sigma Letter
124+ lemma isRegular_forbiddenPattern (a b : α) : Language.IsRegular (forbiddenPattern I a b) := by
125+ unfold forbiddenPattern sigma Letter
126126 repeat apply Language.IsRegular.mul
127127 · apply Language.IsRegular.kstar
128128 exact Language.IsRegular.top
@@ -133,25 +133,25 @@ lemma isRegular_forbiddenPattern (a b : α) : Language.IsRegular (ForbiddenPatte
133133 · apply Language.IsRegular.kstar
134134 exact Language.IsRegular.top
135135
136- lemma isRegular_allForbiddenPatterns : Language.IsRegular (AllForbiddenPatterns I) := by
137- unfold AllForbiddenPatterns
136+ lemma isRegular_allForbiddenPatterns : Language.IsRegular (allForbiddenPatterns I) := by
137+ unfold allForbiddenPatterns
138138 apply Finset.sum_induction
139139 · apply Language.IsRegular.add
140140 · apply Language.IsRegular.zero
141141 · intro ⟨a, b⟩ _
142142 simp
143143 apply isRegular_forbiddenPattern
144144
145- theorem isRegular_lexNf : Language.IsRegular (LexNfLanguage I) := by
145+ theorem isRegular_lexNF : Language.IsRegular (lexNFLanguage I) := by
146146 apply Language.IsRegular.compl
147147 apply isRegular_allForbiddenPatterns
148148
149149omit [Fintype α] [LinearOrder α] in
150- lemma mem_sigma (x : List α) : x ∈ (Sigma : Language α)∗ := by
150+ lemma mem_sigma (x : List α) : x ∈ (sigma : Language α)∗ := by
151151 rw [Language.mem_kstar]
152152 use [x]
153153 simp only [flatten_cons, flatten_nil, append_nil, mem_cons,
154- not_mem_nil, or_false, Sigma , forall_eq, true_and]
154+ not_mem_nil, or_false, sigma , forall_eq, true_and]
155155 apply Set.mem_univ
156156
157157omit [Fintype α] [LinearOrder α] in
@@ -176,9 +176,9 @@ lemma mem_sum_language
176176 exact ⟨j, hj, hxj⟩
177177
178178lemma mem_forbiddenPattern_iff {x : List α} {a b : α} :
179- x ∈ ForbiddenPattern I a b ↔
179+ x ∈ forbiddenPattern I a b ↔
180180 ∃ y u z : List α, x = y ++ [b] ++ u ++ [a] ++ z ∧ (∀ c ∈ u, I.rel a c) := by
181- unfold ForbiddenPattern IndependentLetters
181+ unfold forbiddenPattern independentLetters
182182 constructor
183183 · intro h
184184 simp [Language.mem_mul] at h
@@ -236,23 +236,23 @@ lemma mem_forbiddenPattern_iff {x : List α} {a b : α} :
236236 · simp
237237
238238lemma mem_allForbiddenPatterns_iff {x : List α} :
239- x ∈ AllForbiddenPatterns I ↔
240- ∃ a b, a < b ∧ I.rel a b ∧ x ∈ ForbiddenPattern I a b := by
241- unfold AllForbiddenPatterns
239+ x ∈ allForbiddenPatterns I ↔
240+ ∃ a b, a < b ∧ I.rel a b ∧ x ∈ forbiddenPattern I a b := by
241+ unfold allForbiddenPatterns
242242 rw [mem_sum_language]
243243 simp only [Finset.mem_filter, Finset.mem_univ, true_and, Prod.exists, and_assoc]
244244
245- /-- The language LexNfLanguage contains exactly the strings satisfying the factor condition. -/
246- theorem mem_lexNfLanguage_iff_factorCondition (x : List α) :
247- x ∈ LexNfLanguage I ↔ SatisfiesFactorCondition I x := by
248- unfold LexNfLanguage SatisfiesFactorCondition
245+ /-- The language LexNFLanguage contains exactly the strings satisfying the factor condition. -/
246+ theorem mem_lexNFLanguage_iff_factorCondition (x : List α) :
247+ x ∈ lexNFLanguage I ↔ SatisfiesFactorCondition I x := by
248+ unfold lexNFLanguage SatisfiesFactorCondition
249249 rw [Set.mem_compl_iff, mem_allForbiddenPatterns_iff]
250250 push_neg
251251 constructor
252252 · intro h y u z a b hx h_indep hlt
253253 by_contra h_all_indep
254254 push_neg at h_all_indep
255- have h_in_pattern : x ∈ ForbiddenPattern I a b := by
255+ have h_in_pattern : x ∈ forbiddenPattern I a b := by
256256 rw [mem_forbiddenPattern_iff]
257257 exact ⟨y, u, z, hx, h_all_indep⟩
258258 exact h a b hlt h_indep h_in_pattern
@@ -262,11 +262,11 @@ theorem mem_lexNfLanguage_iff_factorCondition (x : List α) :
262262 rcases h y u z a b hx h_indep hlt with ⟨c, hc_mem, hc_not_indep⟩
263263 exact hc_not_indep (h_all_indep c hc_mem)
264264
265- /-- Words in LexNF are exactly the members of `LexNfLanguage `. -/
266- theorem isLexNf_iff_mem_lexNfLanguage {x : List α} :
267- IsLexNf I x ↔ x ∈ LexNfLanguage I := by
268- rw [mem_lexNfLanguage_iff_factorCondition ]
269- apply isLexNf_iff_factorCondition
265+ /-- Words in LexNF are exactly the members of `LexNFLanguage `. -/
266+ theorem isLexNF_iff_mem_lexNFLanguage {x : List α} :
267+ IsLexNF I x ↔ x ∈ lexNFLanguage I := by
268+ rw [mem_lexNFLanguage_iff_factorCondition ]
269+ apply isLexNF_iff_factorCondition
270270
271271omit [LinearOrder α] [Fintype α] [DecidableRel I.rel] in
272272lemma perm_of_traceEqv {w x : List α} (h : TraceEqv I w x) : w.Perm x := by
@@ -286,9 +286,9 @@ lemma finite_traceEqv_class (w : List α) : {x : List α | TraceEqv I w x}.Finit
286286 exact perm_of_traceEqv I hx
287287 exact Set.Finite.subset w.permutations.finite_toSet h_sub
288288
289- theorem exists_lexNf_rep (t : Trace I) : ∃ s : List α, ⟦s⟧ = t ∧ s ∈ LexNfLanguage I := by
289+ theorem exists_lexNF_rep (t : Trace I) : ∃ s : List α, ⟦s⟧ = t ∧ s ∈ lexNFLanguage I := by
290290 rcases t with ⟨u⟩
291- change ∃ s, ⟦s⟧ = ⟦u⟧ ∧ s ∈ LexNfLanguage I
291+ change ∃ s, ⟦s⟧ = ⟦u⟧ ∧ s ∈ lexNFLanguage I
292292 let S : Set (List α) := {x | TraceEqv I u x}
293293 have h_fin : S.Finite := finite_traceEqv_class I u
294294 have h_nonempty : S.Nonempty := ⟨u, TraceEqv.refl u⟩
@@ -304,13 +304,13 @@ theorem exists_lexNf_rep (t : Trace I) : ∃ s : List α, ⟦s⟧ = t ∧ s ∈
304304 · symm
305305 apply Quotient.sound
306306 exact hs_eqv
307- · rw [mem_lexNfLanguage_iff_factorCondition , ← isLexNf_iff_factorCondition ]
307+ · rw [mem_lexNFLanguage_iff_factorCondition , ← isLexNF_iff_factorCondition ]
308308 intro s' hs'
309309 have hs'_mem : s' ∈ S_finset := by
310310 simp [S_finset, S, hs_eqv.trans hs']
311311 exact Finset.min'_le S_finset s' hs'_mem
312312
313- end LexNf
313+ end LexNF
314314
315315section Language
316316
@@ -441,8 +441,8 @@ instance : KStar (Set (Trace I)) where
441441def connectedComponents (T : Set (Trace I)) : Set (Trace I) :=
442442 {u | Trace.IsConnected I u ∧ u ≠ 1 ∧ ∃ v, u * v ∈ T ∧ Trace.Independent u v}
443443
444- theorem toTrace_kstar_comm (L : Language α) :
445- toTrace I (L ∗) = (toTrace I L )∗ := by
444+ theorem toTrace_kstar_comm (X : Language α) :
445+ toTrace I (X ∗) = (toTrace I X )∗ := by
446446 simp [Language.kstar_def, Set.image, toTrace]
447447 ext t
448448 constructor
0 commit comments