We finally arrive at quantum computer programming. The thing you have to understand about quantum computers is that they aren’t just an improvement on technology, they are part of a whole new science of computing. Being able to harness quantum states and systems as data and operators will allow us to accurately and precisely model all knowable aspects of quantum systems (inasmuch as ‘accurate’ and ‘precise’ serve as reliable descriptors of quantum phenomena). And as a whole new science of computation, new low-level and high-level languages will be needed to program these quantum computers, because classical data types and operators are simply incompatible with quantum systems. But there’s more to it than that—quantum computers also give us unique new approaches to computing that a classical system cannot even fathom. That’s why Feynman suggested a quantum computer be built in the first place.
This topic is also an essential aspect of Placeholder, and of the story’s development, because right from the beginning I knew that Konrad would be a quantum programmer and he would need a quantum computer to program any sort of feasible ‘jump’ drive. But he would also be able to use the quantum computer to turn the ship on his crew, which was essential to the plot right from the beginning as well. In this post I will cover where high-level quantum computer programming stands today, but I will mostly focus on the approach I took specifically for Placeholder.
(Spoiler Alert! The rest of this post discusses technical details of Placeholder’s plot and primary characters.)
Quantum Programming in the SPQS Universe:
Quantum computer programming is Konrad Schreiber’s assignment aboard the SFS Fulgora. His task, as limited as it might seem on the outside, is to program the ship’s MRD via the Quantum core. He has to coordinate this task carefully with the ship’s pilots and science officer, because a REZSEQ is an extremely complicated program and all the spatiotemporal variables need to be accounted for. Of the ship itself, mass, trajectory, velocity. Of spacetime, vector of system exit manoeuvre, relative time dilation (even if ultimately negligible), modelled warping of local spacetime due to gravity, distortion from plasma wake beyond the heliopause, and of course, all the predicted conditions at the terminus coordinates of the REZSEQ.
As the mission progresses, Konrad sets up various systems and programs to collect all this data automatically and feed it live into his REZSEQ programs. But in order for him to have been able to accomplish that, he needed the experience of building it himself to show him what environmental data was really needed, when it was needed, and how it should be applied within the REZSEQ program.
So in this brief summary of his mission assignment, you get the impression that both quantum computers and quantum computer programming are sufficiently developed to use as tools in an applied task. Obviously, in real life as of today, the state of quantum computer science is nowhere near that level of sophistication. Nevertheless, there have already been several attempts made at building a high-level quantum computer programming language, and a few of those attempts have yielded excellent results, in my opinion (for whatever that’s worth).
Original Concepts for Quantum Computer Programming Languages:
When I first conceived of Placeholder in the spring of 2007, I initially drafted a high-level quantum computer programming language called Quantum C that was loosely derived from Objective C. I liked how clean-cut Objective C was, especially when compared with C itself, C++, or C#. Also, it seemed to me that the rigorous application of objects in Objective C suited the needs of quantum computer programming quite perfectly; they could be adapted into Fields and/or Systems, so that the programming of a quantum computer could remain completely in harmony with Quantum Mechanics (which is essential for some of the more advanced concepts in quantum programming).
I thought I had a winner, until I started writing code in my Quantum C for use in the novel. It got messy fast, and I had accidentally lost the clean-cut perfection of Objective C—given more time and effort, I’m sure I could have kneaded it back to some state of orderly, presentable code, but I decided to set my language aside and research other people’s approaches to quantum programming.
That’s when I stumbled upon a very poorly written paper on QCLs and discovered that somebody else had already ‘invented’ Quantum C, and had done a worse job at implementing the idea than I had. But the really annoying part was how they claimed trademark over the name “Quantum C”, and even several of the applied concepts that I was intending to use. You can read the sloppy joke of a language definition here—Quantum Computers and Quantum Computer Languages: Quantum Assembly Language and Quantum C. The PDF link at the top of the page is the paper itself. Brace yourself, it’s truly awful.
Over time the Wikipedia article on quantum computer programming improved substantially, to include the work of real quantum computer scientists such as Bernhard Ömer and Peter Selinger. Summaries of all the serious efforts into quantum computer programming languages are available from Simon J. Gay (University of Glasgow); the bibliography is useful, but in particular check out his article linked to in the first paragraph, Quantum Programming Languages: Survey and Bibliography (PDF).
I liked Ömer’s work the most, which you can read more about on his webpage: QCL – A Programming Language for Quantum Computers. You’ll have to scroll down to the bottom to get at his “documentation,” ie., his masters and PhD theses. His language is known simply as QCL (Quantum Computer Language), and allows quantum and classical operations and data-types to appear side-by-side (which is a very useful feature right now, as we continue to experiment with quantum computers, and will be even more useful when we have fully functional quantum computers working side by side with classically modelled optical computers). QCL as it stands now appears to be procedural, however, so within Placeholder (even though it’s only ever referred to as simply ‘QCL’), Konrad Schreiber is actually using a fully object-oriented implementation of QCL, probably best called Objective QCL, or for those insistent on keeping things weird, “Flux-system QCL” (since the quantum objects are actually fields or quantum systems always in a state of flux). The point of this system is to harness the fluctuations in quantum states, instead of trying to force a hard, definite value on them.
Applications of QCL Concepts in Placeholder:
Now, I make an interesting point in Placeholder in regards to the capabilities of this Flux-system QCL. In a classical computer, data is data and operations are operations. End of story. You have a fixed and limited method of computation to work with, and quite frankly that seems to work out just fine. You can approach Quantum Programming the same way, or, you can take advantage of certain unique properties of quantum computers that makes the line between data and operations a little fuzzier. For example, a qubit can be just a 1 or a 0, but it can also be in a superposition of both values, which is something the classical bit cannot do. And you can also treat the entangled system that is a logic gate as a type of data, while treating the qubit data as the operator that will act on the logic gate. “But that will break the logic gate and cause unpredictable changes to the quantum system!” you might say. Well, actually no it won’t. As far as the quantum system is concerned, both the logic gate and the passing qubit are already both data and operator. The outcome is probabilistically the same for both approaches. But what that does allow you to do differently, is consider other quantum states of the qubits and logic gates within your programs, not necessarily as data or operators, but simply as what they are. So if you start meddling with the other quantum states of your qubits, naturally, that’s going to introduce a change in the value of the state that is supposed to be measured because the probability of knowing the correct value of the qubit for the purposes of data is exponentially reduced. If you know what you are doing, and work out the probabilities, you can introduce very specific changes to large systems completely under the radar. And that’s exactly what Konrad does to hijack the ship, introduce major security holes, network the quantum core to all the other ship systems, and turn the ship on his crewmates.
Pretty wild, eh? And maybe now you have a better idea of why I made the SPQS consider Quantum Computers to be more dangerous than nuclear weapons. If you know what you’re doing, you can use a quantum computer to hijack any classical system. And if you don’t know what you’re doing, you can completely destroy a quantum core with one errant line of code.
Lastly, it may be worth mentioning why I left out the page-long excerpts of code from Placeholder in the end. I decided, first of all, that long excerpts of code would detract from the narrative. Secondly, I would be opening myself up to a particularly dangerous kind of criticism by committing to a specific syntax that might very well be deprecated within the year—programming languages change and evolve as systems do, and we don’t even have a fully functional quantum computer yet. Thirdly, as funny as it would be to include the code for a REZSEQ in a novel, the plot carried along better without the interruptions. The occasional use of Unix-commands in-line with the narrative was enough tech-talk, and since I did go to the trouble of working out the actual quantum programs ahead of time, the summaries of them were suitably evocative.
Truth be told, I would like for a deluxe edition of Placeholder to be released, where I reintroduce everything I had to strip out to clean up the narrative (including the long redacted sections). There were also some sketches that I didn’t have time to reproduce in illustrator—component designs, compartment plan of the ship, the map of Vega b and their camp on the surface, those kinds of things. That would be a suitable edition to include the Flux-system QCL programs, and maybe even more details about the 11-dimensional spatiotemporal coordinate system I worked out. I guess we’ll see.
I thought I would have more to say today, but that about covers it really. And now that I’ve dealt with all the main weird scientific concepts from Placeholder, in my next post I’ll be getting to The Placeholder Theory itself. Exciting times.
— the Phoeron