Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - style: CoeFun for PFunctor.Obj & MvPFunctor.Obj #7526

Closed
wants to merge 9 commits into from

Conversation

Komyyy
Copy link
Collaborator

@Komyyy Komyyy commented Oct 5, 2023


Open in Gitpod

@Komyyy Komyyy added awaiting-review The author would like community review of the PR awaiting-CI labels Oct 5, 2023
@Komyyy Komyyy changed the title refactor: CoeFun for PFunctor.Obj & MvPFunctor.Obj style: CoeFun for PFunctor.Obj & MvPFunctor.Obj Oct 6, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 9, 2023
@Komyyy Komyyy removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 12, 2023
@@ -38,122 +38,125 @@ open MvFunctor (LiftP LiftR)
variable {n m : ℕ} (P : MvPFunctor.{u} n)

/-- Applying `P` to an object of `Type` -/
@[coe]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the coe attribute do? Since we also have the explicit CoeFun instance a few lines lower

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function with a coe attribute is printed as .

id_map := @id_map _ P
comp_map := @comp_map _ P

/-- Constant functor where the input object does not affect the output -/
def const (n : ℕ) (A : Type u) : MvPFunctor n :=
def Const (n : ℕ) (A : Type u) : MvPFunctor n :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, MvPFunctor is a structure, so the naming convention calls for this definition to be lowerCamelCase.
Then again, the point of this PR is to pretend that MvPFunctor is a Type-valued function, in which case we do UpperCamelCase.

I support this change, since it improves consistency between MvPFunctor and MvFunctor, but still I think we should discuss on a Zulip thread whether we want to treat structures with a CoeFun instance as if they were function types, and if so, to document this exception in the naming convention document.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this discussion, I decided to use lowerCamelCase.

@@ -39,37 +39,41 @@ namespace PFunctor
instance : Inhabited PFunctor :=
⟨⟨default, default⟩⟩

variable (P : PFunctor) {α β : Type u}
variable (P : PFunctor.{u}) {α : Type v₁} {β : Type v₂}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
variable (P : PFunctor.{u}) {α : Type v₁} {β : Type v₂}
variable (P : PFunctor.{u}) {α β : Type*}

I think this should have the same effect, but is a bit more succinct

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to fix the order of universe variables as u, v₁, v₂.
With Type*, the order of universe variables becomes v₁, v₂, u.

def Obj (α : Type*) :=
Σx : P.A, P.B x → α
@[coe]
def Obj (α : Type v) :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, what is your motivation for changing Type* to explicitly giving the universe variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to fix the order of universe variables as u, v.
With Type*, the order of universe variables becomes v, u.

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 17, 2023
@Komyyy Komyyy removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 18, 2023
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors d=@digama0

As this is largely stylistic, I'll let Mario decide since they were involved in the initial development.

@bors
Copy link

bors bot commented Oct 18, 2023

✌️ digama0 can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added delegated and removed awaiting-review The author would like community review of the PR labels Oct 18, 2023
@digama0
Copy link
Member

digama0 commented Oct 19, 2023

bors r+

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Oct 19, 2023
bors bot pushed a commit that referenced this pull request Oct 19, 2023
@bors
Copy link

bors bot commented Oct 19, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title style: CoeFun for PFunctor.Obj & MvPFunctor.Obj [Merged by Bors] - style: CoeFun for PFunctor.Obj & MvPFunctor.Obj Oct 19, 2023
@bors bors bot closed this Oct 19, 2023
@bors bors bot deleted the Komyyy/PFunctor.Obj branch October 19, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants