Finite flat algebras

Finite flat algebras.

class dual_pairs.finite_flat_algebra.FiniteFlatAlgebraFactory(*args: Any, **kwargs: Any)

Factory for finite flat algebras.

create_key(base_ring, *data)

Return a key for the algebra defined by the given data.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: FiniteFlatAlgebra.create_key(QQ, x^2 + 1)
(Rational Field, x^2 + 1, (1, x))
sage: FiniteFlatAlgebra.create_key(QQ, [x, x^2 + 1])
(Rational Field, (x, x^2 + 1), ((1,), (1, x)))
sage: FiniteFlatAlgebra.create_key(QQ, x^3 - x - 1, [1, x^2 - 1, x])
(Rational Field, x^3 - x - 1, (1, x^2 - 1, x))
sage: FiniteFlatAlgebra.create_key(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
(Rational Field, (
[1 0]  [ 0  1]
[0 1], [-1  0]
))
create_object(version, key)

Return the algebra defined by the given key.

sage: from dual_pairs import FiniteFlatAlgebra sage: R.<x> = QQ[] sage: FiniteFlatAlgebra.create_object((8, 8), (QQ, x^2 + 1, (R(1), x))) Monogenic algebra of degree 2 over Rational Field with defining polynomial x^2 + 1 sage: FiniteFlatAlgebra.create_object((8, 8), (QQ, (x, x^2 + 1), ((R(1),), (R(1), x)))) Finite flat algebra of degree 3 over Rational Field, product of: Number Field in a0 with defining polynomial x Number Field in a1 with defining polynomial x^2 + 1 sage: FiniteFlatAlgebra.create_object((8, 8), (QQ, x^3 - x - 1, (R(1), x^2 - 1, x))) Monogenic algebra of degree 3 over Rational Field with defining polynomial x^3 - x - 1 sage: FiniteFlatAlgebra.create_object((8, 8), (QQ, (Matrix(QQ, [[1,0], [0,1]]), Matrix(QQ, [[0,1], [-1,0]])))) Finite flat algebra of degree 2 over Rational Field

class dual_pairs.finite_flat_algebra.FiniteFlatAlgebra_base(*args: Any, **kwargs: Any)

A finite flat algebra over a ring.

This is an abstract base class.

Todo

This should be generalised to not necessarily free modules.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.zero()
0
sage: A.one()
1
sage: B = FiniteFlatAlgebra(QQ, [x, x^2 - 5])
sage: B.zero()
(0, 0)
sage: B.one()
(1, 1)
sage: C = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: C.zero()
0
sage: C.one()
e0
basis()

Return the distinguished basis of self.

This method is required by ModulesWithBasis.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.basis()
(1, a, a^2)
sage: B = FiniteFlatAlgebra(QQ, x^3 - x - 1, [1, x^2 - 1, x])
sage: B.basis()
(1, a^2 - 1, a)
sage: C = FiniteFlatAlgebra(QQ, [x, x^2 - 5])
sage: C.basis()
((1, 0), (0, 1), (0, a1))
sage: D = FiniteFlatAlgebra(QQ, [x, x^3 - x - 1], [[1], [1, x^2 - 1, x]])
sage: D.basis()
((1, 0), (0, 1), (0, a1^2 - 1), (0, a1))
finite_dimensional_algebra()

Return a FiniteDimensionalAlgebra isomorphic to self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.finite_dimensional_algebra()
Finite-dimensional algebra of degree 3 over Rational Field
sage: B = FiniteFlatAlgebra(QQ, [x, x, x^2 - 5])
sage: B.finite_dimensional_algebra()
Finite-dimensional algebra of degree 4 over Rational Field
gen(i)

Return the i-th distinguished generator of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - 27, [1, 3*x, 9*x^2])
sage: A.gen(1)
3*a
sage: A.gens()
(1, 3*a, 9*a^2)
sage: B = FiniteFlatAlgebra(QQ, [x, x^2 - 4], [[1], [1, 2*x]])
sage: B.gen(2)
(0, 2*a1)
sage: B.gens()
((1, 0), (0, 1), (0, 2*a1))
module()

Return the underlying module of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: S.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^4 - 16)
sage: A.module()
Vector space of dimension 4 over Rational Field
multiplication_tensor()

Return the multiplication tensor of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.multiplication_tensor()
[
[1 0 0]  [0 1 0]  [0 0 1]
[0 1 0]  [0 0 1]  [1 1 0]
[0 0 1], [1 1 0], [0 1 1]
]
sage: B = FiniteFlatAlgebra(QQ, [x, x, x^2 - 5])
sage: B.multiplication_tensor()
[
[1 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0]  [0 1 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0]  [0 0 0 0]  [0 0 1 0]  [0 0 0 1]
[0 0 0 0], [0 0 0 0], [0 0 0 1], [0 0 5 0]
]
ngens()

Return the number of distinguished generators of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^2 - 9, [1, 3*x])
sage: A.ngens()
2
sage: B = FiniteFlatAlgebra(QQ, [x, x^2 - 4], [[1], [1, 2*x]])
sage: B.ngens()
3
one()

Return the unit element of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = ZZ[]
sage: A = FiniteFlatAlgebra(ZZ, x^3 - 2)
sage: A.one()
1
ramified_primes()

Return the set of ramified primes of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: A.ramified_primes()
{2}
random_element()

Return a random element of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^2 - 1)
sage: A.random_element()  # random
-1/137*a - 1
sage: B = FiniteFlatAlgebra(QQ, [x, x^2 - 1])
sage: B.random_element()  # random
(0, 1/2*a1 - 1/5)
some_elements()

Return some elements of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^2 - 1)
sage: list(A.some_elements())
[1, ...]
splitting_field_polynomial()

Return a defining polynomial for the splitting field of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.splitting_field_polynomial()
x^6 - 6*x^4 + 9*x^2 + 23
sage: A = FiniteFlatAlgebra(QQ, [x, x^3 - x - 1])
sage: A.splitting_field_polynomial()
x^6 - 6*x^4 + 9*x^2 + 23
tensor_product(other)

Return the tensor product of self and other.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: B = FiniteFlatAlgebra(QQ, x^2 + 23)
sage: AB, i, j, from_prod = A.tensor_product(B)
sage: AB
Finite flat algebra of degree 6 over Rational Field
sage: [i(a) for a in A.gens()]
[e0, e2, e4]
sage: [j(b) for b in B.gens()]
[e0, e1]
sage: from_prod(A.gen(1), B.gen(1))
e3

The tensor product is canonically associative:

sage: A2 = A.tensor_product(A)[0]
sage: A2.tensor_product(B)[0] is A.tensor_product(AB)[0]
True
sage: BA = B.tensor_product(A)[0]
sage: A.tensor_product(BA)[0] is AB.tensor_product(A)[0]
True
to_generic()

Return self as a generic finite flat algebra.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, [x, x^2 + x + 1])
sage: A.to_generic()
Finite flat algebra of degree 3 over Rational Field
class dual_pairs.finite_flat_algebra.FiniteFlatAlgebra_generic(*args: Any, **kwargs: Any)

A finite flat algebra over a ring R, represented as a generic finite algebra (see FiniteDimensionalAlgebra).

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: A
Finite flat algebra of degree 2 over Rational Field
sage: A.category()
Category of finite dimensional algebras with basis over Rational Field
Element

alias of FiniteFlatAlgebraElement_generic

algebra()

Return the underlying algebra of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: alg = A.algebra()
sage: alg
Finite-dimensional algebra of degree 2 over Rational Field
sage: alg.category()
Category of finite dimensional associative algebras with basis over Rational Field
change_ring(R)

Return the base change of self to R.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: A.change_ring(GF(2))
Finite flat algebra of degree 2 over Finite Field of size 2
degree()

Return the degree of self.

discriminant()

Return the discriminant of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: A.discriminant()
-4
is_commutative()

Return whether self is commutative.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: m = [Matrix([[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]]),
....:      Matrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]),
....:      Matrix([[0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]),
....:      Matrix([[0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])]
sage: A = FiniteFlatAlgebra(ZZ, m)
sage: A.is_commutative()
False
morphisms_to_ring(R, as_matrix=False)

Return all ring homomorphisms from self to R.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: A.morphisms_to_ring(GF(2))
[(1, 1)]
sage: A.morphisms_to_ring(GF(3))
[]
sage: A.morphisms_to_ring(GF(5))
[(1, 3), (1, 2)]
sage: A.morphisms_to_ring(Qp(23))
Traceback (most recent call last):
...
PrecisionError: p-adic factorization not well-defined since the discriminant is zero up to the requestion p-adic precision
splitting_field(names)

Return a splitting field for self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: A = FiniteFlatAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])])
sage: A.splitting_field('a')
Number Field in a with defining polynomial x^2 + 1
class dual_pairs.finite_flat_algebra.FiniteFlatAlgebra_monogenic(*args: Any, **kwargs: Any)

A finite flat algebra over a ring R, represented as a quotient of the polynomial algebra R[x].

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: S.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^4 - 16)
sage: A
Monogenic algebra of degree 4 over Rational Field with defining polynomial x^4 - 16
sage: A.category()
Category of finite dimensional commutative algebras with basis over Rational Field
Element

alias of FiniteFlatAlgebraElement_monogenic

algebra()

Return the underlying algebra of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]

sage: A = FiniteFlatAlgebra(QQ, x^2 + 1)
sage: alg = A.algebra()
sage: alg
Number Field in a with defining polynomial x^2 + 1
sage: alg.category()
Category of number fields

sage: B = FiniteFlatAlgebra(QQ, x^3 + x)
sage: alg = B.algebra()
sage: alg
Univariate Quotient Polynomial Ring in a over Rational Field with modulus x^3 + x
change_ring(R)

Return the base change of self to R.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^4 - 16)
sage: A.change_ring(GF(3))
Monogenic algebra of degree 4 over Finite Field of size 3 with defining polynomial x^4 + 2
sage: B = FiniteFlatAlgebra(QQ, x^2 - 1/25, [1, 5*x])
sage: B.change_ring(GF(5))
Finite flat algebra of degree 2 over Finite Field of size 5
degree()

Return the degree of self.

discriminant()

Return the discriminant of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^4 - 16, [1, 1/2*x, 1/4*x^2, 1/8*x^3])
sage: A.discriminant()
-256
sage: B = FiniteFlatAlgebra(QQ, x^2 - 1/25, [1, 5*x])
sage: B.discriminant()
4
is_field()

Return whether self is a field.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: FiniteFlatAlgebra(QQ, x^2 + 2).is_field()
True
sage: FiniteFlatAlgebra(QQ, x^4 - 16).is_field()
False
morphisms_to_ring(R, as_matrix=False)

Return all ring homomorphisms from self to R.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.morphisms_to_ring(Qp(23))
[(1 + O(23^20), 3 + 15*23 + 17*23^2 + 21*23^4 + 21*23^5 + 20*23^6 + 2*23^8 + 6*23^9 + 9*23^10 + 13*23^11 + 19*23^12 + 5*23^13 + 21*23^14 + 5*23^15 + 17*23^16 + 7*23^17 + 20*23^18 + 15*23^19 + O(23^20), 9 + 21*23 + 8*23^2 + 18*23^3 + 16*23^5 + 2*23^6 + 22*23^7 + 19*23^8 + 17*23^9 + 17*23^10 + 13*23^11 + 11*23^13 + 15*23^14 + 20*23^15 + 3*23^16 + 2*23^17 + 15*23^18 + O(23^20))]
sage: B = FiniteFlatAlgebra(QQ, x^3 - 7)
sage: B.morphisms_to_ring(QQ)
[]
splitting_field(names)

Return a splitting field for self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, x^3 - x - 1)
sage: A.splitting_field('a')
Number Field in a with defining polynomial x^6 + 3*x^5 + 19*x^4 + 31*x^3 + 121*x^2 + 143*x + 307
class dual_pairs.finite_flat_algebra.FiniteFlatAlgebra_product(*args: Any, **kwargs: Any)

A finite flat algebra over a field R, represented as a product of monogenic extensions of R.

Element

alias of FiniteFlatAlgebraElement_product

algebra()

Return the underlying algebra of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, [x, x^2 + 1])
sage: alg = A.algebra()
sage: alg
The Cartesian product of (Number Field in a0 with defining polynomial x, Number Field in a1 with defining polynomial x^2 + 1)
change_ring(R)

Return the base change of self to R.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, [x, x^2 + x + 1])
sage: A.change_ring(GF(3))
Finite flat algebra of degree 3 over Finite Field of size 3, product of:
Finite Field of size 3
Univariate Quotient Polynomial Ring in a1 over Finite Field of size 3 with modulus a1^2 + a1 + 1
sage: B = FiniteFlatAlgebra(QQ, [x, x^2 - 1/25], [[1], [1, 5*x]])
sage: B.change_ring(GF(5))
Finite flat algebra of degree 3 over Finite Field of size 5
degree()

Return the degree of self.

discriminant()

Return the discriminant of self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, [x, x^2 - 4], [[1], [1, 1/2*x]])
sage: A.discriminant()
4
is_field()

Return whether self is a field.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: FiniteFlatAlgebra(QQ, [R(1), x]).is_field()
True
sage: FiniteFlatAlgebra(QQ, [x, x^2 + 1]).is_field()
False
morphisms_to_ring(R, as_matrix=False)

Return all ring homomorphisms from self to R.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: A = FiniteFlatAlgebra(QQ, [x, x^2 - 1])
sage: A.morphisms_to_ring(QQ)
[(1, 0, 0), (0, 1, 1), (0, 1, -1)]
splitting_field(names)

Return a splitting field for self.

EXAMPLES:

sage: from dual_pairs import FiniteFlatAlgebra
sage: R.<x> = QQ[]
sage: FiniteFlatAlgebra(QQ, [x, x^3 + x]).splitting_field('a')
Number Field in a with defining polynomial x^2 + 1