@@ -399,15 +399,17 @@ lemma alph_map_eq_iff_mems_eq [DecidableEq α] {t t' : Trace I} :
399399 rfl
400400
401401lemma lift_dependency_path [DecidableEq α] {t t' : Trace I} (h_mem_eq : ∀ a, a ∈ t' ↔ a ∈ t)
402- (x y : {a // a ∈ t'} ) (h_path : dependencyTransClosureIn t' x y) :
403- dependencyTransClosureIn t ⟨x. 1 , (h_mem_eq x. 1 ).mp x. 2 ⟩ ⟨y. 1 , (h_mem_eq y. 1 ).mp y. 2 ⟩ := by
402+ (x y : α ) (h_path : dependencyTransClosureIn t' x y) :
403+ dependencyTransClosureIn t x y := by
404404 induction h_path with
405405 | single h_dep =>
406406 apply Relation.TransGen.single
407- exact h_dep
407+ have ⟨hxz, hx, hz⟩ := h_dep
408+ exact ⟨hxz, (h_mem_eq x).mp hx, (h_mem_eq _).mp hz⟩
408409 | tail path step ih =>
409410 apply Relation.TransGen.tail ih
410- exact step
411+ have ⟨hxz, hx, hz⟩ := step
412+ exact ⟨hxz, (h_mem_eq _).mp hx, (h_mem_eq _).mp hz⟩
411413
412414lemma recognizable_connectedComponents {P : Set (Trace I)} [DecidableEq α] [Fintype α]
413415 (hP : IsRecognizable P) : IsRecognizable (connectedComponents P) := by
@@ -445,7 +447,7 @@ lemma recognizable_connectedComponents {P : Set (Trace I)} [DecidableEq α] [Fin
445447 rw [hP_eq, Set.mem_preimage] at hv_in_P ⊢
446448 rw [← h_f_mul] at hv_in_P
447449 exact hv_in_P
448- have h_indep_t_v : Independent' t v := by
450+ have h_indep_t_v : IndependentT t v := by
449451 intro a b ha hb
450452 exact h_indep_t'_v a b ((h_mem_eq a).mpr ha) hb
451453 exact ⟨h_conn, h_neq_1, v, hv_in_P_t, h_indep_t_v⟩
@@ -456,7 +458,7 @@ lemma dependent_letters_of_connected [DecidableEq α] {u v : List α}
456458 ∃ a ∈ u, ∃ b ∈ v, ¬ I.rel a b := by
457459 by_contra h_all_indep
458460 push_neg at h_all_indep
459- have h_indep_trace : Independent' (I := I) ⟦u⟧ ⟦v⟧ := by
461+ have h_indep_trace : IndependentT (I := I) ⟦u⟧ ⟦v⟧ := by
460462 intro a b ha hb
461463 change a ∈ u at ha
462464 change b ∈ v at hb
@@ -1359,7 +1361,7 @@ lemma connected_dep_concat {u v : List α} (hu : IsConnectedL I u) (hv : IsConne
13591361 exact Relation.TransGen.trans haa' (Relation.TransGen.trans ha'b' hb'b)
13601362 | inr hb => exact depTrClIn_sub (List.subset_append_of_subset_right u (by simp)) (hv ⟨a, ha⟩ ⟨b, hb⟩)
13611363
1362- omit [Fintype α] [LinearOrder α] [DecidableRel I.rel] in
1364+ /- omit [Fintype α] [LinearOrder α] [DecidableRel I.rel] in
13631365lemma connected_dup_is_connected {w : List α} (hw : IsConnectedL I w) :
13641366 IsConnectedL I (w ++ w) := by
13651367 cases w with
@@ -1370,7 +1372,7 @@ lemma connected_dup_is_connected {w : List α} (hw : IsConnectedL I w) :
13701372 intro ha
13711373 exfalso
13721374 exact I.irrefl a ha
1373- exact connected_dep_concat hw hw h_dep
1375+ exact connected_dep_concat hw hw h_dep -/
13741376
13751377lemma lexNf_sq_is_lexNf {w : List α} (h : w ++ w ∈ LexNfLanguage I) :
13761378 w ∈ LexNfLanguage I := by
@@ -1436,73 +1438,82 @@ lemma lexNf_ccDec_order {w : List α} (hw : w ∈ LexNfLanguage I) (hz : w ≠ [
14361438 rename_i j
14371439 exact lt_trans (ih (Nat.lt_of_succ_lt hj)) (lexNf_ccDec_adj_order hw hz j hj)
14381440
1441+ lemma ccDec_aux_across_indep (I : Independence α) (u w : List α) (hi : 1 < (ccDec_aux I u w).length) (hwu : w ⊆ u) :
1442+ Independent I ((ccDec_aux I u w).getLast (ccDec_aux_nonempty _ _)) (ccDec_aux I u w)[0 ] ∨
1443+ (Independent I ((ccDec_aux I w w).getLast (ccDec_aux_nonempty _ _) ++ (ccDec_aux I u w)[0 ]) (ccDec_aux I u w)[1 ] ∧
1444+ 2 < (ccDec_aux I u w).length):= by
1445+ by_contra h
1446+ rw [not_or] at h
1447+ rcases h with ⟨h, h'⟩
1448+ apply h'
1449+ clear h'
1450+
1451+ sorry
1452+
1453+
14391454lemma connected_of_lexNf_sq {w : List α}
14401455 (hw : w ∈ LexNfLanguage I)
14411456 (hww : w ++ w ∈ LexNfLanguage I) :
14421457 IsConnected I ⟦w⟧ := by
14431458 rw [<- IsConnected_eq]
1444- -- by_contra h_con
1445- -- have h_dec_len := @ccDec_disconnected_len α I (w ++ w) (by)
1446- cases w with
1447- | nil => simp [IsConnectedL]
1448- | cons a w' =>
1449- let w := a :: w'
1450- have hz : w ≠ [] := List.cons_ne_nil a w'
1451- rw [show a :: w' = w from rfl] at hw hww ⊢
1452- by_contra h_con
1453- replace h_con := ccDec_disconnected_len _ h_con
1454-
1455- have h_lt : ∀ (i : ℕ), ∀ (hi : i + 1 < (ccDec_aux I w w).length),
1456- (ccDec_aux I w w)[i][0 ]'(List.length_pos_iff.mpr (ccDec_aux_elem_nonempty w w i (Nat.lt_of_succ_lt hi) hz)) <
1457- ((ccDec_aux I w w)[i + 1 ][0 ]'(List.length_pos_iff.mpr (ccDec_aux_elem_nonempty w w (i + 1 ) hi hz))) := by
1458- intro i hi
1459- have h_infix := ccDec_aux_adj_infix I w w i hi
1460- apply (mem_lexNfLanguage_iff_factorCondition _ _).mp at hw
1461- apply (isLexNf_iff_factorCondition _ _).mpr at hw
1462- replace h_infix := lexNf_infix_is_lexNf h_infix hw
1463- apply (isLexNf_iff_factorCondition _ _).mp at h_infix
1464-
1465- have h_indep : Independent I (ccDec_aux I w w)[i] (ccDec_aux I w w)[i + 1 ] := ccDec_aux_adj_indep w w i hi (by simp)
1466-
1467- let t₁ := (ccDec_aux I w w)[i]
1468- have ht₁ : (ccDec_aux I w w)[i] = t₁ := rfl
1469- rcases t₁
1470- · exfalso
1471- exact (ccDec_aux_elem_nonempty _ _ _ _ hz) ht₁
1472- rename_i a₁ s₁
1473-
1474- let t₂ := (ccDec_aux I w w)[i + 1 ]
1475- have ht₂ : (ccDec_aux I w w)[i + 1 ] = t₂ := rfl
1476- rcases t₂
1477- · exfalso
1478- exact (ccDec_aux_elem_nonempty _ _ _ _ hz) ht₂
1479- rename_i a₂ s₂
1480-
1481- replace h_infix := h_infix [] s₁ s₂ a₂ a₁
1482- simp [ht₁, ht₂] at h_infix h_indep
1483- simp [List.getElem_of_eq ht₁, List.getElem_of_eq ht₂]
1484- replace h_infix := h_infix (I.symm _ _ h_indep.1 .1 )
1485-
1486- by_contra h_ge
1487- have h_ne : a₁ ≠ a₂ := by
1488- by_contra h_eq
1489- rw [h_eq] at h_indep
1490- exact (I.irrefl _) h_indep.1 .1
1491- have h_gt : a₂ < a₁ := by
1492- simp at h_ge
1493- exact Std.lt_of_le_of_ne h_ge (Ne.symm h_ne)
1494-
1495- replace ⟨c, hcs, hac⟩ := h_infix h_gt
1496- exact hac (I.symm _ _ (h_indep.2 c hcs).1 )
1497-
1498- replace h_lt : ∀ (i : ℕ), ∀ (hi : i + 1 < (ccDec_aux I w w).length),
1499- (ccDec_aux I w w)[i][0 ]'(List.length_pos_iff.mpr (ccDec_aux_elem_nonempty w w i (Nat.lt_of_succ_lt hi) hz)) <
1500- ((ccDec_aux I w w)[(ccDec_aux I w w).length - 1 ][0 ]'(List.length_pos_iff.mpr (ccDec_aux_elem_nonempty w w ((ccDec_aux I w w).length - 1 ) (Nat.sub_one_lt_of_lt h_con) hz))) := by
1501- intro i hi
1502- -- exact @lexNf_ccDec_order α I _ _ _ _ _ _ i (i + 1) _ _
1503- sorry
1504-
1505- sorry
1459+ -- apply (mem_lexNfLanguage_iff_factorCondition _ _).mp at hw
1460+ -- apply (isLexNf_iff_factorCondition _ _).mpr at hw
1461+ apply (mem_lexNfLanguage_iff_factorCondition _ _).mp at hww
1462+ apply (isLexNf_iff_factorCondition _ _).mpr at hww
1463+
1464+ by_cases hz : w = []
1465+ · simp [hz, IsConnectedL]
1466+ by_contra h_con
1467+ have h_con_ww : ¬IsConnectedL I (w ++ w) := by
1468+ contrapose h_con
1469+ intro ⟨a, ha⟩ ⟨b, hb⟩
1470+ replace h_con := h_con ⟨a, List.mem_append_left w ha⟩ ⟨b, List.mem_append_left w hb⟩
1471+ exact depTrClIn_sub (List.append_subset_of_subset_of_subset (by simp) (by simp)) h_con
1472+ have h_dec_w_len := @ccDec_disconnected_len α I w h_con
1473+ have h_dec_ww_len := @ccDec_disconnected_len α I (w ++ w) h_con_ww
1474+ unfold ccDec at h_dec_ww_len
1475+
1476+ have h_across_indep := ccDec_aux_across_indep I w w (Nat.lt_of_succ_le h_dec_w_len) (by simp)
1477+ cases h_across_indep with
1478+ | inl h_across_indep =>
1479+ have h_across_infix := ccDec_across_infix I w (Nat.lt_of_succ_le h_dec_w_len)
1480+ replace h_across_infix : List.IsInfix
1481+ (((ccDec_aux I w w).getLast (ccDec_aux_nonempty _ _)) ++
1482+ ((ccDec_aux I w w)[0 ]'(ccDec_aux_zero_idx)))
1483+ (w ++ w) := by
1484+ unfold ccDec at h_across_infix
1485+ replace ⟨s, t, h_across_infix⟩ := h_across_infix
1486+ use s, (ccDec_aux I w w)[1 ] ++ t
1487+ simp only [<- List.append_assoc] at h_across_infix ⊢
1488+ exact h_across_infix
1489+ have h_across_lexNf := lexNf_infix_is_lexNf h_across_infix hww
1490+ have h_last_ne : (ccDec_aux I w w).getLast (ccDec_aux_nonempty _ _) ≠ [] := by
1491+ rw [List.getLast_eq_getElem]
1492+ exact ccDec_aux_elem_nonempty w w _ _ hz
1493+ rw [List.getLast_eq_getElem] at h_across_indep h_across_lexNf
1494+ have h_gt := lexNf_concat_of_indep h_across_indep h_across_lexNf
1495+ (ccDec_aux_elem_nonempty w w _ _ hz) (ccDec_aux_nonempty_head I w w hz)
1496+ have h_lt := lexNf_ccDec_order hw hz 0 ((ccDec_aux I w w).length - 1 ) (Nat.zero_lt_sub_of_lt h_dec_w_len)
1497+ (Nat.sub_one_lt_of_lt h_dec_w_len)
1498+ exact LT.lt.asymm h_gt h_lt
1499+ | inr h_across_indep =>
1500+ replace ⟨h_across_indep, h_dec_w_len2⟩ := h_across_indep
1501+ have h_across_infix := ccDec_across_infix I w (Nat.lt_of_succ_le h_dec_w_len)
1502+ have h_across_lexNf := lexNf_infix_is_lexNf h_across_infix hww
1503+ rw [List.getLast_eq_getElem] at h_across_indep h_across_lexNf
1504+ have h_across_ne : (ccDec I w)[(ccDec I w).length - 1 ] ++ (ccDec I w)[0 ] ≠ [] :=
1505+ List.append_ne_nil_of_right_ne_nil _ (ccDec_aux_nonempty_head I w w hz)
1506+ have h_gt := lexNf_concat_of_indep
1507+ h_across_indep h_across_lexNf
1508+ h_across_ne
1509+ (ccDec_aux_elem_nonempty w w 1 (Nat.lt_of_succ_le h_dec_w_len) hz)
1510+ have h_eq : ((ccDec_aux I w w)[(ccDec_aux I w w).length - 1 ] ++ (ccDec_aux I w w)[0 ])[0 ]'(List.length_pos_iff.mpr h_across_ne) =
1511+ ((ccDec_aux I w w)[(ccDec_aux I w w).length - 1 ])[0 ]'(ccDec_aux_elem_nonempty_len _ _ _ _ hz) := by
1512+ rw [List.getElem_append_left]
1513+ rw [h_eq] at h_gt
1514+ have h_lt := lexNf_ccDec_order hw hz 1 ((ccDec_aux I w w).length - 1 ) (Nat.lt_sub_of_add_lt h_dec_w_len2)
1515+ (Nat.sub_one_lt_of_lt h_dec_w_len)
1516+ exact LT.lt.asymm h_gt h_lt
15061517
15071518lemma connected_of_lexNf_sq' {w : List α}
15081519 (hww : w ++ w ∈ LexNfLanguage I) :
0 commit comments