Zulip Chat Archive

Stream: mathlib4

Topic: setOf unexpander


Dan Velleman (Jan 18 2023 at 15:43):

I think there is a small bug in Mathlib/Init/Set.lean. The unexpander for setOf includes this line:

  | `($_ fun $x:ident : $ty:term  $p) => `({ $x:ident : $ty:term | $p })

I believe it should be

  | `($_ fun ($x:ident : $ty:term)  $p) => `({ $x:ident : $ty:term | $p })

The delaborator puts parentheses around $x:ident : $ty:term, so the unexpander has to look for those parentheses. Note that this will only cause a problem when using the option pp.funBinderTypes; without that option, the delaborator leaves out the type, so this line of the unexpander doesn't get used.
If others agree, I will file an issue.

Dan Velleman (Jan 18 2023 at 16:03):

Also: I notice that in many unexpanders, the syntax starts with $(_) rather than $_. Can someone explain what the difference is?

Sebastian Ullrich (Jan 18 2023 at 16:03):

The second syntax is newer

Dan Velleman (Jan 18 2023 at 16:04):

So both are acceptable, and they mean the same thing?

Dan Velleman (Jan 18 2023 at 16:08):

Thanks Sebastian. Do you agree about the minor bug in the unexpander?

Dan Velleman (Jan 18 2023 at 16:11):

It looks like the same problem appears (twice) in Mathlib/Order/CompleteLattice.lean

Sebastian Ullrich (Jan 18 2023 at 16:26):

Yeah, sounds sensible


Last updated: Dec 20 2023 at 11:08 UTC