Fractions are not put in lowest terms when the base ring has relations, carrying an arbitrarily large common integer factor
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
This issue was triaged from bugs/mike/1-big-coeffs-in-fractions, one of the 857 files removed from the pre-GitHub bugs/ tree by d2c8d27826 and catalogued in #36. The commentary below was written by Claude (Claude Opus 5, via Claude Code), not by @d-torrance, whose account posted it -- please weigh it accordingly.
The original file, verbatim (130 lines)
R = frac(QQ[x]/(x^5-2)[y])
F = (x/(y-2) + 1 + x*y)
G = F^2*F
f = numerator F^3
g = denominator F^3
f/g
f^3
g^3
(f^3) // (g^3)
S = frac(QQ[x,y]/(x^5-2))
syz matrix{{denominator G, numerator G}}
i16 : use frac(QQ[x]/(x^5-2)[y])
//QQ [x]\ \
o16 = frac||------|[y]|
|| 5 | |
\\x - 2/ /
o16 : FractionField
i17 : (x/(y-2) + 1 + x*y)^4
4 8
54793191022000727827015529616000x y + (- 43834552817600582261612423692
o17 = -----------------------------------------------------------------------
-----------------------------------------------------------------------
4 3 7
8000x + 219172764088002911308062118464000x )y + (15342093486160203791
-----------------------------------------------------------------------
-----------------------------------------------------------------------
4 3
56434829248000x - 1753382112704023290464496947712000x + 3287591461320
-----------------------------------------------------------------------
-----------------------------------------------------------------------
2 6 4
04366962093177696000x )y + (- 3068418697232040758312869658496000x + 5
-----------------------------------------------------------------------
-----------------------------------------------------------------------
3
917664630376078605317677198528000x - 263007316905603493569674542156800
-----------------------------------------------------------------------
-----------------------------------------------------------------------
2 5
0x + 219172764088002911308062118464000x)y + (383552337154005094789108
-----------------------------------------------------------------------
-----------------------------------------------------------------------
4 3
7073120000x - 10958638204400145565403105923200000x + 8547737799432113
-----------------------------------------------------------------------
-----------------------------------------------------------------------
2
541014422620096000x - 1753382112704023290464496947712000x + 5479319102
-----------------------------------------------------------------------
-----------------------------------------------------------------------
4 4
2000727827015529616000)y + (- 3068418697232040758312869658496000x + 1
-----------------------------------------------------------------------
4
54793191022000727827015529616000y - 43834552
-----------------------------------------------------------------------
3
2054502024840160121943416515520000x - 14465402429808192146332099818624
-----------------------------------------------------------------------
3 2
8176005822616124236928000y + 1315036584528017467848372710784000y - 17
-----------------------------------------------------------------------
2
000x + 5479319102200072782701552961600000x - 4383455281760058226161242
-----------------------------------------------------------------------
53382112704023290464496947712000y + 876691056352011645232248473856000
-----------------------------------------------------------------------
3 4
36928000)y + (1534209348616020379156434829248000x - 78902195071681048
-----------------------------------------------------------------------
-----------------------------------------------------------------------
3 2
07090236264704000x + 13479124991412179045445820285536000x - 832856503
-----------------------------------------------------------------------
-----------------------------------------------------------------------
2
5344110629706360501632000x + 1315036584528017467848372710784000)y + (-
-----------------------------------------------------------------------
-----------------------------------------------------------------------
4
438345528176005822616124236928000x + 28492459331440378470048075400320
-----------------------------------------------------------------------
-----------------------------------------------------------------------
3 2
00x - 6575182922640087339241863553920000x + 6136837394464081516625739
-----------------------------------------------------------------------
-----------------------------------------------------------------------
316992000x - 1753382112704023290464496947712000)y + 5479319102200072782
-----------------------------------------------------------------------
-----------------------------------------------------------------------
4 3
7015529616000x - 438345528176005822616124236928000x + 131503658452801
-----------------------------------------------------------------------
-----------------------------------------------------------------------
2
7467848372710784000x - 1753382112704023290464496947712000x + 876691056
-----------------------------------------------------------------------
-----------------------------------------------------------------------
352011645232248473856000
------------------------
//QQ [x]\ \
o17 : frac||------|[y]|
|| 5 | |
\\x - 2/ /
Where it stands today
Fractions are not put in lowest terms when the base ring has quotient relations, so an arbitrarily
large integer factor is carried in both numerator and denominator.
i1 : R = frac(QQ[x]/(x^5-2)[y]);
i2 : F = (x/(y-2) + 1 + x*y)^4;
i3 : denominator F
4 3
o3 = 1443087550851217253118659088405235200y - 11544700406809738024949272707241881600y - ...
That leading coefficient has 37 digits. The same computation over a base ring without relations comes
out in lowest terms:
i4 : S = frac(QQ[z]);
i5 : denominator (1/(z-2) + 1 + z)^4
4 3 2
o5 = z - 8z + 24z - 32z + 16
The factor is exactly removable. Writing C for that 37-digit integer, denominator F == C*(y-2)^4
is true, numerator F is divisible by C, and dividing it out leaves
x^4*y^8 + (-8*x^4+4*x^3)*y^7 + (28*x^4-32*x^3+6*x^2)*y^6 + ...
with coefficients of one or two digits. So F differs from its reduced form only by C/C.
Cause
FractionField::simplify only cancels when use_gcd_simplify is set, and the constructor clears that
flag whenever the base ring is a quotient:
https://github.com/Macaulay2/M2/blob/development/M2/Macaulay2/e/rings/frac.cpp#L38-L46
frac(QQ[x]/(x^5-2)[y]) flattens to a ring with one relation, so use_gcd_simplify is false, the
branch holding the content division — divide_by_given_content on numerator and denominator — is
skipped, and nothing removes the common factor. Two lines below the flag is set there is an
acknowledged #warning "frac simplify: doesn't handle towers of fracs".
This looks like a consequence of gcd being unavailable over such rings rather than an independent
decision; see #4622, where gcd refuses over an
extension because factoryAlmostGood walks past the defining relation.
Relation to other work in this area
- #4462 is open and reworks
frac.cpp. It adds
simplify_unit_denominator, which cancels when the denominator is a unit. The denominator here is
C*(y-2)^4, which is not, so that path returns early and control reaches the same disabled branch.
On reading the diff it therefore appears not to fix this — but that branch was not built and tested,
so treat this as a reading rather than a measurement. - #3172 and
#3173 concern the same construction crashing when the
gcd fails during simplification, which was made to raise instead. - #4461 is about canonical form,
1/2*yagainsty/2.
Where this came from
Cataloguing the bugs/ directory removed in d2c8d27826 (#36). bugs/mike/1-big-coeffs-in-fractions
records a session whose output carries coefficients such as 438345528176005822616124236928000,
which is what the file is named for.
open · disposition issue · source of truth: bug-triage/catalog.tsv
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Macaulay2/e/rings/frac.cpp, especially FractionField::simplify, use_gcd_simplify, and divide_by_given_content. Reproduce the quotient-ring example from the issue, then compare the disabled path with #4462 and the gcd behavior discussed in #4622. Done means the common integer factor is removed safely without breaking fraction simplification over rings with relations.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100