###############################################
#The following code calculates the three overlaps
#r_6, r_7, r_8 on page 8 of the manuscript.
###############################################
r1_sub_list:= {seq(seq(x[r,s,2,1]= p*x[r,s,1,2] + m*x[r,s,1,1], r = 1..3), s = 1..3)}
union {seq(seq(x[r,2,1,s]= p*x[r,1,2,s]+ m*x[r,1,1,s], r
= 1..3), s = 1..3)} union {seq(seq(x[2,1,r,s]= p*x[1,2,r,s]+ m*x[1,1,r,s], r = 1..3), s = 1..3)};
r2_sub_list:={seq(seq(x[r,s,3,2] = a*x[r,s,3,1] + n*x[r,s,1,3] + b*x[r,s,2,3], r =1..3), s = 1..3)} union {seq(seq(x[r,3,2,s] = a*x[r,3,1,s] +
n*x[r,1,3,s] + b*x[r,2,3,s], r = 1..3), s = 1..3)} union {seq(seq(x[3,2,r,s] = a*x[3,1,r,s] + n*x[1,3,r,s] + b*x[2,3,r,s], r = 1..3), s =
1..3)};
r3_sub_list:={seq(x[r,3,3,1] = c*x[r,1,3,3] + d*x[r,2,3,3]+e*x[r,3,1,3], r = 1..3)} union {seq(x[3,3,1,r] = c*x[1,3,3,r] +d*x[2,3,3,r]+
e*x[3,1,3,r], r = 1..3)};
r4_sub_list:= {seq(x[r,3,1,1] = f*x[r,1,1,3] + g*x[r,1,2,3] +h*x[r,2,2,3] + j*x[r,1,3,1] + k *x[r,2,3,1], r = 1..3)} union {seq(x[3,1,1,r] =
f*x[1,1,3,r] + g*x[1,2,3,r] + h*x[2,2,3,r] + j*x[1,3,1,r] + k *x[2,3,1,r], r = 1..3)};
r5_sub_list:= {seq(x[r,3,1,2] = q*n*x[r,1,3,1] + q*b*x[r,2,3,1] + z*x[r,3,1,1], r = 1..3)} union {seq(x[3,1,2,r] = q*n*x[1,3,1,r] +
q*b*x[2,3,1,r] + z*x[3,1,1,r], r = 1..3)};
way1:= subs(r3_sub_list, x[3,3,1,2]);
way2:= subs(r5_sub_list, x[3,3,1,2]);
resolve11:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way1)))))))); resolve12:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve11)))))))); resolve13:=subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve12))))))));
resolve14:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve13)))))))); resolve15:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve14)))))))); resolve1:=subs(r4_sub_list,resolve15);
resolve21:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way2)))))))); resolve22:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve21)))))))); resolve23:=subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve22))))))));
resolve24:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve23)))))))); resolve25:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve24)))))))); resolve2:=subs(r4_sub_list,resolve25);
AA:=simplify(resolve1 - resolve2); BB:={seq(seq(seq(seq(coeff(AA, x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
R6:=add(add(add(add(coeff(AA, x[r,s,t,u])*x[r,s,t,u], r = 1..3), s = 1..3), t = 1..3), u = 1..3);
way3:= subs(r3_sub_list, x[3,3,1,1]);
way4:= subs(r4_sub_list, x[3,3,1,1]);
resolve31:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way3)))))))); resolve32:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve31)))))))); resolve33:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve32))))))));
resolve34:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve33)))))))); resolve3:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve34))))))));
resolve41:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way4)))))))); resolve42:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve41)))))))); resolve43:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve42))))))));
resolve44:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve43)))))))); resolve4:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve44))))))));
AAA:=simplify(resolve3 - resolve4); BBB:={seq(seq(seq(seq(coeff(AAA, x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
R7:=add(add(add(add(coeff(AAA, x[r,s,t,u])*x[r,s,t,u], r = 1..3), s = 1..3), t = 1..3), u = 1..3);
way5:= subs(r1_sub_list, x[3,1,2,1]);
way6:= subs(r5_sub_list, x[3,1,2,1]);
resolve51:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way5)))))))); resolve52:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve51)))))))); resolve53:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve52))))))));
resolve54:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve53)))))))); resolve5:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve54))))))));
resolve61:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way6)))))))); resolve62:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve61)))))))); resolve63:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve62))))))));
resolve64:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve63)))))))); resolve6:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve64))))))));
AAAA:=simplify(resolve5 - resolve6);
BBBB:={seq(seq(seq(seq(coeff(AAAA, x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
R8:=add(add(add(add(coeff(AAAA, x[r,s,t,u])*x[r,s,t,u], r = 1..3), s = 1..3), t = 1..3), u = 1..3);
########################################################
Output from the above program:
######################################################
R6;
(-q*b*a-q*n+e*a-z*e)*x[3,1,3,1]+(e*n*j+c*a*e+c*b*a+c*n-z*c*e+e*b*z*j)*x[1,3,1,3]
+(e*n*k+d*b*a+d*a*e+d*n-z*d*e+e*b*z*k)*x[2,3,1,3]
+(e*n*f+c*b*n+a*c^2-z*c^2+d*a*c*m+d*b*n*m-q*b*n*c-q*b^2*c*m+e*b*z*f-z*d*c*m)*x[1,1,3,3]
+(e*n*g+c*a*d+c*b^2+d*a*c*p+d*b*n*p-q*b*n*d-q*b^2*c*p-z*c*d+e*b*z*g-z*d*c*p)*x[1,2,3,3]
+(e*n*h-q*b^2*d-z*d^2+a*d^2+d*b^2+e*b*z*h)*x[2,2,3,3]
R7;
(-k*a+e-j)*x[3,1,3,1]+(-f*j+c*e-g*z*j-g*q*n-h*n*a-e*n*k-h*a*q*n-h*a*z*j)*x[1,3,1,3]
+(d*e-e*b*k-g*z*k-g*q*b-f*k-h*b*a-h*a*q*b-h*a*z*k)*x[2,3,1,3]
+(-h*n^2+d*c*m+c^2-g*z*f-f^2-k*n*c-h*a*z*f-h*b*n*m-k*b*c*m)*x[1,1,3,3]
+(d*c*p+c*d-f*g-z*g^2-h*n*b-k*n*d-h*a*z*g-h*b*n*p-k*b*c*p)*x[1,2,3,3]
+(-h*b^2+d^2-g*z*h-f*h-a*z*h^2-k*b*d)*x[2,2,3,3]
R8;
(-z*f+m*j^2+m*f+p*z*j^2+p*f*a-j*q*n-z*j^2-k*z*j*m+p*j*q*n+k*j*m^2+p*k*q*n*m+p*k*z*j*m-q*b*j*m)*x[1,1,3,1]
+(-z*g+m*g+p*g*a-j*z*k+m*j*k-q*n*k+k*q*n*p^2+k*z*j*p^2+m*k*j*p)*x[1,2,3,1]
+(m*h+m*k^2-z*h+p*h*a-k*q*b-z*k^2+p*k*q*b+p*z*k^2)*x[2,2,3,1]
+(p*f*n-j*z*f+h*n*p*m^2-k*z*f*m+p*g*n*m+p*j*z*f+m*j*f+k*f*m^2-q*n*f+h*n*p^2*m^2+k*z*f*p^2*m+k*f*p*m^2-q*b*f*p*m-q*b*f*m)*x[1,1,1,3]
+(g*n*p^2+p*f*b-g*z*j+h*n*m*p^2-k*z*f*p^2-k*z*g*m+p*j*z*g+m*j*g+k*g*m^2-g*q*n
+h*n*m*p^3+k*z*f*p^3+p*k*z*g*m+m*k*f*p^2-q*b*f*p^2-q*b*g*m)*x[1,1,2,3]
+(h*n*p^3+p*g*b-j*z*h-k*z*g*p+p*j*z*h+m*j*h-q*n*h+k*z*g*p^2+m*k*g*p-q*b*g*p)*x[1,2,2,3]
+(p*h*b-k*z*h+p*k*z*h+m*k*h-q*b*h)*x[2,2,2,3]
###############################################################
# In section 3.3, we show that in the case m = 0, p \neq 1,
#further reductions allow us to assume that n = 1,
#d not equal to bc.
# We can also assume b = 0 or b =1, since if b is nonzero
#the example is twist equivalent to an example with b = 1.
# In section 3.4, we show that in case m=1, p =1, further
#reductions allow us to assume that a = 0 and that we
# do not have c = d= 0.
# The following commands find these solutions
#(recall that also pq =1 and z = qa -qm.)
##################################################################
Sb0:=solve(BB union BBB union BBBB union {q*p-1} union {d <> b*c} union {m = 0} union {p <>1} union {n = 1} union {b =0} union
{z=a*q-q*m},{a,b,c,d,e,q,p,f,g,h,j,k,m,n,z});
Sb1:=solve(BB union BBB union BBBB union {q*p-1} union {d <> b*c} union {m = 0} union {p <>1} union {n = 1} union {b =1} union
{z=a*q-q*m},{a,b,c,d,e,q,p,f,g,h,j,k,m,n,z});
Sc:=solve(BB union BBB union BBBB union {q = 1} union {m= 1} union {p = 1}
union {a=0} union {z=a*q-q*m} union {c <> 0},{a,b,c,d,e,q,p,f,g,h,j,k,m,n,z});
Sd:=solve(BB union BBB union BBBB union {q = 1} union {m= 1} union {p = 1}
union {a=0} union {z=a*q-q*m} union {d <> 0},{a,b,c,d,e,q,p,f,g,h,j,k,m,n,z});
#################################
#Output from these commands:
##################################
Sb0;
(no solutions)
Sb1;
{a = -1/(q^2), b = 1, c = -q^3, d = 0, e = q^2+q, f = -q^3, g = 0, h = 0, j = q^2+q, k = 0, m = 0, n = 1, p = 1/q, q = q, z = -1/q},
{a = -1, b = 1, c = 1, d = 0, e = 0, f = 0, g = -1, h = 0, j = 1, k = 1, m = 0, n = 1, p = -1, q = -1, z = 1},
{a = -1, b = 1, c = 1, d = 0, e = 0, f = 0, g = 1, h = 0, j = 1, k = 1, m = 0, n = 1, p = -1, q = -1, z = 1},
{a = -1, b = 1, c = 1, d = 0, e = 0, f = h-1, g = 0, h = h, j = 0, k = 0, m = 0, n = 1, p = -1, q = -1, z = 1},
{a = -1, b = 1, c = 0, d = 1, e = 0, f = 0, g = RootOf(_Z^2+1), h = 0, j = 1, k = 1, m = 0, n = 1, p = -1, q = -1, z = 1},
{a = -RootOf(_Z^2+_Z+1), b = 1, c = -1, d = 0, e = -1, f = -1, g = 0, h = 0, j = -1, k = 0, m = 0, n = 1,
p = -RootOf(_Z^2+_Z+1)-1, q = RootOf(_Z^2+_Z+1), z = 1+RootOf(_Z^2+_Z+1)},
{a = 1+RootOf(_Z^2+_Z+1), b = 1, c = RootOf(_Z^2+_Z+1), d = -1, e = -1, f = 0, g = 0, h = -1, j = RootOf(_Z^2+_Z+1),
k = -1, m = 0, n = 1, p = RootOf(_Z^2+_Z+1), q = -RootOf(_Z^2+_Z+1)-1, z = -RootOf(_Z^2+_Z+1)},
{a = -1, b = 1, c = 0, d = 1, e = 0, f = 1-RootOf(1+2*_Z^2-2*_Z), g = 0, h = RootOf(1+2*_Z^2-2*_Z), j = 0, k = 0, m = 0, n = 1, p = -1, q =
-1, z = 1},
{a = RootOf(_Z^2-_Z+1), b = 1, c = 0, d = RootOf(_Z^2-_Z+1)-1, e = -1, f = 0, g = -RootOf(_Z^2-_Z+1), h = 0, j = 0, k = RootOf(_Z^2-_Z+1)-1, m
= 0, n = 1, p = RootOf(_Z^2-_Z+1)-1, q = -RootOf(_Z^2-_Z+1), z = 1-RootOf(_Z^2-_Z+1)}
Sbc;
{a = 0, b = 1/2*e, c = -1/4*e^2, d = 0, e = e, f = -1/4*e^2, g = 0, h = 0, j = e, k = 0, m = 1, n = e, p = 1, q = 1, z = -1}
Sbd;
(no solutions)
############################################################
#We see that Sb0 is empty (so there are no solutions
#with b = 0) and we find nine solution families for section
#3.3 in the list Sb1,
#although one turns out to be a repeat. These have been
#rearranged above so that in the notation of the paper they
#correspond to A(1,q),
#B(1), C(1), D(1,h), E(1, \gamma), F(1, \gamma),
#\underline{F}(1, \gamma), G(1, \gamma), and the
#last one is just a repeat of F(1, \gamma)
#written in a different way.
#
#We see examining Sbc and Sbd that there is
#one solution in Section 3.4, as stated in the paper.
########################################################
############################################################
#The following code repeats the process above with a new
#r_4 such that l = 0 and k = -1, as discussed in section 3.5.
#######################################################
r1_sub_list:= {seq(seq(x[r,s,2,1]= p*x[r,s,1,2] + m*x[r,s,1,1], r = 1..3), s = 1..3)} union {seq(seq(x[r,2,1,s]= p*x[r,1,2,s]+ m*x[r,1,1,s], r
= 1..3), s = 1..3)} union {seq(seq(x[2,1,r,s]= p*x[1,2,r,s]+ m*x[1,1,r,s], r = 1..3), s = 1..3)};
r2_sub_list:={seq(seq(x[r,s,3,2] = a*x[r,s,3,1] + n*x[r,s,1,3] + b*x[r,s,2,3], r =1..3), s = 1..3)} union {seq(seq(x[r,3,2,s] = a*x[r,3,1,s] +
n*x[r,1,3,s] + b*x[r,2,3,s], r = 1..3), s = 1..3)} union {seq(seq(x[3,2,r,s] = a*x[3,1,r,s] + n*x[1,3,r,s] + b*x[2,3,r,s], r = 1..3), s =
1..3)};
r3_sub_list:={seq(x[r,3,3,1] = c*x[r,1,3,3] + d*x[r,2,3,3]+e*x[r,3,1,3], r = 1..3)} union {seq(x[3,3,1,r] = c*x[1,3,3,r] +d*x[2,3,3,r]+
e*x[3,1,3,r], r = 1..3)};
r4_sub_list:= {seq(x[r,2,3,1] = f*x[r,1,1,3] + g*x[r,1,2,3] +h*x[r,2,2,3] + j*x[r,1,3,1], r = 1..3)} union {seq(x[2,3,1,r] = f*x[1,1,3,r] +
g*x[1,2,3,r] + h*x[2,2,3,r] + j*x[1,3,1,r], r = 1..3)};
r5_sub_list:= {seq(x[r,3,1,2] = q*n*x[r,1,3,1] + q*b*x[r,2,3,1] + z*x[r,3,1,1], r = 1..3)} union {seq(x[3,1,2,r] = q*n*x[1,3,1,r] +
q*b*x[2,3,1,r] + z*x[3,1,1,r], r = 1..3)};
way1:= subs(r3_sub_list, x[3,3,1,2]);
way2:= subs(r5_sub_list, x[3,3,1,2]);
resolve11:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way1)))))))); resolve12:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve11)))))))); resolve13:=subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve12))))))));
resolve14:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve13)))))))); resolve15:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve14)))))))); resolve1:=subs(r4_sub_list,resolve15);
resolve21:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way2)))))))); resolve22:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve21)))))))); resolve23:=subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve22))))))));
resolve24:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve23)))))))); resolve25:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve24)))))))); resolve2:=subs(r4_sub_list,resolve25);
AAk:=simplify(resolve1 - resolve2); BBk:={seq(seq(seq(seq(coeff(AAk, x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
rr6:=add(add(add(add(coeff(AAk, x[r,s,t,u])*x[r,s,t,u], r = 1..3), s = 1..3), t = 1..3), u = 1..3);
way3:= subs(r2_sub_list, x[3,2,3,1]);
way4:= subs(r4_sub_list, x[3,2,3,1]);
resolve31:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way3))))))));
resolve32:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve31))))))));
resolve33:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve32))))))));
resolve34:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve33))))))));
resolve3:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve34))))))));
resolve41:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way4))))))));
resolve42:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve41))))))));
resolve43:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve42))))))));
resolve44:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve43))))))));
resolve4:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve44))))))));
AAAk:=simplify(resolve3 - resolve4); BBBk:={seq(seq(seq(seq(coeff(AAAk,
x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
rr7:=add(add(add(add(coeff(AAAk, x[r,s,t,u])*x[r,s,t,u], r = 1..3),
s= 1..3), t = 1..3), u = 1..3);
way5:= subs(r1_sub_list, x[3,1,2,1]);
way6:= subs(r5_sub_list, x[3,1,2,1]);
resolve51:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way5)))))))); resolve52:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve51)))))))); resolve53:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve52))))))));
resolve54:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve53)))))))); resolve5:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve54))))))));
resolve61:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way6)))))))); resolve62:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve61)))))))); resolve63:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve62))))))));
resolve64:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve63)))))))); resolve6:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve64))))))));
AAAAk:=simplify(resolve5 - resolve6);
BBBBk:={seq(seq(seq(seq(coeff(AAAAk, x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
rr8:=add(add(add(add(coeff(AAAAk, x[r,s,t,u])*x[r,s,t,u], r = 1..3), s = 1..3), t = 1..3), u = 1..3);
way7:= subs(r4_sub_list, x[2,3,1,2]);
way8:= subs(r5_sub_list, x[2,3,1,2]);
resolve71:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way7)))))))); resolve72:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve71)))))))); resolve73:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve72))))))));
resolve74:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve73)))))))); resolve7:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve74))))))));
resolve81:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, way8)))))))); resolve82:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list,
subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve81)))))))); resolve83:=subs(r3_sub_list, subs(r2_sub_list,
subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve82))))))));
resolve84:=subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list, subs(r5_sub_list, subs(r4_sub_list, subs(r3_sub_list,
subs(r2_sub_list,subs(r1_sub_list, resolve83)))))))); resolve8:=subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list, subs(r1_sub_list,
subs(r5_sub_list, subs(r3_sub_list, subs(r2_sub_list,subs(r1_sub_list, resolve84))))))));
AAAAAk:=simplify(resolve7 - resolve8);
BBBBBk:={seq(seq(seq(seq(coeff(AAAAAk, x[r,s,t,u]), r = 1..3), s = 1..3), t = 1..3), u = 1..3)};
rr9:=add(add(add(add(coeff(AAAAAk, x[r,s,t,u])*x[r,s,t,u], r = 1..3), s = 1..3), t = 1..3), u = 1..3);
#########################
#output from the above:
#########################
rr6;
(-q*b*a-q*n+e*a-z*e)*x[3,1,3,1]+(e*n+e*b*z)*x[3,1,1,3]
+(d*a*e*j+d*b*a*j-z*d*e*j+c*a*e+c*b*a+d*n*j+c*n-z*c*e)*x[1,3,1,3]
+(d*b*a*f+d*a*e*f-z*d*e*f+c*b*n+d*n*f+a*c^2-z*c^2+d*a*c*m+d*b*n*m-q*b*n*c-q*b^2*c*m-z*d*c*m)*x[1,1,3,3]
+(d*a*e*g+d*b*a*g-z*d*e*g+c*a*d+d*n*g+c*b^2+d*a*c*p+d*b*n*p-q*b*n*d-q*b^2*c*p-z*c*d-z*d*c*p)*x[1,2,3,3]
+(d*a*e*h+d*b*a*h-q*b^2*d-z*d*e*h+d*n*h-z*d^2+a*d^2+d*b^2)*x[2,2,3,3]
rr7;
(a-j)*x[3,1,3,1]
+(-f-z*g-h*a*z)*x[3,1,1,3]
+(e*n-h*a*q*b*j+b*e*j-g*q*n-h*n*a-h*a*q*n-g*q*b*j-h*b*a*j)*x[1,3,1,3]
+(-h*n^2+c*n-h*a*q*b*f+b*e*f+b*c*m-h*b*n*m-g*q*b*f-h*b*a*f)*x[1,1,3,3]
+(d*n-h*a*q*b*g+b*e*g+b*c*p-h*n*b-h*b*n*p-q*b*g^2-h*b*a*g)*x[1,2,3,3]
+(b*d-h*b^2+b*e*h-b*a*h^2-g*q*b*h-a*q*b*h^2)*x[2,2,3,3]
rr8;
(m-z)*x[3,1,1,1]
+(-q*n-q*b*j)*x[1,3,1,1]
+(-q*b*f-g*q*b*j-q*b*h*p*j^2-q*b*h*j*m)*x[1,1,3,1]
+p*x[3,1,1,2]+(-g*q*b*f-q*b*h*f*p*m-q*b*h*f*m-q*b*h*j*p*f)*x[1,1,1,3]
+(-q*b*g^2-q*b*h*f*p^2-q*b*h*g*m-q*b*h*j*p*g)*x[1,1,2,3]
+(-g*q*b*h-q*b*h*g*p-q*b*j*p*h^2)*x[1,2,2,3]-q*b*h^2*x[2,2,2,3]
rr9;
(f*a+g*a*j+j*q*n+q*b*j^2-q*n*m-z*g*j-z*f+h*a*p*j^2+h*a*j*m-q*n*p*j-q*b*p*j^2-q*b*j*m-z*h*p*j^2-z*h*j*m)*x[1,1,3,1]
+(f*n+g*a*f+g*n*m+h*n*m^2-z*g*f+h*a*f*p*m+h*a*f*m+h*a*j*p*f+h*n*p*m^2
+j*q*b*f-q*n*p*f-q*b*f*p*m-q*b*f*m-q*b*j*p*f-z*h*f*p*m-z*h*f*m-z*h*j*p*f)*x[1,1,1,3]
+(a*g^2+f*b+g*n*p-z*g^2+h*a*f*p^2+h*a*g*m+h*a*j*p*g+h*n*p*m+h*n*m*p^2
+g*q*b*j-q*n*p*g-q*b*f*p^2-q*b*g*m-q*b*j*p*g-z*h*f*p^2-z*h*g*m-z*h*j*p*g)*x[1,1,2,3]
+(g*b+g*a*h+h*n*p^2-z*g*h+h*a*g*p+a*j*p*h^2+j*q*b*h-q*n*p*h-q*b*g*p-q*b*j*p*h-z*h*g*p-z*j*p*h^2)*x[1,2,2,3]
+(-q*b*h+a*h^2+h*b-z*h^2)*x[2,2,2,3]
######################
#As described in section 3.5 of the paper, we solve
#for the coefficients of r_6, r_7, r_9 to be 0,
#in the same cases
#as before.
#####################
Sb0k:=solve(BBk union BBBk union BBBBBk union {q*p-1} union {d <> b*c} union {m = 0} union {p <>1} union {n = 1} union {b =0} union
{z=a*q-q*m},{a,b,c,d,e,q,p,f,g,h,j,m,n,z});
Sb1k:=solve(BBk union BBBk union BBBBBk union {q*p-1} union {d <> b*c} union {m = 0} union {p <>1} union {n = 1} union {b =1} union
{z=a*q-q*m},{a,b,c,d,e,q,p,f,g,h,j,m,n,z});
Sck:=solve(BBk union BBBk union BBBBBk union {q = 1} union {m= 1} union {p = 1}
union {a=0} union {z=a*q-q*m} union {c <> 0},{a,b,c,d,e,q,p,f,g,h,j,m,n,z});
Sdk:=solve(BBk union BBBk union BBBBBk union {q = 1} union {m= 1} union {p = 1}
union {a=0} union {z=a*q-q*m} union {d <> 0},{a,b,c,d,e,q,p,f,g,h,j,m,n,z});
###################
#All outputs are empty--- no solutions.
#################
################################
#The final calculation necessary to Section 3.5 is to
#assume now that r_4 has l = 0, k = 0, h \neq 0 and calculate
#that the leading term of the relation arising from the
#overlap x_3x_2^x_3 is -jx_3x_1x_3x_1. This is easily
#done by hand and so
#there is no need to revise the program to do this.
###########################