Skip to content

Commit 8c38698

Browse files
committed
Init rank section for trace languages
1 parent 3b014cd commit 8c38698

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

TraceTheory/TraceTheory/Language.lean

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import TraceTheory.Computability
66

77
namespace TraceTheory
88

9+
section LexNf
10+
911
variable {α : Type} [LinearOrder α]
1012

1113
/-- Lexicographic Normal Form.
@@ -168,3 +170,65 @@ lemma isRegular_allForbiddenPatterns : Language.IsRegular (AllForbiddenPatterns
168170
theorem isRegular_lexNf : Language.IsRegular (LexNfLanguage I) := by
169171
apply Language.IsRegular.compl
170172
apply isRegular_allForbiddenPatterns
173+
174+
end LexNf
175+
176+
section rank
177+
178+
variable {α : Type} {I : Independence α}
179+
180+
/-- The `Language` of all strings trace equivalent to strings in language `X`. -/
181+
def traceClosure (I : Independence α) (X : Language α) : Language α :=
182+
{ y | ∃ x ∈ X, TraceEquiv I x y }
183+
184+
/-- A language is `I`-closed if its trace closure under `I` is equal to itself. -/
185+
def IsClosed (I : Independence α) (X : Language α) : Prop :=
186+
traceClosure I X = X
187+
188+
theorem traceClosure.le_closure {X : Language α} : X ≤ traceClosure I X := by
189+
intro x hx
190+
exact ⟨x, hx, TraceEquiv.refl x⟩
191+
192+
theorem traceClosure.mono {X Y : Language α} (h : X ≤ Y) :
193+
traceClosure I X ≤ traceClosure I Y := by
194+
intro x hx
195+
rcases hx with ⟨w, hw, heqv⟩
196+
exact ⟨w, h hw, heqv⟩
197+
198+
theorem traceClosure.idem {X : Language α} :
199+
traceClosure I (traceClosure I X) = traceClosure I X := by
200+
apply le_antisymm
201+
· intro x hx
202+
rcases hx with ⟨y, ⟨z, hz, heqv_zy⟩, heqv_yx⟩
203+
exact ⟨z, hz, TraceEquiv.trans heqv_zy heqv_yx⟩
204+
· apply mono
205+
apply le_closure
206+
207+
/-- Helper to define rank. -/
208+
def IsValidFactorization
209+
(I : Independence α) (X : Language α) (x y : List α) (xs ys : List (List α)) : Prop :=
210+
xs.length = ys.length ∧
211+
(List.zipWith (· ++ ·) xs ys).flatten ∈ X ∧
212+
TraceEquiv I x xs.flatten ∧
213+
TraceEquiv I y ys.flatten ∧
214+
∀ i : ℕ, ∀ (h : i + 1 < xs.length),
215+
Independent I (xs[i]'(Nat.lt_of_succ_lt h)) ((ys.drop i).flatten)
216+
217+
/-- Predicate for language `X` having rank at most `k`. -/
218+
def HasRankAtMost (I : Independence α) (X : Language α) (k : ℕ) : Prop :=
219+
∀ x y : List α, (x ++ y) ∈ traceClosure I X →
220+
∃ xs ys : List (List α),
221+
xs.length ≤ k + 1
222+
IsValidFactorization I X x y xs ys
223+
224+
/-- Predicate for language `X` having finite rank. -/
225+
def HasFiniteRank (I : Independence α) (X : Language α) : Prop :=
226+
∃ k : ℕ, HasRankAtMost I X k
227+
228+
theorem concat_closed_rank (X₁ X₂ : Language α) (h₁ : IsClosed I X₁) (h₂ : IsClosed I X₂) :
229+
HasRankAtMost I (X₁ * X₂) 1 := by
230+
sorry
231+
232+
end rank
233+
234+
end TraceTheory

0 commit comments

Comments
 (0)