Zulip Chat Archive
Stream: Is there code for X?
Topic: Reducing DFunLike applications
Vincent Beffara (Apr 02 2024 at 10:16):
I have this MWE:
import Mathlib
open SchwartzMap
example : True := by
let f : 𝓢(ℝ, ℝ) := ⟨fun x => x, sorry, sorry⟩
have key (x : ℝ) : f x = x := by
simp [f]
sorry
trivial
After the simp
call, the goal looks like
{ toFun := fun x => x, smooth' := ⋯, decay' := ⋯ } x = x
but I was expecting simp
to close it (and rfl
does, as do change x = x
and the like). How do I tell simp to reduce this?
Vincent Beffara (Apr 02 2024 at 20:34):
Adding this above,
@[simp] lemma toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl
makes it work, but I can't figure if this is filling a hole in the SchwartzMap
API or introducing a footgun defeating the point of DFunLike
...
Eric Wieser (Apr 02 2024 at 20:56):
The missing lemma is
@[simp] lemma coe_mk (f : ℝ → ℂ) {h1 h2} : SchwartzMap.mk f h1 h2 = f := rfl
Yaël Dillies (Apr 02 2024 at 20:58):
([norm_cast]
!)
Vincent Beffara (Apr 03 2024 at 00:02):
Eric Wieser said:
The missing lemma is
@[simp] lemma coe_mk (f : ℝ → ℂ) {h1 h2} : SchwartzMap.mk f h1 h2 = f := rfl
This does not reduce:
import Mathlib
open SchwartzMap
@[simp] lemma coe_mk (f : ℝ → ℂ) {h1 h2} : SchwartzMap.mk f h1 h2 = f := rfl
example : True := by
let f : 𝓢(ℝ, ℝ) := ⟨fun x => x, sorry, sorry⟩
have key (x : ℝ) : f x = x := by
simp [f]
sorry
trivial
Last updated: May 02 2025 at 03:31 UTC