Skip to content

Commit eba35bf

Browse files
committed
chore(ContDiffSupportedIn): use simps to auto-generate basic API (#30659)
Follow-up to #30198.
1 parent 6dd4a09 commit eba35bf

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

Mathlib/Analysis/Distribution/ContDiffMapSupportedIn.lean

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ theorem toFun_eq_coe {f : 𝓓^{n}_{K}(E, F)} : f.toFun = (f : E → F) :=
137137
rfl
138138

139139
/-- See note [custom simps projection]. -/
140-
def Simps.apply (f : 𝓓^{n}_{K}(E, F)) : E → F := f
140+
def Simps.coe (f : 𝓓^{n}_{K}(E, F)) : E → F := f
141141

142-
initialize_simps_projections ContDiffMapSupportedIn (toFun → apply)
142+
initialize_simps_projections ContDiffMapSupportedIn (toFun → coe, as_prefix coe)
143143

144144
@[ext]
145145
theorem ext {f g : 𝓓^{n}_{K}(E, F)} (h : ∀ a, f a = g a) : f = g :=
@@ -165,53 +165,35 @@ theorem toBoundedContinuousFunction_apply (f : 𝓓^{n}_{K}(E, F)) (x : E) :
165165

166166
section AddCommGroup
167167

168+
@[simps -fullyApplied]
168169
instance : Zero 𝓓^{n}_{K}(E, F) where
169170
zero := .mk 0 contDiff_zero_fun fun _ _ ↦ rfl
170171

171-
@[simp]
172-
lemma coe_zero : (0 : 𝓓^{n}_{K}(E, F)) = (0 : E → F) :=
173-
rfl
174-
172+
@[simps -fullyApplied]
175173
instance : Add 𝓓^{n}_{K}(E, F) where
176174
add f g := .mk (f + g) (f.contDiff.add g.contDiff) <| by
177175
rw [← add_zero 0]
178176
exact f.zero_on_compl.comp_left₂ g.zero_on_compl
179177

180-
-- TODO: can this lemma be auto-generated, e.g. using `simps`?
181-
-- Investigate the same question for `zero` above and `sub` , `neg` and `smul` below.
182-
@[simp]
183-
lemma coe_add (f g : 𝓓^{n}_{K}(E, F)) : (f + g : 𝓓^{n}_{K}(E, F)) = (f : E → F) + g :=
184-
rfl
185-
178+
@[simps -fullyApplied]
186179
instance : Neg 𝓓^{n}_{K}(E, F) where
187180
neg f := .mk (-f) (f.contDiff.neg) <| by
188181
rw [← neg_zero]
189182
exact f.zero_on_compl.comp_left
190183

191-
@[simp]
192-
lemma coe_neg (f : 𝓓^{n}_{K}(E, F)) : (-f : 𝓓^{n}_{K}(E, F)) = (-f : E → F) :=
193-
rfl
194-
184+
@[simps -fullyApplied]
195185
instance instSub : Sub 𝓓^{n}_{K}(E, F) where
196186
sub f g := .mk (f - g) (f.contDiff.sub g.contDiff) <| by
197187
rw [← sub_zero 0]
198188
exact f.zero_on_compl.comp_left₂ g.zero_on_compl
199189

200-
@[simp]
201-
lemma coe_sub (f g : 𝓓^{n}_{K}(E, F)) : (f - g : 𝓓^{n}_{K}(E, F)) = (f : E → F) - g :=
202-
rfl
203-
190+
@[simps -fullyApplied]
204191
instance instSMul {R} [Semiring R] [Module R F] [SMulCommClass ℝ R F] [ContinuousConstSMul R F] :
205192
SMul R 𝓓^{n}_{K}(E, F) where
206193
smul c f := .mk (c • (f : E → F)) (f.contDiff.const_smul c) <| by
207194
rw [← smul_zero c]
208195
exact f.zero_on_compl.comp_left
209196

210-
@[simp]
211-
lemma coe_smul {R} [Semiring R] [Module R F] [SMulCommClass ℝ R F] [ContinuousConstSMul R F]
212-
(c : R) (f : 𝓓^{n}_{K}(E, F)) : (c • f : 𝓓^{n}_{K}(E, F)) = c • (f : E → F) :=
213-
rfl
214-
215197
instance : AddCommGroup 𝓓^{n}_{K}(E, F) :=
216198
DFunLike.coe_injective.addCommGroup _ rfl (fun _ _ ↦ rfl) (fun _ ↦ rfl) (fun _ _ ↦ rfl)
217199
(fun _ _ ↦ rfl) fun _ _ ↦ rfl

0 commit comments

Comments
 (0)