Zulip Chat Archive

Stream: new members

Topic: Whence subtype?


Ignat Insarov (Oct 15 2021 at 11:18):

I am looking at this code:

lemma exists_of_subtype {α : Type u} {p : α  Prop} : { x // p x }   x, p x
| a, h := a, h

— And I cannot figure out whence the notation for subtypes { … // … } comes from. Is it built in?

Ignat Insarov (Oct 15 2021 at 11:21):

There is this structure — is it what { … // … } stands for?

structure subtype {α : Sort u} (p : α  Prop) :=
(val : α) (property : p val)

Yaël Dillies (Oct 15 2021 at 11:26):

Yup, exactly.

Ignat Insarov (Oct 15 2021 at 11:26):

So how do we know that this notation stands for this definition?

Yaël Dillies (Oct 15 2021 at 11:30):

It would good if it were written in the docs... And I can't find where the notation is defined :confused:

Anne Baanen (Oct 15 2021 at 11:48):

The parser for all the {}-related syntax in Lean 3 can be found in src/frontends/lean/brackets.cpp

Mario Carneiro (Oct 15 2021 at 11:59):

It's built in. The reason is because there is a lot of overloading of notations that start with {, and lean's notation command can't handle it


Last updated: Dec 20 2023 at 11:08 UTC