Skip to content

Commit a4b56a0

Browse files
feat(Combinatorics/SimpleGraph): add miscellaneous lemmas (#16294)
Co-authored-by: Daniel Weber <55664973+Command-Master@users.noreply.github.com>
1 parent 8f25b64 commit a4b56a0

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Mathlib/Combinatorics/SimpleGraph/Dart.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ theorem Dart.ext (d₁ d₂ : G.Dart) (h : d₁.toProd = d₂.toProd) : d₁ = d
3939
-- Porting note: deleted `Dart.fst` and `Dart.snd` since they are now invalid declaration names,
4040
-- even though there is not actually a `SimpleGraph.Dart.fst` or `SimpleGraph.Dart.snd`.
4141

42+
@[simp]
43+
theorem Dart.fst_ne_snd (d : G.Dart) : d.fst ≠ d.snd :=
44+
fun h ↦ G.irrefl (h ▸ d.adj)
45+
46+
@[simp]
47+
theorem Dart.snd_ne_fst (d : G.Dart) : d.snd ≠ d.fst :=
48+
fun h ↦ G.irrefl (h ▸ d.adj)
49+
4250
theorem Dart.toProd_injective : Function.Injective (Dart.toProd : G.Dart → V × V) :=
4351
Dart.ext
4452

Mathlib/Combinatorics/SimpleGraph/Walk.lean

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kyle Miller
55
-/
66
import Mathlib.Combinatorics.SimpleGraph.Maps
7+
import Mathlib.Data.List.Lemmas
78

89
/-!
910
@@ -499,6 +500,17 @@ theorem support_reverse {u v : V} (p : G.Walk u v) : p.reverse.support = p.suppo
499500
@[simp]
500501
theorem support_ne_nil {u v : V} (p : G.Walk u v) : p.support ≠ [] := by cases p <;> simp
501502

503+
@[simp]
504+
theorem head_support {G : SimpleGraph V} {a b : V} (p : G.Walk a b) :
505+
p.support.head (by simp) = a := by cases p <;> simp
506+
507+
@[simp]
508+
theorem getLast_support {G : SimpleGraph V} {a b : V} (p : G.Walk a b) :
509+
p.support.getLast (by simp) = b := by
510+
induction p
511+
· simp
512+
· simpa
513+
502514
theorem tail_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) :
503515
(p.append p').support.tail = p.support.tail ++ p'.support.tail := by
504516
rw [support_append, List.tail_append_of_ne_nil _ _ (support_ne_nil _)]
@@ -641,6 +653,21 @@ theorem map_fst_darts_append {u v : V} (p : G.Walk u v) :
641653
theorem map_fst_darts {u v : V} (p : G.Walk u v) : p.darts.map (·.fst) = p.support.dropLast := by
642654
simpa! using congr_arg List.dropLast (map_fst_darts_append p)
643655

656+
@[simp]
657+
theorem head_darts_fst {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.darts ≠ []) :
658+
(p.darts.head hp).fst = a := by
659+
cases p
660+
· contradiction
661+
· simp
662+
663+
@[simp]
664+
theorem getLast_darts_snd {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.darts ≠ []) :
665+
(p.darts.getLast hp).snd = b := by
666+
rw [← List.getLast_map (f := fun x : G.Dart ↦ x.snd)]
667+
simp_rw [p.map_snd_darts, List.getLast_tail]
668+
exact p.getLast_support
669+
simpa
670+
644671
@[simp]
645672
theorem edges_nil {u : V} : (nil : G.Walk u u).edges = [] := rfl
646673

0 commit comments

Comments
 (0)