Zulip Chat Archive

Stream: mathlib4

Topic: Can I Use `toFun` in the definition of `RelIso`?


Lingwei Peng (彭灵伟) (Mar 12 2025 at 01:43):

The definition of RelIso is:

structure RelIso {α β : Type*} (r : α  α  Prop) (s : β  β  Prop) extends α  β where
  map_rel_iff' :  {a b}, s (toEquiv a) (toEquiv b)  r a b

There is a nested abstraction chain: FunLike → DFunLike → Function.Injective.
It’s like needing to learn real numbers before learning natural numbers.
Can I simplify this by directly using toFun instead, like so? Can I just use toFun instead

structure RelIso {α β : Type*} (r : α  α  Prop) (s : β  β  Prop) extends α  β where
  map_rel_iff' :  {a b}, s (toFun a) (toFun b)  r a b

Aaron Liu (Mar 12 2025 at 02:05):

why would you want to do this

Lingwei Peng (彭灵伟) (Mar 12 2025 at 02:28):

I am building a small package called MySet for study purposes.

Yury G. Kudryashov (Mar 12 2025 at 03:17):

You can do that.

Yury G. Kudryashov (Mar 12 2025 at 03:19):

The definition in Mathlib doesn't do that because if you reuse an existing Equiv for the toEquiv projection, then the simp-normal form is e a, not e.toFun a.

Lingwei Peng (彭灵伟) (Mar 12 2025 at 03:30):

Thanks, I just realized that e.toFun a is only suitable for the initial stage, where the theorems are simple.


Last updated: May 02 2025 at 03:31 UTC