6 ms·
What would a very simple quantum program look like?
- api 9y ago"The result is that qubit 2 now contains the state of qubit 1 after Hadamard operation." This is really going to be a barrier to understanding. When I was a little kid I could not only grasp but very easily remember what OR, AND, NOT, NOR, and XOR gates did. They take two inputs and tell you what input 1 OR input 2 would be, etc. Addition, subtraction, multiplication, and division are likewise easy to remember once you get the concept. These operations add, subtract, multiply, and divide, respectively. What is Hadamarding? What does it mean to Hadamard something? Do we really have to use language studded with totems to dead people in place of clear conceptual descriptions of things? Math itself has the same problem once you get beyond concepts that were discovered by people we no longer remember. It's fine to memorialize great minds, but not at the expense of understanding for future generations.
- majewsky 9y ago> Do we really have to use language studded with totems to dead people in place of clear conceptual descriptions of things? The name "AND" is just as opaque as "Hadamard", if taken by itself. It just doesn't appear as such to you because you already have an intuitive grasp on the concept of conjunction. The problem is that nearly everything on quantum physics is so profoundly unfamiliar that we cannot map these concepts and operations to familiar words. At that point, it doesn't matter if we call it "the florb operator" or if we name it after some pioneer of the field. EDIT: Math actually has sort of the opposite problem. They use everyday words for very concrete objects with very concrete definitions. The most notable exception is theorems, but I hope you won't argue that a name like "Zorn's lemma" is more practical than something like "the lemma where you plug that thing into this mapping and then this thing becomes frobnicated".
- gravypod 9y ago> The name "AND" is just as opaque as "Hadamard", if taken by itself It's great that "AND" is not taken by itself. It very much helps that AND comes from our language. The AND gate is named after "and" which is an English concept. The word 'and' is used to group two things that will happen together. For example: "I will go to the park and go to the pool." This is much like the AND gate which only turns on after the two inputs turn on. Unfortunately "Hadamard" is not part of the English language. > The problem is that nearly everything on quantum physics is so profoundly unfamiliar that we cannot map these concepts and operations to familiar words There is no simple way to explain this in laymen terms? From what the Wikipedia article says I doubt that [1]. Why not just call it a "map basis states" operations? That's what the Wikipedia article implies it does. [1] - https://en.wikipedia.org/wiki/Hadamard_transform#Quantum_computing_applications https://en.wikipedia.org/wiki/Hadamard_transform#Quantum_com...
- yorwba 9y agoEvery quantum operation maps basis states to something, it's not specific enough to single out the Hadamard transform. Note that the full description in your linked Wikipedia article " a one-qubit rotation, mapping the qubit-basis states |0⟩ and |1⟩ to two superposition states with equal weight of the computational basis states |0⟩ and |1⟩". If I had to choose a descriptive name, I might call it the "equal superposition" operation; but I'm not a quantum physicist either, so that might be wrong as well.
- majewsky 9y ago> Unfortunately "Hadamard" is not part of the English language. Of course "Hadamard operation" is part of the English language. If you didn't allow proper nouns and foreign terms to be added to a language, none of the contemporary languages would exist.
- oh_sigh 9y agoHadamard was not a pre-existing English word or phrase like AND was, which I think what OP was getting at.
- yellowapple 9y ago"The name 'AND' is just as opaque as 'Hadamard', if taken by itself. It just doesn't appear as such to you because you already have an intuitive grasp on the concept of conjunction." True, but the difference is that most people able to communicate with a modern language have an intuitive grasp on the concept of conjunction, and can use that intuition to guess what an "AND" or "OR" or "NOT" might mean, as well as more easily remember what "XOR" or "NAND" or "NOR" might do as long as they can remember that "X" stands for "eXclusive" and "N" stands for "Not". In other words, to even a basic English speaker, the name "AND" shouldn't really be all that opaque. Any basic English speaker should be able to guess what "AND" means. In contrast, naming such things after dead mathematicians makes their meanings unintuitive and unguessable to anyone who hasn't memorized said mathematicians and their notable discoveries. As one of those people, I'll take "the lemma where you plug that thing into this mapping and then this thing becomes frobnicated" over "Zorn's lemma" any day; the latter may be more concise, but it's also significantly more opaque, leaving me with absolutely zero starting point to guess what this "lemma" does. In the context of quantum logic gates/operators, I'd propose some alternative names for things currently named after random people (disclaimer: I'm no expert on quantum mathematics, so my names are probably not really accurate depictions of what such gates do, but rather what I currently understand them to do based on what I can glean about them): - "Hadamard gate" -> "equally-maybe gate" (gate that ensures equal probability - "maybe" - of a qubit's potential states) - "Pauli-X gate" -> "maybe-not gate" (gate that inverts the probabilities of a qubit's potential states) / "X flip gate" (gate that rotates the qubit's state space along the X axis) - "Pauli-Y gate" -> "Y flip gate" (gate that rotates the qubit's state space along the Y axis) - "Pauli-Z gate" -> "Z flip gate" or "phase flip gate" (gate that rotates the qubit's state space along the Z axis) - "Toffoli gate" -> "and maybe-not gate" (inverts the third qubit if the first two are both in the |1> state) - "Fredkin gate" -> "maybe swap gate" (swaps the second and third qubits if the first qubit is in the |1> state) These possible names are arguably much more intuitive than the names currently assigned to these operators/gates, especially once you're familiar with representing qubits as Bloch spheres (which is another thing that needs renamed; maybe "qubit sphere" or "state sphere" or "state space" like I've put it above would be more appropriate?).
- colbyh 9y agobut there are also so, so many concepts about programming that you, when you were a little kid, had no hope of grasping. QC is in such early stages that it is more like talking about a circuit diagram, which is something that would befuddle most smart young people. a Hadamard transform is very "mathy" and harder to understand than the majority of basic programming concepts, but why should QC need to be easy to understand? physics and math are very dense fields where great work is being done right now nevertheless.
- opportune 9y agoThis just seems like pointless whining to me. Quantum stuff is hard and picking a different name wouldn't really change anything. Perhaps calling it a Hadamard rotation would be slightly easier to understand. But regarding the difficulty of the concept: nobody is forcing you to study quantum computing anyway. Also, the only reason you find boolean operators and normal arithmetic operators easy to understand intuitively is due to exposure.
- 21 9y ago> Also, the only reason you find boolean operators and normal arithmetic operators easy to understand intuitively is due to exposure. I'm not so sure about this. A small child can easily understand "this candy AND that candy" vs "this candy OR that candy". I don't see how any amount of explication will make a small child understand intuitively a Hadamard rotation.
- opportune 9y agoI think you're right, but I also think that part of that exposure involves our use of AND in natural language. We don't have many quantum phenomena or analogies that directly affect us (by that I mean, that we consciously notice and are familiar with) on a day to day basis. So in a way, it's still a problem of exposure. That's partly why I say that changing the name of the Hadamard operation won't really help people understand what is doing to a significantly greater extent: there's not an easy analogy or concise definition that we can use to intuitively understand it.
- BenjiWiebe 9y agoReally? In my experience most young children have a hard time grasping the concept this candy OR that candy. /s
- mikeash 9y agoDo you have the same objection to grouping the simple gates you mention under the name of "boolean logic"? I know almost nothing about quantum computing (aside from the fact that it's not just a matter of trying all possible values simultaneously), but looking up the Hadamard transform on Wikipedia, I'm pretty sure the barrier to understanding is going to be the fact that it's a highly complicated operation, not the three-syllable name.
- Joe-Z 9y ago>Do you have the same objection to grouping the simple gates you mention under the name of "boolean logic"? Why wouldn't he? Wouldn't a term like 'switch logic' be much more intuitive? A switch is either on or off, true or false.
- mikeash 9y agoI don't know, I'm just wondering if they're consistent about it, or if they've internalized terms like "boolean" to the point where they forget that they're named in the same way. Given how common such things are in many fields, it strikes me as weird to single out this particular instance. Along those lines, I also wonder if they object to measuring the power consumption of their boolean gates in "watts."
- oh_sigh 9y agoImagine if the operations of boolean logic were, instead of AND is BOOL, OR is QCC(for queens college, cork), NOT is DFG(for duncan f gregory), etc I think that would be more in line with what OP was talking about.
- mikeash 9y agoIt's hard to evaluate that fairly, since I've known the other names for as long as I can remember. How do you feel about computing distances with the Pythagorean theorem, performing a Gaussian blur, thinking about data compression in terms of Kolmogorov complexity, or generating random numbers in a Poisson distribution?
- archgoon 9y agoThis keeps coming up from programmers, and it's utter nonsense. Learning Machine Learning isn't hard because I have to remember tricky and arbitrary names like Keras, Theano, NVidia, and CUDA. Learning those, and what they do is the easy part. Learning how to use them, how they work, and when to use them takes a lot more time than learning the names. Is python a bad introductory language because it's not named "A Dynamic Language With Syntax that Looks Like Pseudo Code and Significant Whitespace"? Names are easy, humans are really good at them. Like people, remembering them become second nature once you work with them.
- yellowapple 9y ago"Learning how to use them, how they work, and when to use them takes a lot more time than learning the names." That part is made significantly easier if their names actually reflect how/when they're used and/or how they work. Remembering that information is also easier when there's at least some semblance of a mapping between the name and function/purpose.
- ashark 9y ago> Is python a bad introductory language because it's not named "A Dynamic Language With Syntax that Looks Like Pseudo Code and Significant Whitespace"? OTOH we say Python is a programming language, where both of those words have other meanings and uses that aid in both initial understanding and later recall. We don't say Python is a "squabitle flop-tangle" to mean the same thing. I think that when it comes to labeling concepts, given the option of either names that provide a bit of grip or mirror-smooth ones that may only be conquered by direct, silo'd memorization, the former are preferable when possible.
- oh_sigh 9y agoYou're confusing having meaningful names for systems vs having meaningful names for operations within a system. I don't think anyone has complained that "boolean logic' is called what it is, but imagine if each operation was called by the name of some great logician and not some quasi-related common english word.
- 9y ago
- wzeng 9y agoThere are libraries todat that let you do quantum programming! A simple Python library to get started with quantum programming is https://pyquil.readthedocs.io/en/latest/overview.html https://pyquil.readthedocs.io/en/latest/overview.html The Python library allows you to construct quantum programs and output in a quantum/classical shared memory instruction set called Quil.
- Strilanc 9y agoMy guess is that at first it will look like existing programming languages, but with some extra commands (apply Hadamard or QFT or whatever to a register). Over time, people will find good ways to incorporate concepts like reversibility, coherent conditions, phasing, and mixing quantum/classical data deep into the language semantics. For example, Grover's algorithm could be written like this: def grover_search_sample(bit_count, predicate): qureg = qalloc(bit_count) apply X to qureg apply H to qureg n = pi/4 * 2**(bit_count/2) for _ < n: if predicate(qureg): phase_by pi if all(x_axis(qureg)): phase_by pi return measure qureg
- devrandomguy 9y agoTL:DR QM programs can be represented by a Lisp DSL, like everything else in life. It's all brackets, all the way down /s
- dexen 9y agoObligatory xkcd: https://www.xkcd.com/224/ https://www.xkcd.com/224/
- yellowapple 9y agoI really like how Perl's Quantum::Entanglement [0] looks/feels/works. Said package's documentation also has some nifty examples of how it (and actual quantum programming) could be used. In particular: $gas = entangle(1, 'bottled', 1, 'released'); # gas now in states |bottled> + |released> $cat_health = p_op($gas, 'eq', 'released', sub {'Dead'}, sub {'Alive'}); # cat,gas now in states |Alive, bottled> + |Dead, released> if ($cat_health eq 'Dead') {# again, outcome is probabilistic # thus gas = |released> } else { # thus gas = |bottled> } I don't know if this is "real" quantum programming, but it's pretty cool regardless. [0]: http://search.cpan.org/~ajgough/Quantum-Entanglement-0.32/Entanglement.pm http://search.cpan.org/~ajgough/Quantum-Entanglement-0.32/En...