Ask Your Question
0

How to make Sage know that a set is an ideal

asked 2020-08-12 06:02:53 -0500

andriam gravatar image

updated 2020-08-12 23:35:16 -0500

I have constructed the following ideal

J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}

in the ring

$$ R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1) $$

where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$) modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its construction, the set $J$ is indeed an ideal, containing 2187 elements, so it is hard to write or copy all its elements. I want to find a Groebner basis of $J$, by writing

B = J.groebner_basis(),

but Sage returns

TypeError: R must be a commutative ring.

This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!

I must first construct the ideal

H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)

and then compute

B = H.groebner_basis().

That works, but, as I previously said, it is not easy to construct the ideal $H$ because that needs copy and paste 2187 elements!

Therefore I'd like to know whether there is another way to the task, without copying and pasting all of the elements of $J$, and declaring the ideal of these elements, is there a way to convert a set of elements in a ring (which is already an ideal) to the underlying ideal?

edit retag flag offensive close merge delete

Comments

I have updatet the question because it contained some syntax errors

andriam gravatar imageandriam ( 2020-08-12 09:23:31 -0500 )edit

The computation

B=H.groebner_basis()

answers my preeceding question "Does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?". The answer is "YES".

andriam gravatar imageandriam ( 2020-08-12 09:35:10 -0500 )edit

Please provide enough code for anyone to reproduce in a fresh Sage session. For instance what is F?

If the question is not self-contained, at least provide an explicit reference to a previous question where things are defined.

slelievre gravatar imageslelievre ( 2020-08-12 19:49:05 -0500 )edit

From your previous questions it would seem this is the context.

Construct a finite field, a multivariate polynomial ring over it, and the quotient by the ideal generated by three polynomials:

sage: F = GF(3)
sage: FXYZ.<X, Y, Z> = F[]
sage: R.<x, y, z> = FXYZ.quo([X^2 - 1, Y^2 - 1, Z^2 - 1])

Check what we have so far:

sage: R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Finite Field of size 3 by the ideal (X^2 - 1, Y^2 - 1, Z^2 - 1)

sage: R.gens()
(x, y, z)

sage: x^2, y^2, z^2
(1, 1, 1)

Now how do you construct the ideal J?

slelievre gravatar imageslelievre ( 2020-08-12 19:49:53 -0500 )edit

Thank for your remarks, the set $F$ is the finite field $GF(3)$ as you knew. The ideal $J$ is a "multicyclic code" of dimension $3$, and is equal the set of polynomials of $R$ which vanishes on a finite subset of $F^3$. Here is the code :

def code(POLS,ZER):

     C=Set({})
     for f in ENS:
         V={f.lift()(c) for c in POLS}
         if V=={0}:
            C=C+Set({f})                        
     return C

In my case, POLS is the set of polynomials of $R$ ( of degree $\leqslant (1,1)$, using the lexicographical order) and ZER a subset of $F^3$ consisting of a unique element. More time is needed to provide the codes for constructing POLS, I will provide these latter on.

andriam gravatar imageandriam ( 2020-08-12 23:45:00 -0500 )edit

1 answer

Sort by » oldest newest most voted
2

answered 2020-08-13 00:59:46 -0500

nbruin gravatar image

updated 2020-08-13 01:06:05 -0500

Try:

ideal(*J)

This is standard python syntax: f(*[a1,a2,a3]) does the same thing as f(a1,a2,a3).

Incidentally, I think you've hidden some of the commands. The code you suggest should produce:

sage: J.groebner_basis()
AttributeError: 'set' object has no attribute 'groebner_basis'

Finally, it seems you want to compute a Groebner basis of an ideal in a quotient ring. There is no such thing! Groebner bases are for ideals of polynomial rings. You should take the inverse image of that ideal in the polynomial ring (that's easy to do: just lift the generators and add the generators of the quotienting ideal to it) and compute a Groebner basis of that.

edit flag offensive delete link more

Comments

Thank you very much, the command you give works : using the ideal $J$ from above, I write

H=ideal(*J)

then

B =H.groebner_basis()

and Sage return the result! No copy and paste of the elements of $J$ are needed, wonderful !

andriam gravatar imageandriam ( 2020-08-13 02:30:05 -0500 )edit

Strangely, the method groebner_basis() works for an ideal in the quotient ring R (see the above example, in the comments in response to slelievre). Perhaps, as you have said, Sage use the lift() method to compute a Gröbner basis in $F3[X,Y,Z]$ and the returned to $R$. I was confused when I first used this for ideals in quotient ring, this is why I asked the question "Does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?

andriam gravatar imageandriam ( 2020-08-13 03:45:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-08-12 06:02:53 -0500

Seen: 61 times

Last updated: Aug 13