Live data from Hacker News

A tutorial quantum interpreter in 150 lines of Lisp

stylewarning.com

11–20 of 46 posts

Re: A tutorial quantum interpreter in 150 lines of Lisp

#11

I wrote something similar a couple of years ago - https://github.com/adamisntdead/QuSimPy Happy to answer any questions people have, including on other simulation methods other than state vector!

One of the aspects emphasized in TFA is being able to simulate gates of any dimension/number of qubits (like a 3-qubit Toffoli or a 5-qubit Molmer-Sorensen), instead of just 1- and 2-qubit gates. Have you thought about extending your simulator to support gates of greater than two qubits?

Re: A tutorial quantum interpreter in 150 lines of Lisp

#12
Recently, I have been working on some things that sometimes overlap with quantum computation and I have realized that the way all the quantum languages approach this wrong. If you are programming explicitly with CNOT gates, you are doing it wrong. A Python programmer doesn't care about logical gates, and neither should a quantum programmer. To that end, I'm convinced that the interplay between coinduction and induction, or coalgebra and algebra is the way forward.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#13

Recently, I have been working on some things that sometimes overlap with quantum computation and I have realized that the way all the quantum languages approach this wrong. If you are programming explicitly with CNOT gates, you are doing it wrong. A Python programmer doesn't care about logical gates, and neither should a quantum programmer. To that end, I'm convinced that the interplay between coinduction and inducti…

This very well may be true, in the same sense that a Python programmer doesn't (usually) care about assembly language. But at their lowest levels, quantum computers are executing a sequence of gates, and much of the work and sophistication of a quantum compiler is to optimize said sequences for rapid and accurate execution. So while gate sequences may not be the end-game to the programmers of tomorrow, they're undoubtedly a necessary component in any software stack.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#14

Recently, I have been working on some things that sometimes overlap with quantum computation and I have realized that the way all the quantum languages approach this wrong. If you are programming explicitly with CNOT gates, you are doing it wrong. A Python programmer doesn't care about logical gates, and neither should a quantum programmer. To that end, I'm convinced that the interplay between coinduction and inducti…

This very well may be true, in the same sense that a Python programmer doesn't (usually) care about assembly language. But at their lowest levels, quantum computers are executing a sequence of gates, and much of the work and sophistication of a quantum compiler is to optimize said sequences for rapid and accurate execution. So while gate sequences may not be the end-game to the programmers of tomorrow, they're undoub…

I never said that they weren't. It's just that most programming language don't deal with gates as a part of their API.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#15

Recently, I have been working on some things that sometimes overlap with quantum computation and I have realized that the way all the quantum languages approach this wrong. If you are programming explicitly with CNOT gates, you are doing it wrong. A Python programmer doesn't care about logical gates, and neither should a quantum programmer. To that end, I'm convinced that the interplay between coinduction and inducti…

Maybe not your point, but a lot of programmers like to take this as "I should invent the Python of quantum computing", which is just about as silly as trying to approach anyone in 1960 and telling them they shouldn't be thinking about electronics at all.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#16
post #2

Any recommendations on a textbook to understand this kind of math?

Ronald de Wolf: Quantum Computing: Lecture Notes

Ronald de Wolf:

https://arxiv.org/abs/1907.09415

David Bacon:

https://courses.cs.washington.edu/courses/cse599d/06wi/

Scott Aaronson:

https://en.wikipedia.org/wiki/Quantum_Computing_Since_Democr...

Re: A tutorial quantum interpreter in 150 lines of Lisp

#17

I wrote something similar a couple of years ago - https://github.com/adamisntdead/QuSimPy Happy to answer any questions people have, including on other simulation methods other than state vector!

One of the aspects emphasized in TFA is being able to simulate gates of any dimension/number of qubits (like a 3-qubit Toffoli or a 5-qubit Molmer-Sorensen), instead of just 1- and 2-qubit gates. Have you thought about extending your simulator to support gates of greater than two qubits?

I guess back when I wrote it I didn't see the need given that single qubit gates along with CNOT are universal and they're implemented. I think airing on the side of 'as few features as is educational' was my mentality on this.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#19

Earlier quoted context omitted.

This very well may be true, in the same sense that a Python programmer doesn't (usually) care about assembly language. But at their lowest levels, quantum computers are executing a sequence of gates, and much of the work and sophistication of a quantum compiler is to optimize said sequences for rapid and accurate execution. So while gate sequences may not be the end-game to the programmers of tomorrow, they're undoub…

I never said that they weren't. It's just that most programming language don't deal with gates as a part of their API.

This is true, but at that point, the goal would be to have a higher level language above the quantum gates. And at that point, I'd guess the code is less educational?

That is, at the end of the day, something like Shor's algorithm can be reduced to some math constructs we roughly know. The speedup comes from these only being efficient using quantum gates. Implementing the code using abstract quantum gates isn't to try and compete, but to try and understand the gates and how they work at a logical level.

This is like learning how boolean gates work to understand some ideas of how computers work. The only people that really think in many of those terms are the CPU designers. Teaching the next round of the designers does so by working with boolean models to get there.

And you are correct that we may have other quantum constructs someday. Just like much of what goes into a CPU isn't strictly OR/AND/etc. With the way gates are wired, it can be confusing to folks as the input signal can also be seen as destroyed in the circuit, but a deterministic signal is captured on the other side.

Now, the above is all from my weak intuition here. I would not be shocked to find I'm wrong on parts.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#20

Recently, I have been working on some things that sometimes overlap with quantum computation and I have realized that the way all the quantum languages approach this wrong. If you are programming explicitly with CNOT gates, you are doing it wrong. A Python programmer doesn't care about logical gates, and neither should a quantum programmer. To that end, I'm convinced that the interplay between coinduction and inducti…

> the interplay between ... coalgebra and algebra

If you have not already seen it, you may be interested in Squiggol (to get an idea of its age, it probably had some indirect influence upon Python)

cf Charity: https://prism.ucalgary.ca/server/api/core/bitstreams/756b50a...

Post reply on HN