Skip to content

Commit e80d61a

Browse files
committed
rewrite IsPath.getVert_injOn
1 parent 228284b commit e80d61a

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Paths.lean

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -409,22 +409,13 @@ theorem IsPath.length_lt [Fintype V] {u v : V} {p : G.Walk u v} (hp : p.IsPath)
409409

410410
lemma IsPath.getVert_injOn {p : G.Walk u v} (hp : p.IsPath) :
411411
Set.InjOn p.getVert (.Iic p.length) := by
412-
intro n hn m hm hnm
413-
induction p generalizing n m with
414-
| nil => simp_all
412+
induction p with
413+
| nil => simp [Set.InjOn]
415414
| @cons v w u h p ihp =>
416-
simp only [length_cons, Set.mem_Iic] at hn hm hnm
417-
by_cases hn0 : n = 0 <;> by_cases hm0 : m = 0
418-
· lia
419-
· simp only [hn0, getVert_zero, Walk.getVert_cons p h hm0] at hnm
420-
have hvp : v ∉ p.support := by aesop
421-
exact (hvp (Walk.mem_support_iff_exists_getVert.mpr ⟨(m - 1), ⟨hnm.symm, by lia⟩⟩)).elim
422-
· simp only [hm0, Walk.getVert_cons p h hn0] at hnm
423-
have hvp : v ∉ p.support := by simp_all
424-
exact (hvp (Walk.mem_support_iff_exists_getVert.mpr ⟨(n - 1), ⟨hnm, by lia⟩⟩)).elim
425-
· simp only [Walk.getVert_cons _ _ hn0, Walk.getVert_cons _ _ hm0] at hnm
426-
suffices n - 1 = m - 1 by lia
427-
exact ihp hp.of_cons (by grind) (by grind) hnm
415+
rw [show ∀ n, Set.Iic n = insert 0 (.Icc 1 n) by grind, Set.injOn_insert <| by simp]
416+
constructor
417+
· grind [getVert_cons, ihp hp.of_cons, Set.InjOn, length_cons]
418+
· grind [getVert_cons, hp.support_nodup, getVert_eq_support_getElem]
428419

429420
lemma IsPath.getVert_eq_start_iff_of_not_nil {i : ℕ} {p : G.Walk u w} (hp : p.IsPath) (h : ¬p.Nil) :
430421
p.getVert i = u ↔ i = 0 := by

0 commit comments

Comments
 (0)