Documentation

Mathlib.Order.BooleanAlgebra.Set

Boolean algebra of sets #

This file proves that Set α is a boolean algebra, and proves results about set difference and complement.

Notation #

Tags #

set, sets, subset, subsets, complement

instance Set.instBooleanAlgebra {α : Type u_1} :
Equations
  • One or more equations did not get rendered due to their size.
theorem Set.inter_diff_assoc {α : Type u_1} (a b c : Set α) :
(a b) \ c = a (b \ c)

See also Set.sdiff_inter_right_comm.

theorem Set.sdiff_inter_right_comm {α : Type u_1} (s t u : Set α) :
s \ t u = (s u) \ t

See also Set.inter_diff_assoc.

theorem Set.inter_sdiff_left_comm {α : Type u_1} (s t u : Set α) :
s (t \ u) = t (s \ u)
theorem Set.diff_union_diff_cancel {α : Type u_1} {s t u : Set α} (hts : t s) (hut : u t) :
s \ t t \ u = s \ u
theorem Set.diff_union_diff_cancel' {α : Type u_1} {s t u : Set α} (hi : s u t) (hu : t s u) :
s \ t t \ u = s \ u

A version of diff_union_diff_cancel with more general hypotheses.

theorem Set.diff_diff_eq_sdiff_union {α : Type u_1} {s t u : Set α} (h : u s) :
s \ (t \ u) = s \ t u
theorem Set.inter_diff_distrib_left {α : Type u_1} (s t u : Set α) :
s (t \ u) = (s t) \ (s u)
theorem Set.inter_diff_distrib_right {α : Type u_1} (s t u : Set α) :
s \ t u = (s u) \ (t u)
theorem Set.diff_inter_distrib_right {α : Type u_1} (s t r : Set α) :
(t r) \ s = t \ s (r \ s)

Lemmas about complement #

theorem Set.compl_def {α : Type u_1} (s : Set α) :
s = {x : α | xs}
theorem Set.mem_compl {α : Type u_1} {s : Set α} {x : α} (h : xs) :
x s
theorem Set.compl_setOf {α : Type u_3} (p : αProp) :
{a : α | p a} = {a : α | ¬p a}
theorem Set.notMem_of_mem_compl {α : Type u_1} {s : Set α} {x : α} (h : x s) :
xs
@[deprecated Set.notMem_of_mem_compl (since := "2025-05-23")]
theorem Set.not_mem_of_mem_compl {α : Type u_1} {s : Set α} {x : α} (h : x s) :
xs

Alias of Set.notMem_of_mem_compl.

theorem Set.notMem_compl_iff {α : Type u_1} {s : Set α} {x : α} :
xs x s
@[deprecated Set.notMem_compl_iff (since := "2025-05-23")]
theorem Set.not_mem_compl_iff {α : Type u_1} {s : Set α} {x : α} :
xs x s

Alias of Set.notMem_compl_iff.

@[simp]
theorem Set.inter_compl_self {α : Type u_1} (s : Set α) :
@[simp]
theorem Set.compl_inter_self {α : Type u_1} (s : Set α) :
@[simp]
theorem Set.compl_empty {α : Type u_1} :
@[simp]
theorem Set.compl_union {α : Type u_1} (s t : Set α) :
(s t) = s t
theorem Set.compl_inter {α : Type u_1} (s t : Set α) :
(s t) = s t
@[simp]
theorem Set.compl_univ {α : Type u_1} :
@[simp]
theorem Set.compl_empty_iff {α : Type u_1} {s : Set α} :
@[simp]
theorem Set.compl_univ_iff {α : Type u_1} {s : Set α} :
theorem Set.compl_ne_univ {α : Type u_1} {s : Set α} :
theorem Set.inl_compl_union_inr_compl {α : Type u_1} {β : Type u_2} {s : Set α} {t : Set β} :
theorem Set.nonempty_compl {α : Type u_1} {s : Set α} :
theorem Set.union_eq_compl_compl_inter_compl {α : Type u_1} (s t : Set α) :
s t = (s t)
theorem Set.inter_eq_compl_compl_union_compl {α : Type u_1} (s t : Set α) :
s t = (s t)
@[simp]
theorem Set.union_compl_self {α : Type u_1} (s : Set α) :
@[simp]
theorem Set.compl_union_self {α : Type u_1} (s : Set α) :
theorem Set.compl_subset_comm {α : Type u_1} {s t : Set α} :
s t t s
theorem Set.subset_compl_comm {α : Type u_1} {s t : Set α} :
s t t s
@[simp]
theorem Set.compl_subset_compl {α : Type u_1} {s t : Set α} :
s t t s
theorem Set.compl_subset_compl_of_subset {α : Type u_1} {s t : Set α} (h : t s) :
theorem Set.subset_union_compl_iff_inter_subset {α : Type u_1} {s t u : Set α} :
s t u s u t
theorem Set.compl_subset_iff_union {α : Type u_1} {s t : Set α} :
s t s t = univ
theorem Set.inter_subset {α : Type u_1} (a b c : Set α) :
a b c a b c
theorem Set.inter_compl_nonempty_iff {α : Type u_1} {s t : Set α} :

Lemmas about set difference #

theorem Set.notMem_diff_of_mem {α : Type u_1} {s t : Set α} {x : α} (hx : x t) :
xs \ t
@[deprecated Set.notMem_diff_of_mem (since := "2025-05-23")]
theorem Set.not_mem_diff_of_mem {α : Type u_1} {s t : Set α} {x : α} (hx : x t) :
xs \ t

Alias of Set.notMem_diff_of_mem.

theorem Set.mem_of_mem_diff {α : Type u_1} {s t : Set α} {x : α} (h : x s \ t) :
x s
theorem Set.notMem_of_mem_diff {α : Type u_1} {s t : Set α} {x : α} (h : x s \ t) :
xt
@[deprecated Set.notMem_of_mem_diff (since := "2025-05-23")]
theorem Set.not_mem_of_mem_diff {α : Type u_1} {s t : Set α} {x : α} (h : x s \ t) :
xt

Alias of Set.notMem_of_mem_diff.

theorem Set.diff_eq_compl_inter {α : Type u_1} {s t : Set α} :
s \ t = t s
theorem Set.diff_nonempty {α : Type u_1} {s t : Set α} :
(s \ t).Nonempty ¬s t
theorem Set.diff_subset {α : Type u_1} {s t : Set α} :
s \ t s
theorem Set.diff_subset_compl {α : Type u_1} (s t : Set α) :
s \ t t
theorem Set.union_diff_cancel' {α : Type u_1} {s t u : Set α} (h₁ : s t) (h₂ : t u) :
t u \ s = u
theorem Set.union_diff_cancel {α : Type u_1} {s t : Set α} (h : s t) :
s t \ s = t
theorem Set.union_diff_cancel_left {α : Type u_1} {s t : Set α} (h : s t ) :
(s t) \ s = t
theorem Set.union_diff_cancel_right {α : Type u_1} {s t : Set α} (h : s t ) :
(s t) \ t = s
@[simp]
theorem Set.union_diff_left {α : Type u_1} {s t : Set α} :
(s t) \ s = t \ s
@[simp]
theorem Set.union_diff_right {α : Type u_1} {s t : Set α} :
(s t) \ t = s \ t
theorem Set.union_diff_distrib {α : Type u_1} {s t u : Set α} :
(s t) \ u = s \ u t \ u
@[simp]
theorem Set.inter_diff_self {α : Type u_1} (a b : Set α) :
a (b \ a) =
@[simp]
theorem Set.inter_union_diff {α : Type u_1} (s t : Set α) :
s t s \ t = s
@[simp]
theorem Set.diff_union_inter {α : Type u_1} (s t : Set α) :
s \ t s t = s
@[simp]
theorem Set.inter_union_compl {α : Type u_1} (s t : Set α) :
s t s t = s
theorem Set.diff_subset_diff {α : Type u_1} {s₁ s₂ t₁ t₂ : Set α} :
s₁ s₂t₂ t₁s₁ \ t₁ s₂ \ t₂
theorem Set.diff_subset_diff_left {α : Type u_1} {s₁ s₂ t : Set α} (h : s₁ s₂) :
s₁ \ t s₂ \ t
theorem Set.diff_subset_diff_right {α : Type u_1} {s t u : Set α} (h : t u) :
s \ u s \ t
theorem Set.diff_subset_diff_iff_subset {α : Type u_1} {s t r : Set α} (hs : s r) (ht : t r) :
r \ s r \ t t s
theorem Set.compl_eq_univ_diff {α : Type u_1} (s : Set α) :
s = univ \ s
@[simp]
theorem Set.empty_diff {α : Type u_1} (s : Set α) :
theorem Set.diff_eq_empty {α : Type u_1} {s t : Set α} :
s \ t = s t
@[simp]
theorem Set.diff_empty {α : Type u_1} {s : Set α} :
s \ = s
@[simp]
theorem Set.diff_univ {α : Type u_1} (s : Set α) :
theorem Set.diff_diff {α : Type u_1} {s t u : Set α} :
(s \ t) \ u = s \ (t u)
theorem Set.diff_diff_comm {α : Type u_1} {s t u : Set α} :
(s \ t) \ u = (s \ u) \ t
theorem Set.diff_subset_iff {α : Type u_1} {s t u : Set α} :
s \ t u s t u
theorem Set.subset_diff_union {α : Type u_1} (s t : Set α) :
s s \ t t
theorem Set.diff_union_of_subset {α : Type u_1} {s t : Set α} (h : t s) :
s \ t t = s
theorem Set.diff_subset_comm {α : Type u_1} {s t u : Set α} :
s \ t u s \ u t
theorem Set.diff_inter {α : Type u_1} {s t u : Set α} :
s \ (t u) = s \ t s \ u
theorem Set.diff_inter_diff {α : Type u_1} {s t u : Set α} :
s \ t (s \ u) = s \ (t u)
theorem Set.diff_compl {α : Type u_1} {s t : Set α} :
s \ t = s t
theorem Set.compl_diff {α : Type u_1} {s t : Set α} :
(t \ s) = s t
theorem Set.diff_diff_right {α : Type u_1} {s t u : Set α} :
s \ (t \ u) = s \ t s u
theorem Set.inter_diff_right_comm {α : Type u_1} {s t u : Set α} :
(s t) \ u = s \ u t
theorem Set.diff_inter_right_comm {α : Type u_1} {s t u : Set α} :
s \ u t = (s t) \ u
@[simp]
theorem Set.union_diff_self {α : Type u_1} {s t : Set α} :
s t \ s = s t
@[simp]
theorem Set.diff_union_self {α : Type u_1} {s t : Set α} :
s \ t t = s t
@[simp]
theorem Set.diff_inter_self {α : Type u_1} {a b : Set α} :
b \ a a =
@[simp]
theorem Set.diff_inter_self_eq_diff {α : Type u_1} {s t : Set α} :
s \ (t s) = s \ t
@[simp]
theorem Set.diff_self_inter {α : Type u_1} {s t : Set α} :
s \ (s t) = s \ t
theorem Set.diff_self {α : Type u_1} {s : Set α} :
s \ s =
theorem Set.diff_diff_right_self {α : Type u_1} (s t : Set α) :
s \ (s \ t) = s t
theorem Set.diff_diff_cancel_left {α : Type u_1} {s t : Set α} (h : s t) :
t \ (t \ s) = s
theorem Set.union_eq_diff_union_diff_union_inter {α : Type u_1} (s t : Set α) :
s t = s \ t t \ s s t
@[simp]
theorem Set.sdiff_sep_self {α : Type u_1} (s : Set α) (p : αProp) :
s \ {a : α | a s p a} = {a : α | a s ¬p a}

If-then-else for sets #

def Set.ite {α : Type u_1} (t s s' : Set α) :
Set α

ite for sets: Set.ite t s s' ∩ t = s ∩ t, Set.ite t s s' ∩ tᶜ = s' ∩ tᶜ. Defined as s ∩ t ∪ s' \ t.

Equations
Instances For
    @[simp]
    theorem Set.ite_inter_self {α : Type u_1} (t s s' : Set α) :
    t.ite s s' t = s t
    @[simp]
    theorem Set.ite_compl {α : Type u_1} (t s s' : Set α) :
    t.ite s s' = t.ite s' s
    @[simp]
    theorem Set.ite_inter_compl_self {α : Type u_1} (t s s' : Set α) :
    t.ite s s' t = s' t
    @[simp]
    theorem Set.ite_diff_self {α : Type u_1} (t s s' : Set α) :
    t.ite s s' \ t = s' \ t
    @[simp]
    theorem Set.ite_same {α : Type u_1} (t s : Set α) :
    t.ite s s = s
    @[simp]
    theorem Set.ite_left {α : Type u_1} (s t : Set α) :
    s.ite s t = s t
    @[simp]
    theorem Set.ite_right {α : Type u_1} (s t : Set α) :
    s.ite t s = t s
    @[simp]
    theorem Set.ite_empty {α : Type u_1} (s s' : Set α) :
    .ite s s' = s'
    @[simp]
    theorem Set.ite_univ {α : Type u_1} (s s' : Set α) :
    univ.ite s s' = s
    @[simp]
    theorem Set.ite_empty_left {α : Type u_1} (t s : Set α) :
    t.ite s = s \ t
    @[simp]
    theorem Set.ite_empty_right {α : Type u_1} (t s : Set α) :
    t.ite s = s t
    theorem Set.ite_mono {α : Type u_1} (t : Set α) {s₁ s₁' s₂ s₂' : Set α} (h : s₁ s₂) (h' : s₁' s₂') :
    t.ite s₁ s₁' t.ite s₂ s₂'
    theorem Set.ite_subset_union {α : Type u_1} (t s s' : Set α) :
    t.ite s s' s s'
    theorem Set.inter_subset_ite {α : Type u_1} (t s s' : Set α) :
    s s' t.ite s s'
    theorem Set.ite_inter_inter {α : Type u_1} (t s₁ s₂ s₁' s₂' : Set α) :
    t.ite (s₁ s₂) (s₁' s₂') = t.ite s₁ s₁' t.ite s₂ s₂'
    theorem Set.ite_inter {α : Type u_1} (t s₁ s₂ s : Set α) :
    t.ite (s₁ s) (s₂ s) = t.ite s₁ s₂ s
    theorem Set.ite_inter_of_inter_eq {α : Type u_1} (t : Set α) {s₁ s₂ s : Set α} (h : s₁ s = s₂ s) :
    t.ite s₁ s₂ s = s₁ s
    theorem Set.subset_ite {α : Type u_1} {t s s' u : Set α} :
    u t.ite s s' u t s u \ t s'
    theorem Set.ite_eq_of_subset_left {α : Type u_1} (t : Set α) {s₁ s₂ : Set α} (h : s₁ s₂) :
    t.ite s₁ s₂ = s₁ s₂ \ t
    theorem Set.ite_eq_of_subset_right {α : Type u_1} (t : Set α) {s₁ s₂ : Set α} (h : s₂ s₁) :
    t.ite s₁ s₂ = s₁ t s₂