Skip to content

Commit b51890a

Browse files
IlPreteRossourkud
andcommitted
feat(Algebra/Group/Indicator): add Pi. mulIndicator_singleton (leanprover-community#34083)
Add `Pi.mulIndicator_singleton ` and `Pi.indicator_singleton ` (via `@[to_additive]`), showing that on non-dependent functions: ```lean Set.mulIndicator {i} f = Pi.mulSingle i (f i) Set.indicator {i} f = Pi.single i (f i) ``` This is the direct `Pi` analog of [`Finsupp.single_eq_set_indicator`](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/Finsupp/Single.html#Finsupp.single_eq_set_indicator), without involving Finsupp. Also add confluence lemmas about `NNReal.toReal` to fix compile. Co-authored-by: IlPreteRosso <will1541286313@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
1 parent a0d377a commit b51890a

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Mathlib/Algebra/Group/Indicator.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,19 @@ theorem apply_mulIndicator_symmDiff {g : G → β} (hg : ∀ x, g x⁻¹ = g x)
196196

197197
end Group
198198

199+
/-! ### Relationship with `Pi.mulSingle`/`Pi.single` -/
200+
201+
variable {ι : Type*} [DecidableEq ι] {M : Type*} [One M]
202+
203+
/-- On non-dependent functions, `Set.mulIndicator` on a singleton set equals `Pi.mulSingle`. -/
204+
@[to_additive (attr := simp)
205+
/-- On non-dependent functions, `Set.indicator` on a singleton set equals `Pi.single`. -/]
206+
theorem mulIndicator_singleton (i : ι) (f : ι → M) :
207+
Set.mulIndicator {i} f = Pi.mulSingle i (f i) := by
208+
ext j
209+
simp only [Set.mulIndicator_apply, Pi.mulSingle_apply, Set.mem_singleton_iff]
210+
split_ifs with h <;> simp [h]
211+
199212
end Set
200213

201214
@[to_additive]

Mathlib/Data/NNReal/Basic.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,26 @@ namespace NNReal
3535

3636
noncomputable instance : FloorSemiring ℝ≥0 := Nonneg.floorSemiring
3737

38+
@[simp, norm_cast]
39+
theorem coe_mulIndicator {α} (s : Set α) (f : α → ℝ≥0) (a : α) :
40+
((s.mulIndicator f a : ℝ≥0) : ℝ) = s.mulIndicator (fun x => ↑(f x)) a :=
41+
map_mulIndicator toRealHom _ _ _
42+
3843
@[simp, norm_cast]
3944
theorem coe_indicator {α} (s : Set α) (f : α → ℝ≥0) (a : α) :
4045
((s.indicator f a : ℝ≥0) : ℝ) = s.indicator (fun x => ↑(f x)) a :=
4146
map_indicator toRealHom _ _ _
4247

48+
@[simp, norm_cast]
49+
theorem coe_mulSingle {α} [DecidableEq α] (a : α) (b : ℝ≥0) (c : α) :
50+
((Pi.mulSingle a b : α → ℝ≥0) c : ℝ) = (Pi.mulSingle a b : α → ℝ) c := by
51+
simpa using coe_mulIndicator {a} (fun _ ↦ b) c
52+
53+
@[simp, norm_cast]
54+
theorem coe_single {α} [DecidableEq α] (a : α) (b : ℝ≥0) (c : α) :
55+
((Pi.single a b : α → ℝ≥0) c : ℝ) = (Pi.single a b : α → ℝ) c := by
56+
simpa using coe_indicator {a} (fun _ ↦ b) c
57+
4358
@[norm_cast]
4459
theorem coe_list_sum (l : List ℝ≥0) : ((l.sum : ℝ≥0) : ℝ) = (l.map (↑)).sum :=
4560
map_list_sum toRealHom l

0 commit comments

Comments
 (0)