Mathlib.Algebra.Notation.Indicator
87 declarations. Mathlib docs · Source
Indicator function
This file defines the indicator function of a set. More lemmas can be found in
Mathlib/Algebra/Group/Indicator.lean.
Main declarations
Set.indicator (s : Set α) (f : α → β) (a : α)isf aifa ∈ sand is0otherwise.Set.mulIndicator (s : Set α) (f : α → β) (a : α)isf aifa ∈ sand is1otherwise.
Implementation notes
In mathematics, an indicator function or a characteristic function is a function
used to indicate membership of an element in a set s,
having the value 1 for all elements of s and the value 0 otherwise.
But since it is usually used to restrict a function to a certain set s,
we let the indicator function take the value f x for some function f, instead of 1.
If the usual indicator function is needed, just set f to be the constant function fun _ ↦ 1.
The indicator function is implemented non-computably, to avoid having to pass around Decidable
arguments. This is in contrast with the design of Pi.single or Set.piecewise.
Tags
indicator, characteristic
def Set.mulIndicator E1 #
{α : Type u_1} → {M : Type u_3} → [One M] → Set α → (α → M) → α → M
Set.mulIndicator s f a is f a if a ∈ s, 1 otherwise.
def Set.indicator E1 #
{α : Type u_1} → {M : Type u_3} → [Zero M] → Set α → (α → M) → α → M
Set.indicator s f a is f a if a ∈ s, 0 otherwise.
theorem Set.piecewise_eq_indicator E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M} [inst_1 : DecidablePred fun x ↦ x ∈ s],
s.piecewise f 0 = s.indicator f
theorem Set.piecewise_eq_mulIndicator E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M} [inst_1 : DecidablePred fun x ↦ x ∈ s],
s.piecewise f 1 = s.mulIndicator f
theorem Set.indicator_apply E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (s : Set α) (f : α → M) (a : α) [inst_1 : Decidable (a ∈ s)],
s.indicator f a = if a ∈ s then f a else 0
theorem Set.mulIndicator_apply E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (s : Set α) (f : α → M) (a : α) [inst_1 : Decidable (a ∈ s)],
s.mulIndicator f a = if a ∈ s then f a else 1
theorem Set.indicator_of_mem E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {a : α}, a ∈ s → ∀ (f : α → M), s.indicator f a = f a
theorem Set.mulIndicator_of_mem E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {a : α}, a ∈ s → ∀ (f : α → M), s.mulIndicator f a = f a
theorem Set.mulIndicator_of_notMem E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {a : α}, a ∉ s → ∀ (f : α → M), s.mulIndicator f a = 1
theorem Set.indicator_of_notMem E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {a : α}, a ∉ s → ∀ (f : α → M), s.indicator f a = 0
theorem Set.mulIndicator_eq_one_or_self E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (s : Set α) (f : α → M) (a : α),
s.mulIndicator f a = 1 ∨ s.mulIndicator f a = f a
theorem Set.indicator_eq_zero_or_self E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (s : Set α) (f : α → M) (a : α),
s.indicator f a = 0 ∨ s.indicator f a = f a
theorem Set.mulIndicator_apply_eq_self E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M} {a : α},
s.mulIndicator f a = f a ↔ a ∉ s → f a = 1
theorem Set.indicator_apply_eq_self E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M} {a : α}, s.indicator f a = f a ↔ a ∉ s → f a = 0
theorem Set.indicator_eq_self E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M}, s.indicator f = f ↔ Function.support f ⊆ s
theorem Set.mulIndicator_eq_self E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M}, s.mulIndicator f = f ↔ Function.mulSupport f ⊆ s
theorem Set.indicator_eq_self_of_superset E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s t : Set α} {f : α → M}, s.indicator f = f → s ⊆ t → t.indicator f = f
theorem Set.mulIndicator_eq_self_of_superset E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s t : Set α} {f : α → M},
s.mulIndicator f = f → s ⊆ t → t.mulIndicator f = f
theorem Set.mulIndicator_apply_eq_one E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M} {a : α}, s.mulIndicator f a = 1 ↔ a ∈ s → f a = 1
theorem Set.indicator_apply_eq_zero E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M} {a : α}, s.indicator f a = 0 ↔ a ∈ s → f a = 0
theorem Set.indicator_eq_zero E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M},
(s.indicator f = fun x ↦ 0) ↔ Disjoint (Function.support f) s
theorem Set.mulIndicator_eq_one E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M},
(s.mulIndicator f = fun x ↦ 1) ↔ Disjoint (Function.mulSupport f) s
theorem Set.indicator_eq_zero' E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M},
s.indicator f = 0 ↔ Disjoint (Function.support f) s
theorem Set.mulIndicator_eq_one' E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M},
s.mulIndicator f = 1 ↔ Disjoint (Function.mulSupport f) s
theorem Set.mulIndicator_apply_ne_one E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M} {a : α},
s.mulIndicator f a ≠ 1 ↔ a ∈ s ∩ Function.mulSupport f
theorem Set.indicator_apply_ne_zero E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M} {a : α},
s.indicator f a ≠ 0 ↔ a ∈ s ∩ Function.support f
theorem Set.support_indicator E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M},
Function.support (s.indicator f) = s ∩ Function.support f
theorem Set.mulSupport_mulIndicator E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M},
Function.mulSupport (s.mulIndicator f) = s ∩ Function.mulSupport f
theorem Set.mem_of_mulIndicator_ne_one E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M} {a : α}, s.mulIndicator f a ≠ 1 → a ∈ s
If a multiplicative indicator function is not equal to 1 at a point, then that point is in the
set.
theorem Set.mem_of_indicator_ne_zero E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M} {a : α}, s.indicator f a ≠ 0 → a ∈ s
If an additive indicator function is not equal to 0 at a point, then that point is in the set.
theorem Set.eqOn_mulIndicator E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M}, Set.EqOn (s.mulIndicator f) f s
See Set.eqOn_mulIndicator' for the version with sᶜ.
theorem Set.eqOn_indicator E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M}, Set.EqOn (s.indicator f) f s
See Set.eqOn_indicator' for the version with sᶜ.
theorem Set.eqOn_mulIndicator' E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M}, Set.EqOn (s.mulIndicator f) 1 sᶜ
See Set.eqOn_mulIndicator for the version with s.
theorem Set.eqOn_indicator' E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M}, Set.EqOn (s.indicator f) 0 sᶜ
See Set.eqOn_indicator for the version with s.
theorem Set.support_indicator_subset E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M}, Function.support (s.indicator f) ⊆ s
theorem Set.mulSupport_mulIndicator_subset E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M}, Function.mulSupport (s.mulIndicator f) ⊆ s
theorem Set.indicator_support E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {f : α → M}, (Function.support f).indicator f = f
theorem Set.mulIndicator_mulSupport E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {f : α → M}, (Function.mulSupport f).mulIndicator f = f
theorem Set.indicator_range_comp E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {ι : Sort u_5} (f : ι → α) (g : α → M),
(Set.range f).indicator g ∘ f = g ∘ f
theorem Set.mulIndicator_range_comp E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {ι : Sort u_5} (f : ι → α) (g : α → M),
(Set.range f).mulIndicator g ∘ f = g ∘ f
theorem Set.indicator_congr E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f g : α → M},
Set.EqOn f g s → s.indicator f = s.indicator g
theorem Set.mulIndicator_congr E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f g : α → M},
Set.EqOn f g s → s.mulIndicator f = s.mulIndicator g
theorem Set.mulIndicator_eq_mulIndicator E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : One M] {s : Set α} {f : α → M} {a : α} {t : Set β} {g : β → M}
{b : β}, (a ∈ s ↔ b ∈ t) → f a = g b → s.mulIndicator f a = t.mulIndicator g b
theorem Set.indicator_eq_indicator E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : Zero M] {s : Set α} {f : α → M} {a : α} {t : Set β} {g : β → M}
{b : β}, (a ∈ s ↔ b ∈ t) → f a = g b → s.indicator f a = t.indicator g b
theorem Set.indicator_const_eq_indicator_const E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : Zero M] {s : Set α} {a : α} {t : Set β} {b : β} {c : M},
(a ∈ s ↔ b ∈ t) → s.indicator (fun x ↦ c) a = t.indicator (fun x ↦ c) b
theorem Set.mulIndicator_const_eq_mulIndicator_const E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : One M] {s : Set α} {a : α} {t : Set β} {b : β} {c : M},
(a ∈ s ↔ b ∈ t) → s.mulIndicator (fun x ↦ c) a = t.mulIndicator (fun x ↦ c) b
theorem Set.mulIndicator_univ E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (f : α → M), Set.univ.mulIndicator f = f
theorem Set.indicator_univ E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (f : α → M), Set.univ.indicator f = f
theorem Set.indicator_empty E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (f : α → M), ∅.indicator f = fun x ↦ 0
theorem Set.mulIndicator_empty E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (f : α → M), ∅.mulIndicator f = fun x ↦ 1
theorem Set.indicator_empty' E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (f : α → M), ∅.indicator f = 0
theorem Set.mulIndicator_empty' E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (f : α → M), ∅.mulIndicator f = 1
theorem Set.indicator_zero E0 #
∀ {α : Type u_1} (M : Type u_3) [inst : Zero M] (s : Set α), (s.indicator fun x ↦ 0) = fun x ↦ 0
theorem Set.mulIndicator_one E0 #
∀ {α : Type u_1} (M : Type u_3) [inst : One M] (s : Set α), (s.mulIndicator fun x ↦ 1) = fun x ↦ 1
theorem Set.indicator_zero' E0 #
∀ {α : Type u_1} (M : Type u_3) [inst : Zero M] {s : Set α}, s.indicator 0 = 0
theorem Set.mulIndicator_one' E0 #
∀ {α : Type u_1} (M : Type u_3) [inst : One M] {s : Set α}, s.mulIndicator 1 = 1
theorem Set.mulIndicator_mulIndicator E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (s t : Set α) (f : α → M),
s.mulIndicator (t.mulIndicator f) = (s ∩ t).mulIndicator f
theorem Set.indicator_indicator E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (s t : Set α) (f : α → M),
s.indicator (t.indicator f) = (s ∩ t).indicator f
theorem Set.indicator_inter_support E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (s : Set α) (f : α → M),
(s ∩ Function.support f).indicator f = s.indicator f
theorem Set.mulIndicator_inter_mulSupport E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (s : Set α) (f : α → M),
(s ∩ Function.mulSupport f).mulIndicator f = s.mulIndicator f
theorem Set.comp_indicator E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : Zero M] (h : M → β) (f : α → M) {s : Set α} {x : α}
[inst_1 : DecidablePred fun x ↦ x ∈ s], h (s.indicator f x) = s.piecewise (h ∘ f) (Function.const α (h 0)) x
theorem Set.comp_mulIndicator E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : One M] (h : M → β) (f : α → M) {s : Set α} {x : α}
[inst_1 : DecidablePred fun x ↦ x ∈ s], h (s.mulIndicator f x) = s.piecewise (h ∘ f) (Function.const α (h 1)) x
theorem Set.indicator_comp_right E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : Zero M] {s : Set α} (f : β → α) {g : α → M} {x : β},
(f ⁻¹' s).indicator (g ∘ f) x = s.indicator g (f x)
theorem Set.mulIndicator_comp_right E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : One M] {s : Set α} (f : β → α) {g : α → M} {x : β},
(f ⁻¹' s).mulIndicator (g ∘ f) x = s.mulIndicator g (f x)
theorem Set.indicator_image E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : Zero M] {s : Set α} {f : β → M} {g : α → β},
Function.Injective g → ∀ {x : α}, (g '' s).indicator f (g x) = s.indicator (f ∘ g) x
theorem Set.mulIndicator_image E1 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : One M] {s : Set α} {f : β → M} {g : α → β},
Function.Injective g → ∀ {x : α}, (g '' s).mulIndicator f (g x) = s.mulIndicator (f ∘ g) x
theorem Set.indicator_comp_of_zero E1 #
∀ {α : Type u_1} {M : Type u_3} {N : Type u_4} [inst : Zero M] [inst_1 : Zero N] {s : Set α} {f : α → M} {g : M → N},
g 0 = 0 → s.indicator (g ∘ f) = g ∘ s.indicator f
theorem Set.mulIndicator_comp_of_one E1 #
∀ {α : Type u_1} {M : Type u_3} {N : Type u_4} [inst : One M] [inst_1 : One N] {s : Set α} {f : α → M} {g : M → N},
g 1 = 1 → s.mulIndicator (g ∘ f) = g ∘ s.mulIndicator f
theorem Set.comp_mulIndicator_const E1 #
∀ {α : Type u_1} {M : Type u_3} {N : Type u_4} [inst : One M] [inst_1 : One N] {s : Set α} (c : M) (f : M → N),
f 1 = 1 → (fun x ↦ f (s.mulIndicator (fun x ↦ c) x)) = s.mulIndicator fun x ↦ f c
theorem Set.comp_indicator_const E1 #
∀ {α : Type u_1} {M : Type u_3} {N : Type u_4} [inst : Zero M] [inst_1 : Zero N] {s : Set α} (c : M) (f : M → N),
f 0 = 0 → (fun x ↦ f (s.indicator (fun x ↦ c) x)) = s.indicator fun x ↦ f c
theorem Set.mulIndicator_apply_apply E0 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : One M] {s : Set α} {a : α} (f : α → β → M) (b : β),
s.mulIndicator f a b = s.mulIndicator (fun i ↦ f i b) a
Evaluating the indicator of a family of functions at a point commutes with the indicator:
s.mulIndicator f a b = s.mulIndicator (f · b) a.
theorem Set.indicator_apply_apply E0 #
∀ {α : Type u_1} {β : Type u_2} {M : Type u_3} [inst : Zero M] {s : Set α} {a : α} (f : α → β → M) (b : β),
s.indicator f a b = s.indicator (fun i ↦ f i b) a
theorem Set.mulIndicator_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (s : Set α) (f : α → M) (B : Set M),
s.mulIndicator f ⁻¹' B = s.ite (f ⁻¹' B) (1 ⁻¹' B)
theorem Set.indicator_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (s : Set α) (f : α → M) (B : Set M),
s.indicator f ⁻¹' B = s.ite (f ⁻¹' B) (0 ⁻¹' B)
theorem Set.indicator_zero_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {t : Set α} (s : Set M), t.indicator 0 ⁻¹' s ∈ {Set.univ, ∅}
theorem Set.mulIndicator_one_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {t : Set α} (s : Set M), t.mulIndicator 1 ⁻¹' s ∈ {Set.univ, ∅}
theorem Set.indicator_const_preimage_eq_union E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (U : Set α) (s : Set M) (a : M) [inst_1 : Decidable (a ∈ s)]
[inst_2 : Decidable (0 ∈ s)], (U.indicator fun x ↦ a) ⁻¹' s = (if a ∈ s then U else ∅) ∪ if 0 ∈ s then Uᶜ else ∅
theorem Set.mulIndicator_const_preimage_eq_union E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (U : Set α) (s : Set M) (a : M) [inst_1 : Decidable (a ∈ s)]
[inst_2 : Decidable (1 ∈ s)], (U.mulIndicator fun x ↦ a) ⁻¹' s = (if a ∈ s then U else ∅) ∪ if 1 ∈ s then Uᶜ else ∅
theorem Set.indicator_const_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (U : Set α) (s : Set M) (a : M),
(U.indicator fun x ↦ a) ⁻¹' s ∈ {Set.univ, U, Uᶜ, ∅}
theorem Set.mulIndicator_const_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (U : Set α) (s : Set M) (a : M),
(U.mulIndicator fun x ↦ a) ⁻¹' s ∈ {Set.univ, U, Uᶜ, ∅}
theorem Set.mulIndicator_preimage_of_notMem E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] (s : Set α) (f : α → M) {t : Set M},
1 ∉ t → s.mulIndicator f ⁻¹' t = f ⁻¹' t ∩ s
theorem Set.indicator_preimage_of_notMem E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] (s : Set α) (f : α → M) {t : Set M},
0 ∉ t → s.indicator f ⁻¹' t = f ⁻¹' t ∩ s
theorem Set.mem_range_mulIndicator E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {r : M} {s : Set α} {f : α → M},
r ∈ Set.range (s.mulIndicator f) ↔ r = 1 ∧ s ≠ Set.univ ∨ r ∈ f '' s
theorem Set.mem_range_indicator E0 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {r : M} {s : Set α} {f : α → M},
r ∈ Set.range (s.indicator f) ↔ r = 0 ∧ s ≠ Set.univ ∨ r ∈ f '' s
theorem Set.mulIndicator_rel_mulIndicator E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] {s : Set α} {f g : α → M} {a : α} {r : M → M → Prop},
r 1 1 → (a ∈ s → r (f a) (g a)) → r (s.mulIndicator f a) (s.mulIndicator g a)
theorem Set.indicator_rel_indicator E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : Zero M] {s : Set α} {f g : α → M} {a : α} {r : M → M → Prop},
r 0 0 → (a ∈ s → r (f a) (g a)) → r (s.indicator f a) (s.indicator g a)
theorem Set.indicator_one_preimage E1 #
∀ {α : Type u_1} {M : Type u_3} [inst : One M] [inst_1 : Zero M] (U : Set α) (s : Set M),
U.indicator 1 ⁻¹' s ∈ {Set.univ, U, Uᶜ, ∅}