proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Category.Instance.ZX

Synopsis

Documentation

newtype Bitstring (n :: Nat) Source Github #

Constructors

BS Int 

Instances

Instances details
KnownNat n => Bounded (Bitstring n) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Enum (Bitstring n) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Num (Bitstring n) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

KnownNat n => Show (Bitstring n) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Eq (Bitstring n) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Ord (Bitstring n) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

split :: forall (n :: Nat) (m :: Natural). KnownNat n => Bitstring (n + m) -> (Bitstring n, Bitstring m) Source Github #

Split n + m bits into two parts: the lower n bits and the higher m bits.

combine :: forall (n :: Nat) (m :: Nat). KnownNat n => Bitstring n -> Bitstring m -> Bitstring (n + m) Source Github #

Combine two bitstrings of lengths n and m into one bitstring with the n lower bits or m higher bits.

filterSparse :: forall (o :: Nat) (i :: Nat). SparseMatrix o i -> SparseMatrix o i Source Github #

transpose :: forall (o :: Nat) (i :: Nat). SparseMatrix o i -> SparseMatrix i o Source Github #

mirror :: forall (n :: Nat). KnownNat n => Bitstring n -> Bitstring (n + n) Source Github #

enumAll :: forall (n :: Nat). KnownNat n => [Bitstring n] Source Github #

nat :: forall (n :: Nat). KnownNat n => Int Source Github #

withPlusIsNat :: forall (a :: Nat) (b :: Nat) r. (KnownNat a, KnownNat b) => (KnownNat (a + b) => r) -> r Source Github #

data ZX (i :: Nat) (o :: Nat) where Source Github #

Constructors

ZX :: forall (i :: Nat) (o :: Nat). (KnownNat i, KnownNat o) => SparseMatrix o i -> ZX i o 

Instances

Instances details
DaggerProfunctor ZX Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

dagger :: forall (a :: Nat) (b :: Nat). ZX a b -> ZX b a Source Github #

Promonad ZX Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

id :: forall (a :: Nat). Ob a => ZX a a Source Github #

(.) :: forall (b :: Nat) (c :: Nat) (a :: Nat). ZX b c -> ZX a b -> ZX a c Source Github #

MonoidalProfunctor ZX Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

par0 :: ZX (Unit :: Nat) (Unit :: Nat) Source Github #

par :: forall (x1 :: Nat) (x2 :: Nat) (y1 :: Nat) (y2 :: Nat). ZX x1 x2 -> ZX y1 y2 -> ZX (x1 ** y1) (x2 ** y2) Source Github #

Profunctor ZX Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

dimap :: forall (c :: Nat) (a :: Nat) (b :: Nat) (d :: Nat). (c ~> a) -> (b ~> d) -> ZX a b -> ZX c d Source Github #

(\\) :: forall (a :: Nat) (b :: Nat) r. ((Ob a, Ob b) => r) -> ZX a b -> r Source Github #

Costrong Nat ZX Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

coact :: forall (a :: Nat) (x :: Nat) (y :: Nat). (Ob a, Ob x, Ob y) => ZX (Act a x) (Act a y) -> ZX x y Source Github #

Strong Nat ZX Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

act :: forall (a :: Nat) (b :: Nat) (x :: Nat) (y :: Nat). (a ~> b) -> ZX x y -> ZX (Act a x) (Act b y) Source Github #

Show (ZX a b) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

showsPrec :: Int -> ZX a b -> ShowS Github #

show :: ZX a b -> String Github #

showList :: [ZX a b] -> ShowS Github #

type family MatrixSize (n :: Nat) :: Nat where ... Source Github #

Equations

MatrixSize 0 = Nat1 
MatrixSize n = Mult Nat2 (MatrixSize (n - 1)) 

toMatrix :: forall (o :: Nat) (i :: Nat). ZX i o -> Vec (MatrixSize o) (Vec (MatrixSize i) (Complex Double)) Source Github #

zSpider :: forall (i :: Nat) (o :: Nat). (KnownNat i, KnownNat o) => Double -> ZX i o Source Github #

xSpider :: forall (i :: Nat) (o :: Nat). (KnownNat i, KnownNat o) => Double -> ZX i o Source Github #

cup :: forall (n :: Nat). KnownNat n => ZX 0 (n + n) Source Github #

cap :: forall (n :: Nat). KnownNat n => ZX (n + n) 0 Source Github #

cnot :: ZX 2 2 Source Github #

Controlled NOT gate

ghzState :: ZX 0 3 Source Github #

Greenberger–Horne–Zeilinger state

hadamard :: forall (n :: Nat). KnownNat n => ZX n n Source Github #

Orphan instances

Monoidal Nat Source Github #

Addition of the number of qubits as monoidal tensor. This is the Kronecker product of the matrices.

Instance details

Associated Types

type Unit 
Instance details

Defined in Proarrow.Category.Instance.ZX

type Unit = 0
type (p :: Natural) ** (q :: Natural) 
Instance details

Defined in Proarrow.Category.Instance.ZX

type (p :: Natural) ** (q :: Natural) = p + q

Methods

withOb2 :: forall (a :: Nat) (b :: Nat) r. (Ob a, Ob b) => (Ob (a ** b) => r) -> r Source Github #

leftUnitor :: forall (a :: Nat). Ob a => ((Unit :: Nat) ** a) ~> a Source Github #

leftUnitorInv :: forall (a :: Nat). Ob a => a ~> ((Unit :: Nat) ** a) Source Github #

rightUnitor :: forall (a :: Nat). Ob a => (a ** (Unit :: Nat)) ~> a Source Github #

rightUnitorInv :: forall (a :: Nat). Ob a => a ~> (a ** (Unit :: Nat)) Source Github #

associator :: forall (a :: Nat) (b :: Nat) (c :: Nat). (Ob a, Ob b, Ob c) => ((a ** b) ** c) ~> (a ** (b ** c)) Source Github #

associatorInv :: forall (a :: Nat) (b :: Nat) (c :: Nat). (Ob a, Ob b, Ob c) => (a ** (b ** c)) ~> ((a ** b) ** c) Source Github #

SymMonoidal Nat Source Github # 
Instance details

Methods

swap :: forall (a :: Nat) (b :: Nat). (Ob a, Ob b) => (a ** b) ~> (b ** a) Source Github #

CopyDiscard Nat Source Github # 
Instance details

Methods

copy :: forall (a :: Nat). Ob a => a ~> (a ** a) Source Github #

discard :: forall (a :: Nat). Ob a => a ~> (Unit :: Nat) Source Github #

CategoryOf Nat Source Github #

The category of qubits, to implement ZX calculus from quantum computing.

Instance details

Associated Types

type (~>) 
Instance details

Defined in Proarrow.Category.Instance.ZX

type (~>) = ZX
type Ob (a :: Nat) 
Instance details

Defined in Proarrow.Category.Instance.ZX

type Ob (a :: Nat) = KnownNat a
CompactClosed Nat Source Github # 
Instance details

Methods

distribDual :: forall (a :: Nat) (b :: Nat). (Ob a, Ob b) => Dual (a ** b) ~> (Dual a ** Dual b) Source Github #

dualUnit :: Dual (Unit :: Nat) ~> (Unit :: Nat) Source Github #

StarAutonomous Nat Source Github # 
Instance details

Associated Types

type Dual (x :: Nat) 
Instance details

Defined in Proarrow.Category.Instance.ZX

type Dual (x :: Nat) = x

Methods

dual :: forall (a :: Nat) (b :: Nat). (a ~> b) -> Dual b ~> Dual a Source Github #

dualInv :: forall (a :: Nat) (b :: Nat). (Ob a, Ob b) => (Dual a ~> Dual b) -> b ~> a Source Github #

linDist :: forall (a :: Nat) (b :: Nat) (c :: Nat). (Ob a, Ob b, Ob c) => ((a ** b) ~> Dual c) -> a ~> Dual (b ** c) Source Github #

linDistInv :: forall (a :: Nat) (b :: Nat) (c :: Nat). (Ob a, Ob b, Ob c) => (a ~> Dual (b ** c)) -> (a ** b) ~> Dual c Source Github #

Closed Nat Source Github # 
Instance details

Associated Types

type (x :: Nat) ~~> (y :: Nat) 
Instance details

Defined in Proarrow.Category.Instance.ZX

type (x :: Nat) ~~> (y :: Nat) = ExpSA x y

Methods

withObExp :: forall (a :: Nat) (b :: Nat) r. (Ob a, Ob b) => (Ob (a ~~> b) => r) -> r Source Github #

curry :: forall (a :: Nat) (b :: Nat) (c :: Nat). (Ob a, Ob b) => ((a ** b) ~> c) -> a ~> (b ~~> c) Source Github #

apply :: forall (a :: Nat) (b :: Nat). (Ob a, Ob b) => ((a ~~> b) ** a) ~> b Source Github #

(^^^) :: forall (a :: Nat) (b :: Nat) (x :: Nat) (y :: Nat). (b ~> y) -> (x ~> a) -> (a ~~> b) ~> (x ~~> y) Source Github #

HasInitialObject Nat Source Github # 
Instance details

Associated Types

type InitialObject 
Instance details

Defined in Proarrow.Category.Instance.ZX

type InitialObject = 0

Methods

initiate :: forall (a :: Nat). Ob a => (InitialObject :: Nat) ~> a Source Github #

HasTerminalObject Nat Source Github # 
Instance details

Associated Types

type TerminalObject 
Instance details

Defined in Proarrow.Category.Instance.ZX

Methods

terminate :: forall (a :: Nat). Ob a => a ~> (TerminalObject :: Nat) Source Github #

MonoidalAction Nat Nat Source Github # 
Instance details

Associated Types

type Act (p :: Nat) (x :: Nat) 
Instance details

Defined in Proarrow.Category.Instance.ZX

type Act (p :: Nat) (x :: Nat) = p ** x

Methods

withObAct :: forall (a :: Nat) (x :: Nat) r. (Ob a, Ob x) => (Ob (Act a x) => r) -> r Source Github #

unitor :: forall (x :: Nat). Ob x => Act (Unit :: Nat) x ~> x Source Github #

unitorInv :: forall (x :: Nat). Ob x => x ~> Act (Unit :: Nat) x Source Github #

multiplicator :: forall (a :: Nat) (b :: Nat) (x :: Nat). (Ob a, Ob b, Ob x) => Act (a ** b) x ~> Act a (Act b x) Source Github #

multiplicatorInv :: forall (a :: Nat) (b :: Nat) (x :: Nat). (Ob a, Ob b, Ob x) => Act a (Act b x) ~> Act (a ** b) x Source Github #

KnownNat a => Frobenius (a :: Nat) Source Github # 
Instance details

Methods

spider :: forall (n :: Nat) (m :: Nat). (SNatI n, SNatI m) => NFold n a ~> NFold m a Source Github #

KnownNat n => Comonoid (n :: Nat) Source Github # 
Instance details

Methods

counit :: n ~> (Unit :: Nat) Source Github #

comult :: n ~> (n ** n) Source Github #

KnownNat n => Monoid (n :: Nat) Source Github # 
Instance details

Methods

mempty :: (Unit :: Nat) ~> n Source Github #

mappend :: (n ** n) ~> n Source Github #