LogTo("f4-w-ath.log");

LoadPackage("GBNP");

GBNP.ConfigPrint("g0","g1","g2","g3","y0","y1","y2","y3","x0","x1","x2","x3","U");

s:=Indeterminate(Rationals,"L1");;
t:=Indeterminate(Rationals,"L2");;

K:=[
[[[1,9],[9,1]],[1,-1]],
[[[1,10],[10,1]],[1,-1]],
[[[1,11],[11,1]],[1,-1]],
[[[1,12],[12,1]],[1,-1]],
[[[2,9],[9,2]],[1,-1]],
[[[2,10],[10,2]],[1,-1]],
[[[2,11],[11,2]],[1,-1]],
[[[2,12],[12,2]],[1,-1]],
[[[3,9],[9,3]],[1,-1]],
[[[3,10],[10,3]],[1,-1]],
[[[3,11],[11,3]],[1,-1]],
[[[3,12],[12,3]],[1,-1]],
[[[4,9],[9,4]],[1,-1]],
[[[4,10],[10,4]],[1,-1]],
[[[4,11],[11,4]],[1,-1]],
[[[4,12],[12,4]],[1,-1]],
[[[5,9],[9,5]],[1,-1]],
[[[5,10],[10,5]],[1,-1]],
[[[5,11],[11,5]],[1,-1]],
[[[5,12],[12,5]],[1,-1]],
[[[6,9],[9,6]],[1,-1]],
[[[6,10],[10,6]],[1,-1]],
[[[6,11],[11,6]],[1,-1]],
[[[6,12],[12,6]],[1,-1]],
[[[7,9],[9,7]],[1,-1]],
[[[7,10],[10,7]],[1,-1]],
[[[7,11],[11,7]],[1,-1]],
[[[7,12],[12,7]],[1,-1]],
[[[8,9],[9,8]],[1,-1]],
[[[8,10],[10,8]],[1,-1]],
[[[8,11],[11,8]],[1,-1]],
[[[8,12],[12,8]],[1,-1]],
[[[13,1],[1,13]],[1,-1]],
[[[13,2],[2,13]],[1,-1]],
[[[13,3],[3,13]],[1,-1]],
[[[13,4],[4,13]],[1,-1]],
[[[13,5],[5,13]],[1,-1]],
[[[13,6],[6,13]],[1,-1]],
[[[13,7],[7,13]],[1,-1]],
[[[13,8],[8,13]],[1,-1]],
[[[13,9],[9,13]],[1,-1]],
[[[13,10],[10,13]],[1,-1]],
[[[13,11],[11,13]],[1,-1]],
[[[13,12],[12,13]],[1,-1]],
[[[5,5],[13]],[1,-s]],
[[[6,6],[13]],[1,-s]],
[[[7,7],[13]],[1,-s]],
[[[8,8],[13]],[1,-s]],
[[[9,9]],[1]],
[[[10,10]],[1]],
[[[11,11]],[1]],
[[[12,12]],[1]],
[[[5,6],[7,5],[6,7],[13]],[1,1,1,-t]],
[[[5,7],[8,5],[7,8],[13]],[1,1,1,-t]],
[[[5,8],[6,5],[8,6],[13]],[1,1,1,-t]],
[[[6,8],[7,6],[8,7],[13]],[1,1,1,-t]],
[[[9,10],[11,9],[10,11]],[1,1,1]],
[[[9,11],[12,9],[11,12]],[1,1,1]],
[[[9,12],[10,9],[12,10]],[1,1,1]],
[[[10,12],[11,10],[12,11]],[1,1,1]],
[[[1,1],[1,1]],[1,-1]],
[[[1,2],[3,1]],[1,-1]],
[[[1,3],[4,1]],[1,-1]],
[[[1,4],[2,1]],[1,-1]],
[[[2,1],[4,2]],[1,-1]],
[[[2,2],[2,2]],[1,-1]],
[[[2,3],[1,2]],[1,-1]],
[[[2,4],[3,2]],[1,-1]],
[[[3,1],[2,3]],[1,-1]],
[[[3,2],[4,3]],[1,-1]],
[[[3,3],[3,3]],[1,-1]],
[[[3,4],[1,3]],[1,-1]],
[[[4,1],[3,4]],[1,-1]],
[[[4,2],[1,4]],[1,-1]],
[[[4,3],[2,4]],[1,-1]],
[[[4,4],[4,4]],[1,-1]],
[[[1,5],[5,1]],[1,1]],
[[[1,6],[7,1]],[1,1]],
[[[1,7],[8,1]],[1,1]],
[[[1,8],[6,1]],[1,1]],
[[[2,5],[8,2]],[1,1]],
[[[2,6],[6,2]],[1,1]],
[[[2,7],[5,2]],[1,1]],
[[[2,8],[7,2]],[1,1]],
[[[3,5],[6,3]],[1,1]],
[[[3,6],[8,3]],[1,1]],
[[[3,7],[7,3]],[1,1]],
[[[3,8],[5,3]],[1,1]],
[[[4,5],[7,4]],[1,1]],
[[[4,6],[5,4]],[1,1]],
[[[4,7],[6,4]],[1,1]],
[[[4,8],[8,4]],[1,1]]
];;

G:=SGrobnerTrunc(K,6,[1,1,1,1,1,1,1,1,1,1,1,1,2]);

d0:=[[[5],[1,9]],[1,1]];;
d1:=[[[6],[2,10]],[1,1]];;
d2:=[[[7],[3,11]],[1,1]];;
d3:=[[[8],[4,12]],[1,1]];;

d210:=MulNP(MulNP(d2,d1),d0);;
d102:=MulNP(MulNP(d1,d0),d2);;
d021:=MulNP(MulNP(d0,d2),d1);;
z1:=MulNP(d210,d210);;
z2:=MulNP(d102,d102);;
z3:=MulNP(d021,d021);;
z:=AddNP(AddNP(z1,z2,1,1),z3,1,1);;

zR:=StrongNormalFormNP(z,G);;

w1:=[[[7,6,5,7,6,5],[6,5,7,6,5,7],[5,7,6,5,7,6]],[1,1,1]];;
w2:=[[[1,1,1,2,2,2,11,10,9,11,10,9],[1,1,1,2,2,2,10,9,11,10,9,11],[1,1,1,2,2,2,9,11,10,9,11,10]],[1,1,1]];;
w:=AddNP(w1,w2,1,1);;

aX:=StrongNormalFormNP(AddNP(zR,w,1,-1),G);;

Print("rho(z) - (z otimes 1 + gz otimes z) is: \n");

PrintNP(aX);

Print("Taking U=1 this is... \n");
 
Print("  L2g0^2g3^2x1x0x2x1 + L2g0^2g1g3x0x2x1x0 + L2g0^2g1^2x2x1x0x2  + others  \n");

r1:=MulNP(MulNP(MulNP(d1,d0),d2),d1);;
r2:=MulNP(MulNP(MulNP(d0,d2),d1),d0);;
r3:=MulNP(MulNP(MulNP(d2,d1),d0),d2);;
r:=AddNP(AddNP(r1,r2,1,1),r3,1,1);;

rR:=StrongNormalFormNP(r,G);;

u1:=[[[6,5,7,6],[5,7,6,5],[7,6,5,7]],[1,1,1]];;

uX:=StrongNormalFormNP(AddNP(rR,u1,1,-1),G);;

uno:=[[[13]],[1]];;

Print("To substract, we need to multiply this by U, that is to say, by 1\n");

uXU:=MulNP(uX,uno);;

aaX:=AddNP(aX,uXU,1,-t);;

Print("rho(z- L2 r) - (z - L2r) otimes 1 - gz otimes z ) is: \n");

PrintNP(aaX);

Print("Taking U=1 this is... \n");
 
Print(" L2(L1-L2) (g1g3 \otimes x2x1 +  g0g3 \otimes x1x0 + g0g2 \otimes x0x2 + others  \n");

v1:=MulNP(d2,d1);;
v2:=MulNP(d1,d0);;
v3:=MulNP(d0,d2);;
v:=AddNP(AddNP(v1,v2,1,1),v3,1,1);;

vR:=StrongNormalFormNP(v,G);;

h1:=[[[7,6],[6,5],[5,7]],[1,1,1]];;

hX:=StrongNormalFormNP(AddNP(vR,h1,1,-1),G);;

uno:=[[[13]],[1]];;

Print("To substract, we need to multiply this by U^2, that is to say, by 1\n");

hXU:=MulNP(MulNP(hX,uno),uno);;

aaaX:=AddNP(aaX,hXU,1,-t*(s-t));;

Print("rho(z- L2 r - L2(L1-L2)v ) - (z - L2r  - L2(L1-L2)v)otimes 1 - gz otimes z ) is: \n");

PrintNP(aaaX);
