# ssh using: calc.math.stonybrook.edu
Then type: M2 to start Macaulay2

# Begin with free Lie algebra F

needsPackage "GradedLieAlgebras"
F=lieAlgebra({a,b,c,d}, Signs=>{1,1,1,1})
r1=(c c)
r2=(d d)
r3=(a c)
r4=(b d)
r5=(a a)+2(b c)
r6=(b b)+2(a d)
r7=(a b)+(c d)
L=F/{r1,r2,r3,r4,r5,r6,r7}
describe L
dims(1,10,L)

peek L#cache
L#cache.basis#4
L#cache.basis#7

--
#Weights give a string of numbers; the first string is the degree. The rest are interpreted in some other way, with the last weight being interpreted as homological if we set LastWeightHomological => true

needsPackage "GradedLieAlgebras"
F = lieAlgebra({a,b,c,d},Weights => {1,1,1,1})
r1=(c c)
r2=(d d)
r3=(a c)
r4=(b d)
r5=(a a)+2(b c)
r6=(b b)+2(a d)
r7=(a b)+(c d)
L=F/{r1,r2,r3,r4,r5,r6,r7}

D=differentialLieAlgebra{a a + a b + a d,b b + a b + c b,c b + c d, a d + c d}

---
#Formal relations
#The symbol @ is used as formal Lie multiplication and formal multiplication by scalars, ++ is used as formal addition, and / is used as formal subtraction. Observe that @, like SPACE, is right associative, while / is left associative, so a/b/c means a-b-c and not a-b+c. 

needsPackage "GradedLieAlgebras"
L0=lieAlgebra({a,b,c,d}, Signs=>{1,1,1,1})
r1= c@c
r2= d@d
r3= a@c
r4= b@d
r5= a@a++2@b@c
r6= b@b++2@a@d
r7= a@b++c@d
r8= a@a@a
r9= b@b@b
L=L0/{r1,r2,r3,r4,r5,r6,r7,r8,r9}
describe L
dims(1,14,L)