Disjoint sum of finsets #
This file defines the disjoint sum of two finsets as Finset (α ⊕ β)
. Beware not to confuse with
the Finset.sum
operation which computes the additive sum.
Main declarations #
Finset.disjSum
:s.disjSum t
is the disjoint sum ofs
andt
.Finset.toLeft
: Given a finset of elementsα ⊕ β
, extracts all the elements of the formα
.Finset.toRight
: Given a finset of elementsα ⊕ β
, extracts all the elements of the formβ
.
theorem
Finset.disjoint_map_inl_map_inr
{α : Type u_1}
{β : Type u_2}
(s : Finset α)
(t : Finset β)
:
theorem
Finset.map_inl_disjUnion_map_inr
{α : Type u_1}
{β : Type u_2}
(s : Finset α)
(t : Finset β)
:
Eq ((map Function.Embedding.inl s).disjUnion (map Function.Embedding.inr t) ⋯) (s.disjSum t)
theorem
Finset.inl_mem_disjSum
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
{a : α}
:
Iff (Membership.mem (s.disjSum t) (Sum.inl a)) (Membership.mem s a)
theorem
Finset.inr_mem_disjSum
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
{b : β}
:
Iff (Membership.mem (s.disjSum t) (Sum.inr b)) (Membership.mem t b)
theorem
Finset.disjSum_mono
{α : Type u_1}
{β : Type u_2}
{s₁ s₂ : Finset α}
{t₁ t₂ : Finset β}
(hs : HasSubset.Subset s₁ s₂)
(ht : HasSubset.Subset t₁ t₂)
:
HasSubset.Subset (s₁.disjSum t₁) (s₂.disjSum t₂)
theorem
Finset.disjSum_ssubset_disjSum_of_ssubset_of_subset
{α : Type u_1}
{β : Type u_2}
{s₁ s₂ : Finset α}
{t₁ t₂ : Finset β}
(hs : HasSSubset.SSubset s₁ s₂)
(ht : HasSubset.Subset t₁ t₂)
:
HasSSubset.SSubset (s₁.disjSum t₁) (s₂.disjSum t₂)
theorem
Finset.disjSum_ssubset_disjSum_of_subset_of_ssubset
{α : Type u_1}
{β : Type u_2}
{s₁ s₂ : Finset α}
{t₁ t₂ : Finset β}
(hs : HasSubset.Subset s₁ s₂)
(ht : HasSSubset.SSubset t₁ t₂)
:
HasSSubset.SSubset (s₁.disjSum t₁) (s₂.disjSum t₂)
theorem
Finset.disjSum_strictMono_left
{α : Type u_1}
{β : Type u_2}
(t : Finset β)
:
StrictMono fun (s : Finset α) => s.disjSum t
Given a finset of elements α ⊕ β
, extract all the elements of the form α
. This
forms a quasi-inverse to disjSum
, in that it recovers its left input.
See also List.partitionMap
.
Equations
- Eq u.toLeft (Finset.filterMap (Sum.elim Option.some fun (x : β) => Option.none) u ⋯)
Instances For
Given a finset of elements α ⊕ β
, extract all the elements of the form β
. This
forms a quasi-inverse to disjSum
, in that it recovers its right input.
See also List.partitionMap
.
Equations
- Eq u.toRight (Finset.filterMap (Sum.elim (fun (x : α) => Option.none) Option.some) u ⋯)
Instances For
theorem
Finset.mem_toLeft
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
{a : α}
:
Iff (Membership.mem u.toLeft a) (Membership.mem u (Sum.inl a))
theorem
Finset.mem_toRight
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
{b : β}
:
Iff (Membership.mem u.toRight b) (Membership.mem u (Sum.inr b))
theorem
Finset.toLeft_subset_toLeft
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
:
HasSubset.Subset u v → HasSubset.Subset u.toLeft v.toLeft
theorem
Finset.toRight_subset_toRight
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
:
HasSubset.Subset u v → HasSubset.Subset u.toRight v.toRight
theorem
Finset.disjSum_subset
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
{u : Finset (Sum α β)}
:
Iff (HasSubset.Subset (s.disjSum t) u) (And (HasSubset.Subset s u.toLeft) (HasSubset.Subset t u.toRight))
theorem
Finset.subset_disjSum
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
{u : Finset (Sum α β)}
:
Iff (HasSubset.Subset u (s.disjSum t)) (And (HasSubset.Subset u.toLeft s) (HasSubset.Subset u.toRight t))
theorem
Finset.subset_map_inl
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{u : Finset (Sum α β)}
:
Iff (HasSubset.Subset u (map Function.Embedding.inl s))
(And (HasSubset.Subset u.toLeft s) (Eq u.toRight EmptyCollection.emptyCollection))
theorem
Finset.subset_map_inr
{α : Type u_1}
{β : Type u_2}
{t : Finset β}
{u : Finset (Sum α β)}
:
Iff (HasSubset.Subset u (map Function.Embedding.inr t))
(And (Eq u.toLeft EmptyCollection.emptyCollection) (HasSubset.Subset u.toRight t))
theorem
Finset.map_inl_subset_iff_subset_toLeft
{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{u : Finset (Sum α β)}
:
Iff (HasSubset.Subset (map Function.Embedding.inl s) u) (HasSubset.Subset s u.toLeft)
theorem
Finset.map_inr_subset_iff_subset_toRight
{α : Type u_1}
{β : Type u_2}
{t : Finset β}
{u : Finset (Sum α β)}
:
Iff (HasSubset.Subset (map Function.Embedding.inr t) u) (HasSubset.Subset t u.toRight)
theorem
Finset.gc_map_inl_toLeft
{α : Type u_1}
{β : Type u_2}
:
GaloisConnection (fun (x : Finset α) => map Function.Embedding.inl x) toLeft
theorem
Finset.gc_map_inr_toRight
{α : Type u_1}
{β : Type u_2}
:
GaloisConnection (fun (x : Finset β) => map Function.Embedding.inr x) toRight
theorem
Finset.toLeft_map_sumComm
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
:
Eq (map (Equiv.sumComm α β).toEmbedding u).toLeft u.toRight
theorem
Finset.toRight_map_sumComm
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
:
Eq (map (Equiv.sumComm α β).toEmbedding u).toRight u.toLeft
theorem
Finset.toLeft_image_swap
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
theorem
Finset.toRight_image_swap
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
theorem
Finset.toLeft_insert_inl
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
{a : α}
[DecidableEq α]
[DecidableEq β]
:
Eq (Insert.insert (Sum.inl a) u).toLeft (Insert.insert a u.toLeft)
theorem
Finset.toLeft_insert_inr
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
{b : β}
[DecidableEq α]
[DecidableEq β]
:
Eq (Insert.insert (Sum.inr b) u).toLeft u.toLeft
theorem
Finset.toRight_insert_inl
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
{a : α}
[DecidableEq α]
[DecidableEq β]
:
Eq (Insert.insert (Sum.inl a) u).toRight u.toRight
theorem
Finset.toRight_insert_inr
{α : Type u_1}
{β : Type u_2}
{u : Finset (Sum α β)}
{b : β}
[DecidableEq α]
[DecidableEq β]
:
Eq (Insert.insert (Sum.inr b) u).toRight (Insert.insert b u.toRight)
theorem
Finset.toLeft_inter
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
Eq (Inter.inter u v).toLeft (Inter.inter u.toLeft v.toLeft)
theorem
Finset.toRight_inter
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
Eq (Inter.inter u v).toRight (Inter.inter u.toRight v.toRight)
theorem
Finset.toLeft_union
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
Eq (Union.union u v).toLeft (Union.union u.toLeft v.toLeft)
theorem
Finset.toRight_union
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
Eq (Union.union u v).toRight (Union.union u.toRight v.toRight)
theorem
Finset.toLeft_sdiff
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
Eq (SDiff.sdiff u v).toLeft (SDiff.sdiff u.toLeft v.toLeft)
theorem
Finset.toRight_sdiff
{α : Type u_1}
{β : Type u_2}
{u v : Finset (Sum α β)}
[DecidableEq α]
[DecidableEq β]
:
Eq (SDiff.sdiff u v).toRight (SDiff.sdiff u.toRight v.toRight)
theorem
Finset.map_disjSum
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{s : Finset α}
{t : Finset β}
(f : Function.Embedding (Sum α β) γ)
:
Eq (map f (s.disjSum t)) ((map (Function.Embedding.inl.trans f) s).disjUnion (map (Function.Embedding.inr.trans f) t) ⋯)
theorem
Finset.fold_disjSum
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(s : Finset α)
(t : Finset β)
(f : Sum α β → γ)
(b₁ b₂ : γ)
(op : γ → γ → γ)
[Std.Commutative op]
[Std.Associative op]
: