Finite sets in option α
#
In this file we define
option.to_finset
: construct an empty or singletonfinset α
from anoption α
;finset.insert_none
: givens : finset α
, lift it to a finset onoption α
usingoption.some
and then insertoption.none
;finset.erase_none
: 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.insert_none = order_embedding.of_map_le_iff (λ (s : finset α), finset.cons none (finset.map function.embedding.some s) _) finset.insert_none._proof_2
@[simp]
@[simp]
Given s : finset (option α)
, s.erase_none : finset α
is the set of x : α
such that
some x ∈ s
.
Equations
- finset.erase_none = (finset.map_embedding (equiv.option_is_some_equiv α).to_embedding).to_order_hom.comp {to_fun := finset.subtype (λ (x : option α), ↥(x.is_some)) (λ (a : option α), bool.decidable_eq a.is_some tt), monotone' := _}
@[simp]
@[simp]
@[simp]
theorem
finset.erase_none_image_some
{α : Type u_1}
[decidable_eq (option α)]
(s : finset α) :
⇑finset.erase_none (finset.image some s) = s
@[simp]
theorem
finset.erase_none_union
{α : Type u_1}
[decidable_eq (option α)]
[decidable_eq α]
(s t : finset (option α)) :
⇑finset.erase_none (s ∪ t) = ⇑finset.erase_none s ∪ ⇑finset.erase_none t
@[simp]
theorem
finset.erase_none_inter
{α : Type u_1}
[decidable_eq (option α)]
[decidable_eq α]
(s t : finset (option α)) :
⇑finset.erase_none (s ∩ t) = ⇑finset.erase_none s ∩ ⇑finset.erase_none t
@[simp]
theorem
finset.image_some_erase_none
{α : Type u_1}
[decidable_eq (option α)]
(s : finset (option α)) :
finset.image some (⇑finset.erase_none s) = s.erase none
@[simp]
theorem
finset.map_some_erase_none
{α : Type u_1}
[decidable_eq (option α)]
(s : finset (option α)) :
@[simp]
theorem
finset.insert_none_erase_none
{α : Type u_1}
[decidable_eq (option α)]
(s : finset (option α)) :
@[simp]