Skip to content

Commit 78d933a

Browse files
committed
chore: golf using grind (#36693)
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): * `Equiv.Perm.ofSubtype_swap_eq`: unchanged 🎉 * `Filter.hasBasis_biInf_of_directed'`: unchanged 🎉 Profiled using `set_option trace.profiler true in`.
1 parent 3076fd7 commit 78d933a

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

Mathlib/GroupTheory/Perm/Support.lean

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,8 @@ def IsSwap (f : Perm α) : Prop :=
194194

195195
@[simp]
196196
theorem ofSubtype_swap_eq {p : α → Prop} [DecidablePred p] (x y : Subtype p) :
197-
ofSubtype (Equiv.swap x y) = Equiv.swap ↑x ↑y :=
198-
Equiv.ext fun z => by
199-
by_cases hz : p z
200-
· rw [swap_apply_def, ofSubtype_apply_of_mem _ hz]
201-
split_ifs with hzx hzy
202-
· simp_rw [hzx, Subtype.coe_eta, swap_apply_left]
203-
· simp_rw [hzy, Subtype.coe_eta, swap_apply_right]
204-
· rw [swap_apply_of_ne_of_ne] <;>
205-
simp [Subtype.ext_iff, *]
206-
· rw [ofSubtype_apply_of_not_mem _ hz, swap_apply_of_ne_of_ne] <;> grind
197+
ofSubtype (Equiv.swap x y) = Equiv.swap ↑x ↑y := by
198+
grind [ofSubtype_apply_of_mem, ofSubtype_apply_of_not_mem]
207199

208200
theorem IsSwap.of_subtype_isSwap {p : α → Prop} [DecidablePred p] {f : Perm (Subtype p)}
209201
(h : f.IsSwap) : (ofSubtype f).IsSwap :=

0 commit comments

Comments
 (0)