Zulip Chat Archive
Stream: general
Topic: ascending/descending factorial notation
Yaël Dillies (Jun 11 2021 at 06:54):
We're trying to come up with nice notation for the ascending ((n + k)!/n!) and descending (n!/(n - k)!) factorials. I'm pretty partial to nꜝk
for the ascending one, but there isn't an index version. Here's what searching for "exclamation" on the Unicode website yields:
n!k
n¡k
nǃk
n‼k
I swear this symbol is great for double factorialn⁈k
n⁉k
n❕k
n❗k
n❢k
n❣k
nꜝk
This one could be nice for the ascending factorialnꜞk
Maybe this one for the descending factorial?nꜟk
Or this one?n︕k
n﹗k
n!k
Which do you prefer? Also, do you like the layoutn <operator> k
?
Alex J. Best (Jun 11 2021 at 07:03):
Its not pretty but you could also try and approximate the Pochammer symbol notation withn⁽k⁾
(untested if this can work in lean)
Yaël Dillies (Jun 11 2021 at 07:04):
I was thinking about n^(k)
and n_(k)
but it doesn't look that great and it always bugged me that ascending adn descending factorials weren't using exclamation marks.
Alex J. Best (Jun 11 2021 at 07:08):
I do like the symmetry of pairs like n¡k
nǃk
and nꜝk
nꜞk
. Did you look at https://en.wikipedia.org/wiki/Falling_and_rising_factorials#Alternate_notations the superscript + and minus versions there could work? Or of course just P(n,k)
...
Mario Carneiro (Jun 11 2021 at 07:19):
I will be very sad if there are big computations involving nꜝk / nꜞk
. At reasonable distances they are not distinguishable
Mario Carneiro (Jun 11 2021 at 07:20):
honestly I think n^(k)
and n_(k)
are better, although there are probably other issues with that
Mario Carneiro (Jun 11 2021 at 07:21):
how about n !+ k
and n !- k
Yaël Dillies (Jun 13 2021 at 17:28):
I'm now defining the notation: infix
!⁺ :50 := asc_factorial
.
What's the correct priority?
Mario Carneiro (Jun 13 2021 at 17:29):
probably somewhere around +, *, ^ : what do you want to be higher priority?
Yaël Dillies (Jun 13 2021 at 17:29):
I think we want !⁺
to have priority.
Mario Carneiro (Jun 13 2021 at 17:30):
so a ^ b !+ c
means a ^ (b !+ c)
?
Yaël Dillies (Jun 13 2021 at 17:30):
Or rather I think it fits between +
and ^
Mario Carneiro (Jun 13 2021 at 17:30):
*
is also between those
Yaël Dillies (Jun 13 2021 at 17:31):
It should probably be below *
Yaël Dillies (Jun 13 2021 at 17:32):
I think we more often want to multiply an ascending factorial than to ascend factor(?) a product.
Kevin Buzzard (Jun 13 2021 at 17:32):
You can use #print notation *
to see the priority of everything. There is no right answer here. You have to decide what you want a * b !+ c
to mean.
Mario Carneiro (Jun 13 2021 at 17:32):
so between 65 and 70 then. Should it be equal to either one?
Kevin Buzzard (Jun 13 2021 at 17:32):
You could see how other notations are used in the literature.
Mario Carneiro (Jun 13 2021 at 17:32):
a lot of other things have prec 65 or 70 since that means they get ordered in the same left associative class
Mario Carneiro (Jun 13 2021 at 17:33):
like + and - are both 65
Mario Carneiro (Jun 13 2021 at 17:33):
so that a + b - c
means (a + b) - c
and a - b + c
means (a - b) + c
Yaël Dillies (Jun 13 2021 at 17:33):
Ah sorry, I meant that !⁺
should have priority over *
Kevin Buzzard (Jun 13 2021 at 17:34):
When we were defining things like external direct sums and products etc we looked in the literature to see how these things were used. We had to decide what mathematicians meant by
Kevin Buzzard (Jun 13 2021 at 17:35):
If people are using notation like or whatever then it should have a very high priority.
Mario Carneiro (Jun 13 2021 at 17:36):
#print notation
is even better since it shows all notations (although it would be nice to sort it by priority)
Yaël Dillies (Jun 13 2021 at 17:36):
Yeah, exactly.
Mario Carneiro (Jun 13 2021 at 17:37):
scalar smul has priority 73
Yaël Dillies (Jun 13 2021 at 17:37):
But I don't think we ever use a ^ b !⁺ c
as a ^ (b !⁺ c)
Yaël Dillies (Jun 13 2021 at 17:37):
However a !⁺b ^ c
could be (a !⁺b) ^ c
Mario Carneiro (Jun 13 2021 at 17:38):
oh, you want them to be equal prec?
Yaël Dillies (Jun 13 2021 at 17:38):
Parsing it as a !⁺ (b ^ c)
is fine, though
Mario Carneiro (Jun 13 2021 at 17:39):
also, FWIW I still think it's better without unicode
Mario Carneiro (Jun 13 2021 at 17:39):
it's literally "+ k"
Yaël Dillies (Jun 13 2021 at 17:39):
Yeah but isn't like conflicting notation with +
?
Mario Carneiro (Jun 13 2021 at 17:39):
no, !+
is a token
Mario Carneiro (Jun 13 2021 at 17:40):
or will be
Yaël Dillies (Jun 13 2021 at 17:40):
Okay then :)
Mario Carneiro (Jun 13 2021 at 17:40):
it will cause a problem if someone wants to write a!+b
to mean a! + b
but we put spaces in that kind of thing anyway by style guide
Yaël Dillies (Jun 13 2021 at 17:43):
So infix
!+ :74 := asc_factorial
is fine?
Eric Wieser (Jun 13 2021 at 18:01):
(a zulip tip - use double backticks for code containing `
, triple backticks for code containing ``
, etc)
Mario Carneiro (Jun 13 2021 at 19:04):
you should put spaces around it like infix ` !+ `:74 := asc_factorial
, which makes it appear with spaces around it when pretty printed
Yaël Dillies (Jun 13 2021 at 19:12):
I already have :smile:
Scott Morrison (Jun 16 2021 at 07:41):
How about just no notation? I think unfamiliar notation is generally worse than nothing.
Yaël Dillies (Jun 16 2021 at 08:44):
Have you had a look at the PR? (#7759) It looks nice in my opinion.
Eric Wieser (Jun 16 2021 at 17:27):
I think it would be best not to introduce new notation in the same PR as one that swaps around definition names - it would be much easier to review whether the notation is a good idea if it were a PR that did nothing other than switch existing lemmas to the new notation
Yaël Dillies (Jun 16 2021 at 17:29):
Okay sure. Will split
Last updated: Dec 20 2023 at 11:08 UTC