Zulip Chat Archive
Stream: maths
Topic: ZFC hom renames
Violeta Hernández (Feb 28 2023 at 08:13):
I'd like to get input from @Mario Carneiro on this. @Yaël Dillies was suggesting a rename of the Class hom lemmas (e.g. docs#Class.mem_hom_left, docs#Class.union_hom) to use coe
instead (e.g. Class.coe_mem
, Class.union_coe
).
Violeta Hernández (Feb 28 2023 at 08:14):
I agree with the rename, but I recall that renaming things in this specific file was iffier than for others.
Kevin Buzzard (Feb 28 2023 at 08:42):
Why not just hold off on these kinds of questions until after the port to lean 4? Why not try and get this stuff ported instead and then have the discussion about changing the lean 4 files?
Yaël Dillies (Feb 28 2023 at 09:10):
because changing the Lean 4 files can only happen once the port is over, namely in 6 months?
Johan Commelin (Feb 28 2023 at 09:14):
$ rg "import set_theory.zfc"
src/set_theory/zfc/ordinal.lean
7:import set_theory.zfc.basic
Johan Commelin (Feb 28 2023 at 09:15):
There is only 1 file in mathlib that depends on this file (set_theory/zfc/ordinal.lean
is a leaf).
Johan Commelin (Feb 28 2023 at 09:15):
So I think that after porting this file, it should feel free to change even if the port isn't done yet.
Johan Commelin (Feb 28 2023 at 09:15):
I'm not aware of plans to make other files in mathlib depend on these two files.
Oliver Nash (Feb 28 2023 at 09:16):
Yaël Dillies said:
because changing the Lean 4 files can only happen once the port is over, namely in 6 months?
Of course people should work on what they enjoy and we are grateful for all contributions but I think it's worth noting that the port will happen more quickly if people divert effort away from Mathlib3 and into the port.
Mario Carneiro (Feb 28 2023 at 10:04):
I have no objection to the renames, but agree with others that this is added work for the port for no good reason
Violeta Hernández (Feb 28 2023 at 12:16):
Alright, I was worrying this might conflict with the Metamath in Lean thingy you had mentioned in the past
Violeta Hernández (Feb 28 2023 at 12:18):
(should have mentioned that specific concern earlier, sorry)
Mario Carneiro (Feb 28 2023 at 19:42):
Those theorems are not used by the generator, only the definitions are important and the theorems are used in the hand written postprocessing file
Violeta Hernández (Mar 29 2023 at 15:00):
Regarding the ZFC Mathlib 4 port, it's almost done
Violeta Hernández (Mar 29 2023 at 15:01):
So hopefully that excuses the following bikeshedding
Violeta Hernández (Mar 29 2023 at 15:01):
I don't remember if I asked before but, what's the point of docs#Class.of_Set and docs#Class.to_Set?
Violeta Hernández (Mar 29 2023 at 15:02):
They are exactly identical to the coercion operator and the membership relation, respectively
Eric Wieser (Mar 29 2023 at 15:03):
In Lean 4, the coercion operator usually requires an underlying definition, because coe
is unfolded (re Class.of_Set
)
Violeta Hernández (Mar 29 2023 at 15:04):
That's good to keep in mind
Violeta Hernández (Mar 29 2023 at 15:05):
Still, if these are entirely auxiliary definitions, I believe they'd be better off being named Class.coe
and Class.mem
Violeta Hernández (Mar 29 2023 at 15:05):
That way it's clear you're supposed to use the other ones
Eric Wieser (Mar 29 2023 at 15:06):
That way it's clear you're supposed to use the other ones
The up arrow and the function that implements it are syntactically the same in lean 4
Eric Wieser (Mar 29 2023 at 15:06):
So you should only call it Class.coe
if you want that name to appear in the goal view when you hover over the arrow
Eric Wieser (Mar 29 2023 at 15:07):
I guess since all the lemmas currently call it coe
calling the function Class.coe
is the least effort
Violeta Hernández (Mar 29 2023 at 15:07):
Ah, I hadn't grasped the "syntactic" bit
Violeta Hernández (Mar 29 2023 at 15:08):
Well, if this behavior will change in Lean 4, I can postpone the bikeshedding until then
Eric Wieser (Mar 29 2023 at 15:13):
The mem
stuff hasn't changed, so you could still bikeshed that if you felt the urge
Violeta Hernández (Mar 29 2023 at 15:17):
Sure, why not
Violeta Hernández (Mar 29 2023 at 15:17):
It's trivial to port this to Lean 4
Violeta Hernández (Mar 29 2023 at 15:17):
More so in comparison to the other 1700 lines that file has
Violeta Hernández (Mar 29 2023 at 15:18):
Oh wait, I'm noticing we already have a Class.mem
Violeta Hernández (Mar 29 2023 at 15:18):
Violeta Hernández (Mar 29 2023 at 15:19):
Surely this means to_Set
should go?
Eric Wieser (Mar 29 2023 at 15:28):
I think you could reasonably delete both mem
and to_Set
Violeta Hernández (Mar 29 2023 at 15:30):
The rest of the file follows the pattern of not inlining instances
Violeta Hernández (Mar 29 2023 at 15:30):
I recall I had some opposition when I tried to change that a few months ago
Violeta Hernández (Mar 29 2023 at 15:30):
So I'd rather keep mem
for now
Violeta Hernández (Mar 29 2023 at 15:33):
Mario Carneiro (Mar 29 2023 at 19:43):
to_Set
and Class.mem
are not the same, the argument order is reversed (and this is important, because it is intended to be used partially applied)
Mario Carneiro (Mar 29 2023 at 19:46):
you should read it as to_Set (B : Class) : Set Class := {A | A \in B}
Eric Wieser (Mar 29 2023 at 20:18):
Should we change it to actually say that?
Mario Carneiro (Mar 29 2023 at 20:23):
This file doesn't use Set A
, it uses A -> Prop
and lambdas, and so it's actually
to_Set (B : Class) : Class -> Prop := fun A => A \in B
at which point the usual style guide kicks in and moves A
before the colon
Mario Carneiro (Mar 29 2023 at 20:28):
but we could use the docstring to emphasize that it is actually a unary function with a function codomain even though it looks like a binary function
Mario Carneiro (Mar 29 2023 at 20:29):
of course there is no difference for the type theory but it affects the sensibility of the name to_Set
Eric Wieser (Mar 29 2023 at 20:41):
Are you talking about docs4#Set or docs#Set?
Mario Carneiro (Mar 29 2023 at 20:45):
Mario Carneiro (Mar 29 2023 at 20:45):
the A -> Prop
one
Violeta Hernández (Mar 30 2023 at 13:17):
Mario Carneiro said:
This file doesn't use
Set A
, it usesA -> Prop
and lambdas
That's the convention we settled on for classes specifically, under the logic that in vanilla ZFC, classes are really predicates with another name. That discussion is summarized in the docs#Class docstring.
For everything else, I believe it would be best if we used whichever of these two makes the most syntactic sense.
We already use set Class
in docs#Class_to_Cong, so there's precedent for this.
Violeta Hernández (Mar 30 2023 at 13:19):
On this note, isn't to_Set
also identical to Class_to_Cong
? Both literally and syntactically.
Last updated: Dec 20 2023 at 11:08 UTC