newsynth-0.2: Exact and approximate synthesis of quantum circuits

Safe HaskellNone




This module provides an efficient symbolic representation of the Clifford group on one qubit. This group is generated by S, H, and the scalar ω = eiπ/4. It has 192 elements.


The Clifford group

data Clifford Source

A type representing single-qubit Clifford operators.


clifford_X :: CliffordSource

The Pauli X-gate as a Clifford operator.

clifford_Y :: CliffordSource

The Pauli Y-gate as a Clifford operator.

clifford_Z :: CliffordSource

The Pauli Z-gate as a Clifford operator.

clifford_H :: CliffordSource

The Hadamard gate as a Clifford operator.

clifford_S :: CliffordSource

The Clifford operator S.

clifford_SH :: CliffordSource

The Clifford operator SH.

clifford_E :: CliffordSource

The Clifford operator E = HS3ω3. This operator is uniquely determined by the properties E³ = I, EXE⁻¹ = Y, EYE⁻¹ = Z, and EZE⁻¹ = X.

clifford_W :: CliffordSource

The Clifford operator ω = eiπ/4.

class ToClifford a whereSource

A type class for things that can be exactly converted to a Clifford operator. One particular instance of this is String, so that Clifford operators can be denoted, e.g.,

 to_clifford "-iX"

The valid characters for such string conversions are "XYZHSEIWi-".


to_clifford :: a -> CliffordSource

Convert any suitable thing to a Clifford operator.


clifford_decompose :: ToClifford a => a -> (Int, Int, Int, Int)Source

Given a Clifford operator U, return (a, b, c, d) such that

  • U = EaXbScωd,
  • a ∈ {0, 1, 2}, b ∈ {0, 1}, c ∈ {0, …, 3}, and d ∈ {0, …, 7}.

Here, E = HS3ω3. Note that E, X, S, and ω have order 3, 2, 4, and 8, respectively. Moreover, each Clifford operator can be uniquely represented as above.

data Axis Source

A axis is either I, H, or SH.



clifford_decompose_coset :: ToClifford a => a -> (Axis, Int, Int, Int)Source

Given a Clifford operator U, return (K, b, c, d) such that

  • U = KXbScωd,
  • K ∈ {I, H, SH}, b ∈ {0, 1}, c ∈ {0, …, 3}, and d ∈ {0, …, 7}.

Group operations

clifford_id :: CliffordSource

The identity Clifford operator.

clifford_mult :: Clifford -> Clifford -> CliffordSource

Clifford multiplication.

clifford_inv :: ToClifford a => a -> CliffordSource

Clifford inverse.

Conjugation by T

clifford_tconj :: Clifford -> (Axis, Clifford)Source

Given a Clifford gate C, return an axis K ∈ {I, H, SH} and a Clifford gate C' such that

  • CT = KTC'.