Closed pjbruin closed 10 years ago
Dear Peter,
I like very much the documentation in algebraic_closure
. Thank you.
For each problem below, I think we need to find a solution which might be: either write specifications in the documentation or provide a fix that change the behaviour.
1) Equality among algebraic closures is not constant over time:
sage: F1 = AlgebraicClosureFiniteField(GF(3), 'z', use_database=False)
sage: F2 = AlgebraicClosureFiniteField(GF(3), 'z', use_database=False)
sage: F1 == F2
True
sage: F1.gen(3)
z3
sage: F1 == F2
False
sage: F2.gen(3)
z3
sage: F1 == F2
True
It becomes really weird when we play with pickling
sage: p = 100003
sage: K = GF(p).algebraic_closure()
sage: K2 = loads(dumps(K))
sage: K.gen(3)
z3
sage: K == K2
False
One fix is to use identity in comparisons of the parent themselves as I suggested in previous comments. The only drawback I see is that K == loads(dumps(K))
will be False
. I think it would be safer that way.
2) Get a very strange error from conversions between different algebraic closures that can be fixed introducing more type checking in the methods.
sage: from sage.rings.algebraic_closure_finite_field import AlgebraicClosureFiniteField
sage: F1 = AlgebraicClosureFiniteField(GF(3), 'z')
sage: F2 = AlgebraicClosureFiniteField(GF(3), 'z')
sage: F1(F2.gen(1))
Traceback (most recent call last):
...
TypeError: no canonical coercion from Algebraic closure of Finite Field of size 3 to Finite Field of size 3
3) (minor) The cache in algebraic_closure
does not take into account the default arguments.
sage: K1 = GF(5).algebraic_closure(implementation='pseudo_conway', use_database=True)
sage: K2 = GF(5).algebraic_closure(implementation='pseudo_conway')
sage: K4 = GF(5).algebraic_closure()
sage: K1 is K2 or K1 is K3 or K2 is K3
False
One fix is to move the cache at the level of AlgebraicClosureFiniteField
, but on the other hand it is good to have the cache at a Cython level.
That's all Vincent
Thanks for your feedback, Vincent! The two new commits should address your points (1) and (2), respectively. As for (3), I thought about moving the cache to AlgebraicClosureFiniteField
, but then we would have to be very careful with weak references to make sure we don't store every algebraic closure forever. Another (ugly) solution would be to duplicate the same default arguments everywhere. I think it is not really worth the trouble, especially because the following does work:
sage: GF(5).algebraic_closure('z') is GF(5).algebraic_closure()
True
I expect it is much more likely that users switch between specifying the 'z' or not than that they switch between specifying keyword arguments or not.
Hi Peter,
I agree with your analysis of (3).
All test pass and the documentation builds.
There is a typo which becomes ugly in the compiled documentation. At line 960 of algebraic_closure_finite_field.py
you wrote `:meth:~sage.rings.finite_rings.finite_field_base.FiniteField.algebraic_closure`
instead of :meth:`~sage.rings.finite_rings.finite_field_base.FiniteField.algebraic_closure`
.
Once the change done, you can set to positive review.
Vincent
Branch pushed to git repo; I updated commit sha1. New commits:
b0e1539 | Trac 14990: fix typo in documentation |
Reviewer: Vincent Delecroix
Done. Thanks a lot for your thorough review!
Changed branch from u/pbruin/14990 to b0e1539
Some change introduced by this ticket is being discussed in this sage-devel thread.
for information, Pari/GP 2.10 implements finite field embeddings. See http://pari.math.u-bordeaux.fr/Events/PARI2018/talks/features.pdf
Flint will soon have them too. See https://github.com/wbhart/flint2/pull/351.
Are the embeddings in PARI/GP compatible?
Would be nice to have both of them interfaced in Sage together with the version that is already there!
The goal of this ticket is a basic implementation of algebraic closures of finite fields. Most importantly, it provides the following:
AlgebraicClosureFiniteField_generic
(abstract base class)subfield(n)
returning a tuple consisting of the subfield of order pn and aRingHomomorphism_im_gens
giving the canonical embedding into the algebraic closureAlgebraicClosureFiniteField_pseudo_conway
(implements the specific defining polynomials of the finite subfields and the relations between the generators of these subfields)AlgebraicClosureFiniteFieldElement
(mostly a wrapper aroundFiniteFieldElement
, so actually an element of a finite subfield, but having the algebraic closure as its parent and taking care of coercion into larger subfields)AlgebraicClosureFiniteField
(to get unique parents)FiniteField.algebraic_closure()
(invokes the factory class)An example using the new functionality is the following analogue of the example from #8335:
To add, we first embed into
Fbar
:One can also do this without explicitly invoking the embeddings; as a shortcut,
Fbar
has a methodgen(n)
returning the fixed generator of the subfield of degree n, but as an element ofFbar
:It is conceivable that there will be different coexisting implementations (deriving from
AlgebraicClosureFiniteField_generic
). The current implementation uses Conway polynomials and the pseudo-Conway polynomials from #14958, as well as the functionality for finite field homomorphisms provided by #13214.Depends on #14958 Depends on #13214
CC: @roed314 @jpflori @sagetrac-JCooley @sagetrac-dfesti @defeo @videlec @sagetrac-erousseau
Component: algebra
Keywords: finite field algebraic closure
Author: Peter Bruin
Branch:
b0e1539
Reviewer: Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/14990