Part X. Capstones · Chapter 84
Hardware-Constrained Lab
An ideal circuit diagram hides everything that makes quantum hardware hard. In this capstone you build a lab that puts the ideal circuit next to its constrained twin and measures what connectivity, native gates, noise, and timing actually change.
In this chapter 9 sections
Freeze the logical experiment and acceptance statistic, map it through the device coupling graph and native basis, account for inserted routing and timing operations, then compare measured output with both an ideal and noise-aware prediction.
A hardware-constrained lab preserves an experimental contract while changing its implementation. The logical Bell task specifies preparation and a parity statistic. Placement, routing, native decomposition, scheduling, calibration, queueing and readout mitigation may change, but the task identifier, logical-bit interpretation, and acceptance rule do not.
Capstone brief: preserve the experiment under constraints
For the ideal reference, . Logical qubits occupy physical endpoints 0 and 2 of a line 0–1–2. A routed implementation must publish initial and final layouts so measured physical bits are interpreted as the intended logical pair. Inserted SWAP cost belongs in the ledger.
Route a Bell experiment on a line
OpenQASM supports the circuit-semantics boundary. Qiskit and Cirq documentation supply dated compilation concepts. Randomized benchmarking does not directly predict this routed Bell statistic, which is why calibration and task-level output remain separate. ACM and the benchmark sources require environment and result records.
Timing and readout redefine the acceptance region
The reference router moves one endpoint through the middle node, applies the entangling operation, and tracks the resulting layout. Using the conventional three-CNOT SWAP decomposition, one SWAP adds three two-qubit operations before the logical entangler. The ideal state fixture still checks only Bell parity and normalization; the hardware notebook must record calibration, shots, counts, and mapping.
| Ledger item | Logical record | Physical consequence | Check |
|---|---|---|---|
| Initial layout | q0→p0, q1→p2 | nonadjacent endpoints | declared |
| Routing | move one endpoint | 1 SWAP = 3 CNOTs | counted |
| Entangler | logical CNOT | native/decomposed operation | backend-specific |
| Measurement | even parity | map physical to logical bits | acceptance frozen |
Artifact contract. A topology diagram, routed operation ledger, executable state fixture, calibration record schema, and acceptance rubric. Routing endpoints are correct, inserted SWAP/CNOT cost is counted, ideal Bell probabilities pass, and hardware claims remain pending without a calibration-stamped run.
from math import isclose
def validate_lab(notebook, minimum_even_parity):
errors = []
if notebook.get("scenario") != "line-routed Bell experiment" or not notebook.get("source_ids"):
errors.append("scenario_or_sources")
route = notebook.get("route", {})
if (type(route.get("logical_endpoints")) is not list or len(route.get("logical_endpoints", [])) != 2 or
type(route.get("swap_count")) is not int or route.get("distance_unit") != "edges"):
errors.append("route_schema")
probabilities = notebook.get("ideal_probabilities", {})
if set(probabilities) != {"00", "01", "10", "11"} or any(type(value) is not float for value in probabilities.values()):
errors.append("probability_schema")
elif not isclose(sum(probabilities.values()), 1.0) or probabilities["01"] + probabilities["10"] != 0.0:
errors.append("ideal_bell_state")
counts = notebook.get("counts", {})
shots = notebook.get("shots", {})
if set(counts) != {"00", "01", "10", "11"} or any(type(value) is not int for value in counts.values()):
errors.append("counts_schema")
if type(shots.get("value")) is not int or shots.get("unit") != "shots" or sum(counts.values()) != shots.get("value"):
errors.append("shots_schema")
calibration = notebook.get("calibration", {})
if type(calibration) is not dict:
errors.append("calibration_schema")
compiled = route.get("swap_count", 0) * 3 + route.get("logical_entanglers", 0)
parity = (counts.get("00", 0) + counts.get("11", 0)) / max(shots.get("value", 0), 1)
stamped = all(calibration.get(name) for name in ("backend", "timestamp", "job_id"))
if errors:
decision = "invalid"
elif parity < minimum_even_parity:
decision = "acceptance-fail"
else:
decision = "hardware-accepted" if stamped else "simulation-only"
return {"decision": decision, "errors": sorted(set(errors)),
"compiled_two_qubit_count": compiled, "even_parity": parity, "calibration_stamped": stamped}
notebook = {"scenario": "line-routed Bell experiment", "source_ids": ["openqasm3"],
"route": {"logical_endpoints": [0, 2], "swap_count": 1,
"logical_entanglers": 1, "distance_unit": "edges"},
"ideal_probabilities": {"00": 0.5, "11": 0.5, "01": 0.0, "10": 0.0},
"counts": {"00": 4800, "11": 4800, "01": 210, "10": 190},
"shots": {"value": 10000, "unit": "shots"},
"calibration": {"backend": "", "timestamp": "", "job_id": ""}}
base_result = validate_lab(notebook, 0.95)
bad_route = {**notebook["route"], "distance_unit": ""}
bad_result = validate_lab({**notebook, "route": bad_route}, 0.95)
strict_result = validate_lab(notebook, 0.97)
assert base_result["compiled_two_qubit_count"] == 4 and base_result["decision"] == "simulation-only"
assert bad_result["decision"] == "invalid" and "route_schema" in bad_result["errors"]
assert strict_result["decision"] == "acceptance-fail" and isclose(strict_result["even_parity"], 0.96)
print(f"PASS: 84 lab notebook gates={base_result['compiled_two_qubit_count']} parity={base_result['even_parity']} claim={base_result['decision']} invalid={bad_result['errors']} strict={strict_result['decision']}")
Exact validation command: python3 tools/validate_briefs.py --briefs data/editorial_briefs_64_87.json --from 64 --through 87 --check-rewritten-sources --execute-artifacts
Record calibration beside every result
Freeze a 10,000-shot acceptance band before device access. Store backend identifier, calibration timestamp, job identifier, compiler versions, seed, layout, routed circuit, raw counts, and applied post-processing. If the result fails, compare the ideal fixture, a declared noise model, and the calibration record in that order. Do not tune the band after seeing counts.
Run the constrained-lab validator
Prompt. Route and validate a Bell-state experiment when logical qubits 0 and 2 occupy a three-node line.
Deliverable. Logical circuit, initial/final layout, routed gate ledger, depth and two-qubit count, 10,000-shot ideal fixture, calibration schema, acceptance rule, and exact validation command.
Pass condition. The final measured logical bits are mapped correctly, routing cost is explicit, ideal counts satisfy the statistical band, and no hardware conclusion appears without matching calibration metadata.
Model lab notebook and analytic rubric
Format. Reference routed notebook record and 100-point rubric.
The model notebook earns 20 points for contract and basis, 20 for correct routing and layout, 15 for gate/depth accounting, 15 for the ideal fixture, 20 for calibration-stamped hardware evidence, and 10 for diagnosis. With calibration fields blank, it can score at most 80 and cannot claim hardware validation. The fixture confirms ideal parity and a three-CNOT routing surcharge.
Verification. The embedded simulator passes ideal parity and routing-account checks; the rubric withholds all hardware-evidence points when calibration fields are blank.
| Criterion | Points | Evidence rule |
|---|---|---|
| Experiment contract and basis | 20 | Show the inspectable experiment contract and basis record; an unsupported assertion receives no credit. |
| Routing and layout correctness | 20 | Show the inspectable routing and layout correctness record; an unsupported assertion receives no credit. |
| Gate, depth, and timing account | 15 | Show the inspectable gate, depth, and timing account record; an unsupported assertion receives no credit. |
| Ideal executable fixture | 15 | Show the inspectable ideal executable fixture record; an unsupported assertion receives no credit. |
| Calibration-stamped hardware record | 20 | Show the inspectable calibration-stamped hardware record record; an unsupported assertion receives no credit. |
| Diagnosis and limits | 10 | Show the inspectable diagnosis and limits record; an unsupported assertion receives no credit. |
| Total | 100 | All pass conditions remain mandatory regardless of point total. |
Companion work
Artifacts for this chapter
These entries resolve to checked-in local source. Commands are reproduced exactly from the chapter manifest, and source-embedded fixtures are exported as direct downloads.
capstone artifact
Three-qubit line-constrained Bell lab
Reproduce or test
python3 tools/validate_briefs.py --briefs data/editorial_briefs_64_87.json --from 64 --through 87 --check-rewritten-sources --execute-artifacts
Provenance
Sources and review
- OpenQASM Technical Steering Committee. OpenQASM 3 specification. Linux Foundation Joint Development Foundation. 2026official technical specification
- IBM Quantum. Qiskit documentation. IBM. 2026official documentation
- Google Quantum AI. Cirq documentation. Google. 2026official documentation
- Easwar Magesan, J. M. Gambetta, and Joseph Emerson. Scalable and robust randomized benchmarking of quantum processes. Physical Review Letters. 2011primary paper
- Association for Computing Machinery. Artifact Review and Badging. ACM Publications. 2026official reproducibility policy
- U.S. Government Accountability Office. Quantum Computing and Communications: Status and Prospects. GAO. 2021government technology assessment
- Lieven M. K. Vandersypen et al.. A look at the full stack. Nature Reviews Physics. 2021peer-reviewed perspective
- Timothy Proctor et al.. Benchmarking quantum computers. Nature Reviews Physics. 2025peer-reviewed perspective
The load-bearing claims in the chapter are mapped inline to this registered source set. A citation supports only the bounded claim beside it.