"Spinor identities"

clear

E1 = sqrt(p1x^2 + p1y^2 + p1z^2 + m1^2)
E2 = sqrt(p2x^2 + p2y^2 + p2z^2 + m2^2)
E3 = sqrt(p3x^2 + p3y^2 + p3z^2 + m3^2)
E4 = sqrt(p4x^2 + p4y^2 + p4z^2 + m4^2)
p1 = (E1,p1x,p1y,p1z)
p2 = (E2,p2x,p2y,p2z)
p3 = (E3,p3x,p3y,p3z)
p4 = (E4,p4x,p4y,p4z)
u11 = (E1+m1,0,p1z,p1x+i*p1y)
u12 = (0,E1+m1,p1x-i*p1y,-p1z)
v21 = (p2z,p2x+i*p2y,E2+m2,0)
v22 = (p2x-i*p2y,-p2z,0,E2+m2)
u31 = (E3+m3,0,p3z,p3x+i*p3y)
u32 = (0,E3+m3,p3x-i*p3y,-p3z)
v41 = (p4z,p4x+i*p4y,E4+m4,0)
v42 = (p4x-i*p4y,-p4z,0,E4+m4)
I = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1))
gmunu = ((1,0,0,0),(0,-1,0,0),(0,0,-1,0),(0,0,0,-1))
gamma0 = ((1,0,0,0),(0,1,0,0),(0,0,-1,0),(0,0,0,-1))
gamma1 = ((0,0,0,1),(0,0,1,0),(0,-1,0,0),(-1,0,0,0))
gamma2 = ((0,0,0,-i),(0,0,i,0),(0,i,0,0),(-i,0,0,0))
gamma3 = ((0,0,1,0),(0,0,0,-1),(-1,0,0,0),(0,1,0,0))
gamma = (gamma0,gamma1,gamma2,gamma3)
pslash1 = dot(p1,gmunu,gamma)
pslash2 = dot(p2,gmunu,gamma)
pslash3 = dot(p3,gmunu,gamma)
pslash4 = dot(p4,gmunu,gamma)

-- dirac equation
check(dot(pslash1-m1*I,u11) == 0)
check(dot(pslash1-m1*I,u12) == 0)
check(dot(pslash2+m2*I,v21) == 0)
check(dot(pslash2+m2*I,v22) == 0)
check(dot(pslash3-m3*I,u31) == 0)
check(dot(pslash3-m3*I,u32) == 0)
check(dot(pslash4+m4*I,v41) == 0)
check(dot(pslash4+m4*I,v42) == 0)

-- completeness
check(outer(u11,dot(conj(u11),gamma0))+outer(u12,dot(conj(u12),gamma0))-
  (E1+m1)*(pslash1+m1*I) == 0)
check(outer(v21,dot(conj(v21),gamma0))+outer(v22,dot(conj(v22),gamma0))-
  (E2+m2)*(pslash2-m2*I) == 0)
check(outer(u31,dot(conj(u31),gamma0))+outer(u32,dot(conj(u32),gamma0))-
  (E3+m3)*(pslash3+m3*I) == 0)
check(outer(v41,dot(conj(v41),gamma0))+outer(v42,dot(conj(v42),gamma0))-
  (E4+m4)*(pslash4-m4*I) == 0)
