Skip to content

Commit b8f1ced

Browse files
committed
feat(Combinatorics/SimpleGraph/Paths): add lemma SimpleGraph.Walk.IsPath.mem_support_iff_exists_append (leanprover-community#27461)
This contribution was created as part of the Utrecht Summerschool "Formalizing Mathematics in Lean" in July 2025.
1 parent df8d6a9 commit b8f1ced

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Paths.lean

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,21 @@ theorem IsPath.concat {p : G.Walk u v} (hp : p.IsPath) (hw : w ∉ p.support)
233233
(h : G.Adj v w) : (p.concat h).IsPath :=
234234
(concat_isPath_iff h).mpr ⟨hp, hw⟩
235235

236-
lemma IsPath.disjoint_support_of_append {u v w : V} {p : G.Walk u v} {q : G.Walk v w}
236+
lemma IsPath.mem_support_iff_exists_append {p : G.Walk u v} (hp : p.IsPath) :
237+
w ∈ p.support ↔ ∃ (q : G.Walk u w) (r : G.Walk w v), q.IsPath ∧ r.IsPath ∧ p = q.append r := by
238+
refine ⟨fun hw ↦ ?_, fun ⟨q, r, hq, hr, hqr⟩ ↦ p.mem_support_iff_exists_append.mpr ⟨q, r, hqr⟩⟩
239+
obtain ⟨q, r, hqr⟩ := p.mem_support_iff_exists_append.mp hw
240+
have : (q.append r).IsPath := hqr ▸ hp
241+
exact ⟨q, r, this.of_append_left, this.of_append_right, hqr⟩
242+
243+
lemma IsPath.disjoint_support_of_append {p : G.Walk u v} {q : G.Walk v w}
237244
(hpq : (p.append q).IsPath) (hq : ¬q.Nil) : p.support.Disjoint q.tail.support := by
238245
have hpq' := hpq.support_nodup
239246
rw [support_append] at hpq'
240247
rw [support_tail_of_not_nil q hq]
241248
exact List.disjoint_of_nodup_append hpq'
242249

243-
lemma IsPath.ne_of_mem_support_of_append {u v w : V} {p : G.Walk u v} {q : G.Walk v w}
250+
lemma IsPath.ne_of_mem_support_of_append {p : G.Walk u v} {q : G.Walk v w}
244251
(hpq : (p.append q).IsPath) {x y : V} (hyv : y ≠ v) (hx : x ∈ p.support) (hy : y ∈ q.support) :
245252
x ≠ y := by
246253
rintro rfl

0 commit comments

Comments
 (0)