A3 (Due Tuesday 26 Sep) Using the code in Vec.hs, implement as many quantum circuits as you can find
and simulate them. I expect you to go beyond the small examples and I expect
some kind of evaluation of the elegance and performance of the resulting
circuits. For concreteness, the circuit at the bottom of page 7 of Basic concepts in
quantum computation can be expressed as follows:
toff :: Lin (Bool,Bool,Bool) (Bool,Bool,Bool)
toff (top,middle,bottom) =
hadamard bottom @>>= \b1 ->
controlled phase (middle,b1) @>>= \ (m1,b2) ->
controlled qnot (top,m1) @>>= \ (t1,m2) ->
controlled (adjoint phase) (m2,b2) @>>= \ (m3,b3) ->
controlled qnot (t1,m3) @>>= \ (t2,m4) ->
controlled phase (t2,b3) @>>= \ (t3,b4) ->
hadamard b4 @>>= \b5 ->
vreturn (t3,m4,b5)
One might argue that the specification is somewhat elegant but that
the overhead of keeping the intermediate names is too tedious.