Twist – a new programming language for quantum computing

Twist is expressive enough to write out programs for well-known quantum algorithms and identify bugs in their implementations.


Scientists from MIT’s Computer Science and Artificial Intelligence (CSAIL) have created Twist – a programming language for quantum computing. The language uses a concept called purity, which enforces the absence of entanglement and results in intuitive programs, with fewer bugs. Twist can describe and verify which pieces of data are entangled in a quantum program, using a language a programmer can understand.

Programming quantum computers requires awareness of entanglement. When two qubits are entangled, actions on one qubit can change the value of the other, even when they are physically separated. This potency is also a source of weakness. While programming, discarding one qubit without being mindful of its entanglement with another qubit can destroy the data stored in the other. This jeopardises the correctness of the program. 


Sign up for your weekly dose of what's up in emerging technology.

“Our language Twist allows a developer to write safer quantum programs by explicitly stating when a qubit must not be entangled with another,” said Charles Yuan, an MIT PhD student in electrical engineering and computer science and the lead author on a new paper about Twist. “Because understanding quantum programs requires understanding entanglement, we hope that Twist paves the way to languages that make the unique challenges of quantum computing more accessible to programmers.” 

Yuan wrote the paper alongside Chris McNally, a PhD student in electrical engineering and computer science, affiliated with the MIT Research Laboratory of Electronics, as well as MIT Assistant Professor Michael Carbin. The research was presented at the 2022 Symposium on Principles of Programming conference in Philadelphia.

According to MIT scientists, Twist is expressive enough to write out programs for well-known quantum algorithms and identify bugs in their implementations. The next step for MIT is using Twist to create higher-level quantum programming languages.

“Quantum computers are error-prone and difficult to program. By introducing and reasoning about the ‘purity’ of program code, Twist takes a big step towards making quantum programming easier by guaranteeing that the quantum bits in a pure piece of code cannot be altered by bits not in that code,” said Fred Chong, Seymour Goodman Professor of Computer Science, University of Chicago and chief scientist, 

The work was supported, in part, by the MIT-IBM Watson AI Lab, the National Science Foundation, and the Office of Naval Research.

More Great AIM Stories

Meeta Ramnani
Meeta’s interest lies in finding out real practical applications of technology. At AIM, she writes stories that question the new inventions and the need to develop them. She believes that technology has and will continue to change the world very fast and that it is no more ‘cool’ to be ‘old-school’. If people don’t update themselves with the technology, they will surely be left behind.

Our Upcoming Events

Conference, in-person (Bangalore)
MachineCon 2022
24th Jun

Conference, Virtual
Deep Learning DevCon 2022
30th Jul

Conference, in-person (Bangalore)
Cypher 2022
21-23rd Sep

3 Ways to Join our Community

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Telegram Channel

Discover special offers, top stories, upcoming events, and more.

Subscribe to our newsletter

Get the latest updates from AIM