|
| 1 | +import Mathlib.Data.List.Lex |
| 2 | +import TraceTheory.Trace |
| 3 | + |
| 4 | +open Trace |
| 5 | + |
| 6 | +namespace Language |
| 7 | + |
| 8 | +variable {α : Type} [LinearOrder α] |
| 9 | + |
| 10 | +/-- Lexicographic Normal Form. |
| 11 | +A word x is in normal form if it is minimal among all words equivalent to it. -/ |
| 12 | +def IsLexNf (I : Independence α) (x : List α) : Prop := |
| 13 | + ∀ w, TraceEquiv I x w → x ≤ w |
| 14 | + |
| 15 | +/-- The condition to be in Lexicographic Normal Form. |
| 16 | +For all factorizations x = ybuaz, where (a, b) ∈ I, and a < b, |
| 17 | +there exists a letter of u which does not commute with a. -/ |
| 18 | +def SatisfiesFactorCondition (I : Independence α) (x : List α) : Prop := |
| 19 | + ∀ (y u z : List α) (a b : α), |
| 20 | + x = y ++ [b] ++ u ++ [a] ++ z → |
| 21 | + I.rel a b → |
| 22 | + a < b → |
| 23 | + ∃ c ∈ u, ¬ I.rel a c |
| 24 | + |
| 25 | +lemma factorCondition_of_lexNf (I : Independence α) (x : List α) (h : IsLexNf I x) : |
| 26 | + SatisfiesFactorCondition I x := by |
| 27 | + intro y u z a b hx h_indep h_lt |
| 28 | + contrapose! h |
| 29 | + unfold IsLexNf |
| 30 | + push_neg |
| 31 | + use y ++ [a] ++ [b] ++ u ++ z |
| 32 | + rw [hx] |
| 33 | + constructor |
| 34 | + · have h_comm_au : TraceEquiv I ([a] ++ u) (u ++ [a]) := by |
| 35 | + apply equiv_comm_append_of_indep |
| 36 | + intro c hc |
| 37 | + simp at hc |
| 38 | + rw [hc] |
| 39 | + exact h |
| 40 | + apply TraceEquiv.compat _ (TraceEquiv.refl z) |
| 41 | + simp only [List.append_assoc] |
| 42 | + apply TraceEquiv.compat (TraceEquiv.refl y) |
| 43 | + apply TraceEquiv.trans (TraceEquiv.compat (TraceEquiv.refl [b]) (TraceEquiv.symm h_comm_au)) |
| 44 | + simp only [← List.append_assoc] |
| 45 | + exact TraceEquiv.compat (TraceEquiv.swap b a (I.symm a b h_indep)) (TraceEquiv.refl u) |
| 46 | + · simp |
| 47 | + apply List.append_left_lt |
| 48 | + apply List.cons_lt_cons_iff.mpr |
| 49 | + left |
| 50 | + exact h_lt |
| 51 | + |
| 52 | +lemma lexNf_of_factorCondition |
| 53 | + (I : Independence α) (x : List α) (h : SatisfiesFactorCondition I x) : |
| 54 | + IsLexNf I x := by |
| 55 | + sorry |
| 56 | + |
| 57 | +theorem isLexNf_iff_factorCondition (I : Independence α) (x : List α) : |
| 58 | + IsLexNf I x ↔ SatisfiesFactorCondition I x := by |
| 59 | + constructor |
| 60 | + · apply factorCondition_of_lexNf |
| 61 | + · apply lexNf_of_factorCondition |
0 commit comments