@@ -1094,6 +1094,49 @@ theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈
10941094 | .cons h q =>
10951095 simp only [getVert_cons_succ, tail_cons_eq, getVert_cons]
10961096 exact getVert_copy q n (getVert_zero q).symm rfl
1097+
1098+ lemma ext_support {u v} {p q : G.Walk u v} (h : p.support = q.support) :
1099+ p = q := by
1100+ induction q with
1101+ | nil =>
1102+ rw [← nil_iff_eq_nil, nil_iff_support_eq]
1103+ exact support_nil ▸ h
1104+ | cons ha q ih =>
1105+ cases p with
1106+ | nil => simp at h
1107+ | cons _ p =>
1108+ simp only [support_cons, List.cons.injEq, true_and] at h
1109+ apply List.getElem_of_eq at h
1110+ specialize h (i := 0 ) (by simp)
1111+ rw [List.getElem_zero, List.getElem_zero, p.head_support, q.head_support] at h
1112+ have : (p.copy h rfl).support = q.support := by simpa
1113+ simp [← ih this]
1114+
1115+ lemma ext_getVert_le_length {u v} {p q : G.Walk u v} (hl : p.length = q.length)
1116+ (h : ∀ k ≤ p.length, p.getVert k = q.getVert k) :
1117+ p = q := by
1118+ suffices ∀ k : ℕ, p.support[k]? = q.support[k]? by
1119+ exact ext_support <| List.ext_getElem?_iff.mpr this
1120+ intro k
1121+ cases le_or_gt k p.length with
1122+ | inl hk =>
1123+ rw [← getVert_eq_support_getElem? p hk, ← getVert_eq_support_getElem? q (hl ▸ hk)]
1124+ exact congrArg some (h k hk)
1125+ | inr hk =>
1126+ replace hk : p.length + 1 ≤ k := hk
1127+ have ht : q.length + 1 ≤ k := hl ▸ hk
1128+ rw [← length_support, ← List.getElem?_eq_none_iff] at hk ht
1129+ rw [hk, ht]
1130+
1131+ lemma ext_getVert {u v} {p q : G.Walk u v} (h : ∀ k, p.getVert k = q.getVert k) :
1132+ p = q := by
1133+ wlog hpq : p.length ≤ q.length generalizing p q
1134+ · exact (this (fun k ↦ (h k).symm) (le_of_not_ge hpq)).symm
1135+ have : q.length ≤ p.length := by
1136+ by_contra!
1137+ exact (q.adj_getVert_succ this).ne (by simp [← h, getVert_of_length_le])
1138+ exact ext_getVert_le_length (hpq.antisymm this) fun k _ ↦ h k
1139+
10971140end Walk
10981141
10991142/-! ### Mapping walks -/
0 commit comments