learning_objective="read small circuits fluently, narrate each step, and connect code structure to diagram structure without confusion",
professional_relevance="Every later skill in the course assumes that you can glance at a small circuit and recover its structure without cognitive panic. If that literacy is weak, statevector reasoning, transpilation reasoning, and debugging all become much harder than they need to be.",
key_vocabulary=[
("quantum register","the set of qubit wires carrying quantum state through the circuit"),
("classical register","the place where measurement outcomes are stored"),
("control","the qubit whose value conditions a controlled gate"),
("target","the qubit modified when the control condition is satisfied"),
],
mental_models=[
"A circuit is a time-ordered process, not a static picture.",
"Measurement is the conversion from quantum evolution to classical record.",
"A gate comment should explain an intention, not merely restate syntax.",
],
canonical_story="prepare superposition on one qubit, correlate the second qubit with it, and finally turn the resulting quantum pattern into classical data through measurement",
design_lens="Look for structure first: preparation, correlation, and readout are distinct design roles.",
# [3] convert the quantum pattern into classical data
circuit.measure([0,1],[0,1])
""",
step_refs=[
{"marker":"[1]","code_focus":"Apply H to qubit 0","diagram_effect":"Create the first branching point on the top wire","why_it_matters":"This is the preparation step that makes later correlation nontrivial."},
{"marker":"[2]","code_focus":"Apply CX from qubit 0 to qubit 1","diagram_effect":"Link the wires with a controlled interaction","why_it_matters":"This is where the second qubit starts depending on the first."},
{"marker":"[3]","code_focus":"Measure both qubits","diagram_effect":"Terminate both quantum wires into classical bits","why_it_matters":"This is the interface between ideal state preparation and observed data."},
analysis_caption="Use this cell to compare the editable version you built with the packaged Bell helper. The goal is not to admire the helper. The goal is to check whether you recognize the same structure in both forms.",
common_mistakes=[
"confusing classical bits with qubits",
"treating measurement as just another reversible gate",
"reading the diagram as decoration rather than as an ordered process",
],
heuristics=[
"Narrate each gate in plain language before you trust your understanding.",
"Ask which lines are preparing state and which lines are merely recording it.",
"If you cannot point to the controlled interaction, you have not really read the circuit yet.",
],
quiz_a=[
{"prompt":"What is the main role of the Hadamard in the canonical Bell circuit?","options":["It stores the measurement result","It creates the initial superposition that later gets correlated","It swaps the two qubits"],"correct_index":1,"explanation":"The Hadamard prepares the branching structure that the controlled gate can exploit."},
{"prompt":"What does the CX add to the circuit story?","options":["A correlation between the qubits","A classical memory cell","A guarantee that both outputs are 1"],"correct_index":0,"explanation":"The CX links the second qubit’s behavior to the first qubit."},
{"prompt":"Why are classical bits present in this version of the circuit?","options":["Because measurement needs somewhere to write outcomes","Because every circuit must have as many classical bits as qubits","Because classical bits increase entanglement"],"correct_index":0,"explanation":"Measurement writes observed outcomes into classical storage."},
],
quiz_b=[
{"prompt":"If you removed the measurements, what would change first?","options":["The internal quantum preparation steps would disappear","The classical readout layer would disappear","The qubit count would become zero"],"correct_index":1,"explanation":"Removing measurements removes the readout layer, not the preparation logic."},
{"prompt":"Why do the code comments use numbered markers?","options":["To connect code lines to diagram effects and explanations","To satisfy Qiskit syntax","To improve simulation speed"],"correct_index":0,"explanation":"The markers explicitly connect code, diagram, and narrative."},
{"prompt":"What is the best reading habit for this notebook?","options":["Run all cells quickly","Predict and narrate each step before executing","Skip the markdown if the diagram looks familiar"],"correct_index":1,"explanation":"Prediction and narration build the actual skill this notebook targets."},
],
mastery_gate="Take a three-line two-qubit circuit, explain every gate’s structural role, redraw the story in words, and modify one gate without losing track of what changed conceptually.",
stretch_prompts=[
"Insert a barrier and explain what changed structurally and what did not.",
"Swap the control and target qubits and predict the effect before rendering.",
"Remove measurement, then write the new circuit story without mentioning classical data.",
],
),
TechnicalSpec(
filename="01_statevectors.ipynb",
title="Statevectors",
learning_objective="reason about the internal ideal state of a small circuit before any measurement occurs",
professional_relevance="Designers do not merely inspect measurement outcomes. They also reason about the internal state the circuit is trying to create. Statevector thinking is the clean-room version of that skill.",
key_vocabulary=[
("amplitude","the complex coefficient associated with a basis state"),
("probability support","the set of basis states carrying nonzero probability"),
("statevector","the ideal pure-state representation before measurement"),
("basis state","a computational-basis label like 00 or 11"),
],
mental_models=[
"The statevector is the internal ideal story before collapse.",
"Probabilities come from amplitudes; they are not the same object.",
"Sparse support usually reflects real structural features of the circuit.",
],
canonical_story="build a Bell state without measurement so the internal state can be inspected before it is turned into sampled classical outcomes",
design_lens="Ask which basis states should carry weight, and which should vanish because of the circuit structure.",
{"marker":"[1]","code_focus":"Hadamard on qubit 0","diagram_effect":"Open two coherent branches on the first wire","why_it_matters":"Without superposition there is no interesting pure-state structure to inspect."},
{"marker":"[2]","code_focus":"Controlled X onto qubit 1","diagram_effect":"Turn single-qubit branching into two-qubit correlation","why_it_matters":"This is why probability support lands on correlated basis states."},
analysis_caption="This analysis cell shows both the raw statevector coefficients and the derived probabilities. The teaching point is to keep those two descriptions distinct while understanding how one induces the other.",
common_mistakes=[
"thinking amplitudes are already probabilities",
"forgetting that statevectors describe the pre-measurement ideal story",
"looking at zero-probability basis states without asking which circuit feature suppressed them",
],
heuristics=[
"Name the expected support before you inspect the statevector.",
"Translate raw amplitudes into a story about which basis states matter.",
"Whenever a basis state has zero weight, ask what structural reason forced it out.",
],
quiz_a=[
{"prompt":"What does the statevector describe in this notebook?","options":["The classical counts after measurement","The ideal internal state before measurement","The coupling map of the backend"],"correct_index":1,"explanation":"The statevector is the clean internal representation before collapse."},
{"prompt":"Why are amplitudes not the same as probabilities?","options":["Because amplitudes can be complex and probabilities are derived from them","Because probabilities only exist for three-qubit systems","Because amplitudes are classical"],"correct_index":0,"explanation":"Probabilities come from amplitude magnitudes, not from the raw amplitude values themselves."},
{"prompt":"Why is Bell-state support concentrated on only two basis states?","options":["Because the circuit structure correlates the two qubits","Because the simulator dropped the missing states by accident","Because two-qubit circuits can only use two basis states"],"correct_index":0,"explanation":"The support pattern is a structural consequence of the preparation and entangling steps."},
],
quiz_b=[
{"prompt":"What is the design lens for this notebook?","options":["Count how many gates are in the circuit","Ask which basis states should carry weight and why","Avoid using measurement forever"],"correct_index":1,"explanation":"The notebook trains support-based reasoning."},
{"prompt":"If you added measurement too early, what would you lose pedagogically?","options":["The ability to inspect the clean ideal state directly","The ability to draw the circuit","The number of qubits"],"correct_index":0,"explanation":"Measurement hides the internal pure-state picture."},
{"prompt":"What is the right reading move after seeing the probabilities?","options":["Accept them and move on","Explain why those exact states and not others received weight","Assume all entangled states look the same"],"correct_index":1,"explanation":"Interpretation, not mere observation, is the point."},
],
mastery_gate="Given a small circuit without measurement, predict its support pattern, inspect the statevector, and explain the agreement or mismatch precisely.",
stretch_prompts=[
"Insert an extra single-qubit rotation before the entangling gate and predict how the support changes.",
"Replace the entangling gate with a different controlled structure and compare the support.",
"Add a final measurement only after you have written the pre-measurement state story.",
],
),
TechnicalSpec(
filename="02_measurement_and_counts.ipynb",
title="Measurement and Counts",
learning_objective="connect ideal probabilities to finite-shot classical data and reason about basis-dependent measurement choices",
professional_relevance="Experimental work and most realistic simulation workflows hand you counts, not pure-state coefficients. A designer has to translate between the clean internal story and the empirical record.",
key_vocabulary=[
("shot","one execution of the circuit ending in one classical outcome"),
("counts","the frequency table of observed bitstrings across shots"),
("basis choice","the effective question asked by the measurement setup"),
("empirical distribution","the probability estimate derived from finite samples"),
],
mental_models=[
"Counts are samples, not exact theoretical probabilities.",
"Measurement basis is a design choice, often implemented by pre-measurement gates.",
"Finite fluctuations are normal and do not automatically indicate a design bug.",
],
canonical_story="sample a Bell circuit repeatedly, then compare what finite classical data tells you to what the ideal probability picture would predict",
design_lens="Always ask whether a surprising histogram comes from the state itself, the basis, or finite sampling.",
# [2] change the question being asked before measurement
circuit.h(0)
# [3] record the outcome as a classical bit
circuit.measure(0,0)
""",
step_refs=[
{"marker":"[1]","code_focus":"Prepare |+> with H","diagram_effect":"Create a balanced superposition before readout","why_it_matters":"This makes basis choice pedagogically visible."},
{"marker":"[2]","code_focus":"Apply another H before measurement","diagram_effect":"Rotate the measurement question back into the computational basis","why_it_matters":"This is how basis choice becomes operational in a circuit."},
{"marker":"[3]","code_focus":"Measure into a classical bit","diagram_effect":"Collapse the process into observed counts","why_it_matters":"This produces the empirical data the notebook is about."},
analysis_caption="This analysis cell shows the Bell counts and their normalization. The educational move is to look at the gap between exact theory and finite sampling without overreacting to ordinary fluctuations.",
common_mistakes=[
"expecting finite counts to match exact fractions perfectly",
"forgetting that basis changes can be implemented with gates before measurement",
"blaming every irregularity on a broken circuit instead of checking sample size and basis choice first",
],
heuristics=[
"Normalize counts before comparing them to theoretical probabilities.",
"Treat basis choice as part of the circuit design, not as a fixed background condition.",
"If a histogram surprises you, separate sampling effects from design effects before debugging.",
],
quiz_a=[
{"prompt":"What is a shot?","options":["One gate in a circuit","One execution of the circuit ending in one outcome","One qubit in a register"],"correct_index":1,"explanation":"A shot is one full run of the measured circuit."},
{"prompt":"Why might balanced theoretical probabilities fail to produce exactly balanced counts?","options":["Because finite sampling fluctuates","Because all balanced circuits are wrong","Because measurement removes qubits"],"correct_index":0,"explanation":"Finite-shot data naturally fluctuates around the ideal distribution."},
{"prompt":"How can a circuit change measurement basis?","options":["By editing the README","By applying gates before the final measurement","By adding more classical bits"],"correct_index":1,"explanation":"Basis changes are commonly implemented with pre-measurement transformations."},
],
quiz_b=[
{"prompt":"What should you ask first when a histogram looks surprising?","options":["Is the sample size small, is the basis different, or is the design wrong?","Which color was used in the bar chart?","How many markdown cells are in the notebook?"],"correct_index":0,"explanation":"Good interpretation separates sampling, basis, and design effects."},
{"prompt":"Why normalize counts?","options":["To estimate probabilities in a comparable form","To remove all randomness","To make the circuit shorter"],"correct_index":0,"explanation":"Normalized counts become an empirical distribution."},
{"prompt":"What ability is this notebook trying to install?","options":["Local execution without interpretation","Translation between ideal probability stories and empirical classical records","Permanent avoidance of measurement"],"correct_index":1,"explanation":"That translation is the core skill here."},
],
mastery_gate="Take a small measured circuit, predict its histogram qualitatively, explain any finite-shot deviations, and describe how a basis change would alter the question being asked.",
stretch_prompts=[
"Run the same circuit at several shot counts and compare how the histogram stabilizes.",
"Remove the pre-measurement basis-change gate and explain the difference in the result.",
"Design a one-qubit circuit that is deterministic in one basis and balanced in another.",
learning_objective="see how an abstract circuit is rewritten under basis-gate and topology constraints, and interpret the engineering cost of that rewrite",
professional_relevance="Abstract correctness is only half the engineering story. Real backends impose basis and connectivity constraints that can inflate depth, add routing, and sometimes suggest that the circuit should be redesigned by hand.",
key_vocabulary=[
("basis gates","the primitive gate set allowed by a backend"),
("coupling map","the graph of allowed two-qubit interactions"),
("routing","the extra transformations needed to move logical interactions onto allowed edges"),
("transpilation cost","the depth, size, and structure inflation induced by compilation"),
],
mental_models=[
"The written circuit is a request; the transpiled circuit is the executable answer to that request.",
"Topology pressure shows up when desired interactions are not local in the coupling graph.",
"A rewritten circuit can be correct and still be a poor engineering outcome.",
],
canonical_story="write a conceptually clear circuit, then watch how a restricted basis and line topology force the implementation to change",
design_lens="After transpilation, ask what was added, what got decomposed, and which abstract interactions were most expensive to realize.",
{"marker":"[1]","code_focus":"Prepare the control qubit","diagram_effect":"Create the initial branch structure on the top wire","why_it_matters":"This establishes the control context for later interactions."},
{"marker":"[2]","code_focus":"Long-range CX from 0 to 2","diagram_effect":"Request a nonlocal interaction across the diagram","why_it_matters":"This is the source of routing pressure under a line topology."},
{"marker":"[3]","code_focus":"Local CX from 0 to 1","diagram_effect":"Add an interaction that is cheap in the line topology","why_it_matters":"This contrasts local and nonlocal implementation cost."},
{"marker":"[4]","code_focus":"Single-qubit rotation on qubit 2","diagram_effect":"Add local refinement after the entangling structure","why_it_matters":"Not every step is equally painful under hardware constraints."},
analysis_caption="This analysis cell exposes depth inflation, size inflation, and the rewritten circuit itself. The task is to explain where the extra structure came from and whether a human redesign might beat the default rewrite.",
common_mistakes=[
"assuming abstract correctness means the implementation problem is solved",
"seeing extra gates after transpilation without asking which constraint forced them in",
"treating transpilation as black-box magic rather than as a structural response to hardware limits",
],
heuristics=[
"Find the nonlocal interactions first; they often dominate the routing cost.",
"Compare before and after depth, but also inspect where the new structure appears.",
"If compilation cost is ugly, consider redesign instead of merely accepting the result.",
],
quiz_a=[
{"prompt":"What is transpilation doing in this notebook?","options":["Changing the problem into a different algorithm","Rewriting the circuit to satisfy backend constraints","Removing all two-qubit gates"],"correct_index":1,"explanation":"The goal is to produce an executable circuit under explicit constraints."},
{"prompt":"Why is the CX from qubit 0 to qubit 2 expensive under a line coupling map?","options":["Because nonadjacent interactions need routing help","Because RX gates forbid it","Because three-qubit circuits cannot use CX"],"correct_index":0,"explanation":"The interaction is nonlocal with respect to the allowed graph."},
{"prompt":"What should a designer inspect after transpilation?","options":["Only the final bar color","Depth inflation, size inflation, and where extra structure appeared","Only whether the notebook still opens"],"correct_index":1,"explanation":"Interpret the cost structurally, not cosmetically."},
],
quiz_b=[
{"prompt":"What is the written circuit best thought of as?","options":["A final immutable implementation","A request that may be rewritten for execution","A classical histogram"],"correct_index":1,"explanation":"The abstract circuit is a request, not always the executable end-state."},
{"prompt":"What is the right response if transpilation looks expensive?","options":["Assume the compiler is wrong and stop","Consider whether the abstract design should be rewritten","Delete all two-qubit gates"],"correct_index":1,"explanation":"A poor compiled form can be a design signal."},
{"prompt":"Why is this notebook a turning point in the course?","options":["It introduces the move from ideal stories to constrained engineering reality","It proves simulators are useless","It removes the need for state reasoning"],"correct_index":0,"explanation":"This is the first serious contact with backend-style constraints."},
],
mastery_gate="Given an abstract circuit and a constrained topology, explain the compiled rewrite, identify the expensive interactions, and propose at least one human redesign to reduce the cost.",
stretch_prompts=[
"Rewrite the abstract circuit to make the long-range interaction less painful before transpilation.",
"Change the coupling map size and compare the cost profile.",
"Delete one interaction and predict which inflation source disappears first.",
],
),
TechnicalSpec(
filename="04_noise_and_robustness.ipynb",
title="Noise and Robustness",
learning_objective="compare ideal and noisy behavior and interpret which parts of a design are structurally fragile under error",
professional_relevance="Professional design does not stop at ideal correctness. It asks how much of the intended behavior survives disturbance and what redesign choices may improve robustness.",
key_vocabulary=[
("noise model","a local simulation device for approximating imperfect execution"),
("robustness","how strongly the intended behavior survives disturbance"),
("readout error","distortion in the final measurement record"),
("fragility","sensitivity of the design to error sources"),
],
mental_models=[
"The ideal story is a target, not a guarantee of observed behavior.",
"Noise can blur an existing pattern or create qualitatively new wrong outcomes.",
"Robustness is partly a design property, not just a backend property.",
],
canonical_story="run the same circuit in ideal and disturbed modes, then compare not just whether they differ but how they differ",
design_lens="Look for which wrong outcomes appear or grow, and ask what part of the design made them easy to create.",
{"marker":"[1]","code_focus":"Prepare the control qubit","diagram_effect":"Create a balanced branch structure","why_it_matters":"Noise has something nontrivial to distort only once branching exists."},
{"marker":"[2]","code_focus":"Entangle via CX","diagram_effect":"Create the correlated ideal pattern","why_it_matters":"This determines which wrong outcomes are most revealing under disturbance."},
{"marker":"[3]","code_focus":"Measure both qubits","diagram_effect":"Turn ideal structure into noisy classical evidence","why_it_matters":"This is where readout error enters the observed record."},
analysis_caption="This comparison is not just about seeing that noisy output is worse. It is about learning how to read the pattern of distortion and connect it to structural fragility in the underlying design.",
common_mistakes=[
"thinking any noisy degradation automatically means the circuit design is bad",
"looking only at whether performance dropped instead of how the error pattern changed",
"treating the local noise model as perfect hardware truth instead of as a teaching approximation",
],
heuristics=[
"Compare ideal and noisy support, not just aggregate success rates.",
"Ask which incorrect outcomes gained weight and why those particular paths are easy to enter.",
"Use noise to diagnose fragility, not merely to complain about realism.",
],
quiz_a=[
{"prompt":"What is the central question of this notebook?","options":["Does noise exist?","How does the pattern of behavior change when disturbance is introduced?","Can we avoid measurement forever?"],"correct_index":1,"explanation":"The notebook is about interpreting distortion, not just acknowledging it."},
{"prompt":"Why compare ideal and noisy runs of the same circuit?","options":["To isolate the effect of disturbance from the intended structure","To make the notebook longer","To remove the need for theory"],"correct_index":0,"explanation":"Holding the circuit fixed isolates the environmental effect."},
{"prompt":"What is a fragile design feature?","options":["A feature whose intended behavior degrades easily under error","Any feature written in Python","A feature with exactly one qubit"],"correct_index":0,"explanation":"Fragility is sensitivity to disturbance."},
],
quiz_b=[
{"prompt":"What should you inspect first in a noisy histogram?","options":["Which wrong outcomes appeared or grew","Only the notebook title","Whether the bars are centered"],"correct_index":0,"explanation":"The shape of the distortion matters."},
{"prompt":"Is the local noise model a perfect replica of hardware reality?","options":["Yes, exactly","No, it is a teaching approximation","Only for Bell states"],"correct_index":1,"explanation":"The model is useful pedagogically, not exact physically."},
{"prompt":"Why is robustness partly a design concern?","options":["Because some designs expose more vulnerable pathways than others","Because only the compiler matters","Because measurement creates robustness automatically"],"correct_index":0,"explanation":"Design choices affect error sensitivity."},
],
mastery_gate="Compare ideal and noisy behavior for a small circuit, identify the most revealing distortion pattern, and explain which structural choices are likely contributing to fragility.",
stretch_prompts=[
"Increase readout error and predict which wrong outcomes should grow first.",
"Simplify the circuit and compare whether the distortion narrows.",
"Propose one redesign that might improve robustness and justify it before testing.",
learning_objective="stop thinking in flat gate lists and start thinking in reusable subcircuits and recurring design motifs",
professional_relevance="As soon as circuits become larger than toy examples, raw gate sequences become an unreadable maintenance burden. Professionals package ideas into reusable blocks and talk in motifs, not only in primitive operations.",
key_vocabulary=[
("subcircuit","a reusable circuit fragment with a named role"),
("design pattern","a recurring structural solution to a familiar circuit need"),
("composition","building larger behavior out of smaller named pieces"),
("abstraction","hiding low-level detail behind a meaningful circuit interface"),
],
mental_models=[
"A circuit block is to quantum design what a function is to software design.",
"Readable structure is itself an engineering asset.",
"If you cannot name a recurring pattern, you will keep rewriting it badly.",
],
canonical_story="wrap a familiar entangling motif into a named block and then reuse it inside a larger circuit rather than flattening everything into one long gate list",
design_lens="Ask whether the circuit is easier to explain, modify, and review once the repeated idea has a name.",
{"marker":"[1]","code_focus":"Define the preparation part of the block","diagram_effect":"Create the first internal step of the reusable motif","why_it_matters":"The block should have an intelligible internal story."},
{"marker":"[2]","code_focus":"Define the entangling part of the block","diagram_effect":"Complete the reusable correlated motif","why_it_matters":"A block needs a stable conceptual purpose to be worth naming."},
{"marker":"[3]","code_focus":"Compose the block into the larger circuit","diagram_effect":"Insert the named motif as a single structural idea","why_it_matters":"Composition is the bridge from tiny examples to scalable design."},
{"marker":"[4]","code_focus":"Extend to a third qubit","diagram_effect":"Show how a block can seed a larger pattern","why_it_matters":"Reusable blocks should make extension cleaner, not messier."},
{"marker":"[5]","code_focus":"Measure the full circuit","diagram_effect":"Produce a classical record for the composed design","why_it_matters":"You still need empirical feedback, even when the structure is abstracted."},
analysis_caption="The analysis cell turns the idea of a reusable block into a concrete circuit drawing. The teaching point is to see how naming and composition change readability without changing the physics you are trying to build.",
common_mistakes=[
"assuming abstraction is optional because toy examples are still readable",
"creating blocks with no stable conceptual purpose",
"hiding too much structure without being able to explain the block internally",
],
heuristics=[
"Name a block only if you can state its role in one sentence.",
"Use composition to make larger designs easier to review, not merely shorter to type.",
"Keep the internal story of the block explainable even after abstraction.",
],
quiz_a=[
{"prompt":"Why introduce subcircuits at all?","options":["To make code harder to read","To package recurring ideas into reusable, reviewable units","To avoid using CX gates"],"correct_index":1,"explanation":"Subcircuits help scale design readability and reuse."},
{"prompt":"What makes a subcircuit worth naming?","options":["It contains at least three gates","It has a stable conceptual role","It uses a classical register"],"correct_index":1,"explanation":"Naming should follow conceptual purpose, not arbitrary size."},
{"prompt":"What is composition doing in this notebook?","options":["Replacing all quantum gates with classical code","Embedding a named block into a larger design","Deleting the reusable block"],"correct_index":1,"explanation":"Composition inserts structured subcircuits into larger circuits."},
],
quiz_b=[
{"prompt":"What is the software-design analogy used in this notebook?","options":["A subcircuit is like a function","A qubit is like a comment","Measurement is like a README"],"correct_index":0,"explanation":"Subcircuits play a function-like role in managing complexity."},
{"prompt":"What is a danger of abstraction?","options":["It can hide structure that you no longer understand","It removes the need for diagrams","It forces the backend to be noiseless"],"correct_index":0,"explanation":"Abstraction is useful only when the internal story is still understood."},
{"prompt":"How do you know a block improved the design?","options":["The block has a cool name","The larger circuit becomes easier to explain, modify, and review","The circuit stops using measurements"],"correct_index":1,"explanation":"Better abstraction improves design clarity and maintainability."},
],
mastery_gate="Refactor a flat circuit into at least one reusable subcircuit, explain the abstraction boundary clearly, and justify why the composed version is a better design artifact.",
stretch_prompts=[
"Create two different reusable blocks for the same preparation goal and compare them.",
"Compose the same block in two different places and explain what stayed invariant.",
"Write a review note arguing why a certain block boundary is good or bad.",
],
),
TechnicalSpec(
filename="06_reversible_logic_and_oracles.ipynb",
title="Reversible Logic and Oracles",
learning_objective="translate structured logical rules into reversible or oracle-style circuit fragments with explicit control and ancilla reasoning",
professional_relevance="Many nontrivial circuit constructions are not invented gate by gate. They come from logical rules, predicates, reversible structure, and careful ancilla management. This is a key threshold from beginner examples to algorithmic block engineering.",
key_vocabulary=[
("oracle","a circuit fragment encoding a predicate or marked condition"),
("ancilla","an auxiliary qubit used to support a construction"),
("reversible logic","logic that preserves enough information to be expressed as a valid quantum transformation"),
("predicate","the rule or condition the circuit is supposed to represent"),
],
mental_models=[
"Start from the logical rule, not from random gate search.",
"Ancillas are resources with purpose and cost, not free decoration.",
"An oracle is a structured encoding of a question, not a mystical object.",
],
canonical_story="begin with a simple logical relation, then implement it as a small reversible or oracle-style circuit whose structure can be justified from the rule itself",
design_lens="Whenever you add a control or ancilla, ask what exact logical role it is playing.",
# [3] observe all wires for truth-table inspection
circuit.measure([0,1,2],[0,1,2])
""",
step_refs=[
{"marker":"[1]","code_focus":"First controlled copy into workspace qubit","diagram_effect":"Make the target reflect qubit 0","why_it_matters":"This begins the predicate accumulation."},
{"marker":"[2]","code_focus":"Second controlled copy into the same workspace","diagram_effect":"Combine qubit 1 with the stored effect of qubit 0","why_it_matters":"Together the two controls implement XOR structure."},
{"marker":"[3]","code_focus":"Measure all wires","diagram_effect":"Expose the reversible relation in classical form","why_it_matters":"This lets you compare the circuit to the truth table directly."},
analysis_caption="The analysis cell gives you a compact oracle-style example to compare against a truth table. The teaching move is to make you derive the circuit from the rule instead of treating the circuit as a mysterious pattern found elsewhere.",
common_mistakes=[
"starting from gates instead of starting from the logical predicate",
"adding ancillas or controls without a clearly stated role",
"calling something an oracle without being able to say what rule it encodes",
],
heuristics=[
"Write the truth table or logical rule before you write the circuit.",
"For every ancilla, state why it exists and what would break without it.",
"Treat control structure as a direct encoding of logical dependence.",
],
quiz_a=[
{"prompt":"What is the right starting point for oracle design?","options":["A random search over gates","The logical predicate or truth table","The backend coupling map"],"correct_index":1,"explanation":"Start from the rule you need to encode."},
{"prompt":"What is an ancilla?","options":["An auxiliary qubit used to support a construction","A measurement outcome","A plotting library"],"correct_index":0,"explanation":"Ancillas are auxiliary resources used for structure."},
{"prompt":"Why are the two CX gates enough for XOR in this simple example?","options":["Because each one folds one input into the workspace qubit","Because XOR never needs two-qubit gates","Because measurement computes the XOR for us"],"correct_index":0,"explanation":"The workspace accumulates the parity information from both controls."},
],
quiz_b=[
{"prompt":"What is a danger of calling a circuit an oracle too casually?","options":["You may stop explaining what rule it actually represents","The notebook will not load","The simulator will become noisy"],"correct_index":0,"explanation":"Naming should not replace explanation."},
{"prompt":"What question should you ask about every ancilla?","options":["What color is it?","What exact role does it play and is it necessary?","How many markdown cells mention it?"],"correct_index":1,"explanation":"Ancillas need explicit justification."},
{"prompt":"What ability is this notebook trying to build?","options":["Translation from logical rule to reversible circuit structure","Avoidance of any classical reasoning","Memorization of one oracle example"],"correct_index":0,"explanation":"The goal is rule-to-circuit translation."},
],
mastery_gate="Start from a clear predicate, build a reversible or oracle-style circuit for it, and justify every control and ancilla in the construction.",
stretch_prompts=[
"Replace XOR with a different Boolean rule and derive a new circuit from the truth table.",
"Add an ancilla intentionally, then argue whether it improved clarity or merely increased cost.",
"Write a short design memo explaining how your circuit encodes the predicate.",
learning_objective="move from isolated circuits to circuit families, decompositions, and parameterized design choices with explicit tradeoff reasoning",
professional_relevance="Serious design work often asks for a circuit family, not a single fixed circuit. You need to reason about decomposition, tunable structure, and tradeoffs between clarity, expressivity, and cost.",
key_vocabulary=[
("ansatz","a parameterized circuit family with a chosen structural template"),
("decomposition","breaking a desired action into implementable gates or substructures"),
("expressivity","how much behavior a parameterized family can represent"),
("tradeoff","a deliberate balance between competing engineering goals"),
],
mental_models=[
"A good design often comes as a family, not a one-off artifact.",
"Every decomposition hides assumptions and costs.",
"Parameterization is a way to separate structural choice from numerical tuning.",
],
canonical_story="start from a simple parameterized template, then treat it as a design family whose structure can be evaluated and compared rather than as a fixed answer",
design_lens="Ask what the parameters are allowed to change, what the structure keeps fixed, and what engineering cost the family imposes.",
# [3] couple the qubits through an entangling layer
circuit.cx(0,1)
# [4] refine the first qubit
circuit.rz(0.5,0)
# [5] refine the second qubit and measure
circuit.ry(0.7,1)
circuit.measure([0,1],[0,1])
""",
step_refs=[
{"marker":"[1]","code_focus":"First local parameter","diagram_effect":"Tune the first qubit's initial orientation","why_it_matters":"This shows what can change without changing the family structure."},
{"marker":"[2]","code_focus":"Second local parameter","diagram_effect":"Tune the second qubit independently","why_it_matters":"Parameterized families often begin with local freedom."},
{"marker":"[3]","code_focus":"Entangling layer","diagram_effect":"Introduce shared structure between the qubits","why_it_matters":"This is usually the expressive heart of the family."},
{"marker":"[4]","code_focus":"Post-entanglement refinement","diagram_effect":"Adjust the first qubit after coupling","why_it_matters":"Later layers let the family represent richer behavior."},
{"marker":"[5]","code_focus":"Final refinement and measurement","diagram_effect":"Complete the template and expose sampled output","why_it_matters":"The family only becomes useful once it can be evaluated."},
analysis_caption="The analysis cell turns the parametric template into a visual object you can critique. Ask which aspects of the design are structural and which are merely parameter values that happen to have been chosen here.",
common_mistakes=[
"treating one parameter choice as the whole design rather than one point in a family",
"talking about expressivity without considering depth and cost",
"calling a decomposition natural without explaining what goal it optimizes",
],
heuristics=[
"Separate the family structure from the chosen parameter values.",
"When comparing families, ask what each layer is trying to buy you.",
"Tradeoff language is mandatory: clarity, expressivity, depth, and hardware cost rarely align perfectly.",
],
quiz_a=[
{"prompt":"What is an ansatz in this notebook?","options":["A parameterized circuit family with a chosen template","A measurement result","A fixed backend layout"],"correct_index":0,"explanation":"An ansatz is a structured family, not just one frozen circuit."},
{"prompt":"Why is parameterization useful?","options":["It separates structural choice from numerical tuning","It removes the need for entanglement","It makes all circuits equally expressive"],"correct_index":0,"explanation":"Parameters let the same structure represent multiple concrete instances."},
{"prompt":"What should you compare when judging two circuit families?","options":["Only the number of markdown cells","Structure, expressivity, depth, and likely implementation cost","Only the prettiness of the diagram"],"correct_index":1,"explanation":"Family comparison is a multidimensional engineering decision."},
],
quiz_b=[
{"prompt":"What is the risk of focusing only on one parameter setting?","options":["You may mistake one instance for the whole family","You automatically create a noise model","You lose the ability to draw the circuit"],"correct_index":0,"explanation":"The family is the real design object here."},
{"prompt":"What is a good decomposition question?","options":["What goal does this decomposition optimize?","How fast can I skip it?","How can I avoid all explanations?"],"correct_index":0,"explanation":"Every decomposition should be justified by an engineering goal."},
{"prompt":"What kind of reasoning is being trained?","options":["Circuit-family and tradeoff reasoning","Blind parameter guessing only","Avoidance of structure"],"correct_index":0,"explanation":"This notebook tries to make design families legible."},
],
mastery_gate="Given a small target behavior, propose a parameterized family or decomposition, explain its structure, and defend the tradeoffs that motivated it.",
stretch_prompts=[
"Create a second ansatz family with a different entangling pattern and compare the engineering tradeoffs.",
"Remove one layer and explain what expressive or design capability was lost.",
"Write a short review note defending one family over another for a given goal.",
],
),
TechnicalSpec(
filename="08_hardware_aware_design_studio.ipynb",
title="Hardware-Aware Design Studio",
learning_objective="redesign circuits under topology and basis constraints instead of merely accepting compiler output as final truth",
professional_relevance="This is the point where you stop being only a user of transpilation and begin acting like a hardware-aware designer who can rewrite a circuit intentionally in response to constraints.",
key_vocabulary=[
("layout pressure","the stress introduced when the logical interaction pattern mismatches the physical graph"),
("manual rewrite","a human redesign performed before or alongside transpilation"),
("implementation choice","the specific route taken to realize an abstract interaction pattern"),
("constraint-aware design","designing with backend limits in view from the beginning"),
],
mental_models=[
"The compiler is a collaborator, not an oracle.",
"If a pattern fights the hardware graph, redesign may be better than post hoc acceptance.",
"Constraint-aware design starts before transpilation, not after it.",
],
canonical_story="begin from an abstract multi-qubit interaction pattern, then manually rethink the structure so the hardware graph becomes a design partner rather than a late-stage obstacle",
design_lens="Ask where the abstract circuit is over-demanding the topology and which manual rewrite might relieve that pressure.",
# [3] add a second interaction in the middle of the line
circuit.cx(1,2)
# [4] tie the first source into the middle pair
circuit.cx(0,2)
# [5] measure every wire for comparison
circuit.measure([0,1,2,3],[0,1,2,3])
""",
step_refs=[
{"marker":"[1]","code_focus":"Prepare the logical source qubit","diagram_effect":"Create the initial branching source","why_it_matters":"This defines where later correlation originates."},
{"marker":"[2]","code_focus":"Long-range interaction to qubit 3","diagram_effect":"Force the most topology-stressed request in the circuit","why_it_matters":"This is the pressure point to scrutinize first."},
{"marker":"[3]","code_focus":"Mid-line interaction","diagram_effect":"Add a relatively cheap local entangling step","why_it_matters":"Not all interactions are equally expensive under the same graph."},
{"marker":"[4]","code_focus":"Bridge from source into the middle pair","diagram_effect":"Create a second topology-sensitive dependency","why_it_matters":"This tests whether a manual rewrite might rearrange the logic more cleanly."},
{"marker":"[5]","code_focus":"Measure all qubits","diagram_effect":"Expose the current design empirically","why_it_matters":"A redesign still needs observable consequences."},
analysis_caption="The analysis cell makes the cost visible. Your job is to use that visibility to propose a better pre-transpilation design rather than letting the compiler carry all of the burden alone.",
common_mistakes=[
"assuming the transpiler’s first answer is automatically the design you should accept",
"complaining about layout pressure without proposing a structural rewrite",
"forgetting that logical dependencies can sometimes be reorganized before compilation",
],
heuristics=[
"Locate the graph-mismatched interactions before you start optimizing.",
"Compare what the circuit is logically asking for to what the topology can cheaply provide.",
"A manual rewrite is justified when it makes the constraints easier to satisfy without changing the intended behavior.",
],
quiz_a=[
{"prompt":"What new skill is emphasized in this notebook?","options":["Accepting transpiler output without question","Constraint-aware manual redesign","Avoiding all two-qubit gates forever"],"correct_index":1,"explanation":"The notebook is about hardware-aware redesign, not passive acceptance."},
{"prompt":"Why is a long-range interaction the first thing to inspect?","options":["It often creates the largest routing burden","It is always mathematically wrong","It deletes all measurements"],"correct_index":0,"explanation":"Long-range requests are frequent cost drivers under restricted graphs."},
{"prompt":"What does it mean to treat the compiler as a collaborator?","options":["You still think and redesign instead of outsourcing all judgment","You ignore its output completely","You never inspect the compiled circuit"],"correct_index":0,"explanation":"Collaboration means using compiler feedback as design information."},
],
quiz_b=[
{"prompt":"What is a manual rewrite?","options":["A human redesign of the abstract circuit to better fit constraints","A classical measurement step","A plotting adjustment"],"correct_index":0,"explanation":"Manual rewrites are structural design interventions."},
{"prompt":"When is a manual rewrite justified?","options":["When it relieves constraint pressure without changing the intended behavior","Whenever a notebook contains CX","Only if the compiler crashes"],"correct_index":0,"explanation":"The point is better implementation under the same logical goal."},
{"prompt":"What identity shift is this notebook trying to create?","options":["From compiler user to hardware-aware designer","From designer to markdown reader","From qubit user to classical-only programmer"],"correct_index":0,"explanation":"This is explicitly a design-identity transition."},
],
mastery_gate="Take a topology-stressed circuit, identify the worst pressure points, propose a manual rewrite, and justify why the new design should compile more gracefully.",
stretch_prompts=[
"Write two competing rewrites for the same abstract circuit and benchmark them.",
"Change which qubit carries the initial superposition and see whether the topology pressure changes.",
"Explain in prose why one logical dependency pattern is more hardware-friendly than another.",
learning_objective="separate design bugs from expected noisy degradation and learn to justify that diagnosis with explicit checks",
professional_relevance="Professional designers do not merely notice that a result is wrong. They diagnose *why* it is wrong: design flaw, compilation artifact, noise effect, or mistaken expectation. Verification language is what makes that diagnosis disciplined.",
key_vocabulary=[
("invariant","a property that should remain true if the design is correct"),
("diagnosis","the explanation of what failure mode is actually present"),
("signal versus distortion","the intended pattern contrasted with the observed corruption"),
("debugging criterion","the standard by which you judge whether a circuit is acceptable"),
],
mental_models=[
"Not every discrepancy is a bug, but every discrepancy deserves classification.",
"Verification begins with explicit expectations, not with surprised observation.",
"Noise and logical flaws can look similar until you articulate the expected invariants.",
],
canonical_story="compare an ideal pattern to a disturbed one and use explicit criteria to decide whether the difference is consistent with noise, design error, or both",
design_lens="Before changing the circuit, state what should still be true if the design is basically correct.",
{"marker":"[1]","code_focus":"Prepare the source of branching","diagram_effect":"Create the ideal split in possibilities","why_it_matters":"This is part of the invariant story you later compare."},
{"marker":"[2]","code_focus":"Correlate the second qubit","diagram_effect":"Create the intended support pattern","why_it_matters":"This determines which outcomes should dominate ideally."},
{"marker":"[3]","code_focus":"Measure both qubits","diagram_effect":"Expose empirical behavior for verification","why_it_matters":"This is where you compare expectation to observation."},
analysis_caption="This cell gives you a concrete distortion measure and the underlying distributions. The job is to move from seeing a difference to classifying that difference with discipline.",
common_mistakes=[
"calling every deviation a bug without checking whether the ideal invariant mostly survives",
"blaming noise for a genuinely incorrect logical design",
"changing the circuit before writing down what a correct circuit should still preserve",
],
heuristics=[
"State the invariant first, then inspect the observed failure.",
"Ask whether the wrong outcomes are qualitatively new or merely inflated by disturbance.",
"A diagnosis is stronger when it names the criterion that led to it.",
],
quiz_a=[
{"prompt":"What is an invariant in this context?","options":["A property that should remain true if the design is correct","A type of backend","A plotting option"],"correct_index":0,"explanation":"Invariants are the expectations you verify against."},
{"prompt":"Why write the expectation before changing the circuit?","options":["To make the diagnosis disciplined instead of reactive","To slow down the notebook for no reason","To remove all noise"],"correct_index":0,"explanation":"Verification depends on explicit criteria."},
{"prompt":"What is one risk in noisy debugging?","options":["Confusing expected distortion with a logical bug","Using too many markdown cells","Having classical bits"],"correct_index":0,"explanation":"Noise and design bugs can be confused if criteria are weak."},
],
quiz_b=[
{"prompt":"What is the central habit this notebook is training?","options":["Reactive tinkering","Disciplined classification of discrepancies","Avoidance of all interpretation"],"correct_index":1,"explanation":"The notebook is about structured verification and diagnosis."},
{"prompt":"What makes a diagnosis strong?","options":["It names the criterion behind the judgment","It uses very dramatic language","It avoids numbers entirely"],"correct_index":0,"explanation":"Criteria make debugging arguments defensible."},
{"prompt":"What should happen before you call a circuit incorrect?","options":["You should state the expected invariant and compare observed failure to it","You should delete the notebook","You should trust the first surprising output"],"correct_index":0,"explanation":"Verification begins with explicit expectations."},
],
mastery_gate="Given ideal and distorted behavior, write an explicit invariant, diagnose whether the discrepancy is due to noise, design error, or both, and justify the conclusion with a concrete criterion.",
stretch_prompts=[
"Deliberately break one gate and compare that failure pattern to a noisy-but-correct pattern.",
"Write two different diagnostic criteria and see whether they agree.",
"Summarize a debugging decision as if you were writing a design review memo.",
learning_objective="treat circuit design as a professional review process involving alternatives, metrics, risks, and a defended final recommendation",
professional_relevance="This notebook is the closest thing in the course to real engineering practice. A professional designer does not present a single circuit as destiny. They compare candidate designs, benchmark them, discuss risks, and justify a recommendation.",
key_vocabulary=[
("candidate design","one proposed circuit family or implementation choice"),
("review memo","a structured written justification of a design decision"),
("risk","a plausible failure mode or engineering concern tied to a design choice"),
("recommendation","the defended final choice after comparing alternatives"),
],
mental_models=[
"A good final answer is usually comparative, not absolute.",
"Metrics matter, but they do not eliminate judgment.",
"A review is strongest when it makes tradeoffs explicit instead of hiding them.",
],
canonical_story="start from a design problem, create at least two candidate circuit approaches, compare them under explicit metrics, then defend the final recommendation as if writing to another engineer",
design_lens="Ask what decision you are making, what evidence supports it, and what risks remain even after you decide.",
{"marker":"[1]","code_focus":"Prepare the source qubit","diagram_effect":"Create the initial resource for the candidate design","why_it_matters":"Review begins by naming what the candidate is trying to achieve."},
{"marker":"[2]","code_focus":"First extension step","diagram_effect":"Spread the candidate pattern to a second qubit","why_it_matters":"This reveals part of the candidate architecture."},
{"marker":"[3]","code_focus":"Second extension step","diagram_effect":"Complete the three-qubit candidate pattern","why_it_matters":"The full candidate can now be compared to alternatives."},
{"marker":"[4]","code_focus":"Measurement layer","diagram_effect":"Expose candidate behavior for benchmarking","why_it_matters":"Review requires observable evidence, not just intention."},
],
analysis_code="""
project_choice=""
candidate_a=""
candidate_b=""
decision_metric_table=[]
{
"project_choice":project_choice,
"candidate_a":candidate_a,
"candidate_b":candidate_b,
"decision_metric_table":decision_metric_table,
}
""",
analysis_caption="This cell is intentionally open-ended. It is the template for your own review memo. The notebook stops being a lecture here and becomes a studio for defended decision-making.",
common_mistakes=[
"presenting one candidate as if alternatives never existed",
"using metrics without saying why those metrics matter for the task",
"hiding risks because they make the final recommendation look less clean",
],
heuristics=[
"Always compare at least two plausible designs before making a recommendation.",
"State which metrics you care about and why they matter for this problem.",
"A professional recommendation includes residual risk, not just confidence.",
],
quiz_a=[
{"prompt":"What is the central shift in the capstone notebook?","options":["From isolated circuits to defended design decisions","From quantum to classical-only programming","From notebooks to no writing at all"],"correct_index":0,"explanation":"The capstone is about professional review and recommendation."},
{"prompt":"Why compare multiple candidates?","options":["Because the first idea is rarely above review","Because metrics are illegal otherwise","Because all circuits are equivalent"],"correct_index":0,"explanation":"Comparison is core to real design judgment."},
{"prompt":"What should a final recommendation include?","options":["Only confidence and no caveats","Tradeoffs, evidence, and residual risks","A list of gate names"],"correct_index":1,"explanation":"Professional decisions remain accountable to evidence and risk."},
],
quiz_b=[
{"prompt":"What weakens a design review?","options":["Hiding alternatives and pretending one design was inevitable","Explaining tradeoffs explicitly","Writing a recommendation"],"correct_index":0,"explanation":"Good reviews make the decision space visible."},
{"prompt":"Why are metrics not enough by themselves?","options":["Because judgment is still needed to interpret which metrics matter most","Because metrics cannot be written down","Because metrics only apply to single-qubit circuits"],"correct_index":0,"explanation":"Metrics inform judgment; they do not replace it."},
{"prompt":"What identity does the capstone aim to confirm?","options":["Independent circuit designer who can defend decisions","Passive notebook executor","Purely theoretical spectator"],"correct_index":0,"explanation":"The capstone is meant to validate professional design identity."},
],
mastery_gate="Frame a circuit problem, create at least two plausible candidates, benchmark them under explicit criteria, and write a final recommendation that names both strengths and remaining risks.",
stretch_prompts=[
"Choose a problem from an earlier notebook and rewrite it as a full review memo with competing candidates.",
"Add a hardware-aware criterion to your decision table and see whether the recommendation changes.",
"Write the final recommendation in the tone of a real engineering review document.",