Skip to content

Commit 1260772

Browse files
eupruninyuanyi-350
authored andcommitted
chore(Order/BooleanAlgebra): golf entire diff_insert_of_notMem, insert_diff_of_mem, insert_diff_of_notMem and subset_insert_iff using grind (leanprover-community#28628)
1 parent 3a532bd commit 1260772

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

Mathlib/Order/BooleanAlgebra/Set.lean

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -401,23 +401,16 @@ lemma subset_insert_diff_singleton (x : α) (s : Set α) : s ⊆ insert x (s \ {
401401
rw [← diff_singleton_subset_iff]
402402

403403
lemma diff_insert_of_notMem (h : a ∉ s) : s \ insert a t = s \ t := by
404-
refine Subset.antisymm (diff_subset_diff (refl _) (subset_insert ..)) fun y hy ↦ ?_
405-
simp only [mem_diff, mem_insert_iff, not_or] at hy ⊢
406-
exact ⟨hy.1, fun hxy ↦ h <| hxy ▸ hy.1, hy.2
404+
grind
407405

408406
@[deprecated (since := "2025-05-23")] alias diff_insert_of_not_mem := diff_insert_of_notMem
409407

410408
@[simp]
411409
lemma insert_diff_of_mem (s) (h : a ∈ t) : insert a s \ t = s \ t := by
412-
ext
413-
constructor <;> simp +contextual [or_imp, h]
410+
grind
414411

415412
lemma insert_diff_of_notMem (s) (h : a ∉ t) : insert a s \ t = insert a (s \ t) := by
416-
classical
417-
ext x
418-
by_cases h' : x ∈ t
419-
· simp [h', ne_of_mem_of_not_mem h' h]
420-
· simp [h']
413+
grind
421414

422415
@[deprecated (since := "2025-05-23")] alias insert_diff_of_not_mem := insert_diff_of_notMem
423416

@@ -464,10 +457,7 @@ lemma mem_diff_singleton_empty {t : Set (Set α)} : s ∈ t \ {∅} ↔ s ∈ t
464457
mem_diff_singleton.trans <| and_congr_right' nonempty_iff_ne_empty.symm
465458

466459
lemma subset_insert_iff : s ⊆ insert a t ↔ s ⊆ t ∨ (a ∈ s ∧ s \ {a} ⊆ t) := by
467-
rw [← diff_singleton_subset_iff]
468-
by_cases hx : a ∈ s
469-
· rw [and_iff_right hx, or_iff_right_of_imp diff_subset.trans]
470-
rw [diff_singleton_eq_self hx, or_iff_left_of_imp And.right]
460+
grind
471461

472462
lemma pair_diff_left (hab : a ≠ b) : ({a, b} : Set α) \ {a} = {b} := by
473463
rw [insert_diff_of_mem _ (mem_singleton a), diff_singleton_eq_self (by simpa)]

0 commit comments

Comments
 (0)