Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  SetAlgebra.lean   Sprache: Lean

 

/-
Copyright (c) 2024 Etienne Marion. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Etienne Marion
-/

module

public import Mathlib.MeasureTheory.SetSemiring

import Mathlib.Basic.Finite.Prod

/-!
# Algebra of sets

In this file we define the notion of algebra of sets and give its basic properties. An algebra
of sets is a family of sets containing the empty set and closed by complement and binary union.
It is therefore similar to a `σ`-algebra, except that it is not necessarily closed
by countable unions.

We also define the algebra of sets generated by a family of sets and give its basic properties,
and we prove that it is countable when it is generated by a countable family. We prove that
the `σ`-algebra generated by a family of sets `��` is the same as the one generated by the algebra
of sets generated by `��`.

## Main definitions

* `MeasureTheory.IsSetAlgebra`: property of being an algebra of sets.
* `MeasureTheory.generateSetAlgebra`: the algebra of sets generated by a family of sets.

## Main statements

* `MeasureTheory.mem_generateSetAlgebra_elim`: If a set `s` belongs to the algebra of sets
  generated by `��`, then it can be written as a finite union of finite intersections of sets which
  are in `��` or have their complement in `��`.
* `MeasureTheory.countable_generateSetAlgebra`: If a family of sets is countable then so is
  the algebra of sets generated by it.

## References

* <https://en.wikipedia.org/wiki/Field_of_sets>

## Tags

algebra of sets, generated algebra of sets
-/


public section

open MeasurableSpace Set

namespace MeasureTheory

variable {α : Type*} {�� : Set (Set α)} {s t : Set α}

/-! ### Definition and basic properties of an algebra of sets -/

/-- An algebra of sets is a family of sets containing the empty set and closed by complement and
union. Consequently it is also closed by difference (see `IsSetAlgebra.sdiff_mem`) and intersection
(see `IsSetAlgebra.inter_mem`). -/

structure IsSetAlgebra (�� : Set (Set α)) : Prop where
  empty_mem : ∅ ∈ ��
  compl_mem : ∀ ⦃s⦄, s ∈ �� → sᶜ ∈ ��
  union_mem : ∀ ⦃s t⦄, s ∈ �� → t ∈ �� → s ∪ t ∈ ��

namespace IsSetAlgebra

/-- An algebra of sets contains the whole set. -/
theorem univ_mem (h�� : IsSetAlgebra ��) : univ ∈ �� :=
  compl_empty ▸ h��.compl_mem h��.empty_mem

/-- An algebra of sets is closed by intersection. -/
theorem inter_mem (h�� : IsSetAlgebra ��) (s_mem : s ∈ ��) (t_mem : t ∈ ��) :
    s ∩ t ∈ �� :=
  inter_eq_compl_compl_union_compl .. ▸
    h��.compl_mem (h��.union_mem (h��.compl_mem s_mem) (h��.compl_mem t_mem))

/-- An algebra of sets is closed by difference. -/
theorem sdiff_mem (h�� : IsSetAlgebra ��) (s_mem : s ∈ ��) (t_mem : t ∈ ��) :
    s \ t ∈ �� := h��.inter_mem s_mem (h��.compl_mem t_mem)

@[deprecated (since := "2026-06-03")] alias diff_mem := sdiff_mem

/-- An algebra of sets is a ring of sets. -/
theorem isSetRing (h�� : IsSetAlgebra ��) : IsSetRing �� where
  empty_mem := h��.empty_mem
  union_mem := h��.union_mem
  sdiff_mem := fun _ _ ↦ h��.sdiff_mem

/-- An algebra of sets is closed by finite unions. -/
theorem biUnion_mem {ι : Type*} (h�� : IsSetAlgebra ��) {s : ι → Set α} (S : Finset ι)
    (hs : ∀ i ∈ S, s i ∈ ��) : ⋃ i ∈ S, s i ∈ �� := h��.isSetRing.biUnion_mem S hs

/-- An algebra of sets is closed by finite intersections. -/
theorem biInter_mem {ι : Type*} (h�� : IsSetAlgebra ��) {s : ι → Set α} (S : Finset ι)
    (hs : ∀ i ∈ S, s i ∈ ��) : ⋂ i ∈ S, s i ∈ �� := by
  by_cases! h : S = ∅
  · rw [h, ← Finset.set_biInter_coe, Finset.coe_empty, biInter_empty]
    exact h��.univ_mem
  · exact h��.isSetRing.biInter_mem S h hs

end IsSetAlgebra

section generateSetAlgebra

/-! ### Definition and properties of the algebra of sets generated by some family -/

/-- `GenerateSetAlgebra ��` is the predicate of being in the smallest algebra of sets
containing `��`. See `generateSetAlgebra` for the set version. -/

private inductive GenerateSetAlgebra {α : Type*} (�� : Set (Set α)) : Set α → Prop
  | base (s : Set α) (s_mem : s ∈ ��) : GenerateSetAlgebra �� s
  | empty : GenerateSetAlgebra �� ∅
  | compl (s : Set α) (hs : GenerateSetAlgebra �� s) : GenerateSetAlgebra �� sᶜ
  | union (s t : Set α) (hs : GenerateSetAlgebra �� s) (ht : GenerateSetAlgebra �� t) :
      GenerateSetAlgebra �� (s ∪ t)

/-- `generateSetAlgebra ��` is the smallest algebra of sets containing `��`. -/
def generateSetAlgebra {α : Type*} (�� : Set (Set α)) : Set (Set α) :=
  {s | GenerateSetAlgebra �� s}

/-- The algebra of sets generated by a family of sets is an algebra of sets. -/
theorem isSetAlgebra_generateSetAlgebra :
    IsSetAlgebra (generateSetAlgebra ��) where
  empty_mem := .empty
  compl_mem := .compl
  union_mem := .union

/-- The algebra of sets generated by `��` contains `��`. -/
theorem self_subset_generateSetAlgebra : �� ⊆ generateSetAlgebra �� := .base

/-- An induction principle for membership of `generateSetAlgebra ��`. If `motive` holds of all
elements of `��` and of `∅`, and is preserved under complement and binary union, then it holds of all
elements of `generateSetAlgebra ��`. -/

@[elab_as_elim]
lemma generateSetAlgebra_induction {motive : ∀ s, s ∈ generateSetAlgebra �� → Prop}
    (base : ∀ (u) (hu : u ∈ ��), motive u (self_subset_generateSetAlgebra hu))
    (empty : motive ∅ isSetAlgebra_generateSetAlgebra.empty_mem)
    (compl : ∀ u hu, motive u hu → motive uᶜ (isSetAlgebra_generateSetAlgebra.compl_mem hu))
    (union : ∀ u v hu hv, motive u hu → motive v hv →
      motive (u ∪ v) (isSetAlgebra_generateSetAlgebra.union_mem hu hv))
    (hs : s ∈ generateSetAlgebra ��) : motive s hs := by
  induction hs with
  | base _ hu => exact base _ hu
  | empty => exact empty
  | compl _ _ ih => exact compl _ _ ih
  | union _ _ _ _ ih₁ ih₂ => exact union _ _ _ _ ih₁ ih₂

/-- `generateSetAlgebra ��` is the smallest algebra of sets containing `��`: if a family of sets `��`
is contained in an algebra of sets `ℬ`, then so is the algebra of sets generated by `��`. -/

lemma IsSetAlgebra.generateSetAlgebra_subset {ℬ : Set (Set α)} (h : �� ⊆ ℬ)
    (hℬ : IsSetAlgebra ℬ) : generateSetAlgebra �� ⊆ ℬ := by
  intro s hs
  induction hs using generateSetAlgebra_induction with
  | base t t_mem => exact h t_mem
  | empty => exact hℬ.empty_mem
  | compl t _ t_mem => exact hℬ.compl_mem t_mem
  | union t u _ _ t_mem u_mem => exact hℬ.union_mem t_mem u_mem

/-- The measurable space generated by a family of sets `��` is the same as the one generated
by the algebra of sets generated by `��`. -/

@[simp]
theorem generateFrom_generateSetAlgebra_eq :
    generateFrom (generateSetAlgebra ��) = generateFrom �� := by
  refine le_antisymm (fun s ms ↦ ?_) (generateFrom_mono self_subset_generateSetAlgebra)
  induction s, ms using generateFrom_induction with
  | hC t ht h =>
    clear h
    induction ht using generateSetAlgebra_induction with
    | base u u_mem => exact measurableSet_generateFrom u_mem
    | empty => exact @MeasurableSet.empty _ (generateFrom ��)
    | compl u _ mu => exact mu.compl
    | union u v _ _ mu mv => exact MeasurableSet.union mu mv
  | empty => exact MeasurableSpace.measurableSet_empty _
  | compl t _ ht => exact ht.compl
  | iUnion t _ ht => exact .iUnion ht

/-- If a family of sets `��` is contained in `ℬ`, then the algebra of sets generated by `��`
is contained in the one generated by `ℬ`. -/

theorem generateSetAlgebra_mono {ℬ : Set (Set α)} (h : �� ⊆ ℬ) :
    generateSetAlgebra �� ⊆ generateSetAlgebra ℬ :=
  isSetAlgebra_generateSetAlgebra.generateSetAlgebra_subset (h.trans self_subset_generateSetAlgebra)

namespace IsSetAlgebra

/-- If `��` is an algebra of sets, then it contains the algebra generated by itself. -/
theorem generateSetAlgebra_subset_self (h�� : IsSetAlgebra ��) :
    generateSetAlgebra �� ⊆ �� := generateSetAlgebra_subset subset_rfl h��

/-- If `��` is an algebra of sets, then it is equal to the algebra generated by itself. -/
theorem generateSetAlgebra_eq (h�� : IsSetAlgebra ��) : generateSetAlgebra �� = �� :=
  Subset.antisymm h��.generateSetAlgebra_subset_self self_subset_generateSetAlgebra

end IsSetAlgebra

/-- If a set belongs to the algebra of sets generated by `��` then it can be written as a finite
union of finite intersections of sets which are in `��` or have their complement in `��`. -/

theorem mem_generateSetAlgebra_elim (s_mem : s ∈ generateSetAlgebra ��) :
    ∃ A : Set (Set (Set α)), A.Finite ∧ (∀ a ∈ A, a.Finite) ∧
    (∀ a ∈ A, ∀ t ∈ a, t ∈ �� ∨ tᶜ ∈ ��) ∧ s = ⋃ a ∈ A, ⋂ t ∈ a, t := by
  induction s_mem using generateSetAlgebra_induction with
  | base u u_mem =>
    refine ⟨{{u}}, finite_singleton {u},
      fun a ha ↦ eq_of_mem_singleton ha ▸ finite_singleton u,
      fun a ha t ht ↦ ?_, by simp⟩
    rw [eq_of_mem_singleton ha, ha, eq_of_mem_singleton ht, ht] at *
    exact Or.inl u_mem
  | empty => exact ⟨∅, finite_empty, fun _ h ↦ (notMem_empty _ h).elim,
    fun _ ha _ _ ↦ (notMem_empty _ ha).elim, by simp⟩
  | compl u _ u_ind =>
    rcases u_ind with ⟨A, A_fin, mem_A, hA, u_eq⟩
    have := finite_coe_iff.2 A_fin
    have := fun a : A ↦ finite_coe_iff.2 <| mem_A a.1 a.2
    refine ⟨{{(f a).1ᶜ | a : A} | f : (Π a : A, ↑a)}, finite_coe_iff.1 inferInstance,
      fun a ⟨f, hf⟩ ↦ hf ▸ finite_coe_iff.1 inferInstance, fun a ha t ht ↦ ?_, ?_⟩
    · rcases ha with ⟨f, rfl⟩
      rcases ht with ⟨a, rfl⟩
      rw [compl_compl, or_comm]
      exact hA a.1 a.2 (f a).1 (f a).2
    · ext x
      simp only [u_eq, compl_iUnion, compl_iInter, mem_iInter, mem_iUnion, mem_compl_iff,
        exists_prop, Subtype.exists, mem_ofPred_eq, iUnion_exists, iUnion_iUnion_eq',
        iInter_exists]
      constructor <;> intro hx
      · choose f hf using hx
        exact ⟨fun ⟨a, ha⟩ ↦ ⟨f a ha, (hf a ha).1⟩, fun _ a ha h ↦ by rw [← h]; exact (hf a ha).2⟩
      · rcases hx with ⟨f, hf⟩
        exact fun a ha ↦ ⟨f ⟨a, ha⟩, (f ⟨a, ha⟩).2, hf (f ⟨a, ha⟩)ᶜ a ha rfl⟩
  | union u v _ _ u_ind v_ind =>
    rcases u_ind with ⟨Au, Au_fin, mem_Au, hAu, u_eq⟩
    rcases v_ind with ⟨Av, Av_fin, mem_Av, hAv, v_eq⟩
    refine ⟨Au ∪ Av, Au_fin.union Av_fin, ?_, ?_, by rw [u_eq, v_eq, ← biUnion_union]⟩
    · rintro a (ha | ha)
      · exact mem_Au a ha
      · exact mem_Av a ha
    · rintro a (ha | ha) t ht
      · exact hAu a ha t ht
      · exact hAv a ha t ht

/-- If a family of sets is countable then so is the algebra of sets generated by it. -/
theorem countable_generateSetAlgebra (h : ��.Countable) :
    (generateSetAlgebra ��).Countable := by
  let ℬ := {s | s ∈ ��} ∪ {s | sᶜ ∈ ��}
  have count_ℬ : ℬ.Countable := by
    apply h.union
    have : compl '' �� = {s | sᶜ ∈ ��} := by
      ext s
      simpa using ⟨fun ⟨x, x_mem, hx⟩ ↦ by simp [← hx, x_mem], fun hs ↦ ⟨sᶜ, hs, by simp⟩⟩
    exact this ▸ h.image compl
  let f : Set (Set (Set α)) → Set α := fun A ↦ ⋃ a ∈ A, ⋂ t ∈ a, t
  let �� := {a | a.Finite ∧ a ⊆ ℬ}
  have count_�� : ��.Countable := countable_ofPred_finite_subset (countable_coe_iff.1 count_ℬ)
  let �� := {A | A.Finite ∧ A ⊆ ��}
  have count_�� : ��.Countable := countable_ofPred_finite_subset (countable_coe_iff.1 count_��)
  have : generateSetAlgebra �� ⊆ f '' �� := by
    intro s s_mem
    rcases mem_generateSetAlgebra_elim s_mem with ⟨A, A_fin, mem_A, hA, rfl⟩
    exact ⟨A, ⟨A_fin, fun a ha ↦ ⟨mem_A a ha, hA a ha⟩⟩, rfl⟩
  exact (count_��.image f).mono this

end generateSetAlgebra

end MeasureTheory

Messung
CHZG
8910010096

¤ Dauer der Verarbeitung: 0.3 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,076
#Domains=862,068