# QuICScript Cheat Sheet

A cheat sheet for quantum programming language QuICScript

## A Cheat Sheet for Quantum Programming Language QuICScript

## What is QuICScript?

QuIC stands for Quantum Interpreted Circuits, and QuICScript was developed by my CEO, Tan Teik Guan, as a hobby to streamline the process of quantum circuit development.

QuICScript is a software-based quantum emulator, which can support quantum computations of up to 20-qubits and scale to gate depths beyond 100,000 gates.

Quantum programs written in QuICScript can be executed in real-time via a QuICScript Engine. Quantum-in-a-Browser is a QuICScript Engine implemented within a standard web browser.

## Overview of a QuICScript Program

At the start of a new execution, each qubit will be initialized to |0⟩. If you need the qubit to be initialized to |1⟩, add a "X" to each relevant qubit before the actual quantum algorithm.

In Diagram 1 above, I want the input qubit q[0] to be in state |0⟩ and qubit q[1] to be in state |1⟩. I added the X gate for q[1] to initialize the qubit to be in state |1⟩. The rest of the QuICScript program "IX,HI,CN" will result in a Bell state with inverse correlation.

## QuICScript Commands

The QuICScript Engine supports the execution of many discrete quantum gates. The commands are listed in the left column, and the associated behavior is listed in the right column.

### Fundamental Gates

QuICScript Command | Description |

I | Identity Gate |

X | Pauli-X Gate |

Y | Pauli-Y Gate |

Z | Pauli-Z Gate / Phase shift by φ = π |

H | Hadamard Gate |

P | Phase (S, P) Gate / Phase shift by φ = π/2 |

p | Inverse Phase (S, P) Gate |

T | Phase (T) Gate / Phase shift by φ = π/4 |

t | Inverse Phase (T) Gate |

s | Swap Gate |

### Universal Gates

QuICScript Command | Description |

U θ φ λ | U Gate. Enables arbitrary rotation of a single qubit. Parameters are the three Euler rotation angles, θ, φ and λ that are separated by 0 between them. |

The matrix for the U gate is defined as

$\mathrm{U(\theta ,\phi ,\lambda )}=\left(\begin{array}{cc}\mathrm{cos}\left(\frac{\theta}{2}\right)& {-e}^{\mathrm{i\lambda}}\mathrm{sin}\left(\frac{\theta}{2}\right)\\ {e}^{\mathrm{i\phi}}\mathrm{sin}\left(\frac{\theta}{2}\right)& {e}^{\mathrm{i(\phi +\lambda )}}\mathrm{cos}\left(\frac{\theta}{2}\right)\end{array}\right)$

To implement the phase shift via the U gate, it is defined as

$P\left(\phi \right)=U(0,\mathrm{\phi},0)$

### Controlled Gates

QuICScript Command | Description |

CN | Controlled Not Gate (CNOT) |

CY | Controlled Y Gate |

CZ | Controlled Z Gate (CZ) |

CP | Controlled Phase (S, P) Gate |

CT | Controlled Phase (T) Gate |

Cs | Fredkin Gate (CSWAP) |

CU | Controlled U Gate |

CCN | Toffoli Gate (CCNOT) |

C...CN | n-bit Toffoli Gate |

Similar to the Toffoli gate, QuICScript also supports controlled-controlled-gate syntax for the above listed controlled gates. E.g., CCY, CYC, ZCC, etc. Note that QuICScript Engine supports any permutation of the QuICScript commands describing the controlled gates.

Similar to the n-bit Toffoli gate, QuICScript also supports n-bit controlled-gate syntax for the above listed controlled gates. E.g., CCCY, CYCC, ZCCCC, etc.

### Measurements

QuICScript Command | Description |

m | Measurement operation that resolves at random, per execution, according to the quantum state probabilities to either |0⟩ or |1⟩. |

0 | Measurement output always set to |0⟩. |

1 | Measurement output always set to |1⟩. |

### Circuit Modifiers

QuICScript Command | Description |

, | One QuICScript command is assigned to each qubit in a top-to-bottom vertical sequence. The comma is a delimiter to indicate that all available qubits have been each assigned a command; the next set of command-to-qubit assignments is expected after the comma. |

d | Delete a qubit from the output state (system wavefunction). The probabilities of the remaining qubits will be normalized in the QuICScript Engine output. |

Author

### Nicholas Ho

Nicholas seriously enjoys learning new knowledge. He is so serious about it that his hobby is to collect hobbies. His most enduring hobby, since 1997, is to continuously explore the ever-evolving domains of applied cryptography, software development, and cybersecurity. His latest aspiration is to add the word quantum in front of each of these 3 domains. Nicholas is currently a Senior Cryptographic Engineer at pQCee.com. Akin to many Singaporeans, he also enjoys collecting popular certifications, including a CS degree, an Infocomm Security masters, CISSP, and CISA.