Goto Chapter: Top 1 2 3 4 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

1 The category of ZX-diagrams
 1.1 Constructors
 1.2 Attributes
 1.3 Example
 1.4 Filters

1 The category of ZX-diagrams

1.1 Constructors

1.1-1 CategoryOfZXDiagrams
‣ CategoryOfZXDiagrams( )( function )

Returns: a category of ZX-diagrams

Creates a category of ZX-diagrams.

1.1-2 ZX
‣ ZX( global variable )

The default instance of the category of ZX-diagrams. It is automatically created while loading this package.

1.1-3 Qubits
‣ Qubits( zx, n )( operation )

Returns: an object

Create n qubits as an object in the category zx of ZX-diagrams.

1.1-4 Z_Spider
‣ Z_Spider( zx, phi, nr_inputs, nr_outputs )( operation )

Returns: a morphism

Create an Z-spider of phase phi with nr_inputs inputs and nr_outputs outputs as a morphism in the category zx of ZX-diagrams.

1.1-5 X_Spider
‣ X_Spider( zx, phi, nr_inputs, nr_outputs )( operation )

Returns: a morphism

Create an X-spider of phase phi with nr_inputs inputs and nr_outputs outputs as a morphism in the category zx of ZX-diagrams.

1.1-6 H_Gate
‣ H_Gate( zx )( operation )

Returns: a morphism

Create an H-gate with 1 input and 1 output as a morphism in the category zx of ZX-diagrams.

1.1-7 CategoryOfZXDiagrams_as_CategoryOfCospans_CategoryOfDecoratedQuivers
‣ CategoryOfZXDiagrams_as_CategoryOfCospans_CategoryOfDecoratedQuivers( )( function )

Returns: a category of ZX-diagrams

Creates a category of ZX-diagrams as a tower. Only available if the package FunctorCategories is available.

1.2 Attributes

1.2-1 AsInteger
‣ AsInteger( obj )( attribute )

The integer defining an object in a category of ZX-diagrams.

1.2-2 VertexLabeledGraph
‣ VertexLabeledGraph( mor )( attribute )

The labeled graph defining a morphism in a category of ZX-diagrams.

1.3 Example

gap> LoadPackage( "ZXCalculusForCAP", false );
true
gap> ZX;
CategoryOfZXDiagrams( )
gap> zero := Qubits( 0 );
<An object in CategoryOfZXDiagrams( ) representing 0 input/output vertices>
gap> one := Qubits( 1 );
<An object in CategoryOfZXDiagrams( ) representing 1 input/output vertices>
gap> two := Qubits( 2 );
<An object in CategoryOfZXDiagrams( ) representing 2 input/output vertices>
gap> three := Qubits( 3 );
<An object in CategoryOfZXDiagrams( ) representing 3 input/output vertices>
gap> three = one + two;
true
gap> three = zero + three;
true
gap> three = 3 * one;
true
gap> id := IdentityMorphism( one );
<An identity morphism in CategoryOfZXDiagrams( )>
gap> id3 := IdentityMorphism( three );
<An identity morphism in CategoryOfZXDiagrams( )>
gap> id3 = 3 * id;
true
gap> ev := EvaluationForDual( three );
<A morphism in CategoryOfZXDiagrams( )>
gap> coev := CoevaluationForDual( three );
<A morphism in CategoryOfZXDiagrams( )>
gap> PreCompose( ev, IdentityMorphism( zero ) );
<A morphism in CategoryOfZXDiagrams( )>
gap> PreCompose( IdentityMorphism( TensorProduct( three, three ) ), ev );
<A morphism in CategoryOfZXDiagrams( )>
gap> PreCompose( coev, IdentityMorphism( TensorProduct( three, three ) ) );
<A morphism in CategoryOfZXDiagrams( )>
gap> PreCompose( IdentityMorphism( zero ), coev );
<A morphism in CategoryOfZXDiagrams( )>
gap> Display( PreCompose( coev, ev ) );
A morphism in CategoryOfZXDiagrams( ) given by a ZX-diagram \
with 0 vertex labels
  [  ],
  inputs
  [  ],
  outputs
  [  ],
  and 0 edges
  [  ].
gap> Display( PreCompose( ev, coev ) );
A morphism in CategoryOfZXDiagrams( ) given by a ZX-diagram \
with 6 vertex labels
  [ "neutral", "neutral", "neutral", "neutral", "neutral", "neutral" ],
  inputs
  [ 0, 1, 2, 0, 1, 2 ],
  outputs
  [ 3, 4, 5, 3, 4, 5 ],
  and 0 edges
  [  ].
gap> IdentityMorphism( one ) + IdentityMorphism( two ) = id3;
true
gap> AssociatorLeftToRight( zero, one, two ) = id3;
true
gap> AssociatorRightToLeft( zero, one, two ) = id3;
true
gap> LeftUnitor( three ) = id3;
true
gap> LeftUnitorInverse( three ) = id3;
true
gap> RightUnitor( three ) = id3;
true
gap> RightUnitorInverse( three ) = id3;
true
gap> Braiding( one, two ) = BraidingInverse( two, one );
true
gap> X_1_1 := X_Spider( 1, 1 );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( X_1_1 );
true
gap> Z_1_1 := Z_Spider( 1, 1 );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( Z_1_1 );
true
gap> H := H_Gate( );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( H );
true
gap> X_1_2 := X_Spider( 1, 2 );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( X_1_2 );
true
gap> Z_2_1 := Z_Spider( 2, 1 );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( Z_2_1 );
true
gap> X_1_2_Z_2_1 := PreCompose( X_1_2, Z_2_1 );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( X_1_2_Z_2_1 );
true
gap> GHZ := ( 3 * X_Spider( 0, 1 ) ) * ( id + H + id ) *
>        ( X_1_2 + Z_Spider( 1, 1 ) + X_1_2 ) *
>        ( id + Z_Spider( 3, 1 ) + id );
<A morphism in CategoryOfZXDiagrams( )>
gap> IsWellDefined( GHZ );
true

1.4 Filters

1.4-1 IsCategoryOfZXDiagrams
‣ IsCategoryOfZXDiagrams( filter )

The filter of categories of ZX-diagrams.

1.4-2 IsObjectInCategoryOfZXDiagrams
‣ IsObjectInCategoryOfZXDiagrams( filter )

The filter of objects in a category of ZX-diagrams.

1.4-3 IsMorphismInCategoryOfZXDiagrams
‣ IsMorphismInCategoryOfZXDiagrams( filter )

The filter of morphisms in a category of ZX-diagrams.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 Ind

generated by GAPDoc2HTML