  Circuit description languages are a class of quantum programming languages in
which programs are classical and produce a description of a quantum
computation, in the form of a quantum circuit. Since these programs can
leverage all the expressive power of high-level classical languages, circuit
description languages have been successfully used to describe complex and
practical quantum algorithms, whose circuits, however, may involve many more
qubits and gate applications than current quantum architectures can actually
muster. In this paper, we present Proto-Quipper-R, a circuit description
language endowed with a linear dependent type-and-effect system capable of
deriving parametric upper bounds on the width of the circuits produced by a
program. We prove both the standard type safety results and that the resulting
resource analysis is correct with respect to a big-step operational semantics.
We also show that our approach is expressive enough to verify realistic quantum
algorithms.
