# Sized Types for low-level Quantum Metaprogramming

**Authors:** Matthew Amy

arXiv: 1908.02644 · 2019-08-08

## TL;DR

This paper introduces metaQASM, a typed extension of openQASM that enables safe, static metaprogramming of quantum circuit families with size-parametrized registers, ensuring finite circuit generation.

## Contribution

It presents a novel sized type system for quantum programming languages, supporting subtyping and guaranteeing strong normalization for circuit family metaprogramming.

## Key findings

- Supports subtyping over register sizes
- Ensures all well-typed programs are strongly normalizing
- Enables static unrolling of circuit families

## Abstract

One of the most fundamental aspects of quantum circuit design is the concept of families of circuits parametrized by an instance size. As in classical programming, metaprogramming allows the programmer to write entire families of circuits simultaneously, an ability which is of particular importance in the context of quantum computing as algorithms frequently use arithmetic over non-standard word lengths. In this work, we introduce metaQASM, a typed extension of the openQASM language supporting the metaprogramming of circuit families. Our language and type system, built around a lightweight implementation of sized types, supports subtyping over register sizes and is moreover type-safe. In particular, we prove that our system is strongly normalizing, and as such any well-typed metaQASM program can be statically unrolled into a finite circuit.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1908.02644/full.md

## Figures

59 figures with captions in the complete paper: https://tomesphere.com/paper/1908.02644/full.md

## References

34 references — full list in the complete paper: https://tomesphere.com/paper/1908.02644/full.md

---
Source: https://tomesphere.com/paper/1908.02644