Finsets in Fin n
#
A few constructions for Finsets in Fin n
.
Main declarations #
Finset.attachFin
: Turns a Finset of naturals strictly less thann
into aFinset (Fin n)
.
Given a Finset s
of ℕ
contained in {0,..., n-1}
, the corresponding Finset in Fin n
is s.attachFin h
where h
is a proof that all elements of s
are less than n
.
Equations
- Finset.attachFin s h = { val := Multiset.pmap (fun a ha => { val := a, isLt := ha }) s.val h, nodup := (_ : Multiset.Nodup (Multiset.pmap (fun a ha => { val := a, isLt := ha }) s.val h)) }
Instances For
@[simp]
theorem
Finset.card_attachFin
{n : ℕ}
(s : Finset ℕ)
(h : ∀ (m : ℕ), m ∈ s → m < n)
:
Finset.card (Finset.attachFin s h) = Finset.card s