What is Silq?

Author: neptune | 08th-Mar-2022 | views: 363

Here we give you an overview of quantum computing language silq and other important Quantum terminology.

What is Silq?

Silq is a new high-level programming language for quantum computing with a strong static type system, developed at ETH Zürich.

Now, Computer scientists from ETH Zürich have made an important breakthrough in the field of programming languages. Silq language is the first of its kind that is as elegant, simple, and safe as classical computer languages.

What is Quantum Programming?

Quantum programming is the process of compiling sequences of instructions, called quantum programs, that runs on quantum computers. Quantum programming languages help quantum algorithms to run using high-level constructs or equations.
Example: QCL, Q# (Q sharp), Silq, etc.

What are Quantum Computers?

Quantum computer is a machine that performs calculations much faster than classical computers. Quantum computers use quantum mechanics to perform calculations.

Classical vs Quantum computers?

Classical computers are based on digital electronics and operate using bits and logic gates. While quantum computer uses qubits and quantum gates for performing calculations rather than using bits and logic gates.

Over the last decade, Scientists made huge progress in the field of quantum computing, because quantum computers can solve problems much faster that we can’t solve using classical computers.

Binary of Quantum computing Qubits?

Qubits are a vector of two complex numbers with unit length. Qubits are quite different from the bits. We know, a bit is either 0 and 1. Bits has no probability factor. While qubit is inherently probabilistic means two identical qubits may have different values.

We can read bits as many times as we want without affecting the state of bits. While qubits loses its quantum properties after some time that we can’t recover.

We measure qubits as|α|², the probability that the qubit will be measured as 0, and |β|², the probability that the qubit will be measured as 1.

Features of Silq language?

  • Reduced and Simple code
  • Easy to understand semantics
  • Prevent errors
  • Automatic type checking
  • Uncomputation (Erase values which are no longer needed like garbage collection in other languages)

Syntax to write function in Silq?

def main() {
return measure(x);
view rawfunction_Silq.slq hosted with ❤ by GitHub

While writing a code in silq we have to save file using .slq extension. eg function_Silq.slq

Problems with quantum computing?

In case of Quantum computers, garbage collection or disposal of is quite trickier due to quantum involvement. Previously calculated value can interact with current values. To solve this problem uncomputation technique comes in picture.

Silq is the first programming language that can automatically identify and erase values no longer needed.

How to install silq?

You can also compile Silq from its GitHub source code: link
The following instructions are targeted for Ubuntu, but should also work for other Linux distributions or Mac.


The following prerequisites are usually already installed on your system. If not, run (on Ubuntu)

sudo apt-get install -y build-essential git wget unzip

Install Silq

git clone # clone the repository
cd silq && ./ && ./ # download dependencies and build project
# [ignore compilation warnings]

Now, you can run silq by

# (expected) error: no input files

Add Silq to Path
Optionally, you may also add the Silq binary to your path. This enables typing silq anywhere, regardless of the current directory:

# Typically not needed: create directory
sudo mkdir -p /usr/local/bin
# make sure the current directory is `/path/to/silq`
sudo ln -s $(pwd)/silq /usr/local/bin/silq

Then, you can just run silq anywhere:

# (expected) error: no input files

In the following, we assume you have followed this step. Otherwise, you have to call silq using its full path, e.g., /path/to/silq.

Program to output 0 or 1.

def main(){
return measure(x);
view rawprogram.slq hosted with ❤ by GitHub


silq program.slq # type-check the correct file
# [no output]
silq program.slq --run # run the correct file
# Outputs 0 or 1

For more details you can visit here

If you have any questions or suggestions let me know in the comments section below, follow us on social media for more such articles.

Thanks for reading!

anonymous | May 24, 2021, 1:09 a.m.

I like the name Silq 😀

Related Blogs
Related Blogs View More