Finite sets in option α
#
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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
Construct an empty or singleton finset from an option
Equations
@[simp]
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 option.none (finset.map function.embedding.some s) _) finset.insert_none._proof_2
theorem
finset.some_mem_insert_none
{α : Type u_1}
{s : finset α}
{a : α} :
option.some a ∈ ⇑finset.insert_none s ↔ a ∈ s
@[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 bool.tt), monotone' := _}
@[simp]
theorem
finset.mem_erase_none
{α : Type u_1}
{s : finset (option α)}
{x : α} :
x ∈ ⇑finset.erase_none s ↔ option.some x ∈ s
@[simp]
@[simp]
@[simp]
theorem
finset.coe_erase_none
{α : Type u_1}
(s : finset (option α)) :
↑(⇑finset.erase_none s) = option.some ⁻¹' ↑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 α)) :
@[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]