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.liftOn s (fun (l : List α) => ↑(List.insert a l)) (_ : ∀ (x x_1 : List α), Setoid.r x x_1 → ⟦List.insert a x⟧ = ⟦List.insert a x_1⟧)
Instances For
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.)
Equations
- Multiset.ndunion s t = Quotient.liftOn₂ s t (fun (l₁ l₂ : List α) => ↑(List.union l₁ l₂)) (_ : ∀ (x x_1 x_2 x_3 : List α), x ≈ x_2 → x_1 ≈ x_3 → ⟦List.union x x_1⟧ = ⟦List.union x_2 x_3⟧)
Instances For
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
- Multiset.ndinter s t = Multiset.filter (fun (x : α) => x ∈ t) s