(* This Mathematic 8.0 code accompanies the paper
"The free commutative automorphic 2-generated loop of nilpotency class 3"
by Dylene Agda Souza de Barros, Alexander Grishkov and Petr Vojtechovsky *)

(* auxiliary functions *)
alp[n_]:=((n^3)-n)/3
bet[n_]:= (n^2)-n

(* free nilpotent class 3 commutative automorphic loop on 2 generators *)

(* auxiliary polynomials *)
f3[a_,b_]:=-a[[1]]b[[1]](a[[2]]+b[[2]])
f4[a_,b_]:=a[[2]]b[[2]](a[[1]]+b[[1]])
f5[a_,b_]:=(a[[2]]+b[[2]])(b[[1]]alp[a[[1]]]+a[[1]]alp[b[[1]]])+a[[2]](a[[1]]bet[b[[1]]]+((b[[1]])^2)bet[a[[1]]])+b[[2]](b[[1]]bet[a[[1]]]+((a[[1]])^2)bet[b[[1]]])-a[[1]]b[[1]](a[[3]]+b[[3]])
f6[a_,b_]:= 2a[[1]]a[[2]]b[[1]]b[[2]](a[[1]]+b[[1]])+(a[[2]]+b[[2]])(a[[1]]bet[b[[1]]]+b[[1]]bet[a[[1]]])+(bet[a[[2]]]+bet[b[[2]]])(a[[1]]((b[[1]])^2)+b[[1]]((a[[1]])^2))-a[[2]]b[[2]]alp[a[[1]]+b[[1]]]-a[[1]]b[[1]](a[[4]]+b[[4]])-(a[[3]]+b[[3]])(a[[1]]b[[2]]+a[[2]]b[[1]])
f7[a_,b_]:=-2a[[1]]a[[2]]b[[1]]b[[2]](a[[2]]+b[[2]])-(a[[1]]+b[[1]])(a[[2]]bet[b[[2]]]+b[[2]]bet[a[[2]]])-(bet[a[[1]]]+bet[b[[1]]])(a[[2]]((b[[2]])^2)+b[[2]]((a[[2]])^2))+a[[1]]b[[1]]alp[a[[2]]+b[[2]]]-a[[2]]b[[2]](a[[3]]+b[[3]])-(a[[4]]+b[[4]])(a[[1]]b[[2]]+a[[2]]b[[1]])
f8[a_,b_]:=-(a[[1]]+b[[1]])(a[[2]]alp[b[[2]]]+b[[2]]alp[a[[2]]])-a[[1]](a[[2]]bet[b[[2]]]+((b[[2]])^2)bet[a[[2]]])-b[[1]](b[[2]]bet[a[[2]]]+((a[[2]])^2)bet[b[[2]]])-a[[2]]b[[2]](a[[4]]+b[[4]])

f[a_,b_]:={
a[[1]]+b[[1]],
a[[2]]+b[[2]],
a[[3]]+b[[3]]+f3[a,b],
a[[4]]+b[[4]]+f4[a,b],
a[[5]]+b[[5]]+f5[a,b],
a[[6]]+b[[6]]+f6[a,b],
a[[7]]+b[[7]]+f7[a,b],
a[[8]]+b[[8]]+f8[a,b]
}
(* left division *)
ld[a_,b_]:= {
b[[1]]-a[[1]],
b[[2]]-a[[2]],
b[[3]]-a[[3]]-f3[a,b-a],
b[[4]]-a[[4]]-f4[a,b-a],
b[[5]]-a[[5]]-f5[a,{b[[1]]-a[[1]],b[[2]]-a[[2]],b[[3]]-a[[3]]-f3[a,b-a],b[[4]]-a[[4]]-f4[a,b-a]}],
b[[6]]-a[[6]]-f6[a,{b[[1]]-a[[1]],b[[2]]-a[[2]],b[[3]]-a[[3]]-f3[a,b-a],b[[4]]-a[[4]]-f4[a,b-a]}],
b[[7]]-a[[7]]-f7[a,{b[[1]]-a[[1]],b[[2]]-a[[2]],b[[3]]-a[[3]]-f3[a,b-a],b[[4]]-a[[4]]-f4[a,b-a]}],
b[[8]]-a[[8]]-f8[a,{b[[1]]-a[[1]],b[[2]]-a[[2]],b[[3]]-a[[3]]-f3[a,b-a],b[[4]]-a[[4]]-f4[a,b-a]}]
}

(* left inner mapping (Subscript[L, x,y])(z) *)
li[a_,b_,c_] := ld[ f[a,b], f[a,f[b,c]]]

(* preformating variables for easy reading *)
aa={(Subscript[a, 1]),(Subscript[a, 2]),(Subscript[a, 3]),(Subscript[a, 4]),(Subscript[a, 5]),(Subscript[a, 6]),(Subscript[a, 7]),(Subscript[a, 8])}
bb={(Subscript[b, 1]),(Subscript[b, 2]),(Subscript[b, 3]),(Subscript[b, 4]),(Subscript[b, 5]),(Subscript[b, 6]),(Subscript[b, 7]),(Subscript[b, 8])}
cc={(Subscript[c, 1]),(Subscript[c, 2]),(Subscript[c, 3]),(Subscript[c, 4]),(Subscript[c, 5]),(Subscript[c, 6]),(Subscript[c, 7]),(Subscript[c, 8])}
xx={(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5]),(Subscript[x, 6]),(Subscript[x, 7]),(Subscript[x, 8])}
yy={(Subscript[y, 1]),(Subscript[y, 2]),(Subscript[y, 3]),(Subscript[y, 4]),(Subscript[y, 5]),(Subscript[y, 6]),(Subscript[y, 7]),(Subscript[y, 8])}

(* verifying commutativity *)
Simplify[f[xx,yy]]==Simplify[f[yy,xx]]

(* verifying the automorphic property *)
Simplify[ li[xx,yy,f[aa,bb]] -  f[ li[xx,yy,aa], li[xx,yy,bb]]]

(* verifying associators *)
assoc[a_,b_,c_] := ld[f[a,f[b,c]],f[f[a,b],c]]
e1 := {1,0,0,0,0,0,0,0}
e2 := {0,1,0,0,0,0,0,0}
e3 := {0,0,1,0,0,0,0,0}
e4 := {0,0,0,1,0,0,0,0}
e5 := {0,0,0,0,1,0,0,0}
e6 := {0,0,0,0,0,1,0,0}
e7 := {0,0,0,0,0,0,1,0}
e8 := {0,0,0,0,0,0,0,1}
assoc[e1,e1,e2]==e3
assoc[e1,e2,e2]==e4
assoc[e1,e1,e3]==e5
assoc[e1,e1,e4]==e6
assoc[e2,e2,e3]==e7
assoc[e2,e2,e4]==e8

(* general associator formula *)
Simplify[assoc[aa,bb,cc]]