Documentation

Mathlib.Data.Set.Finite.Lattice

Finiteness of unions and intersections #

Implementation notes #

Each result in this file should come in three forms: a Fintype instance, a Finite instance and a Set.Finite constructor.

Tags #

finite sets

Fintype instances #

Every instance here should have a corresponding Set.Finite constructor in the next section.

instance Set.fintypeiUnion {α : Type u} {ι : Sort w} [DecidableEq α] [Fintype (PLift ι)] (f : ιSet α) [(i : ι) → Fintype (f i)] :
Fintype (⋃ (i : ι), f i)
Equations
instance Set.fintypesUnion {α : Type u} [DecidableEq α] {s : Set (Set α)} [Fintype s] [H : (t : s) → Fintype t] :
Equations
theorem Set.toFinset_iUnion {α : Type u} {β : Type v} [Fintype β] [DecidableEq α] (f : βSet α) [(w : β) → Fintype (f w)] :
(⋃ (x : β), f x).toFinset = Finset.univ.biUnion fun (x : β) => (f x).toFinset

Finite instances #

There is seemingly some overlap between the following instances and the Fintype instances in Data.Set.Finite. While every Fintype instance gives a Finite instance, those instances that depend on Fintype or Decidable instances need an additional Finite instance to be able to generally apply.

Some set instances do not appear here since they are consequences of others, for example Subtype.Finite for subsets of a finite type.

theorem Finite.Set.finite_iUnion {α : Type u} {ι : Sort w} [Finite ι] (f : ιSet α) [∀ (i : ι), Finite (f i)] :
Finite (⋃ (i : ι), f i)
theorem Finite.Set.finite_sUnion {α : Type u} {s : Set (Set α)} [Finite s] [H : ∀ (t : s), Finite t] :
Finite (⋃₀ s)
theorem Finite.Set.finite_biUnion {α : Type u} {ι : Type u_1} (s : Set ι) [Finite s] (t : ιSet α) (H : is, Finite (t i)) :
Finite (⋃ xs, t x)
theorem Finite.Set.finite_biUnion' {α : Type u} {ι : Type u_1} (s : Set ι) [Finite s] (t : ιSet α) [∀ (i : ι), Finite (t i)] :
Finite (⋃ xs, t x)
theorem Finite.Set.finite_biUnion'' {α : Type u} {ι : Type u_1} (p : ιProp) [h : Finite {x : ι | p x}] (t : ιSet α) [∀ (i : ι), Finite (t i)] :
Finite (⋃ (x : ι), ⋃ (_ : p x), t x)

Example: Finite (⋃ (i < n), f i) where f : ℕ → Set α and [∀ i, Finite (f i)] (when given instances from Order.Interval.Finset.Nat).

theorem Finite.Set.finite_iInter {α : Type u} {ι : Sort u_1} [Nonempty ι] (t : ιSet α) [∀ (i : ι), Finite (t i)] :
Finite (⋂ (i : ι), t i)

Constructors for Set.Finite #

Every constructor here should have a corresponding Fintype instance in the previous section (or in the Fintype module).

The implementation of these constructors ideally should be no more than Set.toFinite, after possibly setting up some Fintype and classical Decidable instances.

theorem Set.finite_iUnion {α : Type u} {ι : Sort w} [Finite ι] {f : ιSet α} (H : ∀ (i : ι), (f i).Finite) :
(⋃ (i : ι), f i).Finite
theorem Set.Finite.biUnion' {α : Type u} {ι : Type u_1} {s : Set ι} (hs : s.Finite) {t : (i : ι) → i sSet α} (ht : ∀ (i : ι) (hi : i s), (t i hi).Finite) :
(⋃ (i : ι), ⋃ (h : i s), t i h).Finite

Dependent version of Finite.biUnion.

theorem Set.Finite.biUnion {α : Type u} {ι : Type u_1} {s : Set ι} (hs : s.Finite) {t : ιSet α} (ht : is, (t i).Finite) :
(⋃ is, t i).Finite
theorem Set.Finite.sUnion {α : Type u} {s : Set (Set α)} (hs : s.Finite) (H : ts, t.Finite) :
(⋃₀ s).Finite
theorem Set.Finite.sInter {α : Type u_1} {s : Set (Set α)} {t : Set α} (ht : t s) (hf : t.Finite) :
(⋂₀ s).Finite
theorem Set.Finite.iUnion {α : Type u} {ι : Type u_1} {s : ιSet α} {t : Set ι} (ht : t.Finite) (hs : it, (s i).Finite) (he : it, s i = ) :
(⋃ (i : ι), s i).Finite

If sets s i are finite for all i from a finite set t and are empty for i ∉ t, then the union ⋃ i, s i is a finite set.

theorem Set.Finite.preimage' {α : Type u} {β : Type v} {f : αβ} {s : Set β} (h : s.Finite) (hf : bs, (f ⁻¹' {b}).Finite) :
(f ⁻¹' s).Finite
theorem Set.union_finset_finite_of_range_finite {α : Type u} {β : Type v} (f : αFinset β) (h : (Set.range f).Finite) :
(⋃ (a : α), (f a)).Finite

A finite union of finsets is finite.

Properties #

theorem Set.finite_subset_iUnion {α : Type u} {s : Set α} (hs : s.Finite) {ι : Type u_1} {t : ιSet α} (h : s ⋃ (i : ι), t i) :
∃ (I : Set ι), I.Finite s iI, t i
theorem Set.eq_finite_iUnion_of_finite_subset_iUnion {α : Type u} {ι : Type u_1} {s : ιSet α} {t : Set α} (tfin : t.Finite) (h : t ⋃ (i : ι), s i) :
∃ (I : Set ι), I.Finite ∃ (σ : {i : ι | i I}Set α), (∀ (i : {i : ι | i I}), (σ i).Finite) (∀ (i : {i : ι | i I}), σ i s i) t = ⋃ (i : {i : ι | i I}), σ i

Infinite sets #

theorem Set.infinite_iUnion {α : Type u} {ι : Type u_1} [Infinite ι] {s : ιSet α} (hs : Function.Injective s) :
(⋃ (i : ι), s i).Infinite
theorem Set.Infinite.biUnion {α : Type u} {ι : Type u_1} {s : ιSet α} {a : Set ι} (ha : a.Infinite) (hs : Set.InjOn s a) :
(⋃ ia, s i).Infinite
theorem Set.Infinite.sUnion {α : Type u} {s : Set (Set α)} (hs : s.Infinite) :
(⋃₀ s).Infinite

Order properties #

theorem Set.map_finite_biSup {α : Type u} {β : Type v} {F : Type u_1} {ι : Type u_2} [CompleteLattice α] [CompleteLattice β] [FunLike F α β] [SupBotHomClass F α β] {s : Set ι} (hs : s.Finite) (f : F) (g : ια) :
f (⨆ xs, g x) = xs, f (g x)
theorem Set.map_finite_biInf {α : Type u} {β : Type v} {F : Type u_1} {ι : Type u_2} [CompleteLattice α] [CompleteLattice β] [FunLike F α β] [InfTopHomClass F α β] {s : Set ι} (hs : s.Finite) (f : F) (g : ια) :
f (⨅ xs, g x) = xs, f (g x)
theorem Set.map_finite_iSup {α : Type u} {β : Type v} {F : Type u_1} {ι : Type u_2} [CompleteLattice α] [CompleteLattice β] [FunLike F α β] [SupBotHomClass F α β] [Finite ι] (f : F) (g : ια) :
f (⨆ (i : ι), g i) = ⨆ (i : ι), f (g i)
theorem Set.map_finite_iInf {α : Type u} {β : Type v} {F : Type u_1} {ι : Type u_2} [CompleteLattice α] [CompleteLattice β] [FunLike F α β] [InfTopHomClass F α β] [Finite ι] (f : F) (g : ια) :
f (⨅ (i : ι), g i) = ⨅ (i : ι), f (g i)
theorem Set.Finite.iSup_biInf_of_monotone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Preorder ι'] [Nonempty ι'] [IsDirected ι' fun (x1 x2 : ι') => x1 x2] [Order.Frame α] {s : Set ι} (hs : s.Finite) {f : ιι'α} (hf : is, Monotone (f i)) :
⨆ (j : ι'), is, f i j = is, ⨆ (j : ι'), f i j
theorem Set.Finite.iSup_biInf_of_antitone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Preorder ι'] [Nonempty ι'] [IsDirected ι' (Function.swap fun (x1 x2 : ι') => x1 x2)] [Order.Frame α] {s : Set ι} (hs : s.Finite) {f : ιι'α} (hf : is, Antitone (f i)) :
⨆ (j : ι'), is, f i j = is, ⨆ (j : ι'), f i j
theorem Set.Finite.iInf_biSup_of_monotone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Preorder ι'] [Nonempty ι'] [IsDirected ι' (Function.swap fun (x1 x2 : ι') => x1 x2)] [Order.Coframe α] {s : Set ι} (hs : s.Finite) {f : ιι'α} (hf : is, Monotone (f i)) :
⨅ (j : ι'), is, f i j = is, ⨅ (j : ι'), f i j
theorem Set.Finite.iInf_biSup_of_antitone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Preorder ι'] [Nonempty ι'] [IsDirected ι' fun (x1 x2 : ι') => x1 x2] [Order.Coframe α] {s : Set ι} (hs : s.Finite) {f : ιι'α} (hf : is, Antitone (f i)) :
⨅ (j : ι'), is, f i j = is, ⨅ (j : ι'), f i j
theorem Set.iSup_iInf_of_monotone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [Nonempty ι'] [IsDirected ι' fun (x1 x2 : ι') => x1 x2] [Order.Frame α] {f : ιι'α} (hf : ∀ (i : ι), Monotone (f i)) :
⨆ (j : ι'), ⨅ (i : ι), f i j = ⨅ (i : ι), ⨆ (j : ι'), f i j
theorem Set.iSup_iInf_of_antitone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [Nonempty ι'] [IsDirected ι' (Function.swap fun (x1 x2 : ι') => x1 x2)] [Order.Frame α] {f : ιι'α} (hf : ∀ (i : ι), Antitone (f i)) :
⨆ (j : ι'), ⨅ (i : ι), f i j = ⨅ (i : ι), ⨆ (j : ι'), f i j
theorem Set.iInf_iSup_of_monotone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [Nonempty ι'] [IsDirected ι' (Function.swap fun (x1 x2 : ι') => x1 x2)] [Order.Coframe α] {f : ιι'α} (hf : ∀ (i : ι), Monotone (f i)) :
⨅ (j : ι'), ⨆ (i : ι), f i j = ⨆ (i : ι), ⨅ (j : ι'), f i j
theorem Set.iInf_iSup_of_antitone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [Nonempty ι'] [IsDirected ι' fun (x1 x2 : ι') => x1 x2] [Order.Coframe α] {f : ιι'α} (hf : ∀ (i : ι), Antitone (f i)) :
⨅ (j : ι'), ⨆ (i : ι), f i j = ⨆ (i : ι), ⨅ (j : ι'), f i j
theorem Set.iUnion_iInter_of_monotone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [IsDirected ι' fun (x1 x2 : ι') => x1 x2] [Nonempty ι'] {s : ιι'Set α} (hs : ∀ (i : ι), Monotone (s i)) :
⋃ (j : ι'), ⋂ (i : ι), s i j = ⋂ (i : ι), ⋃ (j : ι'), s i j

An increasing union distributes over finite intersection.

theorem Set.iUnion_iInter_of_antitone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [IsDirected ι' (Function.swap fun (x1 x2 : ι') => x1 x2)] [Nonempty ι'] {s : ιι'Set α} (hs : ∀ (i : ι), Antitone (s i)) :
⋃ (j : ι'), ⋂ (i : ι), s i j = ⋂ (i : ι), ⋃ (j : ι'), s i j

A decreasing union distributes over finite intersection.

theorem Set.iInter_iUnion_of_monotone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [IsDirected ι' (Function.swap fun (x1 x2 : ι') => x1 x2)] [Nonempty ι'] {s : ιι'Set α} (hs : ∀ (i : ι), Monotone (s i)) :
⋂ (j : ι'), ⋃ (i : ι), s i j = ⋃ (i : ι), ⋂ (j : ι'), s i j

An increasing intersection distributes over finite union.

theorem Set.iInter_iUnion_of_antitone {ι : Type u_1} {ι' : Type u_2} {α : Type u_3} [Finite ι] [Preorder ι'] [IsDirected ι' fun (x1 x2 : ι') => x1 x2] [Nonempty ι'] {s : ιι'Set α} (hs : ∀ (i : ι), Antitone (s i)) :
⋂ (j : ι'), ⋃ (i : ι), s i j = ⋃ (i : ι), ⋂ (j : ι'), s i j

A decreasing intersection distributes over finite union.

theorem Set.iUnion_pi_of_monotone {ι : Type u_1} {ι' : Type u_2} [LinearOrder ι'] [Nonempty ι'] {α : ιType u_3} {I : Set ι} {s : (i : ι) → ι'Set (α i)} (hI : I.Finite) (hs : iI, Monotone (s i)) :
(⋃ (j : ι'), I.pi fun (i : ι) => s i j) = I.pi fun (i : ι) => ⋃ (j : ι'), s i j
theorem Set.iUnion_univ_pi_of_monotone {ι : Type u_1} {ι' : Type u_2} [LinearOrder ι'] [Nonempty ι'] [Finite ι] {α : ιType u_3} {s : (i : ι) → ι'Set (α i)} (hs : ∀ (i : ι), Monotone (s i)) :
(⋃ (j : ι'), Set.univ.pi fun (i : ι) => s i j) = Set.univ.pi fun (i : ι) => ⋃ (j : ι'), s i j
theorem Set.Finite.bddAbove {α : Type u} [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 x2] [Nonempty α] {s : Set α} (hs : s.Finite) :

A finite set is bounded above.

theorem Set.Finite.bddAbove_biUnion {α : Type u} {β : Type v} [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 x2] [Nonempty α] {I : Set β} {S : βSet α} (H : I.Finite) :
BddAbove (⋃ iI, S i) iI, BddAbove (S i)

A finite union of sets which are all bounded above is still bounded above.

theorem Set.infinite_of_not_bddAbove {α : Type u} [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 x2] [Nonempty α] {s : Set α} :
¬BddAbove ss.Infinite
theorem Set.Finite.bddBelow {α : Type u} [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 x2] [Nonempty α] {s : Set α} (hs : s.Finite) :

A finite set is bounded below.

theorem Set.Finite.bddBelow_biUnion {α : Type u} {β : Type v} [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 x2] [Nonempty α] {I : Set β} {S : βSet α} (H : I.Finite) :
BddBelow (⋃ iI, S i) iI, BddBelow (S i)

A finite union of sets which are all bounded below is still bounded below.

theorem Set.infinite_of_not_bddBelow {α : Type u} [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 x2] [Nonempty α] {s : Set α} :
¬BddBelow ss.Infinite
theorem Finset.bddAbove {α : Type u} [SemilatticeSup α] [Nonempty α] (s : Finset α) :

A finset is bounded above.

theorem Finset.bddBelow {α : Type u} [SemilatticeInf α] [Nonempty α] (s : Finset α) :

A finset is bounded below.

theorem Set.finite_diff_iUnion_Ioo {α : Type u} [LinearOrder α] (s : Set α) :
(s \ xs, ys, Set.Ioo x y).Finite
theorem Set.finite_diff_iUnion_Ioo' {α : Type u} [LinearOrder α] (s : Set α) :
(s \ ⋃ (x : s × s), Set.Ioo x.1 x.2).Finite
theorem DirectedOn.exists_mem_subset_of_finset_subset_biUnion {α : Type u_1} {ι : Type u_2} {f : ιSet α} {c : Set ι} (hn : c.Nonempty) (hc : DirectedOn (fun (i j : ι) => f i f j) c) {s : Finset α} (hs : s ic, f i) :
ic, s f i