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
Construct an empty or singleton finset from an Option
Equations
- Option.toFinset o = Option.elim o ∅ singleton
Instances For
@[simp]
theorem
Option.card_toFinset
{α : Type u_1}
(o : Option α)
:
Finset.card (Option.toFinset o) = Option.elim o 0 1
Given a finset on α
, lift it to being a finset on Option α
using Option.some
and then insert Option.none
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem
Finset.card_insertNone
{α : Type u_1}
(s : Finset α)
:
Finset.card (↑Finset.insertNone s) = Finset.card s + 1
theorem
Finset.eraseNone_eq_biUnion
{α : Type u_1}
[DecidableEq α]
(s : Finset (Option α))
:
↑Finset.eraseNone s = Finset.biUnion s 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 : Finset (Option α))
(t : Finset (Option α))
:
@[simp]
theorem
Finset.eraseNone_inter
{α : Type u_1}
[DecidableEq (Option α)]
[DecidableEq α]
(s : Finset (Option α))
(t : Finset (Option α))
:
@[simp]
theorem
Finset.image_some_eraseNone
{α : Type u_1}
[DecidableEq (Option α)]
(s : Finset (Option α))
:
Finset.image some (↑Finset.eraseNone s) = Finset.erase s none
@[simp]
theorem
Finset.map_some_eraseNone
{α : Type u_1}
[DecidableEq (Option α)]
(s : Finset (Option α))
:
Finset.map Function.Embedding.some (↑Finset.eraseNone s) = Finset.erase s 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