Module docstring
{"# Indicator function valued in bool
See also Set.indicator and Set.piecewise.
"}
{"# Indicator function valued in bool
See also Set.indicator and Set.piecewise.
"}
Set.boolIndicator
definition
(x : α)
/-- `boolIndicator` maps `x` to `true` if `x ∈ s`, else to `false` -/
noncomputable def boolIndicator (x : α) :=
@ite _ (x ∈ s) (Classical.propDecidable _) true false
Set.mem_iff_boolIndicator
theorem
(x : α) : x ∈ s ↔ s.boolIndicator x = true
theorem mem_iff_boolIndicator (x : α) : x ∈ sx ∈ s ↔ s.boolIndicator x = true := by
unfold boolIndicator
split_ifs with h <;> simp [h]
Set.not_mem_iff_boolIndicator
theorem
(x : α) : x ∉ s ↔ s.boolIndicator x = false
theorem not_mem_iff_boolIndicator (x : α) : x ∉ sx ∉ s ↔ s.boolIndicator x = false := by
unfold boolIndicator
split_ifs with h <;> simp [h]
Set.preimage_boolIndicator_true
theorem
: s.boolIndicator ⁻¹' { true } = s
theorem preimage_boolIndicator_true : s.boolIndicator ⁻¹' {true} = s :=
ext fun x ↦ (s.mem_iff_boolIndicator x).symm
Set.preimage_boolIndicator_false
theorem
: s.boolIndicator ⁻¹' { false } = sᶜ
theorem preimage_boolIndicator_false : s.boolIndicator ⁻¹' {false} = sᶜ :=
ext fun x ↦ (s.not_mem_iff_boolIndicator x).symm
Set.preimage_boolIndicator_eq_union
theorem
(t : Set Bool) : s.boolIndicator ⁻¹' t = (if true ∈ t then s else ∅) ∪ if false ∈ t then sᶜ else ∅
theorem preimage_boolIndicator_eq_union (t : Set Bool) :
s.boolIndicator ⁻¹' t = (if true ∈ t then s else ∅) ∪ if false ∈ t then sᶜ else ∅ := by
ext x
simp only [boolIndicator, mem_preimage]
split_ifs <;> simp [*]
Set.preimage_boolIndicator
theorem
(t : Set Bool) :
s.boolIndicator ⁻¹' t = univ ∨ s.boolIndicator ⁻¹' t = s ∨ s.boolIndicator ⁻¹' t = sᶜ ∨ s.boolIndicator ⁻¹' t = ∅
theorem preimage_boolIndicator (t : Set Bool) :
s.boolIndicator ⁻¹' ts.boolIndicator ⁻¹' t = univ ∨
s.boolIndicator ⁻¹' t = s ∨ s.boolIndicator ⁻¹' t = sᶜ ∨ s.boolIndicator ⁻¹' t = ∅ := by
simp only [preimage_boolIndicator_eq_union]
split_ifs <;> simp [s.union_compl_self]