Chapter 1 — Key Takeaways (The Quantum Programming Landscape)
The one-page map. Come back to this when you need to explain quantum computing to someone else — which will happen sooner than you think.
What a quantum program is
circuit ──transpile──▶ hardware-native gates ──run × N shots──▶ histogram of bitstrings
- A fixed-size, straight-line sequence of gates on a fixed number of qubits, ending in measurement. Not a script — closer to a hardware description.
- It compiles. What runs is not what you wrote. See Chapter 10.
- It returns a distribution, never a value. Every quantum program. Extracting an answer is a statistics problem — Chapter 5.
The three questions a quantum program can answer
| Question | Primitive | Example algorithms |
|---|---|---|
| What is the most likely outcome? | Sampler | Grover, Shor, Bernstein–Vazirani |
| What is $\langle\psi\lvert H\rvert\psi\rangle$? | Estimator | VQE, QAOA, all of QML |
| What is the whole distribution? | Sampler, many shots | sampling problems, benchmarking |
Picking the wrong one costs shots and accuracy. Chapter 7 §7.6.
The five frameworks, in one line each
| Framework | Owner | The bet | Pick it when |
|---|---|---|---|
| Qiskit | IBM | Circuits + the best compiler + free hardware | Default. Learn this first |
| Cirq | Scheduling and physical placement belong in the program | NISQ research, reading the literature | |
| PennyLane | Xanadu | A circuit is a differentiable function | Anything gradient-based, QML |
| Q# | Microsoft | Quantum programming needs a real language | Algorithm design, resource estimation |
| Braket | Amazon | Portability across hardware technologies | Comparing ions vs. superconducting vs. atoms |
| OpenQASM | (open spec) | Not a framework — the assembly language | Interchange; reading transpiler output |
Why five? The hardware has not converged, so the software cannot.
The stack
APPLICATION → ALGORITHM → CIRCUIT → OpenQASM → TRANSPILER → PULSE → CONTROL → QPU
↕ ↕ ↕ ↕ ↕ ↕
your code VQE/Grover what you portable Ch. 10, 28, Ch. 31
write text 29
Classical analogues: circuit ≈ source, QASM ≈ IR/assembly, transpiler ≈ compiler backend, pulse ≈ microcode.
Where the analogy breaks: a classical compiler affects speed; the transpiler affects correctness, because every added gate adds error and every added nanosecond adds decoherence. A badly transpiled circuit does not run slowly. It returns noise.
The four structural differences
| Property | Broken classical instinct | Consequence | Chapter |
|---|---|---|---|
| Output is probabilistic | assert f(x) == expected |
Testing becomes statistical; precision costs $1/\epsilon^2$ shots | 5, 27 |
| No-cloning | save/restore a checkpoint | No backups, no majority-vote QEC — but QKD works | 25, 38 |
| Measurement collapses | print(state) |
No print debugging; use statevector probes on small instances | 26 |
| Entanglement is a resource | variables are independent | $2^n$ amplitudes = the power; stray entanglement = the bugs | 4, 19 |
The exponential wall
| Qubits | Amplitudes | Statevector memory (complex128) |
|---|---|---|
| 20 | ~1.0 × 10⁶ | 16 MiB |
| 30 | ~1.1 × 10⁹ | 16 GiB |
| 40 | ~1.1 × 10¹² | 16 TiB |
| 50 | ~1.1 × 10¹⁵ | 16 PiB |
~40–50 qubits is where exact classical simulation gives out. That boundary is why quantum hardware is interesting. Chapter 11 covers the partial escapes (stabilizer, tensor network).
NISQ reality, today
Works: learning; small algorithms (Grover 3–4 qubits, DJ, BV, teleportation, BB84, small QFT); small-molecule VQE with mitigation; hardware characterization.
Does not work: breaking RSA (off by orders of magnitude — Ch. 23); beating classical optimizers (Ch. 37); useful QML on natural data (Ch. 33, 34); any reproducible commercial quantum advantage.
Numbers, as orders of magnitude: hundreds to low thousands of physical qubits · two-qubit gate error a few parts per thousand · coherence tens to hundreds of μs · a few hundred to a few thousand sequential ops before decoherence.
The five questions for any quantum claim
- What exactly was computed — and was the answer already known classically?
- What is the classical baseline — the best one, not the customer's legacy system?
- How many qubits, error-corrected or physical? Count without error rate is not a metric.
- Reproducible by anyone outside? Paper, data, code, independent run?
- Today or roadmap? Roadmaps are fine; roadmaps reported as capabilities are not.
Best positive signal: a group that states what their result does not show.
Version reality
# Broken in Qiskit 1.0+ — appears in nearly every pre-2024 tutorial
from qiskit import execute, Aer # ✗ both gone
result = execute(qc, backend, shots=1024).result() # ✗
qasm_text = qc.qasm() # ✗
# Current
from qiskit_aer import AerSimulator
from qiskit import transpile, qasm3
sim = AerSimulator()
result = sim.run(transpile(qc, sim), shots=1024).result() # ✓
qasm_text = qasm3.dumps(qc) # ✓
Check the date on any quantum code you find before you check your own understanding.
Common pitfalls
- Treating a single run as a result. It is one sample.
- Asking for a full distribution when you need an expectation value (costs far more shots, worse answer).
- Reading qubit count as capability.
- Letting statevector inspection into the algorithm rather than only the debugging.
- Believing an advantage claim that has not survived a serious classical counterattack.
- Confusing post-quantum cryptography (classical, deploy it now) with quantum computers.
Project piece added this chapter
The claim: a README.md stating the goal (VQE ground-state energy of H₂), the success criterion
(within 1.6 mHa of −1.137 Ha, STO-3G, 0.735 Å), and the falsification condition — written down
before any data exists. That last item is the cheapest scientific discipline available in a field
where every result needs interpretation.
Starter file: code/project-checkpoint.py.