Zulip Chat Archive

Stream: mathlib4

Topic: set vs. subtype


Kenny Lau (Oct 28 2025 at 20:23):

import Mathlib.Data.Set.Defs

variable (p : Nat  Prop)

-- {n | p n}
#check setOf fun n  p n

-- { n // p n }
#check Subtype fun n  p n

Note the spacing inconsistency: spaces inside brackets ({ n) for subtype, but not for set ({n)

Kenny Lau (Oct 28 2025 at 20:24):

image.png

this part

Dan Velleman (Oct 28 2025 at 20:42):

I think sets used to have those extra spaces, but they disappeared at some point.

Kenny Lau (Oct 28 2025 at 20:44):

@Dan Velleman this Lean 3 code from 8 years ago shows {x : nat | x > 0}

Kenny Lau (Oct 28 2025 at 20:47):

aha this lean 4 code 4 years ago shows the space

syntax "{ " ident " | " term " }" : term

Kenny Lau (Oct 28 2025 at 20:48):

here is the PR by Mario that changed it from space to no space, 2 years ago

Kenny Lau (Oct 28 2025 at 20:50):

here is the PR by Kevin Buzzard 4 years ago porting set to mathlib4, it has the space there

Kenny Lau (Oct 28 2025 at 20:51):

so perhaps Kevin introduced the spaces but Mario removed them to be consistent with Lean 3, but now that Set is entirely in mathlib (i.e. moved out of core), maybe we can put the spaces back?

Dan Velleman (Oct 28 2025 at 20:57):

I prefer it without the spaces.

Kenny Lau (Oct 28 2025 at 21:11):

@Dan Velleman @Michael Stoll does that apply to Subtype as well?


Last updated: Dec 20 2025 at 21:32 UTC