I am trying to encode a chain complex differential $d$ as a symbolic variable that squares to 0. The goal is encoding the simplicial structure of the Dold-Kan complex obtained from a chain complex. This is what I tried so far:
var ('p x y z omega d')
assume(d*d == 0)
#Face maps of the simplicial complex
d10(x,p) = vector(SR, [p])
d11(x,p) = vector(SR, [-d*x+p])
d20(omega,y,x,p) = vector(SR, [x,p])
d21(omega,y,x,p) = vector(SR, [y + x,p])
d22(omega,y,x,p) = vector(SR, [d*omega + y,-d*x + p])
#Degeneracy maps of the simplicial complex
s00(p) = vector(SR, [0,p])
s10(x,p) = vector(SR, [0,0,x,p])
s11(x,p) = vector(SR, [0,x,0,p])
Then, when I try to check the simplicial identity
d11(*d22(omega,y,x,p))==d11(*d21(omega,y,x,p))
this always evaluates to true, no matter what the input of $d_{2,2}$ is. In fact,
d11(*d22(omega,y+z,x,p))==d11(*d21(omega,y,x,p))
still returns true, when clearly
d11(*d22(omega,y+z,x,p))[0].expand()
$\displaystyle -{d}^{2} \omega - {d} x - {d} y - {d} z + p$
d11(*d21(omega,y,x,p))[0].expand()
$\displaystyle -{d} x - {d} y + p$
Am I missing something about how evaluation works or should I specify that $d^2=0$ in a different way? Any other suggestions on how to program a symbolic simplicial set or a differential as a linear symbolic function that squares to 0 are welcome.