Skip to content

Commit

Permalink
feat: lemmas about indicator of the symmetric difference (#6738)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Aug 23, 2023
1 parent 7824a67 commit 4c583ce
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Mathlib/Algebra/IndicatorFunction.lean
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ theorem mulIndicator_union_of_disjoint (h : Disjoint s t) (f : α → M) :
#align set.mul_indicator_union_of_disjoint Set.mulIndicator_union_of_disjoint
#align set.indicator_union_of_disjoint Set.indicator_union_of_disjoint

@[to_additive]
theorem mulIndicator_symmDiff (s t : Set α) (f : α → M) :
mulIndicator (s ∆ t) f = mulIndicator (s \ t) f * mulIndicator (t \ s) f :=
mulIndicator_union_of_disjoint (disjoint_sdiff_self_right.mono_left sdiff_le) _

@[to_additive]
theorem mulIndicator_mul (s : Set α) (f g : α → M) :
(mulIndicator s fun a => f a * g a) = fun a => mulIndicator s f a * mulIndicator s g a := by
Expand Down Expand Up @@ -580,8 +585,19 @@ theorem mulIndicator_diff' (h : s ⊆ t) (f : α → G) :
rw [mulIndicator_diff h, div_eq_mul_inv]
#align set.indicator_diff Set.indicator_diff

@[to_additive]
theorem apply_mulIndicator_symmDiff {g : G → β} (hg : ∀ x, g x⁻¹ = g x)
(s t : Set α) (f : α → G) (x : α):
g (mulIndicator (s ∆ t) f x) = g (mulIndicator s f x / mulIndicator t f x) := by
by_cases hs : x ∈ s <;> by_cases ht : x ∈ t <;> simp [mem_symmDiff, *]

end Group

theorem abs_indicator_symmDiff {G : Type*} [LinearOrderedAddCommGroup G]
(s t : Set α) (f : α → G) (x : α) :
|indicator (s ∆ t) f x| = |indicator s f x - indicator t f x| :=
apply_indicator_symmDiff abs_neg s t f x

section CommMonoid

variable [CommMonoid M]
Expand Down
15 changes: 15 additions & 0 deletions Mathlib/Analysis/Normed/Group/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ theorem norm_inv' (a : E) : ‖a⁻¹‖ = ‖a‖ := by simpa using norm_div_re
#align norm_inv' norm_inv'
#align norm_neg norm_neg

@[to_additive]
theorem dist_mulIndicator (s t : Set α) (f : α → E) (x : α) :
dist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖ := by
rw [dist_eq_norm_div, Set.apply_mulIndicator_symmDiff norm_inv']

@[to_additive (attr := simp)]
theorem dist_mul_self_right (a b : E) : dist b (a * b) = ‖a‖ := by
rw [← dist_one_left, ← dist_mul_right 1 a b, one_mul]
Expand Down Expand Up @@ -932,6 +937,11 @@ theorem nnnorm_inv' (a : E) : ‖a⁻¹‖₊ = ‖a‖₊ :=
#align nnnorm_inv' nnnorm_inv'
#align nnnorm_neg nnnorm_neg

@[to_additive]
theorem nndist_mulIndicator (s t : Set α) (f : α → E) (x : α) :
nndist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖₊ :=
NNReal.eq <| dist_mulIndicator s t f x

@[to_additive]
theorem nnnorm_div_le (a b : E) : ‖a / b‖₊ ≤ ‖a‖₊ + ‖b‖₊ :=
NNReal.coe_le_coe.1 <| norm_div_le _ _
Expand Down Expand Up @@ -986,6 +996,11 @@ theorem edist_eq_coe_nnnorm' (x : E) : edist x 1 = (‖x‖₊ : ℝ≥0∞) :=
#align edist_eq_coe_nnnorm' edist_eq_coe_nnnorm'
#align edist_eq_coe_nnnorm edist_eq_coe_nnnorm

@[to_additive]
theorem edist_mulIndicator (s t : Set α) (f : α → E) (x : α) :
edist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖₊ := by
rw [edist_nndist, nndist_mulIndicator]

@[to_additive]
theorem mem_emetric_ball_one_iff {r : ℝ≥0∞} : a ∈ EMetric.ball (1 : E) r ↔ ↑‖a‖₊ < r := by
rw [EMetric.mem_ball, edist_eq_coe_nnnorm']
Expand Down
5 changes: 5 additions & 0 deletions Mathlib/MeasureTheory/Function/LpSeminorm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ theorem snorm_congr_norm_ae {f : α → F} {g : α → G} (hfg : ∀ᵐ x ∂μ,
snorm_congr_nnnorm_ae <| hfg.mono fun _x hx => NNReal.eq hx
#align measure_theory.snorm_congr_norm_ae MeasureTheory.snorm_congr_norm_ae

theorem snorm_indicator_sub_indicator (s t : Set α) (f : α → E) :
snorm (s.indicator f - t.indicator f) p μ = snorm ((s ∆ t).indicator f) p μ :=
snorm_congr_norm_ae <| ae_of_all _ fun x ↦ by
simp only [Pi.sub_apply, Set.apply_indicator_symmDiff norm_neg]

@[simp]
theorem snorm'_norm {f : α → F} : snorm' (fun a => ‖f a‖) q μ = snorm' f q μ := by simp [snorm']
#align measure_theory.snorm'_norm MeasureTheory.snorm'_norm
Expand Down
14 changes: 14 additions & 0 deletions Mathlib/MeasureTheory/Function/LpSpace.lean
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ theorem nnnorm_toLp (f : α → E) (hf : Memℒp f p μ) :
NNReal.eq <| norm_toLp f hf
#align measure_theory.Lp.nnnorm_to_Lp MeasureTheory.Lp.nnnorm_toLp

theorem coe_nnnorm_toLp {f : α → E} (hf : Memℒp f p μ) : (‖hf.toLp f‖₊ : ℝ≥0∞) = snorm f p μ := by
rw [nnnorm_toLp f hf, ENNReal.coe_toNNReal hf.2.ne]

theorem dist_def (f g : Lp E p μ) : dist f g = (snorm (⇑f - ⇑g) p μ).toReal := by
simp_rw [dist, norm_def]
refine congr_arg _ ?_
Expand Down Expand Up @@ -773,6 +776,17 @@ theorem norm_indicatorConstLp_le :
ENNReal.toReal_rpow, ENNReal.ofReal_toReal]
exact ENNReal.rpow_ne_top_of_nonneg (by positivity) hμs

theorem edist_indicatorConstLp_eq_nnnorm {t : Set α} (ht : MeasurableSet t) (hμt : μ t ≠ ∞) :
edist (indicatorConstLp p hs hμs c) (indicatorConstLp p ht hμt c) =
‖indicatorConstLp p (hs.symmDiff ht) (measure_symmDiff_ne_top hμs hμt) c‖₊ := by
unfold indicatorConstLp
rw [Lp.edist_toLp_toLp, snorm_indicator_sub_indicator, Lp.coe_nnnorm_toLp]

theorem dist_indicatorConstLp_eq_norm {t : Set α} (ht : MeasurableSet t) (hμt : μ t ≠ ∞) :
dist (indicatorConstLp p hs hμs c) (indicatorConstLp p ht hμt c) =
‖indicatorConstLp p (hs.symmDiff ht) (measure_symmDiff_ne_top hμs hμt) c‖ := by
rw [Lp.dist_edist, edist_indicatorConstLp_eq_nnnorm, ENNReal.coe_toReal, Lp.coe_nnnorm]

@[simp]
theorem indicatorConstLp_empty :
indicatorConstLp p MeasurableSet.empty (by simp : μ ∅ ≠ ∞) c = 0 := by
Expand Down
3 changes: 3 additions & 0 deletions Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ theorem measure_union_ne_top (hs : μ s ≠ ∞) (ht : μ t ≠ ∞) : μ (s ∪
(measure_union_lt_top hs.lt_top ht.lt_top).ne
#align measure_theory.measure_union_ne_top MeasureTheory.measure_union_ne_top

theorem measure_symmDiff_ne_top (hs : μ s ≠ ∞) (ht : μ t ≠ ∞) : μ (s ∆ t) ≠ ∞ :=
ne_top_of_le_ne_top (measure_union_ne_top hs ht) <| measure_mono symmDiff_subset_union

@[simp]
theorem measure_union_eq_top_iff : μ (s ∪ t) = ∞ ↔ μ s = ∞ ∨ μ t = ∞ :=
not_iff_not.1 <| by simp only [← lt_top_iff_ne_top, ← Ne.def, not_or, measure_union_lt_top_iff]
Expand Down

0 comments on commit 4c583ce

Please sign in to comment.