Skip to content

Commit 100e68c

Browse files
committed
feat: add Finset.card_le_one_iff_subsingleton and Finset.one_lt_card_iff_nontrivial (#7131)
The versions for `Fintype` already exist but are missing for `Finset`.
1 parent 65ef10e commit 100e68c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Mathlib/Data/Finset/Card.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ theorem card_le_one_iff : s.card ≤ 1 ↔ ∀ {a b}, a ∈ s → b ∈ s → a
539539
tauto
540540
#align finset.card_le_one_iff Finset.card_le_one_iff
541541

542+
theorem card_le_one_iff_subsingleton_coe : s.card ≤ 1 ↔ Subsingleton (s : Type _) :=
543+
card_le_one.trans (s : Set α).subsingleton_coe.symm
544+
542545
theorem card_le_one_iff_subset_singleton [Nonempty α] : s.card ≤ 1 ↔ ∃ x : α, s ⊆ {x} := by
543546
refine' ⟨fun H => _, _⟩
544547
· obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
@@ -565,6 +568,9 @@ theorem one_lt_card_iff : 1 < s.card ↔ ∃ a b, a ∈ s ∧ b ∈ s ∧ a ≠
565568
simp only [exists_prop, exists_and_left]
566569
#align finset.one_lt_card_iff Finset.one_lt_card_iff
567570

571+
theorem one_lt_card_iff_nontrivial_coe : 1 < s.card ↔ Nontrivial (s : Type _) := by
572+
rw [← not_iff_not, not_lt, not_nontrivial_iff_subsingleton, card_le_one_iff_subsingleton_coe]
573+
568574
theorem two_lt_card_iff : 2 < s.card ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c := by
569575
classical
570576
refine' ⟨fun h => _, _⟩

Mathlib/Data/Fintype/Card.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,7 @@ theorem card_le_one_iff_subsingleton : card α ≤ 1 ↔ Subsingleton α :=
576576
#align fintype.card_le_one_iff_subsingleton Fintype.card_le_one_iff_subsingleton
577577

578578
theorem one_lt_card_iff_nontrivial : 1 < card α ↔ Nontrivial α := by
579-
classical
580-
rw [← not_iff_not]
581-
push_neg
582-
rw [not_nontrivial_iff_subsingleton, card_le_one_iff_subsingleton]
579+
rw [← not_iff_not, not_lt, not_nontrivial_iff_subsingleton, card_le_one_iff_subsingleton]
583580
#align fintype.one_lt_card_iff_nontrivial Fintype.one_lt_card_iff_nontrivial
584581

585582
theorem exists_ne_of_one_lt_card (h : 1 < card α) (a : α) : ∃ b : α, b ≠ a :=

0 commit comments

Comments
 (0)