4
$\begingroup$

I'm afraid this question is trivial, but I have spent the last couple of hours trying to figure out what goes wrong without any luck.

Given the following:

CDim = 3;
ODim = 3;
INV1 = Array[XX, {2^ODim - 1, ODim}]
M1 = RandomInteger[1, {ODim, CDim}];
OEF = ConstantArray[0, {2^ODim - 1, CDim}];
PROD = INV1.M1;

I'd like to solve PROD = OEF over GF(2)

Solve[{PROD == OEF}, Flatten[INV1]] 

returns the correct answer

{{XX[1, 1] -> 0, XX[1, 2] -> 0, XX[2, 1] -> 0, XX[2, 2] -> 0, 
  XX[3, 1] -> 0, XX[3, 2] -> 0, XX[4, 1] -> 0, XX[4, 2] -> 0, 
  XX[5, 1] -> 0, XX[5, 2] -> 0, XX[6, 1] -> 0, XX[6, 2] -> 0, 
  XX[7, 1] -> 0, XX[7, 2] -> 0}}

However, when I run

Solve[{PROD == OEF}, Flatten[INV1], Modulus -> 2]

I get:

Solve::naqs: True is not a quantified system of equations and inequalities.
Solve[{{{0, XX[1, 1] + XX[1, 2], XX[1, 2]}, {0, XX[2, 1] + XX[2, 2], 
     XX[2, 2]}, {0, XX[3, 1] + XX[3, 2], XX[3, 2]}, {0, 
     XX[4, 1] + XX[4, 2], XX[4, 2]}, {0, XX[5, 1] + XX[5, 2], 
     XX[5, 2]}, {0, XX[6, 1] + XX[6, 2], XX[6, 2]}, {0, 
     XX[7, 1] + XX[7, 2], XX[7, 2]}} == {{0, 0, 0}, {0, 0, 0}, {0, 0, 
     0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}}, {XX[1, 1], 
  XX[1, 2], XX[1, 3], XX[2, 1], XX[2, 2], XX[2, 3], XX[3, 1], 
  XX[3, 2], XX[3, 3], XX[4, 1], XX[4, 2], XX[4, 3], XX[5, 1], 
  XX[5, 2], XX[5, 3], XX[6, 1], XX[6, 2], XX[6, 3], XX[7, 1], 
  XX[7, 2], XX[7, 3]}, Modulus -> 2].

Why?

Thank you.

Update: it seemingly has to do with variables not appearing in any of the equations. For instance,

Solve[{a + b + c == 0, 4 a + 2 b + c == 3, 9 a + b + c == 0}, {a, b, 
  c, d, e}, Modulus -> 2]

gives the same error, whereas

Solve[{a + b + c == 0, 4 a + 2 b + c == 3, 9 a + b + c == 0}, {a, b, 
  c, d, e}]

yields

{{c -> 41, b -> 26, a -> 18}, {c -> 41, b -> 53, a -> 45}}
$\endgroup$
2
  • 1
    $\begingroup$ Check the variable names. It looks like INVC is used in some places and INV1 in others. $\endgroup$ Commented Apr 17, 2023 at 16:39
  • $\begingroup$ @DanielLichtblau Sorry, I pasted the wrong part of the code. Note that the code runs fine when I'm not solving the system mod 2. $\endgroup$
    – M.B.
    Commented Apr 17, 2023 at 18:07

1 Answer 1

5
$\begingroup$

It is a bug in Solve that affects problems with non-zero modulus and at least 2 variables that do not appear in the system. Will be fixed in the next version of Mathematica.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.