Skip to content

Commit 81f5e3a

Browse files
committed
chore: golf using grind and add grind annotation
1 parent 899a433 commit 81f5e3a

File tree

4 files changed

+8
-38
lines changed

4 files changed

+8
-38
lines changed

Mathlib/GroupTheory/GroupAction/MultipleTransitivity.lean

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -583,19 +583,10 @@ theorem isMultiplyPretransitive (n : ℕ) :
583583
· obtain ⟨i, rfl⟩ := hb
584584
use x i
585585
simp only [ψ, x.injective.extend_apply]
586-
· rw [← Set.mem_compl_iff] at hb
587-
use φ.invFun ⟨b, hb⟩
586+
· use φ.invFun ⟨b, hb⟩
588587
simp only [ψ]
589-
rw [Function.extend_apply' _ _ _ ?_]
590-
· simp only [φ']
591-
set a : α := (φ.invFun ⟨b, hb⟩ : α)
592-
have ha : a ∈ (range x)ᶜ := Subtype.coe_prop (φ.invFun ⟨b, hb⟩)
593-
rw [← Subtype.coe_mk a ha]
594-
simp [a]
595-
· rintro ⟨i, hi⟩
596-
apply Subtype.coe_prop (φ.invFun ⟨b, hb⟩)
597-
rw [← hi]
598-
exact mem_range_self i
588+
simp only [invFun_as_coe]
589+
grind [Function.extend_apply', Function.extend_val_apply]
599590
use Equiv.ofBijective ψ this
600591
ext i
601592
simp [ψ, x.injective.extend_apply]

Mathlib/GroupTheory/Perm/Support.lean

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ theorem disjoint_one_right (f : Perm α) : Disjoint f 1 := fun _ => Or.inr rfl
7878
theorem disjoint_iff_eq_or_eq : Disjoint f g ↔ ∀ x : α, f x = x ∨ g x = x :=
7979
Iff.rfl
8080

81-
@[simp]
81+
@[simp, grind =]
8282
theorem disjoint_refl_iff : Disjoint f f ↔ f = 1 := by
8383
refine ⟨fun h => ?_, fun h => h.symm ▸ disjoint_one_left 1
8484
ext x
@@ -136,13 +136,7 @@ theorem disjoint_prod_perm {l₁ l₂ : List (Perm α)} (hl : l₁.Pairwise Disj
136136

137137
theorem nodup_of_pairwise_disjoint {l : List (Perm α)} (h1 : (1 : Perm α) ∉ l)
138138
(h2 : l.Pairwise Disjoint) : l.Nodup := by
139-
refine List.Pairwise.imp_of_mem ?_ h2
140-
intro τ σ h_mem _ h_disjoint _
141-
subst τ
142-
suffices (σ : Perm α) = 1 by
143-
rw [this] at h_mem
144-
exact h1 h_mem
145-
exact ext fun a => or_self_iff.mp (h_disjoint a)
139+
grind [List.nodup_iff_sublist]
146140

147141
theorem pow_apply_eq_self_of_apply_eq_self {x : α} (hfx : f x = x) : ∀ n : ℕ, (f ^ n) x = x
148142
| 0 => rfl

Mathlib/NumberTheory/LucasLehmer.lean

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,7 @@ theorem sModNat_eq_sMod (p k : ℕ) (hp : 2 ≤ p) : (sModNat (2 ^ p - 1) k :
643643
simp [h2]
644644
| succ k ih =>
645645
rw [sModNat, sMod, ← ih]
646-
have h3 : 22 ^ p - 1 := by
647-
zify [h2]
648-
calc (2 : ℤ)
649-
_ ≤ 4 - 1 := by simp
650-
_ ≤ 2 ^ p - 1 := by zify at h1; exact Int.sub_le_sub_right h1 _
651-
zify [h2, h3]
652-
rw [← add_sub_assoc, sub_eq_add_neg, add_assoc, add_comm _ (-2), ← add_assoc,
653-
Int.add_emod_right, ← sub_eq_add_neg]
646+
grind [Int.emod_eq_emod_iff_emod_sub_eq_zero, Int.add_emod, Int.emod_eq_add_self_emod]
654647

655648
/-- Tail-recursive version of `sModNat`. -/
656649
meta def sModNatTR (q k : ℕ) : ℕ :=

Mathlib/Probability/Kernel/IonescuTulcea/Maps.lean

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,7 @@ lemma _root_.IicProdIoc_preimage {a b : ι} (hab : a ≤ b) (s : (i : Iic b) →
188188
(Set.univ.pi <| frestrictLe₂ (π := (fun n ↦ Set (X n))) hab s) ×ˢ
189189
(Set.univ.pi <| restrict₂ (π := (fun n ↦ Set (X n))) Ioc_subset_Iic_self s) := by
190190
ext x
191-
simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, IicProdIoc_def, forall_const,
192-
Subtype.forall, mem_Iic, Set.mem_prod, frestrictLe₂_apply, restrict₂, mem_Ioc]
193-
refine ⟨fun h ↦ ⟨fun i hi ↦ ?_, fun i ⟨hi1, hi2⟩ ↦ ?_⟩, fun ⟨h1, h2⟩ i hi ↦ ?_⟩
194-
· convert h i (hi.trans hab)
195-
rw [dif_pos hi]
196-
· convert h i hi2
197-
rw [dif_neg (not_le.2 hi1)]
198-
· split_ifs with hi3
199-
· exact h1 i hi3
200-
· exact h2 i ⟨not_le.1 hi3, hi⟩
191+
simp only [Set.mem_preimage, Set.mem_pi, IicProdIoc_def, Subtype.forall, mem_Iic]
192+
grind
201193

202194
end Lemmas

0 commit comments

Comments
 (0)