Skip to content

Commit 58ba99a

Browse files
committed
feat(Data/Finset/Powerset): add results about powersetCard (#39541)
These are useful for set family combinatorics
1 parent 3b9b4dc commit 58ba99a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Mathlib/Data/Finset/Powerset.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,26 @@ theorem powersetCard_sup [DecidableEq α] (u : Finset α) (n : ℕ) (hn : n < u.
332332
rw [← insert_erase hx, powersetCard_succ_insert (notMem_erase _ _)]
333333
exact mem_union_right _ (mem_image_of_mem _ ht)
334334

335+
/-- The union of all `r`-element subsets of `s` is `s`, provided `1 ≤ r ≤ #s`. -/
336+
lemma powersetCard_biUnion [DecidableEq α] {r : ℕ} (hr : r ≠ 0) (hrs : r ≤ #s) :
337+
(s.powersetCard r).biUnion id = s := by
338+
obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hr
339+
rw [← sup_eq_biUnion]
340+
exact powersetCard_sup _ _ hrs
341+
342+
/-- If two finsets of equal cardinality have the same `r`-element subsets for some `1 ≤ r ≤ #a`,
343+
they are equal. -/
344+
lemma eq_of_powersetCard_eq {a b : Finset α} {r : ℕ}
345+
(hab : #a = #b) (hr₀ : r ≠ 0) (hra : r ≤ #a)
346+
(h : a.powersetCard r = b.powersetCard r) : a = b := by
347+
classical
348+
simpa [powersetCard_biUnion hr₀, ← hab, hra] using congr(($h).biUnion id)
349+
350+
/-- For `1 ≤ r ≤ q`, the map `powersetCard r` is injective on the finsets of cardinality `q`. -/
351+
lemma powersetCard_injOn {q r : ℕ} (hr₀ : r ≠ 0) (hrq : r ≤ q) :
352+
Set.InjOn (fun a ↦ a.powersetCard r) {a : Finset α | #a = q}
353+
| _, rfl, _, hbq, h => eq_of_powersetCard_eq hbq.symm hr₀ hrq h
354+
335355
theorem powersetCard_map {β : Type*} (f : α ↪ β) (n : ℕ) (s : Finset α) :
336356
powersetCard n (s.map f) = (powersetCard n s).map (mapEmbedding f).toEmbedding :=
337357
ext fun t => by

0 commit comments

Comments
 (0)