Zulip Chat Archive

Stream: mathlib4

Topic: capitals in Logic.Equiv.Defs file


Kevin Buzzard (Nov 18 2022 at 20:53):

We have Equiv.unique in mathlib4 and it's a def. Should it be Equiv.Unique? Same question for Equiv.symm, Equiv.trans, Equiv.decidableEq, Equiv.inhabited, Equiv.equivCongr, Equiv.permCongr, Equiv.plift... (all defs but have been decapitalised).

Mario Carneiro (Nov 18 2022 at 20:59):

I think so... some of them might be theorem-cased but none of them should be type-cased because they aren't types

Mario Carneiro (Nov 18 2022 at 20:59):

it sounds like they should all be def-cased though

Kevin Buzzard (Nov 18 2022 at 21:02):

There are tons of these, also in Logic.Equiv.Basic. The autoporter has called α × Empty ≃ Empty prodEmpty but it's a def so I'm changing it to ProdEmpty. In particular the conventions for Logic.Equiv.Basic (which I'm porting) are going to be different to those in Logic.Equiv.Defs (which is already ported) at this rate (unless I change Logic.Equiv.Devs too). @Scott Morrison do you have an opinion on this?

Mario Carneiro (Nov 18 2022 at 21:03):

no no, mathport is right here

Mario Carneiro (Nov 18 2022 at 21:04):

ProdEmpty would be if it was defining a type, i.e. something whose type is Type u or Prop

Mario Carneiro (Nov 18 2022 at 21:04):

for example:

def Equiv.Rel (e : A ~= B) (x : A) (y : B) : Prop := e x = y

Kevin Buzzard (Nov 18 2022 at 21:06):

Oh I'd misunderstood! Terms which are not types are lowerCamelCase!

Mario Carneiro (Nov 18 2022 at 21:06):

for something like Equiv.symm, it should be def-cased (lowerCamelCase) because it is constructing "data", i.e. something which is not a proposition:

def Equiv.symm (e : A ~= B) : B ~= A := sorry

Mario Carneiro (Nov 18 2022 at 21:08):

and for completeness: things which construct elements of a proposition are theorem-cased (snake_case), containing name components from the definitions it uses:

def Equiv.symm_symm (e : A ~= B) : e.symm.symm = e := sorry

Yakov Pechersky (Nov 18 2022 at 21:08):

Mario Carneiro said:

it sounds like they should all be def-cased though

I see, I was confused by Kevin calling it a lemma, while it's really an Equiv term.

Kevin Buzzard (Nov 18 2022 at 21:12):

def pemptyProd (α : Type _) : PEmpty × α  PEmpty :=

So the rules are that this should be decapitalised because it's a term-not-a-type, and I think pEmpty looks weird so I'm going for this. Have I finally got it right?

Kevin Buzzard (Nov 18 2022 at 21:15):

def boolEquivPUnitSumPUnit : Bool  Sum PUnit.{u + 1} PUnit.{v + 1} :=

The autoporter gave me boolEquivPunitSumPunit


Last updated: Dec 20 2023 at 11:08 UTC