Skip to content

Commit 7e435e3

Browse files
eupruninjoelriou
authored andcommitted
chore(Data/Finset): golf entire diag_union_offDiag, erase_right_comm, univ_filter_mem_range and powersetCard_map using grind (leanprover-community#28681)
1 parent e16b275 commit 7e435e3

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

Mathlib/Data/Finset/BooleanAlgebra.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ theorem univ_filter_exists (f : α → β) [Fintype β] [DecidablePred fun y =>
231231
/-- Note this is a special case of `(Finset.image_preimage f univ _).symm`. -/
232232
theorem univ_filter_mem_range (f : α → β) [Fintype β] [DecidablePred fun y => y ∈ Set.range f]
233233
[DecidableEq β] : (Finset.univ.filter fun y => y ∈ Set.range f) = Finset.univ.image f := by
234-
letI : DecidablePred (fun y => ∃ x, f x = y) := by simpa using ‹_›
235-
exact univ_filter_exists f
234+
grind
236235

237236
theorem coe_filter_univ (p : α → Prop) [DecidablePred p] :
238237
(univ.filter p : Set α) = { x | p x } := by simp

Mathlib/Data/Finset/Erase.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ theorem coe_erase (a : α) (s : Finset α) : ↑(erase s a) = (s \ {a} : Set α)
9999
theorem erase_idem {a : α} {s : Finset α} : erase (erase s a) a = erase s a := by simp
100100

101101
theorem erase_right_comm {a b : α} {s : Finset α} : erase (erase s a) b = erase (erase s b) a := by
102-
ext x
103-
simp only [mem_erase, ← and_assoc]
104-
rw [@and_comm (x ≠ a)]
102+
grind
105103

106104
theorem erase_inj {x y : α} (s : Finset α) (hx : x ∈ s) : s.erase x = s.erase y ↔ x = y := by
107105
grind [eq_of_mem_of_notMem_erase]

Mathlib/Data/Finset/Powerset.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,7 @@ theorem powersetCard_map {β : Type*} (f : α ↪ β) (n : ℕ) (s : Finset α)
306306
constructor
307307
· classical
308308
intro h
309-
have : map f (filter (fun x => (f x ∈ t)) s) = t := by
310-
ext x
311-
simp only [mem_map, mem_filter]
312-
exact ⟨fun ⟨_y, ⟨_hy₁, hy₂⟩, hy₃⟩ => hy₃ ▸ hy₂,
313-
fun hx => let ⟨y, hy⟩ := mem_map.1 (h.1 hx); ⟨y, ⟨hy.1, hy.2 ▸ hx⟩, hy.2⟩⟩
309+
have : map f (filter (fun x => (f x ∈ t)) s) = t := by grind
314310
refine ⟨_, ?_, this⟩
315311
rw [← card_map f, this, h.2]; simp
316312
· rintro ⟨a, ⟨has, rfl⟩, rfl⟩

Mathlib/Data/Finset/Prod.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ theorem offDiag_empty : (∅ : Finset α).offDiag = ∅ :=
313313

314314
@[simp]
315315
theorem diag_union_offDiag : s.diag ∪ s.offDiag = s ×ˢ s := by
316-
conv_rhs => rw [← filter_union_filter_neg_eq (fun a => a.1 = a.2) (s ×ˢ s)]
317-
rfl
316+
grind
318317

319318
@[simp]
320319
theorem disjoint_diag_offDiag : Disjoint s.diag s.offDiag :=

0 commit comments

Comments
 (0)