Ask Your Question

Revision history [back]

You could work in the ring $(\mathbb{F}_2[x_0,\ldots,x_7,y_0,\ldots,y_7])[X]/(X^8+X^4+X^3+X+1)$:

sage: S = PolynomialRing(GF(2), names=['x_{}'.format(d) for d in range(8)] + ['y_{}'.format(d) for d in range(8)]); R
Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: S.inject_variables()
Defining x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7
sage: T.<Y> = PolynomialRing(S); T
Univariate Polynomial Ring in Y over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: U.<X> = T.quotient(Y^8+Y^4+Y^3+Y+1); U
Univariate Quotient Polynomial Ring in X over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2 with modulus Y^8 + Y^4 + Y^3 + Y + 1
sage: x = x_0 + x_1*X + x_2*X^2 + x_3*X^3 + x_4*X^4 + x_5*X^5 + x_6*X^6 + x_7*X^7
sage: y = y_0 + y_1*X + y_2*X^2 + y_3*X^3 + y_4*X^4 + y_5*X^5 + y_6*X^6 + y_7*X^7
sage: x.lift().coefficients()
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7]
sage: (x + y).lift().coefficients()
[x_0 + y_0,
 x_1 + y_1,
 x_2 + y_2,
 x_3 + y_3,
 x_4 + y_4,
 x_5 + y_5,
 x_6 + y_6,
 x_7 + y_7]

You could work in the ring $(\mathbb{F}_2[x_0,\ldots,x_7,y_0,\ldots,y_7])[X]/(X^8+X^4+X^3+X+1)$:

sage: S = PolynomialRing(GF(2), names=['x_{}'.format(d) for d in range(8)] + ['y_{}'.format(d) for d in range(8)]); R
Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: S.inject_variables()
Defining x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7
sage: T.<Y> = PolynomialRing(S); T
Univariate Polynomial Ring in Y over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: U.<X> = T.quotient(Y^8+Y^4+Y^3+Y+1); U
Univariate Quotient Polynomial Ring in X over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2 with modulus Y^8 + Y^4 + Y^3 + Y + 1
sage: x = x_0 + x_1*X + x_2*X^2 + x_3*X^3 + x_4*X^4 + x_5*X^5 + x_6*X^6 + x_7*X^7
sage: y = y_0 + y_1*X + y_2*X^2 + y_3*X^3 + y_4*X^4 + y_5*X^5 + y_6*X^6 + y_7*X^7
sage: x.lift().coefficients()
x.list()
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7]
sage: (x + y).lift().coefficients()
y).list()
[x_0 + y_0,
 x_1 + y_1,
 x_2 + y_2,
 x_3 + y_3,
 x_4 + y_4,
 x_5 + y_5,
 x_6 + y_6,
 x_7 + y_7]

Here I use .list() instead of .coefficients() because we are in a quotient ring; you could also do .lift().coefficients().

You could work in the ring $(\mathbb{F}_2[x_0,\ldots,x_7,y_0,\ldots,y_7])[X]/(X^8+X^4+X^3+X+1)$:

sage: S = PolynomialRing(GF(2), names=['x_{}'.format(d) for d in range(8)] + ['y_{}'.format(d) for d in range(8)]); R
Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: S.inject_variables()
Defining x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7
sage: T.<Y> = PolynomialRing(S); T
Univariate Polynomial Ring in Y over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: U.<X> = T.quotient(Y^8+Y^4+Y^3+Y+1); U
Univariate Quotient Polynomial Ring in X over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2 with modulus Y^8 + Y^4 + Y^3 + Y + 1
sage: x = x_0 + x_1*X + x_2*X^2 + x_3*X^3 + x_4*X^4 + x_5*X^5 + x_6*X^6 + x_7*X^7
sage: y = y_0 + y_1*X + y_2*X^2 + y_3*X^3 + y_4*X^4 + y_5*X^5 + y_6*X^6 + y_7*X^7
sage: x.list()
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7]
sage: x + y
(x_7 + y_7)*X^7 + (x_6 + y_6)*X^6 + (x_5 + y_5)*X^5 + (x_4 + y_4)*X^4 + (x_3 + y_3)*X^3 + (x_2 + y_2)*X^2 + (x_1 + y_1)*X + x_0 + y_0
sage: (x + y).list()
[x_0 + y_0,
 x_1 + y_1,
 x_2 + y_2,
 x_3 + y_3,
 x_4 + y_4,
 x_5 + y_5,
 x_6 + y_6,
 x_7 + y_7]

Here I use .list() instead of .coefficients() because we are in a quotient ring; you could also do .lift().coefficients().

In your attempt the ring containing X is the base ring over which you build a polynomial ring, but you want it the other way around. You could work in the ring $(\mathbb{F}_2[x_0,\ldots,x_7,y_0,\ldots,y_7])[X]/(X^8+X^4+X^3+X+1)$:

sage: S = PolynomialRing(GF(2), names=['x_{}'.format(d) for d in range(8)] + ['y_{}'.format(d) for d in range(8)]); R
Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: S.inject_variables()
Defining x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7
sage: T.<Y> = PolynomialRing(S); T
Univariate Polynomial Ring in Y over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: U.<X> = T.quotient(Y^8+Y^4+Y^3+Y+1); U
Univariate Quotient Polynomial Ring in X over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2 with modulus Y^8 + Y^4 + Y^3 + Y + 1
sage: x = x_0 + x_1*X + x_2*X^2 + x_3*X^3 + x_4*X^4 + x_5*X^5 + x_6*X^6 + x_7*X^7
sage: y = y_0 + y_1*X + y_2*X^2 + y_3*X^3 + y_4*X^4 + y_5*X^5 + y_6*X^6 + y_7*X^7
sage: x.list()
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7]
sage: x + y
(x_7 + y_7)*X^7 + (x_6 + y_6)*X^6 + (x_5 + y_5)*X^5 + (x_4 + y_4)*X^4 + (x_3 + y_3)*X^3 + (x_2 + y_2)*X^2 + (x_1 + y_1)*X + x_0 + y_0
sage: (x + y).list()
[x_0 + y_0,
 x_1 + y_1,
 x_2 + y_2,
 x_3 + y_3,
 x_4 + y_4,
 x_5 + y_5,
 x_6 + y_6,
 x_7 + y_7]

Here I use .list() instead of .coefficients() because we are in a quotient ring; you could also do .lift().coefficients().

In your attempt the ring containing X is the base ring over which you build a polynomial ring, but you want it the other way around. You could work in the ring $(\mathbb{F}_2[x_0,\ldots,x_7,y_0,\ldots,y_7])[X]/(X^8+X^4+X^3+X+1)$:

sage: S = PolynomialRing(GF(2), names=['x_{}'.format(d) for d in range(8)] + ['y_{}'.format(d) for d in range(8)]); R
S
Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: S.inject_variables()
Defining x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7
sage: T.<Y> = PolynomialRing(S); T
Univariate Polynomial Ring in Y over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: U.<X> = T.quotient(Y^8+Y^4+Y^3+Y+1); U
Univariate Quotient Polynomial Ring in X over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2 with modulus Y^8 + Y^4 + Y^3 + Y + 1
sage: x = x_0 + x_1*X + x_2*X^2 + x_3*X^3 + x_4*X^4 + x_5*X^5 + x_6*X^6 + x_7*X^7
sage: y = y_0 + y_1*X + y_2*X^2 + y_3*X^3 + y_4*X^4 + y_5*X^5 + y_6*X^6 + y_7*X^7
sage: x.list()
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7]
sage: x + y
(x_7 + y_7)*X^7 + (x_6 + y_6)*X^6 + (x_5 + y_5)*X^5 + (x_4 + y_4)*X^4 + (x_3 + y_3)*X^3 + (x_2 + y_2)*X^2 + (x_1 + y_1)*X + x_0 + y_0
sage: (x + y).list()
[x_0 + y_0,
 x_1 + y_1,
 x_2 + y_2,
 x_3 + y_3,
 x_4 + y_4,
 x_5 + y_5,
 x_6 + y_6,
 x_7 + y_7]

Here I use .list() instead of .coefficients() because we are in a quotient ring; you could also do .lift().coefficients().

In your attempt the ring containing X is the base ring over which you build a polynomial ring, but you want it the other way around. You could work in the ring $(\mathbb{F}_2[x_0,\ldots,x_7,y_0,\ldots,y_7])[X]/(X^8+X^4+X^3+X+1)$:

sage: S = PolynomialRing(GF(2), names=['x_{}'.format(d) for d in range(8)] + ['y_{}'.format(d) for d in range(8)]); S
Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: S.inject_variables()
Defining x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7
sage: T.<Y> = PolynomialRing(S); T
Univariate Polynomial Ring in Y over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2
sage: U.<X> = T.quotient(Y^8+Y^4+Y^3+Y+1); U
Univariate Quotient Polynomial Ring in X over Multivariate Polynomial Ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, y_0, y_1, y_2, y_3, y_4, y_5, y_6, y_7 over Finite Field of size 2 with modulus Y^8 + Y^4 + Y^3 + Y + 1
sage: x = x_0 + x_1*X + x_2*X^2 + x_3*X^3 + x_4*X^4 + x_5*X^5 + x_6*X^6 + x_7*X^7
sage: y = y_0 + y_1*X + y_2*X^2 + y_3*X^3 + y_4*X^4 + y_5*X^5 + y_6*X^6 + y_7*X^7
sage: x.list()
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7]
sage: x + y
(x_7 + y_7)*X^7 + (x_6 + y_6)*X^6 + (x_5 + y_5)*X^5 + (x_4 + y_4)*X^4 + (x_3 + y_3)*X^3 + (x_2 + y_2)*X^2 + (x_1 + y_1)*X + x_0 + y_0
sage: (x + y).list()
[x_0 + y_0,
 x_1 + y_1,
 x_2 + y_2,
 x_3 + y_3,
 x_4 + y_4,
 x_5 + y_5,
 x_6 + y_6,
 x_7 + y_7]

Here I use .list() instead of .coefficients() because we are in a quotient ring; you could also do .lift().coefficients().

Note that the $x_i$ and $y_i$ do not behave exactly like elements of $\mathbf{F}_2$ in the sense that $x_i^2 \neq x_i$ etc.