-
Notifications
You must be signed in to change notification settings - Fork 126
rename GRing.exp to pown
#1503
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
base: master
Are you sure you want to change the base?
rename GRing.exp to pown
#1503
Conversation
d8e78f5 to
e55cf5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm not providing an exhaustive review, I think many lemmas are poorly named. In many of them, pownr should be changed to powrn because of the order of the parameters of pown.
What about expn in ssrnat.v and exprz in intmul.v? (The latter is indeed not a power function, but do we really want GRing.pown to be a "power function" while we call exprz "exponentiation"?)
| Lemma expr2 x : x ^+ 2 = x * x. Proof. by []. Qed. | ||
| Lemma pownr0 x : x ^+ 0 = 1. Proof. by []. Qed. | ||
| Lemma pownr1 x : x ^+ 1 = x. Proof. by []. Qed. | ||
| Lemma pownr2 x : x ^+ 2 = x * x. Proof. by []. Qed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that these lemmas should be called powr0n, powr1n, and powr2n, because these 0, 1, and 2 are nat. (See mulr0n, mulr1n, and mulr2n in nmodule.v.)
| Lemma pownr2 x : x ^+ 2 = x * x. Proof. by []. Qed. | ||
|
|
||
| Lemma exprS x n : x ^+ n.+1 = x * x ^+ n. | ||
| Lemma pownrS x n : x ^+ n.+1 = x * x ^+ n. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
powrSnpowrS, like mulrS
|
|
||
| Lemma expr0n n : 0 ^+ n = (n == 0%N)%:R :> R. | ||
| Proof. by case: n => // n; rewrite exprS mul0r. Qed. | ||
| Lemma pown0n n : 0 ^+ n = (n == 0%N)%:R :> R. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pow0rn, like mul0rn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the names pown0n and pown1n (below) look ambiguous because they do not contain r; that is, these names do not indicate that these lemmas are for ring-like structures.
|
|
||
| Lemma expr1n n : 1 ^+ n = 1 :> R. | ||
| Proof. by elim: n => // n IHn; rewrite exprS mul1r. Qed. | ||
| Lemma pown1n n : 1 ^+ n = 1 :> R. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pow1rn
|
|
||
| Lemma exprD x m n : x ^+ (m + n) = x ^+ m * x ^+ n. | ||
| Proof. by elim: m => [|m IHm]; rewrite ?mul1r // !exprS -mulrA -IHm. Qed. | ||
| Lemma pownrD x m n : x ^+ (m + n) = x ^+ m * x ^+ n. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
powrDn? But I'm not so sure. (The additive counterpart is mulrnDr, but it makes sense only because natmul is both left- and right-distributive.)
|
|
||
| Lemma exprSr x n : x ^+ n.+1 = x ^+ n * x. | ||
| Proof. by rewrite -addn1 exprD expr1. Qed. | ||
| Lemma pownrSr x n : x ^+ n.+1 = x ^+ n * x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
powrSr, like mulrSr?
| Qed. | ||
|
|
||
| Lemma exprMn_n x m n : (x *+ m) ^+ n = x ^+ n *+ (m ^ n) :> R. | ||
| Lemma pownMn_n x m n : (x *+ m) ^+ n = x ^+ n *+ (m ^ n) :> R. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
powrMn_n?
| Qed. | ||
|
|
||
| Lemma exprM x m n : x ^+ (m * n) = x ^+ m ^+ n. | ||
| Lemma pownrM x m n : x ^+ (m * n) = x ^+ m ^+ n. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
powrMn?
|
Thanks for the comments. For the naming, I have indeed taken a conservative approach, essentially using As for ssrnat and ssrint, I thought of doing it later (even in another PR) because the review of this PR will answer several questions about naming that will tell us what to do about ssrnat and ssrint and also because we might want to get ssralg.v asap since it is the target of current, orthogonal revisions. |
The names I suggested do not remove
I consider this transitional state a major naming inconsistency, and thus, I prefer to make these changes in a single PR. At the very least, we need to have a rough idea of how we will converge. |
|
IIRC, the motivation of this change is a name conflict with an |
|
@affeldt-aist Is this the meeting you're referring to? It doesn't even say we decided to rename |
|
|
IMO, the following definitions should ideally follow the same naming pattern, with no ambiguity/naming conflict:
One solution I can think of is to make the following renaming:
Although What do you think? |
|
I also argue that renaming |
I'll address all your comments but I am a bit skeptical about enlarging the scope of this PR to other naming issues because it could take a long time to complete. |
|
I agree that my proposal goes beyond what we usually do in a single PR. I think that renaming |
|
I suggest waiting for some input from others before starting any implementation work. @Tragicus @CohenCyril @proux01 |
|
I think I would prefer the |
|
@pi8027 thanks for questioning the renaming, however please do not target this PR or @affeldt-aist who kindly volunteered to experiment with the change we decided during the above mentioned meeting. |
|
by the way, on the MathComp-Analysis side, @jmmarulang has been working to extend |
|
@CohenCyril Right. I didn't see the issues before reading the patch. @affeldt-aist Just in case, let me write down the naming convention I suggest here, so that we can discuss it further at some point. This is based on my understanding of the naming convention for the lemmas about As a rule of thumb, a lemma whose conclusion has the form
Note that we shouldn't use very short abbreviations like As a result, the names of lemmas for Although it obviously doesn't cover everything, I hope it conveys my idea. |
Motivation for this change
as decided during the regular meeting
Minimal TODO list
withdoc/changelog/make-entry.shSee this Checklist for details.
Automatic note to reviewers
Read this Checklist.