Skip to content

Commit 3a32dee

Browse files
committed
Fix partial Theorem 4.1 (iii) => (iv)
1 parent 729f051 commit 3a32dee

1 file changed

Lines changed: 39 additions & 21 deletions

File tree

TraceTheory/TraceTheory/Language.lean

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def dependencyIn' (s : List α) (a b : {a : α // a ∈ s}) := (inducedDependenc
444444

445445
def dependencyTransClosureIn' (s : List α) (a b : {a : α // a ∈ s}) := Relation.TransGen (@dependencyIn' α I s) a b
446446

447-
def isConnected' (s : List α) := ∀ a b : {a : α // a ∈ s}, (Relation.TransGen (inducedDependence I).rel) a b
447+
def isConnected' (s : List α) := ∀ a b : {a : α // a ∈ s}, @dependencyTransClosureIn' α I s a b
448448

449449

450450
def dependencyIn (t : Trace I) (a b : {a : α // a ∈ t}) := (inducedDependence I).rel a b
@@ -454,22 +454,12 @@ def dependencyTransClosureIn (t : Trace I) (a b : {a : α // a ∈ t}) := Relati
454454
def isConnected (t : Trace I) := ∀ a b : {a : α // a ∈ t}, dependencyTransClosureIn t a b
455455

456456

457-
-- lemma
457+
lemma dependencyIn_toTrace (s : List α) : @dependencyIn' α I s = @dependencyIn α I ⟦s⟧ := rfl
458458

459-
-- lemma dependencyIn_toTrace (s : List α) : dependencyIn
459+
lemma dependencyTransClosureIn_toTrace (s : List α) : @dependencyTransClosureIn' α I s = @dependencyTransClosureIn α I ⟦s⟧ := rfl
460+
461+
lemma isConnected_toTrace (s : List α) : @isConnected' α I s = @isConnected α I ⟦s⟧ := rfl
460462

461-
lemma isConnected_toTrace (s : List α) : @isConnected' α I s → @isConnected α I ⟦s⟧ := by
462-
intro h a b
463-
replace h := h a b
464-
unfold dependencyTransClosureIn dependencyIn
465-
cases h with
466-
| single h => exact Relation.TransGen.single h
467-
| tail hac hcb =>
468-
rename_i c
469-
-- rw [show ⟦s⟧ = mk' s from rfl, <- mems_lift] at a b
470-
apply Relation.TransGen.tail
471-
all_goals sorry
472-
-- · exact hac
473463

474464
def isIterativeFactor (X : Language α) (t : List α) :=
475465
∃ u v, ∀ (ts : List (List α)), (∀ t' ∈ ts, t' = t) → u ++ ts.flatten ++ v ∈ X
@@ -816,16 +806,34 @@ theorem connectedIterativeFactors_equiv_starConnected (T : Set (Trace I)) (X : R
816806
use P
817807
simp [hP, himg]
818808

809+
lemma append_indep_is_disconnected_chars (u v : Trace I) (huv : independent' u v)
810+
(a b : { a // a ∈ u * v }) (ha : a.1 ∈ u) (hb : b.1 ∈ v) :
811+
¬ (dependencyTransClosureIn (u * v)) a b := by
812+
intro h
813+
induction h with
814+
| single h =>
815+
rename_i b
816+
apply h
817+
exact huv a b ha hb
818+
| tail h h_tail ih =>
819+
rename_i b c
820+
simp at ih
821+
have hbu : b.1 ∈ u := by
822+
have hb_uv := mem_append.mp b.2
823+
simp [ih] at hb_uv
824+
exact hb_uv
825+
simp [dependencyIn, inducedDependence] at h_tail
826+
unfold independent' at huv
827+
exact h_tail (huv b c hbu hb)
828+
819829
lemma append_indep_is_disconnected (u v : Trace I) (h : independent' u v) (hu : u ≠ ⟦[]⟧) (hv : v ≠ ⟦[]⟧) :
820830
¬isConnected (u * v) := by
821831
by_contra h_con
822832
have ⟨a, ha⟩ := empty_is_eps u hu
823833
have ⟨b, hb⟩ := empty_is_eps v hv
824-
have h_ad := h a b ha hb
825-
have := h_con ⟨a, mem_append.mpr (Or.inl ha)⟩ ⟨b, mem_append.mpr (Or.inr hb)⟩
826-
unfold dependencyTransClosureIn dependencyIn at this
827-
-- simp at this
828-
sorry
834+
have h_ab_con := h_con ⟨a, mem_append.mpr (Or.inl ha)⟩ ⟨b, mem_append.mpr (Or.inr hb)⟩
835+
have h_ab_dis := append_indep_is_disconnected_chars u v h ⟨a, mem_append.mpr (Or.inl ha)⟩ ⟨b, mem_append.mpr (Or.inr hb)⟩ ha hb
836+
exact h_ab_dis h_ab_con
829837

830838
lemma connectedComponents_of_connected (T : Set (Trace I)) (h : ∀ t ∈ T, isConnected t) :
831839
connectedComponents T = T \ {⟦[]⟧} := by
@@ -849,6 +857,15 @@ lemma connectedComponents_of_connected (T : Set (Trace I)) (h : ∀ t ∈ T, isC
849857

850858

851859

860+
theorem flatten_filter_not_isEmpty :
861+
∀ {L : List (Trace I)},
862+
List.foldl (fun (u : Trace I) v => u * v) ⟦[]⟧ (List.filter (· != ⟦[]⟧) L)
863+
= List.foldl (fun (u : Trace I) v => u * v) ⟦[]⟧ L
864+
| [] => rfl
865+
| ⟦[]⟧ :: L
866+
| (a :: l) :: L => by
867+
simp [flatten_filter_not_isEmpty (L := L)]
868+
852869
theorem starConnected_is_cRational (X : RegularExpression α) (h : RegularExpression.isStarConnected I X) :
853870
RegularExpression.matches_trace I X = RegularExpression.matches_cstar_trace I X := by
854871
induction X with
@@ -869,7 +886,8 @@ theorem starConnected_is_cRational (X : RegularExpression α) (h : RegularExpres
869886
have ⟨w, hw, hw₀⟩ := ht
870887
simp at hw₀
871888
rw [<- hw₀]
872-
exact isConnected_toTrace w (h.right w hw)
889+
rw [<- isConnected_toTrace]
890+
exact h.right w hw
873891
rw [connectedComponents_of_connected _ hP_conn]
874892
apply Set.ext
875893
intro t

0 commit comments

Comments
 (0)