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

Factoring padic polynomials #12561

Open
sagetrac-bsinclai mannequin opened this issue Feb 22, 2012 · 70 comments
Open

Factoring padic polynomials #12561

sagetrac-bsinclai mannequin opened this issue Feb 22, 2012 · 70 comments

Comments

@sagetrac-bsinclai
Copy link
Mannequin

sagetrac-bsinclai mannequin commented Feb 22, 2012

OM Tree construction and a native sage implementation of padic polynomial factoring using it. This factorization works for polynomials over Zp as well as over unramified and totally ramified extensions of Zp.

Depends on #15190
Depends on #14825
Depends on #20310

CC: @roed314 @pjbruin

Component: padics

Keywords: sd86.5, sd87, padicIMA

Work Issues: add to reference manual, improve arithmetic of FrameElt, FrameEltTerm (i.e., give them a parent)

Author: Brian Sinclair, Sebastian Pauli

Branch/Commit: u/roed/ticket/12561 @ 0e7f566

Reviewer: Julian Rüth

Issue created by migration from https://trac.sagemath.org/ticket/12561

@sagetrac-bsinclai sagetrac-bsinclai mannequin added this to the sage-5.11 milestone Feb 22, 2012
@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Feb 23, 2012

Attachment: 12561.patch.gz

@saraedum
Copy link
Member

comment:1

On the wiki page about padic factoring it says that the implementation doesn't work correctly for some examples. Is there only a problem with some specific cases? I just tried a few products of low degree polynomials and the factorizations seemed ok.

I want to try to debug the code, so if you know of any simple examples for which it doesn't work, that would be helpful.

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jan 26, 2013

comment:2

Other than the poor state of documentation and polish, I cannot find any faults. I have run the code through all of the previously failed examples with no issue outside of occasionally having insufficient precision. The newton polygon code does not elegantly handle the infinite slope case (the case where the current phi actually divides Phi), but it doesn't have to for factoring since it can be (and is) caught earlier in the loop.

@haikona
Copy link
Mannequin

haikona mannequin commented Feb 28, 2013

comment:3

Patch applies correctly on 7.5 and all doctests written so far pass. However:

In the doctest from pfactortree():

sage: from sage.rings.polynomial.padics.factor.factoring import jorder4,pfactortree 
sage: f = ZpFM(2,24,'terse')['x']( (x^32+16)*(x^32+16+2^16*x^2)+2^34 ) 
sage: pfactortree(f) # long (3.8s) 
[(1 + O(2^24))*x^64 + (65536 + O(2^24))*x^34 + (32 + O(2^24))*x^32 + (1048576 + O(2^24))*x^2 + (256 + O(2^24))] 

This is just returning the polynomial unfactored, so demonstrably the factoring isn't working here. We should get:

sage: f = ZpFM(2,24,'terse')['x']( (x^32+16)*(x^32+16+2^16*x^2)+2^34 )
sage: f.factor()
((1 + O(2^24))*x^32 + (65536 + O(2^24))*x^2 + (16 + O(2^24))) * ((1 + O(2^24))*x^32 + (16 + O(2^24)))

Also, we should rework this code so that a sage Factorization object is returned, and that pfactortree is called by the .factor() method attached to p-adic polynomials.

@roed314
Copy link
Contributor

roed314 commented Mar 1, 2013

comment:4

Replying to @haikona:

Patch applies correctly on 7.5 and all doctests written so far pass. However:

In the doctest from pfactortree():

sage: from sage.rings.polynomial.padics.factor.factoring import jorder4,pfactortree 
sage: f = ZpFM(2,24,'terse')['x']( (x^32+16)*(x^32+16+2^16*x^2)+2^34 ) 
sage: pfactortree(f) # long (3.8s) 
[(1 + O(2^24))*x^64 + (65536 + O(2^24))*x^34 + (32 + O(2^24))*x^32 + (1048576 + O(2^24))*x^2 + (256 + O(2^24))] 

This is just returning the polynomial unfactored, so demonstrably the factoring isn't working here. We should get:

sage: f = ZpFM(2,24,'terse')['x']( (x^32+16)*(x^32+16+2^16*x^2)+2^34 )
sage: f.factor()
((1 + O(2^24))*x^32 + (65536 + O(2^24))*x^2 + (16 + O(2^24))) * ((1 + O(2^24))*x^32 + (16 + O(2^24)))

Also, we should rework this code so that a sage Factorization object is returned, and that pfactortree is called by the .factor() method attached to p-adic polynomials.

Note that increasing the precision yields a factorization:

sage: f = ZpFM(2,44,'terse')['x']( (x^32+16)*(x^32+16+2^16*x^2) + 2^34)
sage: pfactortree(f)
[(1 + O(2^44))*x^32 + (7242791239680 + O(2^44))*x^30 + (13194407968768 + O(2^44))*x^28 + (7902202888192 + O(2^44))*x^26 + (2147483648 + O(2^44))*x^24 + (442381107200 + O(2^44))*x^22 + (21474836480 + O(2^44))*x^20 + (6193337597952 + O(2^44))*x^18 + (240518168576 + O(2^44))*x^16 + (2405122965504 + O(2^44))*x^14 + (2886218022912 + O(2^44))*x^12 + (16766847680512 + O(2^44))*x^10 + (1099511627776 + O(2^44))*x^8 + (2190164885504 + O(2^44))*x^6 + (14293651161088 + O(2^44))*x^4 + (14178492350464 + O(2^44))*x^2 + (8796093022224 + O(2^44)),
 (1 + O(2^44))*x^32 + (10349394804736 + O(2^44))*x^30 + (8796093022208 + O(2^44))*x^28 + (5291936645120 + O(2^44))*x^26 + (17149804937216 + O(2^44))*x^22 + (11398848446464 + O(2^44))*x^18 + (15187063078912 + O(2^44))*x^14 + (825338363904 + O(2^44))*x^10 + (15402021158912 + O(2^44))*x^6 + (3413693759488 + O(2^44))*x^2 + (8797166764048 + O(2^44))]

In the case Simon pointed out, adding 2^34 doesn't do anything since the precision cap of the base ring is 24, so we have an actual example of a reducible polynomial being claimed to be irreducible.

@saraedum
Copy link
Member

comment:5

The algorithm used in pfactortree only works for square-free polynomials, so I don't think this is a bug. Square-free decomposition doesn't work currently though, see #13439.

@saraedum
Copy link
Member

comment:6

Oh wait. I looked at the wrong numbers sorry.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Oct 14, 2013

comment:8

Attachment: 12561.2.patch.gz

This new patch replaces the first and has a great deal of improvements, bug-fixes, and documentation. The examples should be more sensible now.

It should successfully factor monic, square-free, fixed-mod padic polynomials without fail.

I am running more tests to ensure its validity as well as implementing the transformations needed to handle non-monic cases, which would leave it only dependant on square-free decomposition.

@saraedum
Copy link
Member

comment:9

Nice. I volunteer to review this once it is ready. On a first look, several methods still don't have docstrings (but you are probably aware of this).

@jdemeyer
Copy link

comment:10

Please be aware of #15422 (which fixes some bugs in Sage's factoring of non-squarefree p-adic polynomials).

@roed314
Copy link
Contributor

roed314 commented Jan 4, 2014

Dependencies: #15190

@roed314
Copy link
Contributor

roed314 commented Jan 4, 2014

Commit: f40ee7c

@roed314
Copy link
Contributor

roed314 commented Jan 4, 2014

Branch: u/roed/ticket/12561

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jan 6, 2014

Changed branch from u/roed/ticket/12561 to u/bsinclai/ticket/12561

@roed314
Copy link
Contributor

roed314 commented Jan 7, 2014

Changed branch from u/bsinclai/ticket/12561 to u/roed/ticket/12561

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jan 7, 2014

Changed branch from u/roed/ticket/12561 to u/bsinclai/ticket/12561

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 7, 2014

Changed commit from f40ee7c to e97aa08

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 7, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

e97aa08Added check at FrameElt.polynomial to not allow negative exponents. Added example to FrameElt.residue.

@roed314
Copy link
Contributor

roed314 commented Jan 7, 2014

Changed branch from u/bsinclai/ticket/12561 to u/roed/ticket/12561

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jan 7, 2014

Changed branch from u/roed/ticket/12561 to u/bsinclai/ticket/12561

@roed314
Copy link
Contributor

roed314 commented Jan 8, 2014

Changed branch from u/bsinclai/ticket/12561 to u/roed/ticket/12561

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jan 8, 2014

Changed branch from u/roed/ticket/12561 to u/bsinclai/ticket/12561

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jan 8, 2014

New commits:

f2e4f41Adding a bit more documentation
2bf9723Merge branch 'u/bsinclai/ticket/12561' of git://trac.sagemath.org/sage into ticket/12561
61d57efAdding more doctests, fixing trailing whitespace
60f5d9bMiscellaneous style improvements, rewrite of _newton_polygon using monotone chain algorithm
6432e20Changes to make sure types of slope, _exponent, Eplus, etc are consistent - int, Integer or Rational.
1d3f6c6A few more changes related to variable types
0ec528dFix ignoring non-monics with all coefficients divisible by uniformizer. Fixes in FrameElt.
ab1540dMerge branch 'u/bsinclai/ticket/12561' of git://trac.sagemath.org/sage into ticket/12561
e1bb657Remove unneeded if-else statements in Frame.seed and Frame.find_psi. Fixed example in FrameElt.reduce.

@saraedum
Copy link
Member

Last 10 new commits:

8081eabadded doctests after fixing conflicts
063b58cMerge branch 'develop' into t/20073/ticket/20073
48be601Added documentation to verify that the extension has the right defining polynomial
921af5eChanging modulus and defining_polynomial to use an exact keyword
39043f1Merge branch 't/23331/allow_exact_defining_polynomials_for_p_adic_extensions' into t/20310/change_precision
77779eaminor docstring changes
6e2495fMerge branch 't/23331/allow_exact_defining_polynomials_for_p_adic_extensions' into t/20310/change_precision
7428353minor docstring fixes
998b3c1Merge branch 't/20310/change_precision' into t/12561/ticket/12561
8c171f9remove conflict markers

@saraedum
Copy link
Member

Changed commit from 195abcc to 8c171f9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

9a519eaimprove documentation
81ab3a8Remove __cmp__
7366625Implement __hash__
45dfd22improve documentation
0af8e52Added some high level documentation for associated factors
bd15d71add exact keyword
9d01c94Merge branch 't/23331/allow_exact_defining_polynomials_for_p_adic_extensions' into t/12561/ticket/12561
9ca7f24fix doctest

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Changed commit from 8c171f9 to 9ca7f24

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

7e620cdRenamed associated factor to residual factor
206443aHigh level documentation for frames
805801cCleanup documentation of Frame

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Changed commit from 9ca7f24 to 805801c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

fb41e0eAdded spaces for code layout

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Changed commit from 805801c to fb41e0e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

45bcdd9Improve documentation of FrameElt

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 20, 2017

Changed commit from fb41e0e to 45bcdd9

@saraedum
Copy link
Member

comment:44

I think it would be very nice to come up with a parent for FrameElt and FrameEltTerm and then inherit from Element for these. This would make implementation of arithmetic much easier I think.

Isn't FrameElt basically just a sparse polynomial whose coefficients are FrameEltTerm? I actually find it surprising that FrameEltTerm exists. It's just wrapping a FrameElt except in the base case where it is wrapping a constant. I think that a tower of sparse polynomial rings could give you the same much more easily.

Not sure if you feel like rewriting this or if we should postpone this.

@saraedum
Copy link
Member

Work Issues: add to reference manual, improve arithmetic of FrameElt, FrameEltTerm (i.e., give them a parent)

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jul 20, 2017

Changed commit from 45bcdd9 to 275bc9d

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jul 20, 2017

comment:46

I think that in the end, finding a parent for FrameElt and FrameEltTerm make sense. FrameElts are sparse polynomials of FrameEltTerms and FrameEltTerms are either representations of p-adic integers as valuation-and-unit or (FrameElt in phii-1)*phiideg. However, there are specialized mechanics to consider and these objects are at the core of most of this code.

I think that this would be worthwhile, but might make sense to do as part of a refactor that also collapses segments and residual factors into frames and cleans up the object interface.

@sagetrac-bsinclai
Copy link
Mannequin Author

sagetrac-bsinclai mannequin commented Jul 20, 2017

Changed branch from u/saraedum/ticket/12561 to u/bsinclai/ticket/12561

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 21, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

93f4fe8Fix some doctests, work on comparison functions

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 21, 2017

Changed commit from 275bc9d to 93f4fe8

@roed314
Copy link
Contributor

roed314 commented Aug 21, 2017

Changed branch from u/bsinclai/ticket/12561 to u/roed/ticket/12561

@roed314
Copy link
Contributor

roed314 commented Jul 23, 2018

New commits:

c8a3261Merge branch 'u/bsinclai/ticket/12561' of git://trac.sagemath.org/sage into t/12561/om_tree

@roed314
Copy link
Contributor

roed314 commented Jul 23, 2018

Changed keywords from sd86.5, sd87 to sd86.5, sd87, padicIMA

@roed314
Copy link
Contributor

roed314 commented Jul 23, 2018

Changed commit from 93f4fe8 to c8a3261

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 23, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

0e7f566Merge branch 'u/roed/ticket/12561' of git://trac.sagemath.org/sage into t/12561/padic_poly

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 23, 2018

Changed commit from c8a3261 to 0e7f566

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

No branches or pull requests

4 participants