from sympy import *
import numpy as np
init_printing(use_unicode=True)

a, b, d, f = symbols('alpha beta theta phi')
a, b, d, f

p1=exp(I*f)
p2=Matrix([[exp(-I*a/2), 0],[0, exp(I*a/2)]])
p3=Matrix([[cos (d/2), -I*sin (d/2)],[-I*sin (d/2), cos (d/2)]])
p4=Matrix([[exp(-I*b/2), 0],[0, exp(I*b/2)]])
p1, p2, p3, p4

out=p1*p2*p3*p4
out

H=Matrix([[1/sqrt(2), 1/sqrt(2)],[1/sqrt(2), -1/sqrt(2)]])
lhs=H
lhs

#option A
rhs=out.subs([(f, 0), (a, 0), (b, 0), (d, pi/2)])
print (rhs)
if (lhs==rhs):
    print ("It is true")
else:
    print ("It is false")

#option B
lhs=out.subs([(f, pi/2), (a, pi/2), (b, pi/2), (d, pi/2)])
print (rhs)
if (lhs==rhs):
    print ("It is true")
else:
    print ("It is false")

#option C
lhs=out.subs([(f, 0), (a, pi/2), (b, pi/2), (d, pi/4)])
print (rhs)
if (lhs==rhs):
    print ("It is true")
else:
    print ("It is false")

#option D
lhs=out.subs([(f, pi/4), (a, pi/2), (b, pi/2), (d, pi/4)])
print (rhs)
if (lhs==rhs):
    print ("It is true")
else:
    print ("It is false")