Finite sets in Option α
#
In this file we define
Option.toFinset
: construct an empty or singletonFinset α
from anOption α
;Finset.insertNone
: givens : Finset α
, lift it to a finset onOption α
usingOption.some
and then insertOption.none
;Finset.eraseNone
: givens : Finset (Option α)
, returnst : Finset α
such thatx ∈ t ↔ some x ∈ s
.
Then we prove some basic lemmas about these definitions.
Tags #
finset, option
Given a finset on α
, lift it to being a finset on Option α
using Option.some
and then insert Option.none
.
Equations
- Finset.insertNone = OrderEmbedding.ofMapLEIff (fun (s : Finset α) => Finset.cons none (Finset.map Function.Embedding.some s) ⋯) ⋯
Instances For
Given s : Finset (Option α)
, eraseNone s : Finset α
is the set of x : α
such that
some x ∈ s
.
Equations
- Finset.eraseNone = (Finset.mapEmbedding (Equiv.optionIsSomeEquiv α).toEmbedding).toOrderHom.comp { toFun := Finset.subtype fun (x : Option α) => x.isSome = true, monotone' := ⋯ }
Instances For
theorem
Finset.eraseNone_eq_biUnion
{α : Type u_1}
[DecidableEq α]
(s : Finset (Option α))
:
Finset.eraseNone s = s.biUnion Option.toFinset
@[simp]
theorem
Finset.eraseNone_map_some
{α : Type u_1}
(s : Finset α)
:
Finset.eraseNone (Finset.map Function.Embedding.some s) = s
@[simp]
theorem
Finset.eraseNone_image_some
{α : Type u_1}
[DecidableEq (Option α)]
(s : Finset α)
:
Finset.eraseNone (Finset.image some s) = s
@[simp]
theorem
Finset.eraseNone_union
{α : Type u_1}
[DecidableEq (Option α)]
[DecidableEq α]
(s t : Finset (Option α))
:
@[simp]
theorem
Finset.eraseNone_inter
{α : Type u_1}
[DecidableEq (Option α)]
[DecidableEq α]
(s t : Finset (Option α))
:
@[simp]
theorem
Finset.image_some_eraseNone
{α : Type u_1}
[DecidableEq (Option α)]
(s : Finset (Option α))
:
Finset.image some (Finset.eraseNone s) = s.erase none
@[simp]
theorem
Finset.map_some_eraseNone
{α : Type u_1}
[DecidableEq (Option α)]
(s : Finset (Option α))
:
Finset.map Function.Embedding.some (Finset.eraseNone s) = s.erase none
@[simp]
theorem
Finset.insertNone_eraseNone
{α : Type u_1}
[DecidableEq (Option α)]
(s : Finset (Option α))
:
@[simp]
theorem
Finset.eraseNone_insertNone
{α : Type u_1}
(s : Finset α)
:
Finset.eraseNone (Finset.insertNone s) = s