Recursive Quantum Programs with Classical Control
Recursive Quantum Programs with Classical Control
Procedure declarations, unfolding, finite approximations, and least fixed points for classical recursion in quantum programs.
Syntax, declarations, and scope
This entry follows Chapter 5, Section 5.5 (printed pp. 82–90). Recursion here has classical control determined by measurement outcomes. It is distinct from recursion with coherent quantum control in Chapter 12. Prerequisites are denotational semantics and quantum languages.
Definitions 5.14–5.16 add procedure identifiers to the while language. A program scheme may contain calls. A declaration assigns bodies to distinct procedure names; bodies can call any of these names. A recursive program consists of a main statement and a declaration , allowing direct and mutual recursion. The formal development concerns parameterless procedures. Classical and quantum parameters are further extension questions, not features already covered by these results.
Operational meaning of a call
In a configuration , the state is a partial density operator. The REC rule in Figure 5.6 (p. 84) is
A call unfolds to its body without changing the quantum state. The copy rule copies program syntax, not an unknown quantum state. Existing while-language rules remain, using transitions relative to the declaration.
Definition 5.19 defines by summing outputs of all finite terminating executions, with multiplicity when distinct paths yield the same output. Infinite executions contribute no terminating output. For normalized input, the output trace is the termination probability; individual branches must not first be normalized.
While loops as recursion
On p. 85, while M[q]=1 do B od is represented by
Using as the main statement gives the same denotation as the loop. Outcome 0 terminates; outcome 1 executes the body and calls again. General mutual recursion goes beyond this single-loop pattern.
Sequential composition still satisfies : the order of function composition must not be reversed.
Finite unfolding and the supremum
Definition 5.20 and Eq. (5.16), p. 85, define approximations uniformly for arbitrary program schemes:
Substitution is simultaneous. The initial approximation is abort, producing no terminating output, not skip. Approximants contain no procedure calls but may retain while constructs, so finite unfolding does not mean every execution terminates.
Proposition 5.8 (p. 86) states
This is the supremum of an increasing semantic chain, not a sum of approximants, which would double-count terminating paths. The proof establishes that every finite terminating execution appears in some unfolding and every terminating execution of an unfolding corresponds to one of the original program.
Least fixed points
Write for the semantic functional interpreting procedure names as quantum operations. The declaration induces
Section 5.5.4 works in the domain of quantum operations with componentwise order. Continuity allows iteration from the tuple of zero operations to yield the least fixed point. Theorem 5.2 (p. 88) gives
Leastness excludes extra output unsupported by finite terminating executions. For , the fixed-point equation alone permits many solutions, but iteration from zero remains zero, correctly representing nontermination. Existence of a least fixed point does not imply almost-sure termination.
Source verification
Chapter 5, Section 5.5: Definitions 5.14–5.21, Figure 5.6, Proposition 5.8, and Theorem 5.2. PDF images of printed pp. 84, 85, 86, and 88 were inspected for REC, simultaneous substitution, the supremum, and fixed-point formulas; surrounding scope was checked against page-separated text. This entry explains the semantics without claiming to reproduce every proof in the chapter.