Part X. Capstones · Chapter 83
Full-Stack Algorithm Trace
Follow one quantum algorithm all the way down — problem, mathematics, circuit, code, noise, hardware budget, decision — and publish the trace as an artifact other engineers can inspect. That end-to-end chain is your capstone.
In this chapter 9 sections
Build a trace whose problem promise, classical baseline, state evolution, circuit, compiled operations, noise model, resource estimate, and decision consequence are linked by executable small cases and explicit assumptions.
A full-stack trace is a chain of preserved contracts. The four-item Grover instance begins with an oracle promise and basis order, evolves amplitudes through preparation, phase marking and diffusion, compiles gates into an instruction ledger, and ends with measurement, error assumptions, resource counts, and the claim those counts can support.
Capstone brief: one algorithm, every interface
Use basis order . The ideal uniform state has amplitudes . One oracle call changes the marked amplitude’s sign; inversion about the mean then maps the marked state to amplitude 1 and all others to 0. This exact small case tests correctness, not large-instance advantage.
Trace Grover’s four-item instance by amplitude
Compile the oracle and count the physical consequences
def one_iteration(marked, apply_oracle=True):
if marked not in range(4) or type(apply_oracle) is not bool:
raise ValueError("marked must be a four-item oracle index")
amplitudes = [0.5] * 4
if apply_oracle:
amplitudes[marked] *= -1
assert abs(sum(a*a for a in amplitudes) - 1.0) < 1e-12
mean = sum(amplitudes) / 4
amplitudes = [2*mean - a for a in amplitudes]
assert abs(sum(a*a for a in amplitudes) - 1.0) < 1e-12
return amplitudes
baseline = one_iteration(2)
alternate = one_iteration(0)
oracle_omitted = one_iteration(2, False)
for marked in range(4):
result = one_iteration(marked)
assert result[marked] == 1.0 and sum(abs(a) for i, a in enumerate(result) if i != marked) == 0
assert baseline == [0.0, 0.0, 1.0, 0.0] and alternate == [1.0, 0.0, 0.0, 0.0]
assert oracle_omitted == [0.5, 0.5, 0.5, 0.5]
print(f"PASS: 83 full-stack Grover baseline={baseline} alternate={alternate} no_oracle_success={oracle_omitted[2]**2:.2f}")
For marked index 2, the phase vector is [1/2, 1/2, -1/2, 1/2]. Its mean is 1/4. Applying yields [0, 0, 1, 0]. The table records that state evolution. The code repeats it for all four possible marked indices, checks normalization at every material step, and separates one oracle query from the gates needed to implement that oracle.
Artifact contract. A semantic state table, OpenQASM-adjacent gate ledger, executable amplitude fixture, and resource-account rubric. The fixture normalizes every state, returns the marked item with probability one in the ideal one-iteration case, and the report separates query count from compiled gates, shots, and error assumptions.
| Step | Amplitude vector in declared basis | Invariant | Resource boundary |
|---|---|---|---|
| Uniform | [1/2, 1/2, 1/2, 1/2] | norm 1 | state preparation |
| Oracle for index 2 | [1/2, 1/2, -1/2, 1/2] | norm 1 | one query |
| Diffusion | [0, 0, 1, 0] | norm 1 | logical gates separate |
| Measurement | index 2 with probability 1 | probabilities sum 1 | shots separate |
Exact validation command: python3 tools/validate_briefs.py --briefs data/editorial_briefs_64_87.json --from 64 --through 87 --check-rewritten-sources --execute-artifacts
Package a reproducible trace submission
The submission must add a compiled ledger and hardware assumptions without promoting the toy result. Query complexity, logical one- and two-qubit gates, routed gates, depth, shots, physical-error model, and validation are separate rows. A reviewer should be able to replace the oracle and rerun the trace before discussing resource scaling.
Validate the full-stack chain
Prompt. Submit a full-stack trace for the four-item Grover search and one changed oracle.
Deliverable. Problem contract, basis order, state table, circuit, executable fixture, compiled gate ledger, noise assumption, resource table, validation command, and decision note.
Pass condition. Both oracles pass normalization and marked-state tests; query, logical-gate, compiled-gate, shot, and physical-resource statements remain separate; every simplification is labeled.
Model submission and scoring rubric for the trace
Format. Reference two-oracle Grover trace and 100-point analytic rubric.
The reference submission passes all four marked indices and awards correctness points only after basis, oracle, diffusion, normalization, and measurement contracts agree. Its 100-point rubric assigns 25 points to problem and baseline, 25 to state and circuit correctness, 20 to executable reproduction, 20 to complete resource boundaries, and 10 to limitations. Reporting only one query earns no physical-resource credit.
Verification. The fixture returns each marked basis state at unit ideal probability and the rubric awards no resource credit for reporting only oracle queries.
| Criterion | Points | Evidence rule |
|---|---|---|
| Problem promise and classical baseline | 25 | Show the inspectable problem promise and classical baseline record; an unsupported assertion receives no credit. |
| State evolution and circuit correctness | 25 | Show the inspectable state evolution and circuit correctness record; an unsupported assertion receives no credit. |
| Executable reproduction | 20 | Show the inspectable executable reproduction record; an unsupported assertion receives no credit. |
| Compiled and physical resource boundaries | 20 | Show the inspectable compiled and physical resource boundaries record; an unsupported assertion receives no credit. |
| Limitations and transfer | 10 | Show the inspectable limitations and transfer 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.
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
- Lov K. Grover. A fast quantum mechanical algorithm for database search. Proceedings of STOC. 1996primary paper
- Robert Beals, Harry Buhrman, Richard Cleve, Michele Mosca, and Ronald de Wolf. Quantum lower bounds by polynomials. Journal of the ACM. 2001primary paper
- OpenQASM Technical Steering Committee. OpenQASM 3 specification. Linux Foundation Joint Development Foundation. 2026official technical specification
- IBM Quantum. Qiskit documentation. IBM. 2026official documentation
- Association for Computing Machinery. Artifact Review and Badging. ACM Publications. 2026official reproducibility policy
- Easwar Magesan, J. M. Gambetta, and Joseph Emerson. Scalable and robust randomized benchmarking of quantum processes. Physical Review Letters. 2011primary paper
- 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.