Skip to content

Commit 31345b6

Browse files
committed
chore: golf using grind (#38381)
The goal of this PR is to decrease the number of times lemmas are called explicitly. Any decrease in compilation time is a welcome side effect, although it is not a primary objective. Trace profiling results (differences <30 ms considered measurement noise): * `✅️ SimpleGraph.Walk.takeUntil_eq_take`: 258 ms before, 206 ms after 🎉 Profiled using `set_option trace.profiler true in`.
1 parent ccfee27 commit 31345b6

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Walk/Decomp.lean

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,8 @@ lemma takeUntil_eq_take (p : G.Walk u v) (h : w ∈ p.support) :
6464
| nil =>
6565
simp only [takeUntil, eq_mpr_eq_cast, support_nil, getVert_nil, take, support_copy]
6666
grind [mem_support_nil_iff, support_nil]
67-
| @cons a _ _ _ p ih =>
68-
by_cases! h' : w = a
69-
· grind [List.idxOf_cons_self, take_zero, copy_rfl_rfl, support_nil, takeUntil_first]
70-
· rw [take_cons_eq _ _ _ (by grind), takeUntil_cons (List.mem_of_ne_of_mem h' h) h'.symm,
71-
support_cons, support_copy, ih (by grind)]
72-
grind
67+
| cons hadj p ih =>
68+
grind [takeUntil, support, copy_rfl_rfl, take_support_eq_support_take_succ]
7369

7470
lemma length_takeUntil (p : G.Walk u v) (h : w ∈ p.support) :
7571
(p.takeUntil w h).length = p.support.idxOf w := by

0 commit comments

Comments
 (0)