Preparations for defining operations on finset
.
The operations here ignore multiplicities,
and preparatory for defining the corresponding operations on finset
.
finset insert
ndinsert a s
is the lift of the list insert
operation. This operation
does not respect multiplicities, unlike cons
, but it is suitable as
an insert operation on finset
.
Equations
- multiset.ndinsert a s = quot.lift_on s (λ (l : list α), ↑(list.insert a l)) _
finset union
ndunion s t
is the lift of the list union
operation. This operation
does not respect multiplicities, unlike s ∪ t
, but it is suitable as
a union operation on finset
. (s ∪ t
would also work as a union operation
on finset, but this is more efficient.)
finset inter
ndinter s t
is the lift of the list ∩
operation. This operation
does not respect multiplicities, unlike s ∩ t
, but it is suitable as
an intersection operation on finset
. (s ∩ t
would also work as a union operation
on finset, but this is more efficient.)
Equations
- s.ndinter t = multiset.filter (λ (_x : α), _x ∈ t) s