Q# is a standalone domain-specific programming language from Microsoft for writing and running quantum programs.Like most industrial languages, it was designed without a formal specification, which can naturally lead to ambiguity in its interpretation.We aim to provide a formal language definition for Q#, placing the language on a solid mathematical foundation and enabling further evolution of its design and type system.This paper presents λ Q# , an idealized version of Q# that illustrates how we may view Q# as a quantum ALGOL (algorithmic language).We show the safety properties enforced by λ Q# 's type system and present its equational semantics based on a fully complete algebraic theory by Staton.
Q# is a standalone domain-specific programming language from Microsoft for writing and running quantum programs.Like most industrial languages, it was designed without a formal specification, which can naturally lead to ambiguity in its interpretation.We aim to provide a formal language definition for Q#, placing the language on a solid mathematical foundation and enabling further evolution of its design and type system.This paper presents λ Q# , an idealized version of Q# that illustrates how we may view Q# as a quantum ALGOL (algorithmic language).We show the safety properties enforced by λ Q# 's type system and present its equational semantics based on a fully complete algebraic theory by Staton.
As quantum computing matures beyond isolated algorithm demonstrations, the need for robust, scalable, and formally structured programming environments has become increasingly evident.While early quantum programming frameworks primarily focused on circuit construction and gate-level abstraction, modern quantum software development requires higher-level language constructs, strong correctness guarantees, and seamless integration with classical computing infrastructure.Addressing these needs, Q# was introduced by Microsoft as part of its broader quantum software ecosystem [113].Unlike Python-based libraries such as Qiskit and Cirq, Q# is a domain-specific programming language designed explicitly for quantum computation.It is not merely a library layered on top of an existing classical language; rather, it is a purpose-built language that embeds quantum programming principles directly into its syntax, type system, and execution model.Q# emphasizes correctness, composability, and hybrid quantum-classical workflows, making it particularly suitable for largescale algorithm development, formal reasoning, and long-term quantum software engineering.This chapter presents an in-depth exploration of Q# and Microsoft's Quantum Toolkit.It begins by examining the conceptual foundations and design philosophy of Q#, followed by a detailed discussion of writing quantum programs in Q#.The chapter then explores the rich quantum libraries and simulation infrastructure provided by Microsoft and concludes with an extensive analysis of hybrid quantum-classical programming, which lies at the heart of practical quantum applications.
In this paper we develop a functional programming language for quantum computers by extending the simply-typed lambda calculus with quantum types and operations. The design of this language adheres to the ‘quantum data, classical control’ paradigm, following the first author's work on quantum flow-charts. We define a call-by-value operational semantics, and give a type system using affine intuitionistic linear logic. The main results of this paper are the safety properties of the language and the development of a type inference algorithm.
We propose the design of a programming language for quantum computing. Traditionally, quantum algorithms are frequently expressed at the hardware level, for instance in terms of the quantum circuit model or quantum Turing machines. These approaches do not encourage structured programming or abstractions such as data types. In this paper, we describe the syntax and semantics of a simple quantum programming language with high-level features such as loops, recursive procedures, and structured data types. The language is functional in nature, statically typed, free of run-time errors, and has an interesting denotational semantics in terms of complete partial orders of superoperators.
Quantum Intermediate Representation (QIR) is a Microsoft-developed, LLVM-based intermediate representation for quantum program compilers. QIR aims to provide a general solution for quantum program compilers independent of front-end languages and back-end hardware, thus avoiding duplicate development of intermediate representations and compilers. Since it is still under development, QIR is described in natural language and lacks a formal definition, leading to ambiguity in its interpretation and a lack of rigor in implementing quantum functions. In this paper, we provide formal definitions for the data types and instruction sets of QIR, aiming to provide correctness and security guarantees for operations and intermediate code conversions in QIR. To validate our design, we show some samples of unsafe QIR code where errors can be detected by our formal approach.
We present IQu, namely a quantum programming language that extends Reynold's Idealized Algol, the paradigmatic core of Algol-like languages. IQu combines imperative programming with high-order features, mediated by a simple type theory. IQu mildly merges its quantum features with the classical programming style that we can experiment through Idealized Algol, the aim being to ease a transition towards the quantum programming world. The proposed extension is done along two main directions. First, IQu makes the access to quantum co-processors by means of quantum stores. Second, IQu includes some support for the direct manipulation of quantum circuits, in accordance with recent trends in the development of quantum programming languages. Finally, we show that IQu is quite effective in expressing well-known quantum algorithms.
This paper introduces a formal metalanguage called the lambda-q calculus for the specification of quantum programming languages. This metalanguage is an extension of the lambda calculus, which provides a formal setting for the specification of classical programming languages. As an intermediary step, we introduce a formal metalanguage called the lambda-p calculus for the specification of programming languages that allow true random number generation. We demonstrate how selected randomized algorithms can be programmed directly in the lambda-p calculus. We also demonstrate how satisfiability can be solved in the lambda-q calculus.