Safe Haskell | None |
---|

This module defines the Syntax of the Quantum IO Monad, which is an embedded language for writing quantum computations.

- type RR = Double
- type CC = Complex RR
- amp :: CC -> RR
- newtype Qbit = Qbit Int
- type Rotation = (Bool, Bool) -> CC
- data U
- data QIO a
- rot :: Qbit -> Rotation -> U
- swap :: Qbit -> Qbit -> U
- cond :: Qbit -> (Bool -> U) -> U
- ulet :: Bool -> (Qbit -> U) -> U
- urev :: U -> U
- unot :: Qbit -> U
- uhad :: Qbit -> U
- uphase :: Qbit -> RR -> U
- mkQbit :: Bool -> QIO Qbit
- applyU :: U -> QIO ()
- measQbit :: Qbit -> QIO Bool
- rid :: Rotation
- rnot :: Rotation
- rhad :: Rotation
- rphase :: RR -> Rotation
- rrev :: Rotation -> Rotation
- show' :: U -> Int -> Int -> String
- spaces :: Int -> String

# Documentation

For Complex numbers, we use the built in Complex numbers, over our Real number type (i.e. Double)

The type of Qubits in QIO are simply integer references.

Enum Qbit | |

Eq Qbit | |

Num Qbit | |

Ord Qbit | |

Show Qbit | We can display a qubit reference |

Heap HeapMap | A HeapMap is an instance of the Heap type class, where the Heap functions can make use of the underlying Map functions. |

Qdata Bool Qbit | The lowest-level instance of Qdata is the relation between Booleans and Qubits. |

The underlying data type of a U unitary operation

The underlying data type of a QIO Computation

cond :: Qbit -> (Bool -> U) -> USource

Apply the conditional unitary, depending on the value of the given qubit

ulet :: Bool -> (Qbit -> U) -> USource

Introduce an Ancilla qubit in the given state, for use in the sub-unitary

mkQbit :: Bool -> QIO QbitSource

Initialise a qubit in the given state (adding it to the overall quantum state)