Zulip Chat Archive

Stream: mathlib4

Topic: naming conventions


Kevin Buzzard (Oct 21 2022 at 09:57):

I've heard a rumour that there is still no final decision made on casing in mathlib4 theorem names. My belief right now is that when we have ported a bunch of these grimy low-level files which have few tactics available then the manual porting job is going to get much easier and in particular more people will be able to get involved, so I see porting these low-level files as a high priority task (in fact there are several reasons why I believe this). Let me talk about the beginning of data.bool.basic, a file so low-level in mathlib3 that it has no imports at all, meaning that you don't even get a tada emoji when you finish a tactic proof, although this is not really an issue because there is only one begin end block in the entire file anyway.

The block below is referring to naming of the first few theorems in data.bool.basic. The format of the block is:

mathlib3_name : mathlib3_statement
mathlib3port auto-gen name
my proposed mathlib4_name : mathlib4_statement

Note that mathlib3's tt : bool is mathlib4's true : Bool, mathlib3's to_bool is mathlib4's decide, mathlib3's coe_sort is mathlib4's CoeSort.coe. Note also that I am not speaking from a position of authority when it comes to mathlib4 naming -- in fact I am speaking from a position of complete cluelessness. On the other hand I'm thoroughly enjoying porting data.bool.basic even though it's turning out to be very hard work (I'm still only a quarter of the way through -- I work on it when I'm on my commute). Any advice as to what these things should be called would be welcome -- even if the advice is "quit changing the mathlib3port names". [note added in proof: I just realised that mathlib3port is not changing the names at all!]

If names get changed, my understanding is that I should do #align mathlib3_name mathlib4_name after the proof of the theorem. Is that right?

theorem coe_sort_tt : coe_sort.{1 1} tt = true :=
coe_sort_tt
theorem CoeSort_coe_true : ( true : Prop) = True :=

theorem coe_sort_ff : coe_sort.{1 1} ff = false :=
coe_sort_ff
theorem CoeSort_coe_false : ( false : Prop) = False :=

theorem to_bool_true {h} : @to_bool true h = tt :=
to_bool_true
theorem decide_True {h} : @decide True h = true :=

theorem to_bool_false {h} : @to_bool false h = ff :=
to_bool_false
theorem decide_False {h} : @decide False h = false :=

theorem to_bool_coe (b:bool) {h} : @to_bool b h = b :=
to_bool_coe
theorem decide_coe (b : Bool) {h} : @decide b h = b :=

theorem coe_to_bool (p : Prop) [decidable p] : to_bool p  p :=
coe_to_bool
theorem coe_decide (p : Prop) [d : Decidable p] : decide p  p :=

lemma of_to_bool_iff {p : Prop} [decidable p] : to_bool p  p :=
of_to_bool_iff
theorem of_decide_iff {p : Prop} [Decidable p] : decide p  p :=

lemma tt_eq_to_bool_iff {p : Prop} [decidable p] : tt = to_bool p  p :=
tt_eq_to_bool_iff
theorem true_eq_decide_iff {p : Prop} [Decidable p] : true = decide p  p :=

lemma ff_eq_to_bool_iff {p : Prop} [decidable p] : ff = to_bool p  ¬ p :=
ff_eq_to_bool_iff
theorem false_eq_decide_iff {p : Prop} [Decidable p] : false = decide p  ¬p :=

Mario Carneiro (Oct 21 2022 at 10:17):

theorem CoeSort_coe_true : ( true : Prop) = True :=

This one is actually true_eq_true_eq_True if you actually look at the statement:

CoeSort_coe_true : (true = true) = True

Theorems about coercions are going to be misleading like this, and most likely they should just be removed and all applications of the theorem should use something else.

Mario Carneiro (Oct 21 2022 at 10:18):

The standard way of coercing a bool to a prop is currently b = true, so we should probably come up with some naming convention for this that doesn't require spelling out the eq_true all the time

Mario Carneiro (Oct 21 2022 at 10:21):

Since coe doesn't actually show up in any of the statements of the lemmas, I would avoid names that contain coe. Other suggestions: to_bool_coe -> decide_bool, coe_to_bool -> decide_eq_true, of_to_bool_iff -> isn't this the same theorem?, tt_eq_to_bool_iff -> true_eq_decide, ff_eq_to_bool_iff -> false_eq_decide

Yakov Pechersky (Oct 23 2022 at 23:28):

Re mentions of coe, what's the mathlib4 equivalent of a lemma that has the following statement?

theorem cases_on'_none_coe (f : Option α  β) (o : Option α) :
    casesOn' o (f none) (f  coe) = f o := by

What do we put now instead of coe?

Mario Carneiro (Oct 24 2022 at 03:36):

(↑)

Yakov Pechersky (Oct 24 2022 at 03:44):

Thanks! Can one do explicit ((a : α) : Option α) as well?

Kevin Buzzard (Oct 24 2022 at 06:07):

When I tried to use a coercion (in this case \-|u or whatever order you put those three characters in) it was automatically unfolded in the statement I was using it in. Is this normal?

Mario Carneiro (Oct 24 2022 at 06:31):

yes, this is a significant difference from lean 3

Mario Carneiro (Oct 24 2022 at 06:32):

The function coe basically never shows up in statements anymore, coercions are now unfolded at elaboration time

Mario Carneiro (Oct 24 2022 at 06:33):

(I'm not sure what anagram of those characters you mean, I usually just use \u)

Kevin Buzzard (Oct 24 2022 at 07:07):

(I was coe'ing to sort)

Scott Morrison (Oct 24 2022 at 10:13):

So... what is the casing rule for things like

theorem lift_rel_subrelation_lex : Subrelation (LiftRel r s) (Lex r s) := LiftRel.lex

?

  1. Leave as is, to avoid having to write lots of #align statements, and potentially do a big rename after the port?
  2. Rename to LiftRel_Subrelation_Lex, and add lots of #align statements.

I think I prefer 1., however much that leaves lemma names unpredictable for now.

Mario Carneiro (Oct 24 2022 at 10:15):

I think it is better to take advantage of our heavy work on tool-assisted renaming now rather than postponing what could be thousands of renames into the future

Mario Carneiro (Oct 24 2022 at 10:16):

I've been reviewing diffs of lean3port and it's really looking a lot better than before

Mario Carneiro (Oct 24 2022 at 10:24):

Personally, the way I've been leaning toward combining our snake-casing theorem convention with capitalized definition names is to lowercase the definitions without going full snake case so that name components stay together. So your example would be rendered as liftRel_subrelation_lex

Mario Carneiro (Oct 24 2022 at 10:26):

Name components in a theorem would only stay capitalized when this is needed to work around a name conflict, as in And_assoc, although even here I'm inclined to use and_assoc for associativity of And and Bool.and_assoc for associativity of and

Yakov Pechersky (Oct 24 2022 at 12:36):

For this subrel example, we rename explicitly in a manual way in the file correct? Is there any align we need to define here?

Mario Carneiro (Oct 24 2022 at 13:10):

If the name is not the one that mathport would have already generated, you need to add an #align directive with the original lean 3 name and the new lean 4 name.

Mario Carneiro (Oct 24 2022 at 13:11):

I suggest putting it immediately after the theorem

Jannis Limperg (Oct 24 2022 at 16:05):

Mario Carneiro said:

Name components in a theorem would only stay capitalized when this is needed to work around a name conflict, as in And_assoc, although even here I'm inclined to use and_assoc for associativity of And and Bool.and_assoc for associativity of and

If you need so many exceptions (some of which, like this one, are even non-local), isn't that a sign that the naming convention is not good? Throughout all these discussions, I've never understood what's wrong with taking the 'components' of a theorem's type, with whatever case they have, and putting underscores between them. So And_assoc because it's about And, Subrelation because it's about Subrelation.

Mario Carneiro (Oct 24 2022 at 16:59):

Well, LE_Iff_Eq_Or_LT didn't play well with the focus groups

Mario Carneiro (Oct 24 2022 at 17:00):

The naming conflict in this case could be solved if and was an export of Bool.and

Jannis Limperg (Oct 24 2022 at 17:14):

I don't mind LE_Iff_Eq_Or_LT at all and I think people would get used to it very quickly. So if there's still a chance to go in this direction, I think this should be reconsidered. But I realise I'm quite late.

Mario Carneiro (Oct 24 2022 at 17:26):

Stuff like inv_Eq_Iff_inv_Eq just looks (and is) very random

Jannis Limperg (Oct 24 2022 at 17:47):

It looks a bit funny maybe, but it's perfectly straightforward and predictable. More so than a convention that requires case-folding with exceptions. And the funny looks are not a long-term concern imo. Two months with any naming convention and it'll feel perfectly natural.

Mario Carneiro (Oct 24 2022 at 18:25):

well I'm arguing for case folding (almost) without exceptions. I won't say there are no exceptions but honestly I think that a good naming convention should always allow for exceptions lest you get absurd examples. Naming conventions are for humans, not machines.

Mario Carneiro (Oct 24 2022 at 18:27):

Anyway the naming convention was the source of a long discussion so I don't want to diverge too much from what we are using today

Jannis Limperg (Oct 24 2022 at 20:26):

All right. Doesn't matter too much at the end of the day.

Yakov Pechersky (Oct 25 2022 at 01:11):

Not trying to bikeshed, just get clarity on guidelines... for this instance
instance lift_or_get_is_left_id (f : α → α → α) : IsLeftId (Option α) (liftOrGet f) none :=
should that be liftOrGet_isLeftId? Does it not matter because it is an instance?

Jakob von Raumer (Oct 25 2022 at 07:35):

Wouldn't that be IsLeftId_liftOrGet?

Scott Morrison (Oct 25 2022 at 07:41):

cf. the example

theorem lift_rel_subrelation_lex : Subrelation (LiftRel r s) (Lex r s) := LiftRel.lex

above, which I think we decided to case as liftRel_subrelation_lex. Each CamelCased chunk had its initial capital lowered when forming the theorem name.

Jakob von Raumer (Oct 25 2022 at 07:43):

Remind me, why does subrelation go in the middle here? Because we're to imagine it as an infix operator?

Scott Morrison (Oct 25 2022 at 07:50):

I guess so. I've never had strong opinions about word order in theorem names...

Jon Eugster (Nov 03 2022 at 14:52):

Is there a file where these naming conventions are written down? Seems like https://github.com/leanprover-community/mathlib4/wiki would be a good place.

Yakov Pechersky (Nov 09 2022 at 04:14):

Should docs#cmp_le be CmpLe or CmpLE? How should cmp_le_swap be spelled? cmpLe_swap?
Mathlib3:

def cmp_le {α} [has_le α] [@decidable_rel α ()] (x y : α) : ordering :=

Kevin Buzzard (Nov 09 2022 at 09:09):

Yakov Pechersky said:

Not trying to bikeshed, just get clarity on guidelines... for this instance
instance lift_or_get_is_left_id (f : α → α → α) : IsLeftId (Option α) (liftOrGet f) none :=
should that be liftOrGet_isLeftId? Does it not matter because it is an instance?

Did we get to the bottom of this? I think I have a similar question. Is the below code following the naming convention?

-- `ReflGen r`: reflexive closure of `r` -/
#check @ReflGen -- @ReflGen : {α : Type u_1} → (α → α → Prop) → α → α → Prop
theorem refl_gen_iff (r : α  α  Prop) (a b : α) : ReflGen r a b  b = a  r a b := sorry

I'm still very much getting used to the idea that the concept of "ReflGen" might manifest itself as both ReflGen and refl_gen in names of declarations. Or have I misunderstood?

Eric Wieser (Nov 09 2022 at 09:39):

Mario Carneiro said:

Personally, the way I've been leaning toward combining our snake-casing theorem convention with capitalized definition names is to lowercase the definitions without going full snake case so that name components stay together. So your example would be rendered as liftRel_subrelation_lex

Mario Carneiro said:

Well, LE_Iff_Eq_Or_LT didn't play well with the focus groups

Doesn't your rule above advocate lE_iff_eq_or_lT, which feels worse?

Kevin Buzzard (Nov 09 2022 at 09:49):

Because you're mentioning focus groups let me stress that I have no opinion about the naming convention; Mario's earlier comment that basically everyone will just learn it and get on with it once it's established struck me as probably the truth. My issue is simply that I currently don't understand the naming convention and so struggle to conform to it!

Mario Carneiro (Nov 09 2022 at 12:39):

Yakov Pechersky said:

Should docs#cmp_le be CmpLe or CmpLE? How should cmp_le_swap be spelled? cmpLe_swap?
Mathlib3:

def cmp_le {α} [has_le α] [@decidable_rel α ()] (x y : α) : ordering :=

For acronym name components, I prefer to capitalize / lowercase them as a group, although I think that this has been used inconsistently for LE. That is, this approach would suggest the names CmpLE and cmpLE_swap. Although, I've already violated this rule it seems...

Mario Carneiro (Nov 09 2022 at 12:40):

(Another fun thing about this example is that it is exactly the opposite of your example - it derives LE from an Ordering function rather than the other way around.)

Mario Carneiro (Nov 09 2022 at 12:43):

Eric Wieser said:

Mario Carneiro said:

Well, LE_Iff_Eq_Or_LT didn't play well with the focus groups

Doesn't your rule above advocate lE_iff_eq_or_lT, which feels worse?

As another example, the acronym naming convention would use le_iff_eq_or_lt in this example, this is what I mean by lowercasing as a group.

Mario Carneiro (Nov 09 2022 at 12:45):

But also, it's totally fine to challenge these conventions! I'm just making stuff up here trying to get something that is mostly deterministic, doesn't look too weird, and still has some room for the author's own tastes

Mario Carneiro (Nov 09 2022 at 12:47):

Kevin Buzzard said:

Yakov Pechersky said:

Not trying to bikeshed, just get clarity on guidelines... for this instance
instance lift_or_get_is_left_id (f : α → α → α) : IsLeftId (Option α) (liftOrGet f) none :=
should that be liftOrGet_isLeftId? Does it not matter because it is an instance?

Did we get to the bottom of this? I think I have a similar question. Is the below code following the naming convention?

-- `ReflGen r`: reflexive closure of `r` -/
#check @ReflGen -- @ReflGen : {α : Type u_1} → (α → α → Prop) → α → α → Prop
theorem refl_gen_iff (r : α  α  Prop) (a b : α) : ReflGen r a b  b = a  r a b := sorry

I'm still very much getting used to the idea that the concept of "ReflGen" might manifest itself as both ReflGen and refl_gen in names of declarations. Or have I misunderstood?

no, those should be liftOrGet_isLeftId and reflGen_iff respectively

Yakov Pechersky (Nov 09 2022 at 12:49):

By the way, I've been avoiding this question for instance names by making instances anonymous.

Yakov Pechersky (Nov 09 2022 at 12:50):

For the cmp_le, I also ended up with CmpLE in my PR, so I think we deterministic-ed in the same way.

Mario Carneiro (Nov 09 2022 at 13:18):

One thing that I may or may not have mentioned before: I think instances should be named either like theorems, or using something similar to the automatic lean 4 naming system which is basically inst + the conclusion mashed together into one word, at the author's discretion. In particular I don't think we should use Of ever, which mathport sometimes gets wrong

Mario Carneiro (Nov 09 2022 at 13:23):

When making instances anonymous, make sure to hover on the word "instance" to double check that the autogenerated name is not terribly ambiguous. If the original is named you might also want to #align it (I usually don't align instances unless I think it is being referred to directly for some reason)

Yakov Pechersky (Nov 09 2022 at 13:31):

For a lot of the base files, it's hard to know if named instances will be referred to, since that reference usually comes much later in the import tree

Mario Carneiro (Nov 09 2022 at 13:31):

I usually do a text search in mathlib to get a ballpark estimate

Mario Carneiro (Nov 09 2022 at 13:33):

Some lean 3 instances are named only because the original name was ambiguous and it was causing a duplicate definition error

Yakov Pechersky (Nov 09 2022 at 13:33):

Would it be alright to defer the aligns until the later files are ported? Because sometimes, names are only used because of shorthand, and in those places, an inferInstanceAs can fill in

Mario Carneiro (Nov 09 2022 at 13:33):

That sounds fine

Yakov Pechersky (Nov 09 2022 at 13:33):

Basically, not explicitly naming instances might help with hygiene?

Mario Carneiro (Nov 09 2022 at 13:35):

Instance names are not hygienic, they used to be but this is actually not as great as it sounds on paper because it totally breaks pp.all reprinting

Mario Carneiro (Nov 09 2022 at 13:36):

I think it is better to think of them as part of the public surface of the API, even though they are usually heuristically named and usually don't need to be referred to explicitly

Mario Carneiro (Nov 09 2022 at 13:36):

to_additive does something similar

Moritz Doll (Nov 11 2022 at 00:13):

I don't get the current naming convention yet, but if I understand this thread and Scott's comment on my PR correctly, then docs4#is_empty_pi should be isEmpty_pi, right? Reason is that I looked at that file and thought I was doing the right thing by not changing the alignment..

Moritz Doll (Nov 11 2022 at 00:14):

i.e., type names are firstLowerCamelCase if they appear in lemmas

Scott Morrison (Nov 11 2022 at 01:48):

That's my understanding.

Scott Morrison (Nov 11 2022 at 01:50):

I think we should be permissive about where it is appropriate to fix naming in earlier files. If you feel like making a separate PR, do that, but I think it's fine to include naming issues in PRs that are mostly about porting a later file.

Scott Morrison (Nov 11 2022 at 01:50):

This isn't ideal from a history/reviewing point of view, but I think worthwhile for efficiency.

Moritz Doll (Nov 11 2022 at 01:52):

I can make a PR for renaming the lemmas in that file, mainly as an easy exercise for myself to learn the naming convention.

Moritz Doll (Nov 11 2022 at 01:53):

I would like to add a section in the wiki for the naming convention.

Yakov Pechersky (Nov 11 2022 at 02:09):

I thought they are lower_case_snake_case if they are LowerCaseSnakeCase : Prop though.

Mario Carneiro (Nov 11 2022 at 04:09):

theorems are mostly snake case, but individual name components coming from MyFoo : Prop definitions appear as myFoo_is_bar in theorems, i.e. you don't introduce a _ in the middle of the name

Andrew Yang (Nov 11 2022 at 04:35):

Is there a written documentation / community wiki on the new naming conventions?

Moritz Doll (Nov 11 2022 at 08:04):

why do we have has_rightInverse? this should be hasRightInverse or not?

Moritz Doll (Nov 11 2022 at 08:06):

(deleted)

Moritz Doll (Nov 11 2022 at 08:26):

oh still wrong - it should be HasRightInverse

Moritz Doll (Nov 11 2022 at 09:21):

https://github.com/leanprover-community/mathlib4/wiki#naming-convention comments and improvements are very welcome

Scott Morrison (Nov 11 2022 at 10:09):

We'll get there. :-)

Andrew Yang (Nov 11 2022 at 10:52):

Why is docs4#Cmp in upper camel case? I think it is defining a term?

Moritz Doll (Nov 11 2022 at 11:24):

we also have docs4#Set.mem which does also not conform to the convention, before doing more edits I would like to hear from someone with more to say on these matters (aka Mario) that what I wrote is correct and if that is the case then we can go ahead and fix everything we find.

Moritz Doll (Nov 11 2022 at 11:28):

Also what Yakov mentioned in the morning might become more important: in definition-heavy files the amount of manual aligns is too high and we have to figure out some way to optimize the names that mathport generates. Something along the lines of "get all types of the variables, and if a conversion to snake case matches part of the lemma name then replace that part by camel case".

Yakov Pechersky (Nov 11 2022 at 11:49):

Regarding Cmp, I totally accept that I could have misunderstood the guidelines for it.

Mario Carneiro (Nov 11 2022 at 13:04):

Cmp should be cmp, CmpUsing should be cmpUsing, Set.mem should be Set.Mem

Mario Carneiro (Nov 11 2022 at 13:06):

I think that the type searching heuristic is doable, it just needs some elbow grease

Jakob von Raumer (Nov 11 2022 at 14:13):

Is there a decision on what to do with the distinction between e.g. inf and Inf?

Yaël Dillies (Nov 11 2022 at 14:36):

And docs#lattice vs docs#Lattice?

Mario Carneiro (Nov 11 2022 at 14:36):

well, a Set A is actually a function returning a Prop, so there is an argument to be made that Inf is following the new convention already

Mario Carneiro (Nov 11 2022 at 14:37):

I'm not sure we came to a final consensus on what to do about functions returning sets

Mario Carneiro (Nov 11 2022 at 14:38):

If we want to name them as functions I think inf, infi, sInf, bInf is as good as any

Mario Carneiro (Nov 11 2022 at 14:39):

For lattice vs Lattice the naming convention that mathport implements is to suffix categories with Cat, so they would become Lattice and LatticeCat respectively

Eric Wieser (Nov 11 2022 at 14:42):

Mario Carneiro said:

well, a Set A is actually a function returning a Prop, so there is an argument to be made that Inf is following the new convention already

Can you make that argument more explicitly please?

Eric Wieser (Nov 11 2022 at 14:43):

Mario Carneiro said:

If we want to name them as functions I think inf, infi, sInf, bInf is as good as any

docs#infi is already a thing; are you proposing renaming Inf to infi and infi to ...?

Mario Carneiro (Nov 11 2022 at 14:43):

no I meant keeping infi as is

Yaël Dillies (Nov 11 2022 at 14:43):

I'm not a big fan of appending 3 letters to the names of the numerous categories we have in order theory. Some lemma names are already stupidly long.

Mario Carneiro (Nov 11 2022 at 14:43):

Inf would become sInf there

Mario Carneiro (Nov 11 2022 at 14:44):

:shrug:

Eric Wieser (Nov 11 2022 at 14:44):

What is the bInf of your proposal?

Mario Carneiro (Nov 11 2022 at 14:44):

infimum bounded by a set; it isn't an actual definition but it shows up in lots of lemmas

Eric Wieser (Nov 11 2022 at 14:45):

What we call binfi right now (because it's about infi not Inf)

Mario Carneiro (Nov 11 2022 at 14:45):

oh, that's a name change I hadn't noticed

Mario Carneiro (Nov 11 2022 at 14:46):

bInfi works too

Eric Wieser (Nov 11 2022 at 14:46):

Mario Carneiro said:

I'm not sure we came to a final consensus on what to do about functions returning sets

Maybe you're referring to something else, but Inf isn't a function returning a set, it's a function consuming a set

Mario Carneiro (Nov 11 2022 at 14:46):

oh right, I was thinking about set big union

Mario Carneiro (Nov 11 2022 at 14:47):

I think we should go for lowercased names for all of these then

Yaël Dillies (Nov 11 2022 at 14:47):

We should definitely respect capitalisation between Inf and Union. They are genuinely the same function.

Eric Wieser (Nov 11 2022 at 14:48):

No they're not, docs#set.Union is docs#infi

Eric Wieser (Nov 11 2022 at 14:48):

And docs#set.sUnion is docs#Inf

Eric Wieser (Nov 11 2022 at 14:48):

So I think renaming Inf to sInf is very reasonable (along with cInf to csInf?)

Yaël Dillies (Nov 11 2022 at 14:48):

Aah, of course I meant sUnion

Yaël Dillies (Nov 11 2022 at 14:49):

I think cInf can stay as is in this scheme.

Eric Wieser (Nov 11 2022 at 14:49):

Yaël Dillies said:

They are genuinely the same function.

You mean aside from the fact that the union of no sets is empty and the infimum of no sets is the universe, and the functions are morally opposites?

Mario Carneiro (Nov 11 2022 at 14:50):

The argument I alluded to before @Eric Wieser is that when determining whether a definition returns "data" or "a proposition", it depends on whether we unfold the type (up to reducibles, up to semireducibles?). In the case of Set A := A -> Prop that would mean that anything that returns a Set A should be cased like a proposition, i.e. capital camel case

Eric Wieser (Nov 11 2022 at 14:50):

@Mario Carneiro: which in this case doesn't actually apply to Inf due to the confusion above, but does apply to set.sUnion

Mario Carneiro (Nov 11 2022 at 14:51):

Personally I am not a fan of this, I think we should just take the declaration as is without unfolding and hence something returning Set A "returns data" and hence is lowercased

Eric Wieser (Nov 11 2022 at 14:51):

It definitely shouldn't include unfolding, because then we have to rename everything if we change Set to a structure

Yaël Dillies (Nov 11 2022 at 15:41):

Sorry, I meant sUnion and Sup, and sInter and Inf

Moritz Doll (Nov 20 2022 at 12:20):

Mario Carneiro said:

Yakov Pechersky said:

Should docs#cmp_le be CmpLe or CmpLE? How should cmp_le_swap be spelled? cmpLe_swap?
Mathlib3:

def cmp_le {α} [has_le α] [@decidable_rel α ()] (x y : α) : ordering :=

For acronym name components, I prefer to capitalize / lowercase them as a group, although I think that this has been used inconsistently for LE. That is, this approach would suggest the names CmpLE and cmpLE_swap. Although, I've already violated this rule it seems...

I am very sorry for pulling this out again, but I was just trying to port zero_le_one and are we really sure that this file should be named zeroLEOne? It looks wrong to me (I read it as zero_leo_ne) and I then realized that nobody complained that we have (and this is my fault as well and I even took that as an example :silence: ) NeZero..

Mario Carneiro (Nov 20 2022 at 12:26):

it would be zero_le_one

Mario Carneiro (Nov 20 2022 at 12:26):

because it combines zero, LE and one and they all get lowercased and snake-case strung together

Andrew Yang (Nov 20 2022 at 12:27):

Doesn't the current naming convention advocate for NEZero instead, for NE being an acronym?

Mario Carneiro (Nov 20 2022 at 12:27):

that's a good point

Moritz Doll (Nov 20 2022 at 12:27):

Mario Carneiro said:

it would be zero_le_one

It is a file

Mario Carneiro (Nov 20 2022 at 12:27):

I'm inclined to make an exception because Ne already exists in core with that spelling

Moritz Doll (Nov 20 2022 at 12:27):

Andrew that is exactly my point

Mario Carneiro (Nov 20 2022 at 12:28):

There's a file called zero_le_one?

Mario Carneiro (Nov 20 2022 at 12:29):

there is.. what is the world coming to

Moritz Doll (Nov 20 2022 at 12:29):

algebra.order.zero_le_one

Mario Carneiro (Nov 20 2022 at 12:29):

ZeroLEOne

Moritz Doll (Nov 20 2022 at 12:30):

alright. does #align also work for filenames?

Mario Carneiro (Nov 20 2022 at 12:30):

Unsure

Mario Carneiro (Nov 20 2022 at 12:31):

probably not

Mario Carneiro (Nov 20 2022 at 12:31):

there are a few other consumers of the file rename map as well, like leanproject --port-progress, so I think we will have to live with the misalignment

Moritz Doll (Nov 20 2022 at 12:32):

probably not a big problem, since that file is probably not imported too often

Andrew Yang (Nov 20 2022 at 12:37):

Now that we are on this, shouldn't docs4#HasSmul be HasSMul or even SMul according to the Lean4 manual?

Mario Carneiro (Nov 20 2022 at 12:41):

SMul

Riccardo Brasca (Nov 20 2022 at 12:41):

I've proposed this in mathlib4#606

Riccardo Brasca (Nov 20 2022 at 12:42):

But feel free to open another PR for that, I can just merge master in my PR

Yaël Dillies (Nov 20 2022 at 14:30):

I think we can just merge algebra.order.zero_le_one with algebra.order.monoid.defs. None imports one but not the other.

Moritz Doll (Nov 20 2022 at 14:37):

yes, but let's please do that later. I already have mathlib4#664

Yaël Dillies (Nov 20 2022 at 14:56):

No need to hasten. We can do things right: #17646

Arien Malec (Nov 20 2022 at 16:18):

I edited the porting wiki to make the naming rules clearer & added more examples. Please review for accuracy...

Arien Malec (Nov 20 2022 at 16:20):

While we are on it, I'm not at all clear why Ne is UpperCamelCase and isn't treated like LT -- is this to follow Eq?

Arien Malec (Nov 20 2022 at 16:44):

nevermind -- I see this discussion above.

Scott Morrison (Nov 20 2022 at 20:46):

@Moritz Doll, I agree with @Yaël Dillies here that #17646 is worth doing first.

Scott Morrison (Nov 20 2022 at 20:47):

But we should avoid doing this too much, it is costly in time. However in this case it detangles some imports, and I think is valuable.

Scott Morrison (Nov 20 2022 at 20:48):

@Yaël Dillies, could you keep an eye on that PR and merge as soon as CI completes? I'm going to be offline for a while.

Yaël Dillies (Nov 20 2022 at 20:49):

No sorry I locked myself in the library for the next 4 jours :sad:

Ruben Van de Velde (Nov 20 2022 at 20:49):

CI is broken, in fact, but I can push a fix

Scott Morrison (Nov 20 2022 at 20:49):

Okay :-)

Yaël Dillies (Nov 20 2022 at 20:49):

But I welcome anyone to keep an eye on it

Scott Morrison (Nov 20 2022 at 20:49):

Good luck with exams!!

Yaël Dillies (Nov 20 2022 at 20:50):

Thanks Ruben!

Scott Morrison (Nov 20 2022 at 20:50):

@Ruben Van de Velde, I just fixed it, but have limited internet and can't push. :-)

Scott Morrison (Nov 20 2022 at 20:50):

I seem to be allowed to use http, but not ssh, on this network. What fun.

Ruben Van de Velde (Nov 20 2022 at 20:51):

Then I guess I unfairly beat you to it :)

Yaël Dillies (Nov 20 2022 at 20:52):

Exams are far still. The only thing I am preparing to beat up is myself.

Scott Morrison (Nov 20 2022 at 20:52):

I've added a https remote, and will be ready for the next one. I guess I actually need a VPN.

Scott Morrison (Nov 20 2022 at 20:59):

@Ruben Van de Velde, could you double check you got the right imports there? I think you imported more than necessary.

Ruben Van de Velde (Nov 20 2022 at 21:02):

The error was missing linear_ordered_comm_monoid_with_zero, which grep tells me is declared in

src/algebra/order/monoid/with_zero.lean:class linear_ordered_comm_monoid_with_zero (α : Type*)

so I think it's right?

Scott Morrison (Nov 20 2022 at 21:04):

Oh, hmm. Maybe order.hom.basic is not required now, as it's transitively imported? But that doesn't matter. Sorry for the noise.

Scott Morrison (Nov 20 2022 at 21:05):

There's another failure now.

Ruben Van de Velde (Nov 20 2022 at 21:07):

Want me to take a look at this one too?

Scott Morrison (Nov 20 2022 at 21:07):

Could you? I'm getting confused by not having ssh access and sorting out alternate remotes. :-(

Ruben Van de Velde (Nov 20 2022 at 21:08):

Sure

Moritz Doll (Nov 21 2022 at 00:16):

Scott Morrison said:

But we should avoid doing this too much, it is costly in time. However in this case it detangles some imports, and I think is valuable.

I am sorry, I did not look at the PR and thought it was just doing the merging, not the other cleanup.
If the process of untangling imports causes delays in the porting then I am not so sure whether it is a good idea to do it before porting. We have to port all files anyways and moving things around in mathlib3 makes the port only faster if the number of files to port is the bottleneck. Of course these refactors are worthwhile in their own right.

Jireh Loreaux (Nov 21 2022 at 21:44):

Are we changing coe in names to the name of the function they unfold to?

Mario Carneiro (Nov 21 2022 at 21:46):

I think we should

Jireh Loreaux (Nov 21 2022 at 21:46):

that's what I thought, good.

Mario Carneiro (Nov 21 2022 at 21:47):

I mean, the function itself might be named coe, maybe we should use that name more consistently for coe-registered functions

Mario Carneiro (Nov 21 2022 at 21:47):

e.g. Nat.cast -> Nat.coe

Jireh Loreaux (Nov 21 2022 at 21:51):

What about Units.val? Moreover, what if there is more than one coercion on a given type (e.g., ℝ≥0 coerces to both and ℝ≥0∞)?

Mario Carneiro (Nov 21 2022 at 21:52):

if the function has a better name then that's fine

Mario Carneiro (Nov 21 2022 at 21:52):

I would not use the name coe in either of those examples

Yaël Dillies (Nov 21 2022 at 23:47):

I assume we don't want to write toFun in lemma names.

Mario Carneiro (Nov 21 2022 at 23:51):

that one does sound like a function we should call coe

Jireh Loreaux (Nov 23 2022 at 06:01):

Shouldn't docs4#HasSmul just be called Smul?

Moritz Doll (Nov 23 2022 at 06:19):

there is a PR that does that rename

Moritz Doll (Nov 23 2022 at 06:20):

mathlib4#606

Jireh Loreaux (Nov 23 2022 at 06:22):

aha, thanks.

Ruben Van de Velde (Nov 24 2022 at 12:31):

protected theorem IsBot.is_min (h : IsBot a) : IsMin a := fun b _ => h b

Should this be IsBot.isMin?

Ruben Van de Velde (Nov 24 2022 at 14:46):

Ruben Van de Velde said:

protected theorem IsBot.is_min (h : IsBot a) : IsMin a := fun b _ => h b

Should this be IsBot.isMin?

https://github.com/leanprover-community/mathlib4/pull/713

Scott Morrison (Dec 13 2022 at 10:47):

/-- Make a ring homomorphism from an additive group homomorphism from a commutative ring to an
integral domain that commutes with self multiplication, assumes that two is nonzero and `1` is sent
to `1`. -/
def mkRingHomOfMulSelfOfTwoNeZero (h :  x, f (x * x) = f x * f x) (h_two : (2 : α)  0)
    (h_one : f 1 = 1) : β →+* α :=

Could / should this be mkRingHom_of_mul_self_of_two_ne_zero?

Scott Morrison (Dec 13 2022 at 10:50):

This is the last question remaining on mathlib4#958, so probably I'll merge as is.

Winston Yin (Dec 13 2022 at 10:51):

Maybe it’s not aesthetically pleasing, but I don’t see this as any worse than the super long auto generated instance names

Reid Barton (Dec 13 2022 at 10:52):

Well you're not really supposed to need to refer to instances by name, while you do refer to defs by name.

Mario Carneiro (Dec 13 2022 at 11:07):

the current naming convention says no, but I am certainly sympathetic to wanting to snake case this

Mario Carneiro (Dec 13 2022 at 11:08):

but it could also get a shorter name which is less about symbol reading

Eric Wieser (Dec 13 2022 at 11:28):

I don't think we need to block on this for that PR, I just though I should raise it for future consideration

Eric Wieser (Dec 13 2022 at 11:29):

Perhaps something like "Switch to snake case for trailing prop arguments"

Yaël Dillies (Jan 08 2023 at 20:37):

Just found an interesting capitalisation error. docs4#Disjoint.comm should be disjoint.comm because it's a lemma name and dot notation doesn't apply, but clearly the weird name threw off whoever ported it.

Sky Wilshaw (Jan 08 2023 at 20:38):

Should it not be disjoint_comm to match with things like disjoint_self and disjoint_bot_left?

Sky Wilshaw (Jan 08 2023 at 20:39):

Presumably this should apply to the original mathlib3 name too.

Yaël Dillies (Jan 08 2023 at 20:39):

Yes, I am renaming it to disjoint_comm. We could backport the change, but also the #align will take care of it for us so we can avoid the fuss.

Sky Wilshaw (Jan 08 2023 at 20:39):

Ah, nice.

Eric Wieser (Jan 08 2023 at 20:39):

I don't think disjoint.commwould be correct

Sky Wilshaw (Jan 08 2023 at 20:40):

Yeah, there's no disjoint namespace.

Sky Wilshaw (Jan 08 2023 at 20:40):

Or rather, there shouldn't be.

Yaël Dillies (Jan 08 2023 at 20:40):

I didn't want to throw people off by suggesting removing the namespace, but I guess we agree :grinning_face_with_smiling_eyes:

Yaël Dillies (Jan 08 2023 at 20:41):

I guess this is a good reason to get rid of the weird docs#and.comm and friends

Sky Wilshaw (Jan 08 2023 at 20:42):

The names of those lemmas do look pretty weird.

Sky Wilshaw (Jan 08 2023 at 20:43):

I wonder if this is a lint that can be made? If there is a definition/theorem where its namespace is capitalised, it must refer to an item in the environment?

Sky Wilshaw (Jan 08 2023 at 20:43):

...and dot notation should apply.

Eric Wieser (Jan 08 2023 at 20:44):

Or phrased another way; never have two namespaces which are case-insensitively the same?

Yaël Dillies (Jan 08 2023 at 20:44):

Ah, in fact this is a much wider problem than I originally thought. There are some predicates that have corresponding namespaces, and all the basic API about them is dumped into that namespace even when there is no dot notation possible.

Yaël Dillies (Jan 08 2023 at 20:44):

Consider docs4#Commute

Eric Wieser (Jan 08 2023 at 20:44):

I don't think we need to worry about this too much in the port

Eric Wieser (Jan 08 2023 at 20:44):

It's already inconsistent in mathlib 3

Sky Wilshaw (Jan 08 2023 at 20:45):

Eric Wieser said:

Or phrased another way; never have two namespaces which are case-insensitively the same?

This wouldn't fix the original issue, because the namespace was translated to Disjoint.

Yaël Dillies (Jan 08 2023 at 20:45):

The thing is that our new naming convention makes it matter :frown:

Eric Wieser (Jan 08 2023 at 20:45):

This wouldn't fix the original issue, because the namespace was translated to Disjoint.

That's correct though?

Sky Wilshaw (Jan 08 2023 at 20:46):

I think we're talking about different things, I was suggesting that a linter deny the use of the Disjoint namespace when dot notation can't be used, like in Disjoint.comm.

Sky Wilshaw (Jan 08 2023 at 20:46):

I could very easily be misunderstanding though

Sky Wilshaw (Jan 08 2023 at 20:47):

Yaël Dillies said:

The thing is that our new naming convention makes it matter :frown:

At least from my perspective it's just making assumptions visible that we didn't realise we were making

Yaël Dillies (Jan 08 2023 at 20:47):

The thing is that we want to allow lemmas such as docs4#Nat.add_le_add...

Sky Wilshaw (Jan 08 2023 at 20:48):

That makes sense, so my suggestion for a lint rule would absolutely not work.

Sky Wilshaw (Jan 08 2023 at 20:48):

But then again, that implies Disjoint.comm is a reasonable spelling.

Sky Wilshaw (Jan 08 2023 at 20:48):

In this context, disjoint_comm is clearer, but I can't really tell why I think that.

Yaël Dillies (Jan 08 2023 at 20:49):

I think your linter is reasonable so long as it only runs on namespaces associated to predicates.

Yaël Dillies (Jan 08 2023 at 20:49):

In fact, this is the same dichotomy I am making to decide whether a given lemma should be protected (see for example #18076)

Sky Wilshaw (Jan 08 2023 at 20:49):

I think I'd need to see more examples to convince myself it's a good idea.

Yaël Dillies (Jan 08 2023 at 20:50):

cc @Alex J. Best, because we're talking about the linter I made you write

Yaël Dillies (Jan 08 2023 at 20:51):

Empirically, we open namespaces associated to structures, and we don't open namespaces associated to predicates.

Sky Wilshaw (Jan 08 2023 at 20:51):

(ignore)

Yaël Dillies (Jan 08 2023 at 20:52):

The best dichotomy would be to see whether a given namespace is ever opened, but that sounds like a terrible idea :stuck_out_tongue_closed_eyes:

Sky Wilshaw (Jan 08 2023 at 20:56):

The problem I see with Disjoint.comm is that

  • opening the namespace is bad because you end up with the badly named comm
  • not opening the namespace is bad because you have to write Disjoint.comm every time, so you should have named it disjoint_comm instead

Eric Wieser (Jan 08 2023 at 21:13):

  • opening the namespace is bad because you end up with the badly named comm

I don't see how this is any worse than opening the namespace and getting symm

Sky Wilshaw (Jan 08 2023 at 21:14):

I agree, opening that namespace is just generally bad.

Eric Wieser (Jan 08 2023 at 21:14):

I think that's true of a very large number of namespaces

Eric Wieser (Jan 08 2023 at 21:16):

It is definitely annoying that in lean 3 you could try foo_bar.baz and foo_bar_baz when looking for a lemma, but in Lean 4 you have to try FooBar.bar and fooBar_baz which is more than one character different

Sky Wilshaw (Jan 08 2023 at 21:17):

Is it possible for the LSP to just know that those mean the same thing?

Eric Wieser (Jan 08 2023 at 21:18):

It could certainly offer to autocorrect the wrong one to the right one

Eric Wieser (Jan 12 2023 at 12:04):

Am I right in saying that we have a rule that functions in Prop (such as Disjoint) should be UpperCamelCase? If so, why do Nonempty.intro and LE.le not follow this rule?

Mario Carneiro (Jan 12 2023 at 12:41):

Because it's in core. I had a conversation with Leo about this; one of the points he disagrees with on the current style guide is that structure fields being capitalized is too weird (examples given include Membership.mem and LE.le). I've been putting off what to do about this situation, but there is an open PR lean4#1897 about it. Leo has indicated that he doesn't want to lose hair in naming convention discussions, which I totally understand. I'm not really sure how best to approach the situation, but it would be good if we could find a compromise which isn't just special casing these classes.

Thomas Murrills (Jan 13 2023 at 06:45):

If we want a compromise rule that includes these cases, how about:

Structure fields which are not exported and which would otherwise be UpperCamelCase are instead lowerCamelCase.

Thomas Murrills (Jan 13 2023 at 06:45):

The carve-out for exported things makes naming a bit more subtle, but has the benefit of making usage and reading more consistent.

The “real” rule that this implements is just “if it follows a dot, it starts with a lowercase letter” (otherwise it’s named normally)

Johan Commelin (Jan 13 2023 at 18:46):

I'm still confused. Is this right?

theorem ndinter_eq_zero_iff_disjoint {s t : Multiset α} : ndinter s t = 0  Disjoint s t

or should disjoint in the name be Disjoint?

Yaël Dillies (Jan 13 2023 at 18:46):

It should be disjoint because of lowerCamelCase

Eric Wieser (Mar 01 2023 at 14:48):

What's the lower-cased version of docs4#SMulCommClass ? smulCommClass or sMulCommClass? If you look at the instances we currently have a mixture

Anne Baanen (Mar 01 2023 at 14:50):

Based on how I pronounce it in my mind, I'd write smulCommClass. (yum!)

Eric Wieser (Mar 01 2023 at 14:53):

!4#2557

Jireh Loreaux (Mar 01 2023 at 15:03):

It's smul because of the lowercase as a group rule.

Siddhartha Gadgil (Mar 10 2023 at 09:07):

Should the square root of -1 be Complex.I or Complex.i? @Eric Wieser suggested Complex.I and in mathlib3 it is complex.I (but mathport used lowercase)

Scott Morrison (Mar 10 2023 at 09:08):

Let's keep .I.

Notification Bot (Apr 02 2023 at 09:26):

29 messages were moved from this topic to #mathlib4 > naming conventions: natCast vs nat_cast by Eric Wieser.

Yury G. Kudryashov (Jun 03 2023 at 03:52):

Hi, why do we drop Is in is_haar_measure etc?

Eric Wieser (Jun 03 2023 at 05:42):

I also think that's strange. Did a human do that, or did mathport?

Yury G. Kudryashov (Jun 03 2023 at 22:42):

It was done by @Pol'tta / Miyahara Kō in !4#4496 and approved by @Chris Hughes and @Johan Commelin.

Heather Macbeth (Jun 03 2023 at 23:44):

This seems like a bad idea given that we need to distinguish docs#measure_theory.measure.is_haar_measure from docs#measure_theory.measure.haar_measure.

Eric Wieser (Jun 04 2023 at 00:16):

Also IsAddLeftInvariant got renamed to AddLeftInvariant

Eric Wieser (Jun 04 2023 at 00:16):

@Pol'tta / Miyahara Kō, can you explain why you did this rename?

Eric Wieser (Jun 04 2023 at 00:17):

Were you confusing Is with Has?

Yury G. Kudryashov (Jun 04 2023 at 00:45):

Heather Macbeth said:

This seems like a bad idea given that we need to distinguish docs#measure_theory.measure.is_haar_measure from docs#measure_theory.measure.haar_measure.

Now we have HaarMeasure (TC) vs haarMeasure (def)

Pol'tta / Miyahara Kō (Jun 04 2023 at 00:46):

Sorry, I didn't read the porting wiki well and misunderstood the rule for IsLawfulFoo.

Pol'tta / Miyahara Kō (Jun 04 2023 at 00:46):

I will make the PR which fix this.

Yury G. Kudryashov (Jun 04 2023 at 00:47):

Thank you!

Eric Wieser (Jun 04 2023 at 01:15):

I'm not sure I know what #porting-wiki says there... (edit: what's the linkifier?)

Pol'tta / Miyahara Kō (Jun 04 2023 at 04:20):

!4#4639 is ready to review.

Jireh Loreaux (Jun 07 2023 at 18:46):

What is our stance on UpperCamelCase versus lowerCamelCase for things which are technically terms, but which have a CoeSort and we always think of them as types? The example I have in mind because I'm currently porting it is docs#weak_dual.character_space. Technically, this has type (in Lean 4 notation) Set (WeakDual 𝕜 A), but we are always using it as a type. In fact, it being of type Set (WeakDual 𝕜 A) as opposed to being a type synonym for a subtype of WeakDual 𝕜 A is entirely an implementation detail.

Eric Wieser (Jun 07 2023 at 18:59):

Arguably it's not an implementation detail, because the user has to use coeSort everywhere

Jireh Loreaux (Jun 07 2023 at 19:09):

Fair enough, for that and other reasons I concede it's not an implementation detail.

Jireh Loreaux (Jun 07 2023 at 19:10):

So what should I do with the namespace WeakDual.CharacterSpace? Should I call it WeakDual.characterSpace?

Eric Wieser (Jun 07 2023 at 19:10):

Refactor it in mathlib3 first and make it a subtype!

Reid Barton (Jun 07 2023 at 19:10):

But technically technically, Set X = X -> Prop so t : Set X is still a type

Eric Wieser (Jun 07 2023 at 19:10):

Eric Wieser said:

Refactor it in mathlib3 first and make it a subtype!

The other reason to do this is I think it will make dot notation work.

Eric Wieser (Jun 07 2023 at 19:11):

@Reid Barton, I don't understand that reasoning at all

Jireh Loreaux (Jun 07 2023 at 19:12):

I am looking at that refactor, however, we would lose the ability to (easily) say things like docs#weak_dual.character_space.union_zero

Eric Wieser (Jun 07 2023 at 19:12):

You could instead take the range of the coercion to talk about the set

Jireh Loreaux (Jun 07 2023 at 19:13):

Right, it's just not quite as easy.

Jireh Loreaux (Jun 07 2023 at 19:13):

It would give us dot notation though. @Frédéric Dupuis I know we discussed this design choice back when you defined the character space. Do you have thoughts on the matter?

Frédéric Dupuis (Jun 07 2023 at 19:43):

From what I recall, my impression at the time was that using a set as a type worked quite seamlessly, whereas using a subtype as a set was very painful, so we went with a set even though most of the time we want to think of it as a type.

Frédéric Dupuis (Jun 07 2023 at 19:44):

If the subtype approach turns out to be not so painful after all, I'd be happy with it.

Jireh Loreaux (Jun 07 2023 at 20:48):

Okay, I'll look into that refactor further.

Jireh Loreaux (Jun 07 2023 at 21:43):

This seems feasible and not too much of a headache (in some places it's likely nicer), but I don't have a strong reason to do it before the port. We can reconsider after the port whether we want a set with CoeSort or a subtype.

Johan Commelin (Jun 08 2023 at 03:54):

Eric Wieser said:

Reid Barton, I don't understand that reasoning at all

Is X → Type considered a type? Reid is saying that t : Set X is a family of Props.

Wojciech Nawrocki (Jun 08 2023 at 18:48):

While porting CategoryTheory.Closed.Cartesian I came across (already ported) names isIso_of_mono_of_isSplitEpi and Adjunction.leftAdjointOfNatIso. There are more names in both styles. I would have expected either the latter to be Adjunction.leftAdjoint_of_natIso, or the former to be isIsoOfMonoOfIsSplitEpi. Is this an inconsistency, or is there a rule?

Ruben Van de Velde (Jun 08 2023 at 18:50):

There is a rule, and it's whether the result is a Prop or not

Scott Morrison (Jun 09 2023 at 08:00):

It's not the greatest rule, but it's a rule. :-)

Yury G. Kudryashov (Jun 12 2023 at 15:19):

Should we translate docs#measure_theory.has_pdf as HasPdf or HasPDF?

Jireh Loreaux (Jun 12 2023 at 15:32):

HasPDF is the only thing that makes sense to me.

Jireh Loreaux (Jun 12 2023 at 15:32):

Is there precedent for things like HasPdf?

Yury G. Kudryashov (Jun 12 2023 at 15:34):

docs4#ENNReal

Yury G. Kudryashov (Jun 12 2023 at 15:36):

I'll fix !4#4962 later today.

Jireh Loreaux (Jun 12 2023 at 16:14):

That's not a precedent because the Real part isn't an acronym, whereas PDF is.

Alex Keizer (Jun 12 2023 at 16:39):

There's MvQPF as a precedent for capitalizing the entire abbreviation.

Floris van Doorn (Jun 14 2023 at 10:24):

The gamma function in Lean 3 was called complex.Gamma/real.Gamma. In Lean 4, should we keep Gamma capitalized or use the usual capitalization conventions (i.e. lowercase gamma)? (c.f. !4#5042)

Sebastien Gouezel (Jun 14 2023 at 10:26):

This was already discussed in mathlib 3. We settled on Gamma to avoid confusing it with the gamma constant. I think the same applies in Lean 4.

Floris van Doorn (Jun 14 2023 at 10:28):

ok!

Mario Carneiro (Jun 14 2023 at 16:55):

I agree regarding confusion from that clear name clash, but I wonder if we can't use some other mechanism than capitalization, like Complex.gammaF

Mario Carneiro (Jun 14 2023 at 16:56):

it seems kind of similar to the is_o / is_O thing, we shouldn't be treating notations directly as label names

Jireh Loreaux (Jun 14 2023 at 16:57):

I know it's longer, but Complex.gammaFun seems even better to me.

Mario Carneiro (Jun 14 2023 at 16:57):

yeah I am also okay with that but didn't want to be the one to propose it :)

Trebor Huang (Jun 27 2023 at 04:33):

The mathematica solution is EulerGamma for the constant (although it has different casing conventions)

Timo Carlin-Burns (Jul 01 2023 at 22:05):

docs3#pgame.domineering.L is uppercase because it's talking about an L-shaped fragment of a chess board. Should this remain uppercase in mathlib4 despite not being a type?

Edit: I think uppercase. Hopefully my PR reviewer agrees

Yuyang Zhao (Sep 10 2023 at 04:21):

Are names like docs#AdjoinRoot.Minpoly.toAdjoin and docs#SetCoe.forall appropriate? docs#AdjoinRoot.Minpoly.toAdjoin references docs#minpoly. SetCoe in docs#SetCoe.forall is not even a name.

Yuyang Zhao (Sep 10 2023 at 04:26):

In general, what should we do when a non-UpperCamelCase name comes before the dot?

Anatole Dedecker (Sep 10 2023 at 08:11):

SetCoe is just the name of a namespace, like Metric in Metric.ball, so I think this one is fine (although, for consistency, we should decide whether to move all Subtype. that are really about sets in the SetCoe namespace)

Ruben Van de Velde (Dec 16 2023 at 19:32):

Should docs#IsFreeGroup.MulEquiv really start with a capital M?

Jireh Loreaux (Dec 16 2023 at 19:32):

No


Last updated: Dec 20 2023 at 11:08 UTC