Safe Haskell | None |
---|---|

Language | Haskell2010 |

This module contains some simple examples of quantum computations written using the Quantum IO Monad.

- q0 :: QIO Qbit
- q1 :: QIO Qbit
- qPlus :: QIO Qbit
- qMinus :: QIO Qbit
- randBit :: QIO Bool
- share :: Qbit -> QIO Qbit
- bell :: QIO (Qbit, Qbit)
- test_bell :: QIO (Bool, Bool)
- hadTwice :: Bool -> QIO Bool
- hadTwice' :: Bool -> QIO Bool
- alice :: Qbit -> Qbit -> QIO (Bool, Bool)
- uZZ :: Qbit -> U
- bobsU :: (Bool, Bool) -> Qbit -> U
- bob :: Qbit -> (Bool, Bool) -> QIO Qbit
- teleportation :: Qbit -> QIO Qbit
- test_teleport :: QIO (Bool, Bool)
- teleport_true' :: QIO Qbit
- teleport_true :: QIO Bool
- teleport_random' :: QIO Qbit
- teleport_random :: QIO Bool
- u :: (Bool -> Bool) -> Qbit -> Qbit -> U
- deutsch :: (Bool -> Bool) -> QIO Bool
- problem :: QIO Bool

# Documentation

Initialise a qubit in the |+> state. This is done by applying a Hadamard gate to the |0> state.

Initialise a qubit in the |-> state. This is done by applying a Hadamard gate to the |1> state.

share :: Qbit -> QIO Qbit Source #

This function can be used to "share" the state of one qubit, with another newly initialised qubit. This is not the same as "cloning", as the two qubits will be in an entangled state. "sharing" is achieved by simply initialising a new qubit in state |0>, and then applying a controlled-not to that qubit, depending on the state of the given qubit.

test_bell :: QIO (Bool, Bool) Source #

This function creates a Bell state, and then measures it. The resulting pair of Booleans will always be in the same state as one another.

hadTwice :: Bool -> QIO Bool Source #

This function initiaslised a qubit in the state corresponding to the given Boolean value. The Hadamard transform (which is self-inverse) is applied to the qubit twice, and then the qubit is measured. This should correspond to the identity function on the given Boolean value.

hadTwice' :: Bool -> QIO Bool Source #

A different implementation of `hadTwice`

where QIO is used to apply two
unitaries, each of which is a single Hadamard gate, as opposed to a single
unitary, which is two Hadamard gates.

alice :: Qbit -> Qbit -> QIO (Bool, Bool) Source #

The operations that Alice must perform in the classic quantum teleportation example.

bobsU :: (Bool, Bool) -> Qbit -> U Source #

The unitary operations that Bob must perform in the classic quantum teleportation example.

bob :: Qbit -> (Bool, Bool) -> QIO Qbit Source #

The overall operations that Bob must perform in the classic quantum teleportation example

teleportation :: Qbit -> QIO Qbit Source #

The overall QIO computation that teleports the state of single qubit

test_teleport :: QIO (Bool, Bool) Source #

A small test function of quantum teleportation, which teleports a bell state, and then measures it.

teleport_true' :: QIO Qbit Source #

teleports a qubit in the state |1>

teleport_true :: QIO Bool Source #

teleports a qubit in the state |1>, and then measures it

teleport_random' :: QIO Qbit Source #

teleports a qubit in the state |+>

teleport_random :: QIO Bool Source #

teleports a qubit in the state |+>, and then measures it.

u :: (Bool -> Bool) -> Qbit -> Qbit -> U Source #

The implementation of Deutsch's algorithm requires a unitary to represent the "oracle" function.