Skip to content

add simplfication/ canonicalization to FunctionFields#2393

Open
fieker wants to merge 1 commit intomasterfrom
CF/SimplifyFldFunElem
Open

add simplfication/ canonicalization to FunctionFields#2393
fieker wants to merge 1 commit intomasterfrom
CF/SimplifyFldFunElem

Conversation

@fieker
Copy link
Copy Markdown
Contributor

@fieker fieker commented Apr 15, 2026

fixes Tobias' is_irreducible problem:

julia> Qt, t = rational_function_field(QQ, :t)
julia> Qtx, x = Qt[:x]
julia> f = x^4 + 4*(t^12-t)*x
julia> K = splitting_field(f)
julia> R, s = K[:s]
julia> r = roots(K, f)[1] #the root might vary
(1//72*b^4 + (-1//2*t^12 + 1//2*t)*b)//(t^12 - t)

julia> g = s^2 - r^3 - t^12 + t
s^2 + 3*t^12 - 3*t

julia> is_irreducible(g) #this kills time and memory without the fix

I do not really know how to test this...it does not change the mathematics, but the performance - in particular in functions not available in AA...

fixes Tobias' is_irreducible problem:

julia> Qt, t = rational_function_field(QQ, :t)
julia> Qtx, x = Qt[:x]
julia> f = x^4 + 4*(t^12-t)*x
julia> K = splitting_field(f)
julia> R, s = K[:s]
julia> r = roots(K, f)[1] #the root might vary
(1//72*b^4 + (-1//2*t^12 + 1//2*t)*b)//(t^12 - t)

julia> g = s^2 - r^3 - t^12 + t
s^2 + 3*t^12 - 3*t

julia> is_irreducible(g) #this kills time and memory without the fix

I do not really know how to test this...it does not change the
mathematics, but the performance - in particular in functions not
available in AA...
@fieker fieker added enhancement New feature or request release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Apr 15, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.12%. Comparing base (3355a14) to head (7694dc7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2393      +/-   ##
==========================================
- Coverage   88.13%   88.12%   -0.01%     
==========================================
  Files         128      128              
  Lines       32886    32890       +4     
==========================================
+ Hits        28983    28984       +1     
- Misses       3903     3906       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tobias271828
Copy link
Copy Markdown

@fieker Thank you very much for this helpful PR!

parent::FunctionField{T}

function FunctionFieldElem{T}(R::FunctionField{T}, num::Poly{S}, den::S) where {T <: FieldElement, S <: PolyRingElem{T}}
if !iszero(num) #normalize the denominator
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why only do this if the numerator is not zero? In the case of it being zero, couldn't we canonicalize even more by setting the denominator to 1?

Comment on lines +1092 to +1094
c = inv(content(den))
num *= c
den *= c
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
c = inv(content(den))
num *= c
den *= c
c = content(den)
num = divexact(num, c)
den = divexact(den, c)

A long time ago someone (you) told me that I should not use inv when doing division :)

@fieker
Copy link
Copy Markdown
Contributor Author

fieker commented Apr 17, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants