Zulip Chat Archive

Stream: general

Topic: set notation


Yury G. Kudryashov (Feb 20 2020 at 17:00):

Currently {a, b} is defined as insert b {a}, so various lemmas about insert reverse the order. E.g., Sup {a, b} simplifies to sup b a while I'd expect sup a b. Is there any reason to have it this way?

Patrick Massot (Apr 13 2020 at 20:43):

From times to times I get random errors using set notations. We can do:

variables s : set 

#check {x | x = 0}
#check {x :  | x = 0}
#check {x  s | x = 0}

But sometimes the second variant rises an error "function expected at", but it's very hard to minimize. Does anyone understand the magic behind this notation? Only the last variation (which is pretty rarely used) has a clear origin using the has_sep class.

Yury G. Kudryashov (Apr 13 2020 at 20:56):

The first two are parsed in C++ with hardcoded set_of

Yury G. Kudryashov (Apr 13 2020 at 20:57):

https://github.com/leanprover-community/lean/blob/master/src/frontends/lean/brackets.cpp#L28

Patrick Massot (Apr 13 2020 at 21:12):

Yes I understand that things that are not defined by Lean code are defined by C++ code. My question was not precise enough. I'd like to know whether other people see random failure with these notations and know how to fix them.

Mario Carneiro (Apr 13 2020 at 21:17):

I've never seen a failure, but it's possible that it's triggered by certain combinations of leaving things out which I might be systematically avoiding for style reasons


Last updated: Dec 20 2023 at 11:08 UTC