Scientific Algorithms
Exercise PLAN-209
primary source nl only. Additive answer successor with distinct content-bound review; historical rejected answer retained only for audit. No new Lean verification is claimed for this NL view.
Assumptions and conventions
- A bit oracle and reversible classical arithmetic are available
- The block encoding requires the entry as an amplitude of a flagged ancilla
- Query cost counts oracle calls; gate cost counts elementary gates; ancilla cost distinguishes borrowed (clean) from persistent
- 'No free cleanup' means uncomputation is a counted resource
Question
Two input models for the entries of a matrix A appear in the sparse block-encoding discussion: the BIT oracle O~_A |0^{d'}>|i>|j> = |A~_ij>|i>|j>, which writes a classical fixed-point string into a register, and the AMPLITUDE oracle O_A |0>|i>|j> = (A_ij|0> + sqrt(1-|A_ij|^2)|1>)|i>|j>, which encodes the entry as the amplitude of an ancilla qubit. Explain conceptually (i) what distinguishes the two as computational resources -- which is a 'digital/query' interface and which is an 'analog/amplitude' interface; (ii) why building the amplitude oracle from the bit oracle requires both controlled rotations (gate work) and uncomputation (query work), i.e. the amplitude oracle is strictly derived, not primitive; and (iii) in a resource count for the overall block encoding, why it is natural to charge the construction one forward and one inverse bit-oracle query plus the gates of a controlled rotation, and why the work register must be counted as borrowed (returned clean), not consumed.
Hint: mathematical route
An entry-derived amplitude oracle needs original queries plus reversible arithmetic, signed/complex signal loading and cleanup. A fused O;C;R;C†;O† implementation uses one forward and inverse ENTRY query while charging both arithmetic passes and all live workspace; two derived-angle calls are a different ledger.
- The entry oracle writes a coherent fixed-point record on retained indices; reading all entries or copying arbitrary quantum states is not a free digital operation.
- The signal interface coherently loads a valid signed/complex rounded coefficient; magnitude rotation plus the correct conditional phase gives the full two-branch state, not a complete matrix block encoding by itself.
- For the fused sequence O;C;R_sig;C†;O†, arithmetic is charged gate work and cleanup uses one counted original inverse query; separately packaged angle-oracle calls must have all internal costs expanded.
- The explicit fused ledger is one forward/one inverse original entry query plus2G_C+G_R gates and complete peak scratch, not a lower bound forbidding known-constant circuits, cancellation or other resource trade-offs.
- All temporary value/angle/phase/arithmetic work returns clean in both signal branches and remains part of peak physical space; the signal is retained output, with exactness only for the specified rounded parameters and ideal gates.
Reference solution
Keep the two interfaces separate. With retained combined index t=(i,j), an entry oracle O writes a fixed d'-bit datum b_t on a clean value register V while retaining T. In a coherent superposition it writes sum_t c_t|b_t,t>, not a freely readable classical list of all entries. Measuring that value can disturb T, and CNOT fanout copies computational-basis records, not arbitrary unknown states. An amplitude oracle instead places a coefficient on a signal basis vector while retaining T; probabilities alone generally lose its sign/complex phase, and estimating or reading it is not free. The relevant block is a coherent compression, not a classical numeric output. In the stated bit-access construction the amplitude oracle is derived; another input model may stipulate it as primitive, and known special matrices may have direct circuits. There is no universal separation or lower bound asserted by the digital/analog labels.
First make the target meaningful: z|0>+sqrt(1-|z|²)|1> is normalized with nonnegative real second coefficient precisely for |z|<=1. If entries exceed that range, a known positive scaling factor or another target is needed; computing that bound is not free. A finite datum for a general real/complex entry does not by itself give its original exact coefficient. What the finite-angle construction implements exactly in the ideal-rotation model is z_hat=exp(2pi i p_b) cos(pi q_b), with actually computed binary fractions q_b in[0,1/2] and p_b in[0,1). The original input-rounding, arithmetic-rounding and gate-synthesis errors remain separate. For complex entries, the given entry datum must describe the complex value, e.g. its real/imaginary parts within total width d'; a magnitude-only datum cannot determine missing phase. This does not add a nonnegative-real restriction. At zero choose phase0 without dividing by its magnitude. Signed real values can use phase0 or1/2 and the same magnitude rotation; an alternative signed-angle circuit must include its endpoint handling.
Here is one explicitly composable original-entry-query implementation. Registers are(signal S,value V,angle Q,phase P,arithmetic scratch R,index T), with widths1,d',d,e,w,|T|. All temporary registers start zero. Choose a specified reversible arithmetic circuit C of non-oracle gate cost G_C, preserving V, that maps |b,0_Q,0_P,0_R> to |b,q_b,p_b,g_b>. Garbage g_b may be retained during the rotation; all arithmetic workspace used by this implementation belongs to R and its cost. Constructing and costing C is a genuine obligation, not a unit-cost angle query. One may choose d>=1 for the magnitude fraction so q=1/2 is representable; any alternative endpoint encoding/flags are counted. The safe stored q range is part of the explicit arithmetic design, not an inferred error guarantee for arbitrary input bits. If rounded data leave the unit disk, clipping/scaling must be specified and its approximation effect analyzed rather than silently treated as exact A.
Chronologically apply O; C; R_sig; C†; O†. On each index t the successive records are |0,0,0,0,0,t> -> |0,b_t,0,0,0,t> -> |0,b_t,q_t,p_t,g_t,t> -> |v_t,b_t,q_t,p_t,g_t,t> -> |v_t,b_t,0,0,0,t> -> |v_t,0,0,0,0,t>, where v_t=z_hat_t|0>+sqrt(1-|z_hat_t|²)|1>. Specifically R_sig first applies Ry(2pi q_t) and then D(p_t)=diag(exp(2pi i p_t),1) on S, controlled on the stored bits. Since0<=q<=1/2, its sine is nonnegative. Bit expansion of q gives d ideal bit-controlled Y rotations; expansion of p gives e bit-controlled phase-on-zero operations. Their chronological product has the claimed first column. The phase-on-zero operation must not be replaced by an Rz while dropping an index-dependent overall phase: that would change coherent label phases. Real negative and complex coefficients are not recovered by a magnitude-only rotation.
R_sig changes none of V,Q,P,R,T. Consequently the actual C† restores Q,P,R in BOTH signal branches, and O† restores V. This proves the arbitrary-superposition law by linearity, not just basis-input probabilities. If the only specification of O is its action on zero V, unitarity gives its mathematical inverse but does not automatically give black-box inverse-query access or its cost. The ledger explicitly uses one O† call when that interface is available; for the usual XOR value oracle O|v,t>=|v xor b_t,t>, it is self-inverse. A known reversible entry circuit may instead be reversed with its full cost. No inverse access or controlled unknown-unitary oracle is made free by notation.
The fused architecture has ledger(one original O query,one original O† query,2G_C+G_R other gates,d'+d+e+w peak temporary qubits,one retained signal), plus the retained indices and any outer block-encoding registers. G_R denotes the actual rotation/phase implementation cost: d+e counts ideal controlled operations in this explicitly extended gate model, not elementary Clifford+T gates. If query circuits are also compiled, their gate/depth/workspace costs must be included without double-counting the oracle-level metric. C may require further arithmetic storage or input evaluation; w is the complete live amount in the chosen reversible implementation, not an output-length estimate. For purely real known-phase data P and its gates may be omitted only with the corresponding justified interface. All temporary qubits return clean but physically exist at peak: 'borrowed clean' is this question's convention, not dirty borrowed workspace or zero qubit cost. The signal is intended output, not scratch to uncompute; persistent here means retained for the outer circuit, not consumed forever or counted twice when reused sequentially.
Compare a separately packaged CLEAN angle/phase oracle B. The schematic B;R_sig;B† uses one B and one B†, but every original-entry query, arithmetic gate and workspace cost inside B must be expanded. For example, a clean converter F preserving b and restoring its own scratch gives B chronologically O;F;O†. That costs two original queries per B, so naive B;R_sig;B† costs FOUR original queries, not two. Because R_sig acts on S,Q,P while O acts on V,T, their actions commute; keeping V live across R_sig cancels the middle O†/O pair and yields the fused O;F;R_sig;F†;O† construction. Retaining more live data is an explicit resource trade-off. Thus cleanup is charged for this circuit, but 'cannot amortize away' is not a theorem about every algorithm, known constant or fused multi-call design.
For a density rho on T the clean S=0 compression is D_z=sum_t z_hat_t|t><t|, with success p=sum_t rho_tt|z_hat_t|² and accepted state D_z rho D_z†/p only if p>0. This diagonal action on the combined index is NOT by itself a full matrix block encoding of A; sparsity/permutation or row-column constructions and their queries/gates must be supplied separately. Omitting cleanup and tracing the remaining records generally dephases different records in the joint signal/index state; the signal-only marginal and a basis-input signal need not change. Those exceptions do not satisfy the specified reusable clean interface. Exactness here is for stored q,p with ideal gates. If true ideal parameters q,p have errors bounded by delta_q and circular delta_p, the signal-vector error is at most pi delta_q+2pi delta_p, plus synthesis error; relating those to original matrix-data error, especially near magnitude endpoints, needs its own analysis. No arbitrary-real exactness, free readout/amplification, total sparse-block-encoding cost, arithmetic runtime bound or optimal query lower bound follows from '+2 queries'.
Assessment rubric
- Distinguishes coherent digital entry records from signed/complex amplitude access, avoids free readout/fanout claims, and separates primitive-model choices from this derived construction and finite-bit exactness. (1 weight)
- Derives O;C;R_sig;C†;O† on all retained registers and arbitrary coherent input, including valid phase loading, zero/endpoints, all scratch and explicit original inverse-access typing; does not replace C by one free angle query. (1 weight)
- Gives one original forward plus one inverse entry query for the explicit fused construction with2G_C+G_R other gates and d'+d+e+w live clean work, contrasts the fully expanded packaged-angle ledger and possible fusion, and does not claim a universal optimality/lower bound. (1 weight)
- Distinguishes peak clean temporary qubits from retained signal/indices/outer flags, restores all arithmetic workspace, and keeps normalization/phases, error/gate-synthesis, projection versus channel, sparsity/readout/amplification and original-real-versus-rounded target limits explicit. (1 weight)
Graph-grounded prerequisites
These are support/source anchors, not an automatically extracted theorem-dependency proof.
- Block Encoding (frozen curriculum anchor; see graph registry)
- Oracle and circuit complexity (frozen curriculum anchor; see graph registry)
- Operator and semigroup theory (frozen curriculum anchor; see graph registry)
Lean view and evidence boundary
No aligned Lean view has been admitted for this native core in this textbook checkpoint. This is not a claim that the underlying mathematics lacks a formal proof. Contributions must preserve this exact target contract and split.
Sources and provenance
- website/research/sources.json
lin-wiebe-2026-qasc
Source SHA-256:9f85f45f20ed5a46931ad0dec3b94ee09748bc56e39fae29b0aefe910440b0ae· MIT metadata only - Primary source
Contract: ae91a774d00f0200a6dba18a3d4f7ee65df6ac6452cf482ae647f019cc41846e
Item digest: 6857bd12f50ecc5dd4d6573d1ddba061e0d187b3053669baf5fca1173049c092
Graph snapshot: qcb-snapshot-ffa644f0da3031a1ce754b9a
Authored support steps: 5. This is not measured graph distance or model difficulty.
Answer revision lineage
{ "predecessor_item_digest": "2d729fc273777101818a6bc5aef94cbf317330c1f2235e25a5c01a52c2a7de0a", "predecessor_key": "qcb-core-plan-209-amplitude-vs-bit-oracle-query-gate-roles", "repair_record": "shared/repairs/plan-209-original-entry-query-ledger-answer-repair.json", "repair_record_digest": "7772e1aa6bd2547c24707f9ec7c81274592566b12c83fac43ac95738f04d7750", "review_record": "reports/textbook-v1/repairs/plan-209-original-entry-query-ledger-answer-repair-review.json", "review_digest": "320650ea91ecf5ffeb090e7dea2219bcd063d6ba527c0450229ce506ae042aa4" }