Ask Your Question
1

Compute variety in a finite field despite ideal dimension 1

asked 2025-02-07 04:10:29 +0100

YesIsBetterThanCrimson gravatar image

Hi!

My problem has to do asking Sage affine rational points of a variety on a finite field.

Essentially, I define an ideal of bivariate $\mathbb F_q$-polynomials in Sage, and ask Sage for the variety associated to the ideal. I happen to know a list of elements in the variety, but Sage doesn't want to compute them, on the basis that the ideal has dimension $1$, even though we're working on a finite field...

What would be the best way to make Sage compute these solutions? In full generality, I'm working with polynomials that are not restricted to two variables, so efficiency is important.

# Define a finite field and a bivariate polynomial ring on this field:
Fq.<z> = GF(2^4)
R.<x, y> = Fq[]

# Define a bunch of bivariate polynomials:
polynomials = [
        x^15 + (z^2 + z)*x^12*y + x^9*y^2 + (z^2 + z + 1)*x^3*y^4 + y^5,
        x^28*y + x^25*y^2 + x^19*y^4 + (z^2 + z + 1)*x^16*y^5 + x^7*y^8 + (z^2 + z + 1)*x*y^10,
        x^48*y^5 + x^36*y^9 + x^33*y^10 + x^12*y^17 + x^9*y^18 + x^3*y^20,
        x^64*y^21 + x^16*y^37 + x^4*y^41 + x*y^42
]

# Some known solutions to this system:
known_solutions = [
        (0          , 0),
        (1          , 1),
        (z^2 + z    , 1),
        (z^2 + z + 1, 1)
]

# Verify that these are indeed solutions:
for (a, b) in known_solutions:
    for polynomial in polynomials:
        if polynomial(a, b) != 0:
            raise ValueError('OP is lying')

# Now, let's try to see what SageMath has to say about solutions:
ideal = Ideal(polynomials)
# bruh
try:
    variety = ideal.variety(Fq)
except ValueError:
    print('OP is crying')

Best

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2025-02-07 06:27:27 +0100

Max Alekseyev gravatar image

Dimension 1 tells us about the system having too many "degrees of freedom". Since we work in a finite field, it is easy to deal with it by fixing one of the variables, say, x:

variety = sum( (Ideal(polynomials+[x-x0]).variety() for x0 in Fq), [] )

which produces 16 solutions.

edit flag offensive delete link more

Comments

Max Alekseyev gravatar imageMax Alekseyev ( 2025-02-07 17:28:15 +0100 )edit

Thanks for the answer and the issue! Although this does work here, if the field is large (e.g. with order $2^{128}$), this is not great. I have reasons to believe that my equations have in fact very few solutions.

YesIsBetterThanCrimson gravatar imageYesIsBetterThanCrimson ( 2025-02-07 21:03:23 +0100 )edit

Well, solving polynomial systems over finite fields is known to be hard. Otherwise people would not invent things like XSL attack. So, you may be out of luck with your system over the large finite field.

Said that, I have a custom implementation of variety function that might find some solutions for ideals of positive dimension. I can give it a try if you share your system.

Max Alekseyev gravatar imageMax Alekseyev ( 2025-02-07 21:16:30 +0100 )edit

Thanks for the proposal! My systems come from very early stage research, so I don't feel comfortable sharing that right now... However, I can generate other examples, though.

YesIsBetterThanCrimson gravatar imageYesIsBetterThanCrimson ( 2025-02-07 21:42:26 +0100 )edit

Either way is fine with me.

Max Alekseyev gravatar imageMax Alekseyev ( 2025-02-07 21:58:55 +0100 )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: 2025-02-07 04:10:29 +0100

Seen: 105 times

Last updated: Feb 07