This paper introduces a realizability-based semantics for a linear algebraic lambda-calculus that characterizes unitarity, providing a foundation that extends to classical and quantum lambda-calculi.
Contribution
It presents a novel realizability semantics for linear algebraic lambda-calculus that captures unitarity and extends to classical and quantum systems.
Findings
01
Semantics characterizes unitarity in the system
02
Derived typing rules for a simply-typed linear algebraic lambda-calculus
03
Extension of the calculus to classical and quantum lambda-calculi
Abstract
In this paper we present a semantics for a linear algebraic lambda-calculus based on realizability. This semantics characterizes a notion of unitarity in the system, answering a long standing issue. We derive from the semantics a set of typing rules for a simply-typed linear algebraic lambda-calculus, and show how it extends both to classical and quantum lambda-calculi.
Tables8
Table 1. TABLE I: Syntax of the calculus
Table 2. TABLE II: Congruence rules on term distributions
Table 3. TABLE III: Inference rules of the relation of
atomic evaluation t ▷ t → ′ ▷ 𝑡 superscript → 𝑡 ′ t\mathrel{\triangleright}\vec{t}^{\prime}
\begin{array}[t]{@{}lll@{}}\vec{t}\mathrel{{\succ}\mskip-6.0mu{\succ}}\alpha\cdot\mathtt{t\!t}&\text{for some }\alpha\in\mathbb{C}\text{\,s.t.\,}|\alpha|=1,&\text{or}\\
\vec{t}\mathrel{{\succ}\mskip-6.0mu{\succ}}\beta\cdot\mathtt{f\!f}&\text{for some }\beta\in\mathbb{C}\text{\,s.t.\,}|\beta|=1,&\text{or}\\
\vec{t}\mathrel{{\succ}\mskip-6.0mu{\succ}}\alpha\cdot\mathtt{t\!t}+\beta\cdot\mathtt{f\!f}&\lx@intercol\text{for some
}\alpha,\beta\in\mathbb{C}\text{\,s.t.\,}|\alpha|^{2}\,{+}\,|\beta|^{2}=1\,.\hfil\lx@intercol\end{array}
\begin{array}[t]{@{}lll@{}}\vec{t}\mathrel{{\succ}\mskip-6.0mu{\succ}}\alpha\cdot\mathtt{t\!t}&\text{for some }\alpha\in\mathbb{C}\text{\,s.t.\,}|\alpha|=1,&\text{or}\\
\vec{t}\mathrel{{\succ}\mskip-6.0mu{\succ}}\beta\cdot\mathtt{f\!f}&\text{for some }\beta\in\mathbb{C}\text{\,s.t.\,}|\beta|=1,&\text{or}\\
\vec{t}\mathrel{{\succ}\mskip-6.0mu{\succ}}\alpha\cdot\mathtt{t\!t}+\beta\cdot\mathtt{f\!f}&\lx@intercol\text{for some
}\alpha,\beta\in\mathbb{C}\text{\,s.t.\,}|\alpha|^{2}\,{+}\,|\beta|^{2}=1\,.\hfil\lx@intercol\end{array}
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Full text
Realizability in the Unitary Sphere
Alejandro
Díaz-Caro12,
Mauricio Guillermo3,
Alexandre Miquel3, and
Benoît Valiron4
A. Díaz-Caro and B. Valiron have been partially supported
by PICT 2015-1208, ECOS-Sud A17C03, and the French-Argentinian
International Laboratory SINFIN. B. Valiron has been partially
supported by the French National Research Agency
(ANR) under the research project SoftQPRO ANR-17-CE25-0009-02,
and by the DGE of the French Ministry of Industry under the research
project PIA-GDN/QuantEx P163746-484124.
M. Guillermo and A. Miquel have been partially supported by the
Uruguayan National Research & Innovation Agency (ANII) under the
research project “Realizability, Forcing and Quantum Computing”,
FCE_1_2014_1_104800.
1Universidad Nacional de Quilmes, Bernal, Buenos Aires, Argentina
2Instituto de Ciencias de la Computación
(UBA-CONICET), Buenos Aires, Argentina
In this paper we present a semantics for a linear algebraic
lambda-calculus based on realizability. This semantics
characterizes a notion of unitarity in the system, answering a long
standing issue. We derive from the semantics a set of typing rules for
a simply-typed linear algebraic lambda-calculus, and show how it
extends both to classical and quantum lambda-calculi.
I Introduction
The linear-algebraic lambda calculus
(Lineal) [1, 2, 3] is an
extension of the lambda calculus where lambda terms are closed under
linear combinations over a semiring K. For instance, if t and r
are two lambda terms, then so is α.t+β.r with
α,β∈K. The original motivation
of [1] for such a calculus was to set the basis
for a future quantum calculus, where α.t+β.r could be seen
as the generalization of the notion of quantum superposition to the
realm of programs (in which case K is the field C of complex
numbers).
In quantum computation, data is encoded in the state of a set of
particles governed by the laws of quantum mechanics. The mathematical
formalization postulates that quantum data is modeled as a unit vector
in a Hilbert space.
The quantum analogue to a Boolean value is the quantum bit,
that is a linear combination of the form
ϕ=α∣0⟩+β∣1⟩, where ∣0⟩ and ∣1⟩
respectively correspond to “true” and “false”, and where
∣α∣2+∣β∣2=1.
In other words, the state ϕ is a linear combination of the
Boolean values “true” and “false”, of l2-norm equal to 1: it
is a unit-vector in the Hilbert space C2.
A quantum memory consists in a list of registers holding quantum
bits. The canonical model for interacting with a quantum memory is the
QRAM model [4]. A fixed set of elementary operations
are allowed on each quantum register. Mathematically, these operations
are modeled with unitary maps on the corresponding Hilbert spaces,
that is: linear maps preserving the l2-norm and the orthogonality.
These operations, akin to Boolean gates, are referred to as quantum
gates, and they can be combined into linear sequences called quantum
circuits. Quantum algorithms make use of a quantum memory to solve a
particular classical problem. Such an algorithm therefore consists in
particular in the description of a quantum circuit.
Several existing languages for describing quantum algorithms such as
Quipper [5] and QWIRE [6]
are purely functional and based on the lambda calculus.
However, they only provide classical control: the quantum
memory and the allowed operations are provided as black boxes.
These languages are mainly circuit description languages using opaque
high-level operations on circuits.
They do not feature quantum control, in the sense that the
operations on quantum data are not programmable.
A lambda calculus with linear combinations of terms made “quantum”
would allow to program those “black boxes” explicitly, and provide
an operational meaning to quantum control.
However, when trying to identify quantum data with linear combinations
of lambda terms, the problem arises from the norm condition on quantum
superpositions.
To be quantum-compatible, one cannot have any linear
combination of programs.
Indeed, programs should at the very least yield valid quantum
superpositions, that is: linear combinations whose l2-norm
equals 1—a property which turns out to be very difficult to
preserve along the reduction of programs.
So far, the several attempts at accommodating linear algebraic lambda
calculi with the l2-norm have failed.
At one end of the spectrum, [7] stores lambda terms
directly in the quantum memory, and encodes the reduction process as a
purely quantum process.
Van Tonder shows that this forces all lambda terms in superposition to
be mostly equivalent.
At the other end of the spectrum, the linear algebraic approaches
pioneered by Arrighi and Dowek consider a constraint-free calculus and
try to recover quantum-like behavior by adding ad-hoc term reductions
[1] or type systems
[8, 9, 10].
But if these approaches yield very expressive models of computations,
none of them is managing to precisely characterize linear
combinations of terms of unit l2-norm, or equivalently, the
unitarity of the representable maps.
This paper answers this question by presenting an
algebraic lambda calculus together with a type system that enforces
unitarity. For that, we use semantic techniques coming from
realizability [11] to decide on the unitarity of
terms.
Since its creation by Kleene as a semantics for Heyting arithmetic,
realizability has evolved to become a versatile toolbox, that can be
used both in logic and in functional programming.
Roughly speaking, realizability can be seen as a generalization of the
notion of typing where the relation between a term and its type is not
defined from a given set of inference rules, but from the very
operational semantics of the calculus, via a computational
interpretation of types seen as specifications.
Types are first defined as sets of terms verifying certain properties,
and then, valid typing rules are derived from these properties rather
than set up as axioms.
The main feature of our realizability model is that types are not
interpreted as arbitrary sets of terms or values, but as subsets of
the unit sphere of a particular weak vector
space [3], whose vectors are distributions
(i.e. weak linear combinations) of “pure” values.
So that by construction, all functions that are correct w.r.t. this
semantics preserve the ℓ2-norm.
As we shall see, this interpretation of types is not
only compatible with the constructions of the simply typed lambda
calculus (with sums and pairs), but it also allows us to distinguish
pure data types (such as the type B of pure Booleans) from
quantum data types (such as the type ♯B of quantum
Booleans).
Thanks to these constraints, the type system we obtain naturally
enforces that the realizers of the type ♯B→♯B
are precisely the functions representing unitary operators of C2.
This realizability model is therefore answering a hard
problem [12]: it provides a unifying
framework able to express not only classical control, with
the presence of “pure” values, but also quantum control, with
the possibility to interpret quantum data-types as (weak) linear
combinations of classical ones.
I-A Contributions
(1) We propose a realizability semantics based on
a linear algebraic lambda calculus capturing a notion of unitarity
through the use of a l2-norm. As far as we know, such a construction is novel.
(2) The semantics provides a unified model for both classical and
quantum control. Strictly containing the simply-typed lambda calculus,
it does not only serve as a model for a quantum circuit-description
language, but it also provides a natural interpretation of quantum control.
(3) In order to exemplify the expressiveness of the model, we show how
a circuit-description language in the style of
QWIRE [6] can be naturally interpreted in the
model.
Furthermore, we discuss how one can give within the model an
operational semantics to a high-level operation on circuits
usually provided as a black box in circuit-description languages:
the control of a circuit.
I-B Related Works
Despite its original motivations, [10] showed
that Lineal can handle the l1-norm.
This can be used for example to represent probabilistic distributions
of terms.
Also, a simplification of Lineal, without scalars, can serve as a
model for non-deterministic computations [13].
And, in general, if we consider the standard values of the lambda
calculus as the basis, then linear combinations of those form a vector
space, which can be characterized using
types [9].
In [14] a similar distinction between
classical bits (B) and qbits (♯B) has been also studied.
However, without unitarity, it is impossible to obtain a calculus that
could be compiled onto a quantum machine.
Finally, a concrete categorical semantics for such a calculus has
been recently given in [15].
An alternative approach for capturing unitarity (of data superpositions
and functions) consists to change the language.
Instead of starting with a lambda calculus, [16] defines and
extends a reversible language to express quantum computation.
Lambda calculi with vectorial structures are not specific to quantum
computation.
Vaux [17] independently developed the
algebraic lambda calculus (where linear combinations of terms
are also terms), initially to study a fragment of
the differential lambda calculus of [18].
Unlike its quantum-inspired cousin Lineal, the algebraic lambda
calculus is morally call-by-name, and
[19] shows the formal
connection with Lineal.
Designing an (unconstrainted) algebraic lambda calculus (in
call-by-name [17] or in
call-by-value [1]) raises the problem of how
to enforce the confluence of reduction.
Indeed, if the semi-ring K is a ring, since 0⋅t=0, it
is possible to design a term Yt reducing both to t and the empty
linear combination 0.
A simple solution to recover consistency is to weaken the vectorial
structure and remove the equality
0⋅t=0 [3].
The vector space of terms becomes a weak vector space.
This approach is the one we shall follow in our construction.
This paper is concerned with modeling quantum higher-order programming
languages. If the use of realizability techniques is novel, several
other techniques have been used, based on positive matrices and
categorical tools. For first-order quantum languages,
[20] constructs a fully complete semantics based on
superoperators. To model a strictly linear quantum lambda-calculus,
[21] shows that the compact closed category CPM
based on completely positive maps forms a fully abstract
model. Another approach has been taken in [22], with
the use of a presheaf model on top of the category of
superoperators. To accomodate duplicable data,
[23] extends CPM using techniques
developed for quantitative models of linear logic.
Finally, a categorical semantics of circuit-description languages
has been recently designed using linear-non-linear models by
[24, 25].
I-C Outline
Section II presents the linear algebraic calculus and its
weak vector space structure.
Section III discusses the evaluation of term distributions.
Section IV introduces the realizability semantics and the
algebra of types spawning from it.
At the end of this section, Theorem IV.12 and
Corollary IV.13 express that the type of maps from
quantum bits to quantum bits only contains unitary functions.
Section V introduces a notion of typing judgment and
derives a set of valid typing rules from the semantics.
Section V-B discusses the inclusion of the
simply-typed lambda calculus in this unitary semantics.
Finally, Section VI describes a small quantum
circuit-description language and shows how it lives inside the unitary
semantics.
II Syntax of the calculus
This section presents the calculus upon which our realizability model
will be designed.
It is a lambda-calculus extended with linear combinations of lambda-terms,
but with a subtelty: terms form a weak vector space.
II-A Values, terms and distributions
The language is made up of four syntactic categories:
pure values, pure terms, value distributions
and term distributions (Table I).
As usual, the expressions of the language are built from a fixed
denumerable set of variables, written X.
In this language, a pure value is either
a variable x,
a λ-abstraction λx.s (whose body is an
arbitrary term distribution s),
the void object ∗,
a pair of pure values (v1,v2), or
one the two variants inl(v) and inr(v) (where v is pure
value).
A pure term is either a pure value v or a destructor, that
is:
an application st,
a sequence t;s for destructing the void object
in t111Note the asymmetry: t is a pure term whereas s
is a term distribution.
As a matter of fact, the sequence t;s (that could also be
written let∗=tins) is the nullary version of the
pair destructing let let(x1,x2)=tins.,
a let-construct let(x1,x2)=tins for destructing a pair in t, or
a match-construct matcht{inl(x1)↦s1∣inr(x2)↦s2}
(where s, s1 and s2 are arbitrary term
distributions).
A term distribution is simply a formal C-linear combination
of pure terms, whereas a value distribution is a term
distribution that is formed only from pure values.
We also define Booleans
using the following abbreviations:
tt:=inl(∗), ff:=inr(∗), and, finally,
ift{s1∣s2}:=matcht{inl(x1)↦x1;s1∣inr(x2)↦x2;s2}.
The notions of free and bound (occurrences of) variables are defined
as expected, and in what follows, we shall consider pure values, pure
terms, value distributions and term distributions up to
α-conversion, silently renaming bound variables whenever
needed.
The set of all pure terms (resp. of all pure values) is
written Λ(X) (resp. V(X)), whereas the set of all term
distributions (resp. of all value distributions) is written
Λ(X) (resp. V(X)).
So that we have the inclusions:
[TABLE]
II-B Distributions as weak linear combinations
Formally, the set Λ(X) of term distributions is equipped
with a congruence ≡ that is generated from the
7 rules of Table II.
We assume that the congruence ≡ is shallow, in the sense that
it only goes through sums (+) and scalar multiplications (⋅),
and stops at the level of pure terms.
So that
t+(s1+s2)≡t+(s2+s1)
but
λx.s1+s2≡λx.s2+s1.
(This important design choice will be justified in
Section V-A, Remark V.5).
We easily check that:
Lemma II.1**.**
For all α∈C, we have
α⋅0≡0.
Proof.
From
0⋅0≡0⋅0+0≡0⋅0+1⋅0≡(0+1)⋅0=1⋅0≡0,
we get
α⋅0≡α⋅(0⋅0)≡(0α)⋅0=0⋅0≡0.
∎
On the other hand, the relation 0⋅t≡0 cannot be
derived from the rules of Table II as we shall see below
(Proposition II.6 and Example II.7).
As a matter of fact, the congruence ≡ implements the equational
theory of a restricted form of linear combinations—which we shall
call distributions—that is intimately related to the notion
of weak vector space [3].
Definition II.2** (Weak vector space).**
A weak vector space (over a given field K) is a commutative
monoid (V,+,0) equipped with a scalar multiplication
(⋅):K×V→V such that for all u,v∈V, α,β∈K,
we have
1⋅u=u,
α⋅(β⋅u)=αβ⋅u,
(α+β)⋅u=α⋅u+β⋅u, and
α⋅(u+v)=α⋅u+α⋅v.
Remark II.3**.**
The notion of weak vector space differs from the traditional notion of
vector space in that the underlying additive structure
(V,+,0) may be an arbitrary commutative monoid, whose
elements do not necessarily have an an additive inverse.
So that in a weak vector space, the vector (−1)⋅u is in
general not the additive inverse of u, and the product 0⋅u
does not simplify to 0.
Weak vector spaces naturally arise in functional analysis as the
spaces of unbounded operators.
Historically, the notion of unbounded operator was introduced by von
Neumann to give a rigorous mathematical definition to the operators
that are used in quantum mechanics.
Given two (usual) vector spaces E and F
(over the same field K), recall that an unbounded operator
from E to F is a linear
map f:D(f)→F that is defined on a sub-vector space
D(f)⊆E, called the domain of f.
The sum of two unbounded operators f,g:E⇀F is
defined by:
D(f+g):=D(f)∩D(g),
(f+g)(x):=f(x)+g(x) (for all x∈D(f+g)),
whereas the product of an unbounded operator
f:E⇀F by a scalar α∈K is defined by:
D(α⋅f):=D(f), (α⋅f)(x):=α⋅f(x) (for all x∈D(α⋅f)).
Example II.4**.**
The space \L(E,F) of all unbounded
operators from E to F is a weak vector
space, whose null vector is the (totally defined) null function.
Indeed, we observe that an unbounded operator
f∈\L(E,F) has an additive inverse if and
only f is total, that is: if and only if D(f)=E—and
in this case, the additive inverse of f is the operator (−1)⋅f.
In particular, it should be clear to the reader that
0⋅f(=0↾D(f))=0 as
soon as D(f)=E.
We can now observe that, by construction:
Proposition II.5**.**
The space Λ(X)/≡ of all term distributions
(modulo the congruence ≡) is the free weak C-vector space
generated by the set Λ(X) of all pure terms222The same way as the space of linear combinations over a
given set X is the free vector space generated by X..
∎
Again, the notion of distribution (or weak linear combination) differs
from the standard notion of linear combination in that the summands of
the form 0⋅t cannot be erased, so that the distribution
t1+(−3)⋅t2 is not equivalent to the distribution
t1+(−3)⋅t2+0⋅t3 (provided t3≡t1,t2).
In particular, the distribution
(−1)⋅t1+3⋅t2 is not the additive inverse of
t1+(−3)⋅t2, since
\bigl{(}t_{1}+(-3)\cdot t_{2}\bigr{)}+\bigl{(}(-1)\cdot t_{1}+3\cdot t_{2}\bigr{)}~{}\equiv~{}0\cdot t_{1}+0\cdot t_{2}~{}\not\equiv~{}\vec{0}\,.
However, the equivalence of term distributions can be simply
characterized as follows:
Proposition II.6** (Canonical form of a distribution).**
Each term distribution t can be written
t≡∑i=1nαi⋅ti,
where α1,…,αn∈C are arbitrary scalars
(possibly equal to [math]), and where t1,…,tn (n≥0)
are pairwise distinct pure terms.
This writing—which is called the canonical form
of t—is unique, up to a permutation of the
summands αi⋅ti (i=1..n).∎
Example II.7**.**
Given distinct pure terms t1 and t2, we consider the term
distributions t:=3⋅t1 and
t′:=3⋅t1+0⋅t2.
We observe that the distributions t and t′ (that are
given in canonical form) do not have the same number of summands,
hence they are not equivalent: t≡t′.
Corollary II.8**.**
The congruence ≡ is trivial on pure terms:
t≡t′ iff t=t′, for all t,t′∈Λ(X).∎
Thanks to Proposition II.6, we can associate to each term
distribution t≡∑i=1nαi⋅ti (written in
canonical form) its domaindom(t):={t1,…,tn}333Note that the domain of a distribution
t≡∑i=1nαi⋅ti gathers all pure
terms ti (i=1..n), including those affected with a coefficient
αi=0.
So that the domain of a distribution should not be mistaken with its
support.
and its weightϖ(t):=∑i=1nαi.
Note that the weight function ϖ:Λ(X)/≡→C is a linear function from
the weak C-vector space of term distributions to C, whereas the
domain function dom:Λ(X)/≡→Pfin(Λ(X)) is a
morphism of commutative monoids from
(Λ(X)/≡,+,0) to
(Pfin(Λ(X)),∪,∅), since we have444Actually, the function dom:Λ(X)/≡→Pfin(Λ(X)) is even linear, since the commutative (and idempotent) monoid
(Pfin(Λ(X)),∪,∅) has a natural structure
of weak C-vector space whose (trivial) scalar multiplication is
defined by α⋅X=X for all α∈C and
X∈Pfin(Λ(X)).:
dom(0)=∅,
dom(t1+t2)=dom(t1)∪dom(t2),
dom(t)={t} and
dom(α⋅t)=dom(t)
for all t∈Λ(X), t1,t2∈Λ(X)
and α∈C.
Remark II.9**.**
In practice, one of the main difficulties of working with
distributions is that addition is not regular, in the sense that
the relation t+t1≡t+t2 does not
necessarily imply that t1≡t2.
However, for example if t=α.s, we can deduce that
t1≡t2 or
t1≡t2+0⋅s or
t2≡t1+0⋅s.
To simplify the notation, we shall adopt the following:
Convention II.10**.**
From now on, we consider term distributions modulo the
congruence ≡, and simply write t=t′ for
t≡t′.
This convention does not affect inner—or
raw—distributions (which occur within a pure term, for
instance in the body of an abstraction), that are still considered
only up to α-conversion555Intuitively, a distribution that appears in the body of an
abstraction (or in the body of a let-construct, or in a branch
of a match-construct) does not represent a real superposition, but
it only represents machine code that will produce later a
particular superposition, after some substitution has been
performed..
The same convention holds for value distributions.
To sum up, we now consider that
s1+s2=s2+s1 (as a top-level distribution),
but:
[TABLE]
II-C Extending syntactic constructs by linearity
Pure terms and term distributions are intended to be evaluated
according to the call-by-basis strategy (Section III),
that can be seen as the declination of the call-by-value
strategy in a computing environment where all functions are
linear by construction.
Keeping this design choice in mind, it is natural to extend the
syntactic constructs of the language by linearity, proceeding as
follows:
for all value distributions v=∑i=1nαi⋅vi
and w=∑j=1mβj⋅wj, and for all term distributions s1,s2, t=∑k=1pγk⋅tk and s=∑ℓ=1qδℓ⋅sℓ we have:
[TABLE]
The value distribution (v,w) will be sometimes
written v⊗w as well.
II-D Substitutions
Given a variable x and a pure value w, we define an operation of
pure substitution,
written [x:=w], that associates to each pure value v (resp. to
each pure term t, to each raw value distribution v, to each
raw term distribution t) a pure value v[x:=w] (resp. a pure
term t[x:=w], a raw value distribution v[x:=w], a raw term
distribution t[x:=w]).
The four operations v[x:=w], t[x:=w], v[x:=w] and
t[x:=w] are defined by mutual recursion as expected.
Although the operation t[x:=w] is primarily defined on
raw term distributions (i.e. by recursion on the tree
structure of t, without taking into account the congruence
≡), it is compatible with the congruence ≡, in the sense
that
if t≡t′, then
t[x:=w]≡t′[x:=w] for all pure values w.
In other words, the operation of pure substitution is compatible with
Convention II.10.
It is also clear that, by construction, the operation
t[x:=w] is linear w.r.t. t, so that
t[x:=w] is
∑i=1nαi⋅ti[x:=w]
for all term distributions t=∑i=1nαi⋅ti.
(The same observations hold for the operation v[x:=w]).
Moreover, the operation of pure substitution behaves well with the
linear extension of the syntactic constructs of the language
(cf. Appendix -D).
And we have the expected substitution lemma:
For all term distributions t and for all pure values v
and w,
provided x=y and x∈/FV(w)),
we have
t[x:=v][y:=w]:=t[y:=w][x:=v[y:=w]].
We extend the notation to parallel substitution in the usual manner
(cf. Remark .14 in Appendix -D).
From the operation of pure substitution [x:=w], we define an
operation of bilinear substitution⟨x:=w⟩ that is
defined for all term distributions
t=∑i=1nαi⋅ti and for all value
distributions w=∑j=1mβj⋅wj, letting
t⟨x:=w⟩:=∑j=1mβj⋅t[x:=wj]=∑i=1n∑j=1mαiβj⋅ti[x:=wj].
By construction, the generalized operation of substitution
t⟨x:=w⟩ is bilinear—which is consistent with the
bilinearity of application (Section II-C).
But beware! The bilinearity of the operation t⟨x:=w⟩
also makes its use often counter-intuitive, so that this notation
should always be used with the greatest caution.
Indeed, while inl(v)⟨x:=w⟩=inl(v⟨x:=w⟩),
(v1,v2)⟨x:=w⟩=(v1⟨x:=w⟩,v2⟨x:=w⟩).
Lemma .10, in Appendix -C gives the valid identities.
In addition, bilinear
substitution
is not
(completely) canceled when x∈/FV(t), in which case
t⟨x:=w⟩=ϖ(w)⋅t=t.
where ϖ(w):=∑j=1mβj is the weight of w
(cf Section II-B).
III Evaluation
The set of term distributions is equipped with a relation of
evaluationt≻≻t′ that is defined in three
steps as follows.
III-A Atomic evaluation
First we define an asymmetric relation of atomic evaluationt▹t′ (between a pure term t and a term distribution
t′) from the inference rules of
Table III.
These rules basically implement a deterministic call-by-value
strategy, where function arguments are evaluated from the right to the
left.
(The argument of an application is always evaluated before the
function666This design choice is completely arbitrary, and we could
have proceeded the other way around.).
Also notice that no reduction is ever performed in the body of an
abstraction, in the second argument of a sequence, in the body of a
let-construct, or in a branch of a match-construct.
Moreover, atomic evaluation is substitutive:
If t▹t′, then
t[x:=w]▹t′[x:=w] for all pure values w.
III-B One step evaluation
The relation of one step evaluationt≻t′
is defined as follows:
Definition III.1** (One step evaluation).**
Given two term distributions t and t′, we say
that tevaluates in one step to t′ and write
t≻t′ when there exist a scalar α∈C,
a pure term s and two term distributions s′ and
r such that
t=α⋅s+r,
t′=α⋅s′+r, and
s▹s′.
Notice that the relation of one step evaluation is also substitutive.
In addition, the strict determinism of the relation of atomic evaluation
t▹t′ implies that the relation of one step
evaluation fulfills the following weak diamond property:
Lemma III.2** (Weak diamond).**
If t≻t1′ and t≻t2′, then
one of the following holds: either t1′=t2′;
either t1′≻t2′ or
t2′≻t1′;
either t1′≻t′′ and
t2′≻t′′ for some t′′.∎
Remark III.3**.**
In the decomposition t=α⋅s+r of
Definition III.1, we allow that s∈dom(r).
So that for instance, we have the following. Let t:=(λx.x)y. Then,
[TABLE]
Remark III.4**.**
Given a pure term t, we write Yt:=(λx.t+xx)(λx.t+xx), so that we have Yt▹t+Yt by construction.
Then we observe that
for all α∈C, we have
[TABLE]
This example does not jeopardize the confluence of evaluation,
since we also have
[TABLE]
III-C Evaluation
Finally, the relation of evaluation t≻≻t′ is defined
as the reflexive-transitive closure of the relation of one step
evaluation t≻t′, that is: (≻≻):=(≻)∗.
Proposition III.5** (Linearity of evaluation).**
The relation t≻≻t′ is linear, in the sense that:
0≻≻0**
2. 2.
If t≻≻t′, then α⋅t≻≻α⋅t′ for all α∈C.
3. 3.
If t1≻≻t1′ and t2≻≻t2′, then t1+t2≻≻t1′+t2′.
∎
Example III.6**.**
In our calculus, the Hadamard operator H:C2→C2, whose matrix
is given by
Mat(H):=21(11+1−1),
is computed by the term
[TABLE]
Indeed, for all α,β∈C, we have
[TABLE]
Theorem III.7** (Confluence of evaluation).**
If t≻≻t1′ and t≻≻t2′, then there is a term distribution t′′ such that t1′≻≻t′′ and t2′≻≻t′′.
Proof.
Writing (≻?) the reflexive closure of (≻), it
is clear from Lemma III.2 that (≻?)
fulfills the diamond property.
Therefore, (≻≻)=(≻)∗=(≻?)+
fulfills the diamond property.
∎
III-D Normal forms
From what precedes, it is clear that the normal forms
of the relation of evaluation t≻≻t′ are the term
distributions of the form
t=∑i=1nαi⋅ti
where ti▹ for each i=1..n.
In particular, all value distributions v are normal forms (but
they are far from being the only normal forms in the calculus).
From the property of confluence, it is also clear that when a term
distribution t reaches a normal form t′, then this
normal form is unique.
In what follows, we shall be more particularly interested in the
closed term distributions t that reach a (unique) closed
value distribution v through the process of evaluation.
IV A semantic type system
In this section, we present the type system associated with the
(untyped) language presented in Section II as well as
the corresponding realizability semantics.
IV-A Structuring the space of value distributions
In what follows, we write:
Λ the set of all closed pure terms;
Λ the space of all closed term distributions;
V(⊆Λ) the set of all closed pure values,
which we shall call basis vectors;
and
V(⊆Λ)
the space of all closed value distributions, which we shall call
vectors.
The space V formed by all closed value distributions
(i.e. vectors) is equipped with the inner product
⟨v∣w⟩ and the pseudo-ℓ2-norm ∥v∥
that are defined by
[TABLE]
where v=∑i=1nαi⋅vi and
w=∑j=1mβj⋅wj (both in canonical form), and
where δvi,wj is the Kronecker delta such that it is 1 if
vi=wj and [math] otherwise. Let us observe that the inner product
behaves well with term constructors, so that e.g.
⟨inl(v1)∣inl(v2)⟩=⟨v1∣v2⟩, and that values built from distinct term
constructors are orthogonal, so that
e.g. ⟨inl(v1)∣inr(w2)⟩=0. We can also infer
that for all v,w∈V, we have
∥inl(v)∥=∥inr(v)∥=∥v∥ and ∥(v,w)∥=∥v∥∥w∥.
Most of the constructions we shall perform hereafter will take
place in the unit sphereS1⊆V, that is
defined by
S1:={v∈V:∥v∥=1}.
It is clear that for all
v,w∈S1, we have
inl(v)∈S1, inr(w)∈S1 and
(v,w)∈S1.
Given a set of vectors X⊆V, we also write
span(X) the span of X, defined by
\Bigl{\{}\sum_{i=1}^{n}\alpha_{i}\cdot\vec{v}_{i}~{}:~{}n\geq 0,~{}\alpha_{1},\ldots,\alpha_{n}\in\mathbb{C},~{}\vec{v}_{1},\ldots,\vec{v}_{n}\in X\Bigr{\}}\subseteq\vec{\mathrm{V}},
and ♭X the basis of X, defined by
⋃v∈Xdom(v)⊆V.
Note that by construction, span(X) is the smallest (weak)
sub-vector space of V such that X⊆span(X),
whereas ♭X is the smallest set of basis vectors such that
X⊆span(♭X).
IV-B The notion of unitary type
Definition IV.1** (Unitary types).**
A unitary type (or a type, for short) is defined
by a notationA, together with a set of unitary vectors
[[A]]⊆S1, called the unitary semantics of A.
Definition IV.2** (Realizability predicate).**
To each type A we associate a realizability predicatet⊩A (where t ranges over Λ) that is
defined by
t⊩A if and only if t≻≻v for some v∈[[A]].
The set or realizers of A, written {⊩A}, is then
defined by
{t∈Λ:t⊩A}, that is,
{t∈Λ:∃v∈[[A]],t≻≻v}.
Lemma IV.3**.**
For all types A, we have [[A]]={⊩A}∩V.∎
IV-C Judgments, inference rules and derivations
Definition IV.4** (Judgments).**
A judgment is a notation J expressing some assertion,
together with a criterion of validity, that defines whether
the judgment J is valid or not.
For instance, given any two types A and B, we can consider the
following two judgments:
•
The judgment A≤B (‘A is a subtype of B’), that is
valid when [[A]]⊆[[B]].
•
The judgment A≃B (‘A is equivalent to B’), that is
valid when [[A]]=[[B]].
(In Section V-A below, we shall also introduce a
typing judgment written Γ⊢t:A).
From the definition of both judgments A≤B and A≃B,
it is clear that the judgment A≃B is valid if and only if
both judgments A≤B and B≤A are valid.
Moreover:
Lemma IV.5**.**
Given any two types A and B:
A≤B* is valid if and only if
{⊩A}⊆{⊩B}.*
2. 2.
A≃B* is valid if and only if
{⊩A}={⊩B}.
∎*
More generally, we call an inference rule any pair formed by a
finite set of judgments J1,…,Jn, called the premises
of the rule, and a judgment J0, called the conclusion:
[TABLE]
We say that an inference rule J0J1⋯Jn is
valid when the joint validity of the premises J1,…,Jn
implies the validity of the conclusion J0.
As usual, inference rules can be assembled into derivations, and we
shall say that a derivation is valid when all the inference
rules that are used to build this derivation are valid.
It is clear that when all the premises of a valid derivation are
valid, then so is its conclusion.
In particular, when a judgment has a valid derivation without
premises, then this judgment is valid.
IV-D A simple algebra of types
In this section, we design a simple algebra of unitary types whose
notations (i.e. the syntax) are given in Table IV and
whose unitary semantics are given in Table V.
The choice we make in this paper follows from
the structure of the calculus: each set of standard
constructor/destructor canonically yields a type constructor: this
gives :
U, the unit type, that is inhabited by the sole
vector ∗ ;
A+B, the simple sum of A and B ;
A×B, the simple product of A and B;
A→B, the space of all pure functions mapping A
to B.
The next natural choice of type constructor is derived from the
existence of linear combinations of terms. First,
♭A is the basis of A, that is: the minimal set
of basis vectors that generate all vectors of type A by (weak)
linear combinations.
Note that in general, ♭A is not a subtype of A.
Then,
♯A is the unitary span of A, that is:
the type of all unitary vectors that can be formed as a (weak)
linear combination of vectors of type A.
Note that A is always a subtype of ♯A.
The last non-trivial type is A⇒B: the space of all unitary
function distributions mapping A to B. As lambda-terms are not
distributives over linear combinations, this type is distinct from
♯(A→B) (see next remark for a discussion). However,
by construction, A→B is always a subtype of A⇒B.
Finally, we provide some syntactic sugar: the type of Booleans, the
direct sum and the tensor product are defined by
B:=U+U, A⊕B:=♯(A+B), and
A⊗B:=♯(A×B).
The type ♯B=♯(U+U)=U⊕U
will be called the type of unitary Booleans. Notice that its
semantics is given by the definition
[[♯B]]=span({tt,ff})∩S1, that is, the set
\bigl{\{}\alpha\cdot\mathtt{t\!t}:|\alpha|=1\bigr{\}}\cup\bigl{\{}\beta\cdot\mathtt{f\!f}:|\beta|=1\bigr{\}}\cup\bigl{\{}\alpha\cdot\mathtt{t\!t}+\beta\cdot\mathtt{f\!f}:|\alpha|^{2}+|\beta|^{2}=1\bigr{\}}.
Remarks IV.6**.**
The type constructors ♭ and ♯ are monotonic and idempotent: ♭♭A≃♭A and ♯♯A≃♯A.
2. 2.
We always have the inclusion A≤♯A, but the inclusion ♭A≤A does not hold in general. For instance, given any type A, we easily check that \frac{3}{5}\cdot\bigl{(}\lambda x\,{.}\,\frac{5}{6}\cdot x\bigr{)}+\frac{4}{5}\cdot\bigl{(}\lambda x\,{.}\,\frac{5}{8}\cdot x\bigr{)}~{}\in~{}\llbracket A\Rightarrow A\rrbracket\,, so that (λx.65⋅x),(λx.85⋅x)∈♭[[A⇒A]]=[[♭(A⇒A)]]. On the other hand, it is also clear that (λx.65⋅x),(λx.85⋅x)∈/[[A⇒A]] (unless [[A]]=∅). Therefore, ♭(A⇒A)≤A⇒A.
3. 3.
We have the equivalence ♭♯A≃♭A, but only the
inclusion A≤♯♭A. More generally, the type constructor
♭ commutes with + and ×:
♭(A+B)≃♭A+♭B and ♭(A×B)≃♭A×♭B
but the type constructor ♯ does not, since we only have the inclusions
♯A+♯B≤♯(A+B) and
♯A×♯B≤♯(A×B)
4. 4.
The inclusions A⇒B≤♯(A⇒B) and ♯(A→B)≤♯(A⇒B) are strict in general
(unless the type A⇒B is empty).
As a matter of fact, the two types ♯(A→B) and
♯(A⇒B) have no interesting properties—for instance,
they are not subtypes of ♯A⇒♯B.
In practice, the type
constructor ♯ is only used on top of an algebraic
type, constructed using one of U, +, or ×.
IV-D1 Pure types and simple types
In what follows, we shall say that a type A is pure when its
unitary semantics only contains pure values, that is: when
[[A]]⊆V.
Equivalently, a type A is pure when the type equivalence
♭A≃A is valid (or when A≤♭B for some
type B).
We easily
check that:
Lemma IV.7**.**
For all types A and B:
The types U, ♭A and A→B are pure.
2. 2.
If A and B are pure, then so are
A+B and A×B.
3. 3.
♯A* and A⇒B are not pure, unless they are empty.
∎*
A particular case of pure types are the simple types, that are
syntactically defined from the following sub-grammar of the grammar of
Table IV:
[TABLE]
It is clear from Lemma IV.7 that all simple types are
pure types.
The converse is false, since the type ♯U→♯U is
pure, although it is not generated from the above grammar.
IV-D2 Pure arrow vs unitary arrow
The pure arrow A→B and the unitary arrow A⇒B only differ
in the shape of the functions which they contain: the pure arrow
A→B only contains pure abstractions whereas the unitary arrow
A⇒B contains arbitrary unitary distributions of abstractions
mapping values of type A to realizers of type B.
However, the functions that are captured by both sets
[[A→B]]⊆V and [[A⇒B]]⊆S1 are
extensionally the same:
Proposition IV.8**.**
For all unitary distributions of abstractions
\bigl{(}\sum_{i=1}^{n}\alpha_{i}\cdot\lambda x\,{.}\,\vec{t}_{i}\bigr{)}\in\mathcal{S}_{1},
one has:
[TABLE]
IV-E Representation of unitary operators
Recall that
the type of unitary Booleans is defined as
♯B=♯(U+U)=U⊕U,
so that for all closed term distributions t, we have
t⊩♯B iff
[TABLE]
We can observe that the unitary semantics of the type
♯B simultaneously contains the vectors α⋅tt and
α⋅tt+0⋅ff, that can be considered as “morally”
equivalent (although they are not according to the
congruence ≡).
To identify such vectors, it is convenient to introduce the
Boolean projectionπB:span({tt,ff})→C2 defined by
[TABLE]
for all α,β∈C.
By construction, the function
πB:span({tt,ff})→C2 is linear, surjective,
and neglects the difference between α⋅tt+0⋅ff and
α⋅tt (and between 0⋅tt+β⋅ff and
β⋅ff).
Moreover, the map πB:span({tt,ff})→C2
preserves the inner product, in the sense that
for all v,w∈span({tt,ff}), we have
[TABLE]
Definition IV.9**.**
We say that a closed term distribution trepresents a
function F:C2→C2 when for all
v∈span({tt,ff}), there exists
w∈span({tt,ff}) such that
[TABLE]
Remark IV.10**.**
From the bilinearity of application, it is clear that each function
F:C2→C2 that is represented by a closed term distribution is
necessarily linear.
Recall that an operator F:C2→C2 is unitary when it
preserves the inner product of C2, in the sense that
⟨F(u)∣F(v)⟩=⟨u∣v⟩ for all u,v∈C2.
Equivalently, an operator F:C2→C2 is unitary if and only if
∥F(1,0)∥C2=∥F(0,1)∥C2=1 and
⟨F(1,0)∣F(0,1)⟩C2=0.
The following propositions expresses that the types
♯B→♯B and ♯B⇒♯B capture unitary operators:
Proposition IV.11**.**
Given a closed λ-abstraction λx.t, we have
λx.t∈[[♯B→♯B]] if and
only if there are two value distributions
v1,v2∈[[♯B]] such that we have
t[x:=tt]≻≻v1,
t[x:=ff]≻≻v2 and
⟨v1∣v2⟩=0.∎
Theorem IV.12** **(Characterization of the values of type
♯B→♯B).
A closed λ-abstraction λx.t is a value of type
♯B→♯B if and only if it represents a unitary
operator F:C2→C2.∎
Corollary IV.13** **(Characterization of the values of type
♯B⇒♯B).
A unitary distribution of abstractions
\bigl{(}\sum_{i=1}^{n}\alpha_{i}\cdot\lambda x\,{.}\,\vec{t}_{i}\bigr{)}\in\mathcal{S}_{1} is
a value of type ♯B⇒♯B if and only if it
represents a unitary operator F:C2→C2.∎
V Typing Judgements
In Section IV, we introduced a simple type algebra
(Table IV) together with the corresponding unitary
semantics (Table V).
We also introduced the two judgments A≤B and A≃B.
Now, it is time to introduce the typing judgment
Γ⊢t:A together with the corresponding notion of
validity.
V-A Typing Rules
As usual, we call a typing context (or a context) any
finite function from the set of variables to the set of types.
Contexts Γ are traditionally written
Γ=x1:A1,…,xℓ:Aℓ
where {x1,…,xℓ}=dom(Γ) and where
Ai=Γ(xi) for all i=1..ℓ.
The empty context is written ∅, and the concatenation of
two contexts Γ and Δ such that
dom(Γ)∩dom(Δ)=∅ is defined by
Γ,Δ:=Γ∪Δ (that is: as the union of the
underlying functions).
Similarly, we call a substitution any finite function from
the set of variables to the set V of closed value
distributions.
Substitutions σ are traditionally written
σ={x1:=v1,…,xℓ:=vℓ}
where {x1,…,xℓ}=dom(σ) and where
vi=σ(xi) for all i=1..ℓ.
The empty substitution is written ∅, and the concatenation
of two substitutions σ and τ such that
dom(σ)∩dom(τ)=∅ is defined by
σ,τ:=σ∪τ (that is: as the union of the
underlying functions).
Given an open term distribution t and a substitution
σ={x1:=v1,…,xℓ:=vℓ}, we write
t⟨σ⟩:=t⟨x1:=v1⟩⋯⟨xℓ:=vℓ⟩.
Note that since the value distributions
v1,…,vℓ are closed, the order in
which the (closed) bilinear substitutions ⟨xi:=vi⟩
(i=1..ℓ) are applied to t is irrelevant.
Definition V.1** **(Unitary semantics of a typing
context).
Given a typing context Γ, we call the unitary
semantics of Γ and write [[Γ]] the set of
substitutions defined by
[TABLE]
Finally, we call the strict domain of a context Γ and
write dom♯(Γ) the set
[TABLE]
Intuitively, the elements of the set dom♯(Γ) are the variables
of the context Γ whose type is not a type of pure values.
As we shall see below, these variables are the variables that must
occur in all the term distributions that are well-typed in the
context Γ.
(This restriction is essential to ensure the validity of the
rule (UnitLam), Table VI).
Definition V.2** (Typing judgments).**
A typing judgment is a triple Γ⊢t:A
formed by a typing context Γ, a (possibly open) term
distribution t and a type A.
This judgment is valid when:
In the rule (PureLam), the notation
♭Γ≃Γ refers to the conjunction of
premises
♭A1≃A1&⋯&♭Aℓ≃Aℓ,
where A1,…,Aℓ are the types occurring in the
context Γ.
Remark V.5**.**
The proof of validity of the typing rule (UnitLam) crucially
relies on the fact that the body t of the abstraction
λx.t is a raw distribution (i.e. an expression
that is considered only up to α-conversion, and not ≡).
This is the reason why we endowed term distributions
(Section II-B) with the congruence ≡ that is
shallow, in the sense that it does not propagate in the bodies of
abstractions, in the bodies of let-constructs, or in the branches of
match-constructs.
V-B Simply-typed lambda-calculus
Recall that simple types (Section IV-D1) are
generated from the following sub-grammar of the grammar of
Table IV:
[TABLE]
By construction, all simple types A are pure types, in the sense
that ♭A≃A.
Since pure types allow the use of weakening and contraction, it is
a straightforward exercise to check that any typing judgment Γ⊢t:A that is derivable in the simply-typed
λ-calculus with sums and products is also derivable from
the typing rules of Table VI.
V-C Typing Church numerals
Let us recall that Church numerals nˉ are defined for all n∈N by
nˉ:=λf.λx.fnx.
From the typing rules of Table VI, we easily
derive that
⊢nˉ:(B→B)→(B→B)
(by simple typing) and even that
⊢nˉ:(♯B→♯B)→(♯B→♯B),
using the fact that ♯B→♯B is a pure type,
that is subject to arbitrary weakenings and contractions.
On the other hand, since we cannot use weakening or contraction for
the non pure type ♯B⇒♯B, we cannot derive the
judgments
⊢nˉ:(♯B⇒♯B)→(♯B⇒♯B) and
⊢nˉ:(♯B⇒♯B)⇒(♯B⇒♯B) but for n=1.
(cf. Fact .11 in Appendix -C).
V-D Orthogonality as a Typing Rule
The typing rules of Table VI allow us to derive
that the terms I:=λx.x, Ktt:=λx.tt,
Kff:=λx.ff and N:=λx.ifx{ff∣tt} have type
B→B; they even allow us to derive that I has type
♯B→♯B, but they do not allow us (yet) to derive
that the Boolean negation N or the Hadamard H have type
♯B→♯B.
For that, we need to introduce a new form of judgment:
orthogonality judgments.
Definition V.6** (Orthogonality judgments).**
An orthogonality judgment is a sextuple
[TABLE]
formed by three typing contexts Γ, Δ1 and Δ2,
two (possibly open) term distributions t1, t2 and
a type A.
This judgment is valid when:
both judgments Γ,Δ1⊢t1:A and
Γ,Δ2⊢t2:A are valid; and
2. 2.
for all σ∈[[Γ]],
σ1∈[[Δ1]] and
σ2∈[[Δ2]], if
t1⟨σ,σ1⟩≻≻v1 and
t2⟨σ,σ2⟩≻≻v2,
then ⟨v1∣v2⟩=0.
When both contexts Δ1 and Δ2 are empty, the
orthogonality judgment
Γ⊢(Δ1⊢t1)⊥(Δ2⊢t2):A is
simply written Γ⊢t1⊥t2:A.
With this definition, we can prove a new typing rule, which can be used to type Hadamard:
We have ⊢tt⊥ff:B.
Consider the terms ∣+⟩=21⋅tt+21⋅ff and ∣−⟩=21⋅tt+(−21)⋅ff. Then we can prove that
⊢∣+⟩⊥∣−⟩:♯B.
We can also prove that
[TABLE]
Using this fact,
and the rule (UnitaryMatch) from Proposition V.7, we can
derive the type ♯B→♯B for the Hadamard gate H defined in Example III.6.
Recall that ♯B=♯(U+U)=U⊕U.
VI Unifying Model of Classical and Quantum Control
We showed in Section V-B that the unitary linear
algebraic lambda calculus strictly contains the simply-typed lambda
calculus. With Theorem IV.12 and
Corollary IV.13 we expressed how the “only” valid
functions were unitary maps, and in Section V-D we
hinted at how to type orthogonality with the model.
This section is devoted to showing how the model can be used as a
model for quantum computation, with the model providing an
operational semantics to a high-level operation on circuits: the
control of a circuit.
VI-A A Quantum Lambda-Calculus
The language we consider, called λQ, is a circuit-description
language similar to QWIRE [6] or
Proto-Quipper [26].
Formally, the types of λQ are defined from the following grammar:
[TABLE]
The types denoted by A, B are the usual simple types, which we
call classical types.
(Note that they contain a type bit of classical bits, that
corresponds to the type U+U in our model.)
The types denoted by AQ, BQ are the quantum types; they
basically consist in tensor products of the type qbit of quantum
bits.
As the former types are duplicable while the latter are
non-duplicable, we define a special (classical) function-type
AQ⊸BQ between quantum types.
The term syntax for λQ is defined from the following grammar:
[TABLE]
The first two lines of the definition describe the usual constructions
of the simply-typed lambda calculus with (ordinary) pairs.
The last two lines adds the quantum specificities: a tensor for dealing
with systems of several quantum bits (together with the corresponding
destructor), an operator new to create a new quantum bit, and a
family of operators U(t) to apply a given unitary operator on t.
We also provide a special lambda abstraction λQ to make a
closure out of a quantum computation, as well as a special application
to apply such a closure.
Note that for simplicity, we only consider unary quantum
operators—that is: operators on the type qbit—, but this can
be easily extended to quantum operators acting on tensor products of
the form qbit⊗n.
Also note that we do not consider measurements, for our realizability
model does not natively support it.
The language λQ features two kinds of typing judgments:
a classical judgmentΔ⊢Ct:A, where Δ is a
typing context of classical types and where A is a classical type,
and a quantum judgmentΔ∣Γ⊢Qt:AQ,
where Δ is a typing context of classical types, Γ a
typing context of quantum types, and where AQ is a quantum type.
An empty typing context is always denoted by ∅.
As usual, we write Γ,Δ for Γ∪Δ (when
Γ∩Δ=∅), and we use the notation
FV(t):qbit to represent the quantum context
x1:qbit,…,xn:qbit made up of the finite set
FV(t)={x1,…,xn}.
The typing rules for classical judgements are standard and are given in the Appendix -D.
Rules for quantum judgements are given in the Table VII. The last three rules allows to navigate between
classical and quantum judgments.
Note that in the above rules, classical variables (declared in the
Δ’s) can be freely duplicated whereas quantum variables
(declared in the Γ’s) cannot.
Also note that in λQ, pure quantum computations are
essentially first-order.
The first of the last three rules makes a qbit out of a bit, the second rule makes a
closure out of a quantum computation, while the third rule opens a
closure containing a quantum computation.
These last two operations give a hint of higher-order to quantum
computations in λQ.
A value is a term belonging to the grammar:
[TABLE]
The language λQ is equipped with the standard operational
semantics presented in [27]: the quantum
environment is separated from the term, in the spirit of the QRAM
model of [4].
Formally, a program is defined as a triplet [Q,L,t] where t
is a term, L is a bijection from FV(t) to {1,…,n} and Q
is an n-quantum bit system: a normalized vector in the
2n-dimensional vector space (C2)⊗n.
We say that a program [Q,L,t] is well-typed of type
AQ when the judgment ∅∣FV(t):qbit⊢Qt:AQ
is derivable.
In particular, well-typed programs correspond to quantum
typing judgements, closed with respect to classically-typed
term-variables.
The operational semantics is call-by-value and relies on applicative
contexts, that are defined as follows:
[TABLE]
The operational semantics of the calculus is formally defined from the
rules given in Table VIII.
The language λQ satisfies the usual safety properties,
proved as in [27].
Theorem VI.1** (Safety properties).**
If [Q,L,t]:AQ and [Q,L,t]→[Q′,L′,r], then
[Q′,L′,r]:AQ. Moreover, whenever a program [Q,L,t] is well-typed,
either t is already a value or it reduces to some other program.
∎
VI-B Modelling λQ
The realizability model based on the unitary linear-algebraic
lambda-calculus is a model for the quantum lambda-calculus
λQ. We write \llparenthesist\rrparenthesis for the translation of a term of
λQ into its model. The model can indeed not only accomodate
classical features, using pure terms, but also quantum states, using
linear combinations of terms.
We map qbit to ♯B and bit to B. This makes
bit a subtype of qbit: the model captures the intuition
that booleans are “pure” quantum bits. Classical arrows → are
mapped to → and classical product × is mapped to the
product of the model, in the spirit of the encoding of simply-typed
lambda-calculus. Finally, the tensor of λQ is mapped to the
tensor of the model.
The interesting type is AQ⊸BQ. We need this type to be
both classical and capture the fact that a term of this type is
a pure quantum computation from AQ to BQ, that is, a unitary
map. The encoding we propose consists in using “thunk”, as proposed
by [28].
Formally, the translation of types is as follows:
\llparenthesisbit\rrparenthesis=B,
\llparenthesisA×B\rrparenthesis=\llparenthesisA\rrparenthesis×\llparenthesisB\rrparenthesis,
\llparenthesisA→B\rrparenthesis=\llparenthesisA\rrparenthesis→\llparenthesisB\rrparenthesis,
\llparenthesisAQ⊸BQ\rrparenthesis=U→(\llparenthesisAQ\rrparenthesis⇒\llparenthesisBQ\rrparenthesis),
\llparenthesisqbit\rrparenthesis=♯B,
\llparenthesisAQ⊗BQ\rrparenthesis=\llparenthesisAQ\rrparenthesis⊗\llparenthesisBQ\rrparenthesis=♯(\llparenthesisAQ\rrparenthesis×\llparenthesisBQ\rrparenthesis), and
\llparenthesisU\rrparenthesis=U.
Lemma VI.2**.**
For all classical types A, ♭\llparenthesisA\rrparenthesis≃\llparenthesisA\rrparenthesis.∎
Lemma VI.3**.**
For all qbit types AQ, ♯\llparenthesisAQ\rrparenthesis≃\llparenthesisAQ\rrparenthesis.∎
The classical structural term constructs of λQ are translated
literally: \llparenthesisx\rrparenthesis=x, \llparenthesis∗\rrparenthesis=∗,
\llparenthesisλx.t\rrparenthesis=λx.\llparenthesist\rrparenthesis, \llparenthesistr\rrparenthesis=\llparenthesist\rrparenthesis\llparenthesisr\rrparenthesis,
\llparenthesis(t,r)\rrparenthesis=(\llparenthesist\rrparenthesis,\llparenthesisr\rrparenthesis),
\llparenthesisift{r∣s}\rrparenthesis=match\llparenthesist\rrparenthesis{inl(z1)↦z1;\llparenthesisr\rrparenthesis∣inr(z2)↦z2;\llparenthesiss\rrparenthesis} with
z1 and z2 fresh variables,
\llparenthesistt\rrparenthesis=inl(∗), \llparenthesisff\rrparenthesis=inr(∗),
\llparenthesisπi(t)\rrparenthesis=let(x1,x2)=\llparenthesist\rrparenthesisinxi.
Finally, the term constructs related to quantum bits make use of the algebraic aspect of
the language. First, new is simply the identity, since
booleans are subtypes of quantum bits:
\llparenthesisnew(t)\rrparenthesis=\llparenthesist\rrparenthesis. Then, the translation of the unitary
operators is done with the construction already encountered in
e.g. Example III.6: \llparenthesisU(t)\rrparenthesis=Uˉ\llparenthesist\rrparenthesis where Uˉ is
defined as follows. If U=(acbd), then
Uˉ=λx.matchx{inl(x1)↦a⋅inl(x1)+c⋅inr(x1)∣inr(x2)↦b⋅inl(x2)+d⋅inr(x2)}.
Then, the tensor is defined with the pairing construct, which is
distributive:
\llparenthesist⊗r\rrparenthesis=(\llparenthesist\rrparenthesis,\llparenthesisr\rrparenthesis) and \llparenthesisletx⊗y=sint\rrparenthesis=let(x,y)=\llparenthesiss\rrparenthesisin\llparenthesist\rrparenthesis.
Finally, the quantum closure and applications are defined by
remembering the use of the thunk: \llparenthesisλQx.t\rrparenthesis=λzx.\llparenthesist\rrparenthesis, where z is a fresh variable, and \llparenthesist\MVAtr\rrparenthesis=(\llparenthesist\rrparenthesis∗)\llparenthesisr\rrparenthesis: one first “open” the thunk before applying
the function.
We also define the translation of typing contexts as follows:
if Γ={xi:Ai}i, we write \llparenthesisΓ\rrparenthesis for
{xi:\llparenthesisAi\rrparenthesis}i, and we write \llparenthesisΔ∣Γ\rrparenthesis for \llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis.
Finally, a program is translated as follows:
\llparenthesis[∑i=1mαi.∣y1i,…,yni⟩,{x1:=p(1),…,xn:=p(n)},t]\rrparenthesis=∑i=1mαi⋅\llparenthesist\rrparenthesis[x1:=yˉp(1)i,…,xn:=yˉp(n)i]
where p is a permutation of n and 0ˉ=tt and 1ˉ=ff.
Example VI.4**.**
Let P be the program
[α∣00⟩+β∣11⟩,{x:=1,y:=2},(x⊗y)]. It consists on
a pair of the two quantum bits given in the quantum context on the
first component of the triple. The translation of this program is as
follows.
\llparenthesisP\rrparenthesis=α⋅(x,y)[x:=tt,y:=tt]+β⋅(x,y)[x:=ff,y:=ff]=α⋅(tt,tt)+β⋅(ff,ff).
The translation is compatible with typing and rewriting. This is to be
put in reflection with Theorem IV.12: not only the realizability
model captures unitarity, but it is expressive enough to comprehend
a higher-order quantum programming language.
Theorem VI.5**.**
Translation preserves typeability:
If Γ⊢Qt:AQ then \llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisAQ\rrparenthesis.
2. 2.
If Δ∣Γ⊢Ct:A then \llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisA\rrparenthesis.
3. 3.
If [Q,L,t]:A then ⊢\llparenthesis[Q,L,t]\rrparenthesis:\llparenthesisA\rrparenthesis.∎
Theorem VI.6** (Adequacy).**
If [Q,L,t]→[Q′,L′,r], then \llparenthesis[Q,L,t]\rrparenthesis≻≻\llparenthesis[Q′,L′,r]\rrparenthesis.
∎
VI-C A Circuit-Description Language
Quantum algorithms do not only manipulate quantum bits: they also
manipulate circuits. A quantum circuit is a sequence of
elementary operations that are buffered before being sent to the
quantum memory. If one can construct a quantum circuit by
concatenating elementary operations, several high-level operations on
circuits are allowed for describing quantum algorithms: repetition,
control (discussed in Section VI-D), inversion, etc.
In recent years, several quantum programming languages have been
designed to allow the manipulation of circuits: Quipper [5]
and its variant ProtoQuipper [26], QWIRE [6],
etc. These languages share a special function-type
Circ(A,B) standing for the type of circuits from wires of type
A to wires of type B. Two built-in constructors are used to go
back and forth between circuits and functions acting on quantum bits:
•
box:(AQ⊸BQ)→Circ(AQ,BQ). Its operational
semantics is to evaluate the input function on a phantom element of
type A, collect the list of elementary quantum operations to be
performed and store them in the output circuit.
•
unbox:Circ(AQ,BQ)→(AQ⊸BQ). This operator is the
dual: it takes a circuit — a list of elementary operations — and
return a concrete function.
The advantage of distinguishing between functions and circuits is that
a circuit is a concrete object: it is literally a list of operations
that can be acted upon. A function is a suspended computation: it
is a priori not possible to inspect its body.
The language λQ does not technically possess a type
constructor for circuits: the typing construct ⊸ is really a
lambda-abstraction. However, it is very close to being a circuit: one
could easily add a typing construct Circ in the classical type
fragment and implement operators box and unbox, taking
inspiration for the operational semantics on what has been done
by [26] for ProtoQuipper.
How would this be reflected in the realizability model? We claim that
the translation of the type Circ(AQ,BQ) can be taken to be the
same as the translation of AQ⊸BQ, the operator box
and unbox simply being the identity. The realizability model is
then rich enough to express several high-level operations on circuits:
this permits to extend the language λQ. The fact that the
model “preserves unitarity” (Theorem IV.12) ensuring
the soundness of the added
constructions.
In what follows, by abuse of notation, we identify
Circ(AQ,BQ) and AQ⊸BQ.
VI-D Control Operator
Suppose that we are given a closed term t of λQ with type
qbit⊸qbit. This function corresponds to a unitary
matrix U=(acbd), sending
∣0⟩ to a∣0⟩+c∣1⟩ and ∣1⟩ to b∣0⟩+d∣1⟩. We
might want to write ctl(t) of type
(qbit⊗qbit)⊸(qbit⊗qbit)
behaving as the control of U, whose behavior is to send
∣0⟩⊗ϕ to ∣0⟩⊗ϕ and ∣1⟩⊗ϕ to
∣1⟩⊗(Uϕ): if the first input quantum bit is in state
∣0⟩, control-U acts as the identity. If the first input quantum bit is in
state ∣1⟩, control-U performs U on the second quantum bit.
This is really a “quantum test” [29]. It has been formalized
in the context of linear algebraic lambda-calculi by [1]. It
can be ported to the unitary linear algebraic lambda-calculus as follows:
[TABLE]
and ctl can be given the type
[TABLE]
Note how the definition is very semantical: the control operation is
literally defined as a test on the first quantum bit.
We can then add an opaque term construct ctl(s) to λQ
with typing rule
[TABLE]
The translation of this new term construct is then
\llparenthesisctl(t)\rrparenthesis=λz.(ctl(\llparenthesist\rrparenthesis∗))
with z a fresh variable, and Theorem VI.6 still holds.
VII Conclusions
In this paper we have presented a language based on
Lineal [1, 2]. Then, we have given a set of
unitary types and proposed a realizability semantics associating terms and
types.
The main result of this paper can be pinpointed to
Theorem IV.12 and Corollary IV.13, which,
together with normalization, progress, and subject reduction of the calculus
(which are axiomatic properties in realizability models), imply that every term
of type ♯B→♯B represent a unitary operator. In addition, the
Definition V.6 of orthogonal judgements led to
Proposition V.7 proving rule (UnitaryMatch). Indeed, one of
the main historic drawbacks for considering a calculus with quantum control has
been to define the notion of orthogonality needed to encode unitary gates (cf.,
for example, [29]).
Finally, as an example to show the expressiveness of the language, we have
introduced λQ and showed that the calculus presented in this paper can
be considered as a denotational semantics of it.
Let scalars α1,α2∈C, pure terms t1, t2 and
term distributions s1, s2 such that
α1⋅t1+s1≡α2⋅t2+s2.
If t1=t2=t and α1=α2, then: s1≡s2 or s1≡s2+0⋅t or s2≡s1+0⋅t.
2. 2.
If t1=t2=t but α1=α2, then: s1≡s2+(α2−α1)⋅t or s2≡s1+(α1−α2)⋅t.
3. 3.
If t1=t2, then: s1≡s3+α2⋅t2 and s2≡s3+α1⋅t1 for some distribution s3.
(All the above disjunctions are inclusive).
∎
Lemma III.2 (Weak diamond). *
if t≻t1′ and t≻t2′, then
one of the following holds: either t1′=t2′;
either t1′≻t2′ or
t2′≻t1′;
either t1′≻t′′ and
t2′≻t′′ for some t′′.
*
Case where s1=s2=s and α1=α2=α. In this case, we have s′1=s′2=s′ since
atomic evaluation is deterministic.
And by Lemma .1 (1), we deduce that:
–
Either r1=r2, so that: t1′=α⋅s′+r1=α⋅s′+r2=t2′.
–
Either r1=r2+0⋅s, so that:
[TABLE]
–
Either r2=r1+0⋅s, so that:
[TABLE]
•
Case where s1=s2=s, but α1=α2. In this case, we have s′1=s′2=s′ since
atomic evaluation is deterministic.
And by Lemma .1 (2), we deduce that:
–
Either r1=r2+(α2−α1)⋅s,
so that:
[TABLE]
–
Either r2=r1+(α1−α2)⋅s,
so that:
[TABLE]
•
Case where s1=s2. In this case, we know by Lemma .1 (3) that
r1=r3+α2⋅s2 and
r2=r3+α1⋅s1 for some r3.
Writing
t′′=α1⋅s′1+α2⋅s′2+r3,
we conclude that
For all value distributions v1,v2,w1,w2,
we have:
[TABLE]
Proof.
Let us write
v1=∑i1=1n1α1,i1⋅v1,i1,
v2=∑i2=1n2α2,i2⋅v2,i1,
w1=∑j1=1m1β1,j1⋅w1,j1 and
w2=∑j2=1m2β2,j2⋅w2,j1 (all
in canonical form).
Writing δv,v′=1 when v=v′ and δv,v′=0 when
v=v′ (Kronecker symbol), we observe that:
The inclusion [[A]]⊆{⊩A}∩V is clear from
the definition of {⊩A}.
Conversely, suppose that v∈{⊩A}∩V.
From the definition of the set {⊩A}, we know that
v≻≻v′ for some v′∈[[A]].
But since v is a normal form, we deduce that
v=v′∈[[A]].
∎
The direct implications are obvious from the definition of
{⊩A}, and the converse implications immediately follow from
Lemma IV.3.
∎
Proposition IV.11. *
Given a closed λ-abstraction λx.t, we have
λx.t∈[[♯B→♯B]] if and
only if there are two value distributions
v1,v2∈[[♯B]] such that*
[TABLE]
Proof.
The condition is necessary. Suppose that λx.t∈[[♯B→♯B]].
Since tt,ff∈[[♯B]], there are
v1,v2∈[[♯B]] such that
t[x:=tt]≻≻v1 and
t[x:=ff]≻≻v2.
It remains to prove that ⟨v1∣v2⟩=0.
For that, consider α,β∈C such that
∣α∣2+∣β∣2=1.
By linearity, we observe that
[TABLE]
But since α⋅tt+β⋅ff∈[[♯B]],
we must have
α⋅v1+β⋅v2∈[[♯B]] too,
and in particular ∥α⋅v1+β⋅v2∥=1.
From this, we get
[TABLE]
and thus
Re(αˉβ⟨v1∣v2⟩)=0.
Taking α=β=21, we deduce that
Re(⟨v1∣v2⟩)=0.
And taking α=i21 and β=21, we deduce that
Im(⟨v1∣v2⟩)=0.
Therefore: ⟨v1∣v2⟩=0.
The condition is sufficient. Suppose that there are v1,v2∈[[♯B]]
such that t[x:=tt]≻≻v1,
t[x:=ff]≻≻v2 and
⟨v1∣v2⟩=0.
In particular, we have v1,v2∈span({tt,ff})
and ∥v1∥=∥v2∥=1.
Now, given any v∈[[♯B]], we distinguish three
cases:
•
Either v=α⋅tt, where ∣α∣=1. In this case, we observe that
[TABLE]
since α⋅v1∈span({tt,ff})
and ∥α⋅v1∥=∣α∣∥v1∥=1.
•
Either v=β⋅ff, where ∣β∣=1. In this case, we observe that
[TABLE]
since β⋅v2∈span({tt,ff})
and ∥β⋅v2∥=∣β∣∥v2∥=1.
•
Either v=α⋅tt+β⋅ff,
where ∣α∣2+∣β∣2=1. In this case, we observe that
[TABLE]
since α⋅v1+β⋅v2∈span({tt,ff}) and
[TABLE]
We have thus shown that t⟨x:=v⟩⊩♯B
for all v∈[[♯B]].
Therefore λx.t∈[[♯B→♯B]].
∎
Theorem IV.12 (Characterization of the values of type ♯B→♯B). *
A closed λ-abstraction λx.t is a value of type
♯B→♯B if and only if it represents a unitary
operator F:C2→C2.
*
Proof.
The condition is necessary. Suppose that λx.t∈[[♯B→♯B]].
From Prop. IV.11, there are
v1,v2∈[[♯B]] such that
t[x:=tt]≻≻v1,
t[x:=ff]≻≻v2 and
⟨v1∣v2⟩=0.
Let F:C2→C2 be the operator defined by
F(1,0)=πB(v1) and
F(0,1)=πB(v2).
From the properties of linearity of the calculus, it is clear that
the abstraction λx.t represents the operator
F:C2→C2.
Moreover, the operator F is unitary since
∥πB(v1)∥C2=∥πB(v2)∥C2=1
and ⟨πB(v1)∣πB(v2)⟩C2=0.
The condition is sufficient. Let us assume that the abstraction λx.t represents a
unitary operator F:C2→C2.
From this, we deduce that:
•
(λx.t)tt≻≻v1 for some
v1∈span({tt,ff}) such that
πB(v1)=F(πB(tt))=F(1,0);
•
(λx.t)ff≻≻v2 for some
v2∈span({tt,ff}) such that
πB(v2)=F(πB(ff))=F(0,1).
Using the property of confluence, we deduce that
•
t[x:=tt]≻≻v1∈[[♯B]],
since ∥v1∥=∥F(1,0)∥C2=1;
•
t[x:=ff]≻≻v2∈[[♯B]],
since ∥v2∥=∥F(0,1)∥C2=1.
We deduce that
λx.t∈[[♯B→♯B]] by
Prop. IV.11, since
⟨v1∣v2⟩=⟨F(1,0)∣F(0,1)⟩C2=0.
∎
Corollary IV.13 (Characterization of the values of type ♯B⇒♯B). *
A unitary distribution of abstractions
\bigl{(}\sum_{i=1}^{n}\alpha_{i}\cdot\lambda x\,{.}\,\vec{t}_{i}\bigr{)}\in\mathcal{S}_{1} is
a value of type ♯B⇒♯B if and only if it
represents a unitary operator F:C2→C2.
*
Proof.
Indeed, given
\bigl{(}\sum_{i=1}^{n}\alpha_{i}\cdot\lambda x\,{.}\,\vec{t}_{i}\bigr{)}\in\mathcal{S}_{1},
we have
[TABLE]
since both functions ∑i=1nαi⋅λx.ti
and \lambda x\,{.}\,\bigl{(}\sum_{i=1}^{n}\alpha_{i}\cdot\vec{t}_{i}\,\bigr{)}
are extensionally equivalent.
∎
Lemma .3**.**
For all term distributions t, t′, s,
s1, s2 and for all value distributions
v and w:
If t≻≻t′, then let(x1,x2)=tins≻≻let(x1,x2)=t′ins
9. 9.
If t≻≻t′, then \begin{array}[t]{@{}l@{}}\texttt{match}~{}\vec{t}~{}\{\texttt{inl}(x_{1})\mapsto\vec{s}_{1}~{}|~{}\texttt{inr}(x_{2})\mapsto\vec{s}_{2}\}~{}\mathrel{{\succ}\mskip-6.0mu{\succ}}{}\\
\qquad\texttt{match}~{}\vec{t}^{\prime}~{}\{\texttt{inl}(x_{1})\mapsto\vec{s}_{1}~{}|~{}\texttt{inr}(x_{2})\mapsto\vec{s}_{2}\}\\
\end{array}
10. 10.
If t≻≻t′, then t⟨x:=v⟩≻≻t′⟨x:=v⟩.
Proof.
(1) Assume that v=∑i=1nαi⋅vi.
Then we observe that
[TABLE]
(2) Assume that v=∑i=1nαi⋅vi and
w=∑j=1mβj⋅wj.
Then we observe that
[TABLE]
Items (3) and (4) are proved similarly as item (2).
Then, items (5), (6), (7), (8), (9) and (10) are all proved
following the same pattern, first treating the case where
t≻t′ (one step), and then deducing the general
case by induction on the number of evaluation steps.
Let us prove for instance (5), first assuming that
t≻t′ (one step).
This means that there exist a scalar α∈R, a pure
term t0 and term distributions t0′ and r such
that
[TABLE]
So that for all term distributions
s=∑i=1nβi⋅si, we have:
[TABLE]
observing that sit0▹sit0′, hence αβi⋅sit0+βi⋅sir≻αβi⋅sit0′+βi⋅sir for all i=1..n.
Hence we proved that t≻t′ implies
st≻≻st′.
By a straightforward induction on the number of evaluation steps, we
deduce that t≻≻t′ implies
st≻≻st′.
∎
Lemma .4** (Application of realizers).**
If s⊩A⇒B and t⊩A,
then st⊩B∎
Proof.
Since t⊩A, we have t≻≻v for some
vector v∈[[A]].
And since s⊩A⇒B, we have
s≻≻∑i=1nαi⋅λx.si
for some unitary distribution of abstractions
∑i=1nαi⋅λx.si∈[[A⇒B]].
Therefore, we get
[TABLE]
from Lemma .3 (5), (6), (1) and from the
definition of [[A⇒B]].
∎
Given a type A, two vectors
u1,u2∈[[♯A]] and a scalar α∈C,
there exists a vector u0∈[[♯A]] and a scalar
λ∈C such that
u1+α⋅u2=λ⋅u0.
Proof.
Let λ:=∥u1+α⋅u2∥.
When λ=0, we take
u0:=λ1⋅(u1+α⋅u2)∈[[♯A]],
and we are done.
Let us now consider the (subtle) case where λ=0.
In this case, we first observe that α=0, since
α=0 would imply that
∥u1+α⋅u2∥=∥u1∥=0, which would be
absurd, since ∥u1∥=1.
Moreover, since λ=∥u1+α⋅u2∥=0,
we observe that all the coefficients of the distribution
u1+α⋅u2 are zeros (when written in
canonical form), which implies that
[TABLE]
Using the triangular inequality, we also observe that
[TABLE]
hence λ′:=∥u1+(−α)⋅u2∥=0.
Taking
u0:=λ′1⋅(u1+(−α)⋅u2)∈[[♯A]],
we easily see that
[TABLE]
Proposition .6** (Polarisation identity).**
For all value distributions v and w, we have:
[TABLE]
Lemma .7**.**
Given a valid typing judgment of the form Δ,x:♯A⊢s:C, a substitution σ∈[[Δ]], and
value distributions u1,u2∈[[♯A]],
there are value distributions
w1,w2∈[[C]] such that
[TABLE]
Proof.
From the validity of the judgment Δ,x:♯A⊢s:C, we know that there are w1,w2∈[[C]] such that
s⟨σ,x:=u1⟩≻≻w1 and
s⟨σ,x:=u2⟩≻≻w2.
In particular, we have ∥w1∥=∥w2∥=1.
Now applying Lemma .5 four times, we know that
there are vectors
u0,1,u0,2,u0,3,u0,4∈[[♯A]]
and scalars λ1,λ2,λ3,λ4∈C such that
[TABLE]
From the validity of the judgment Δ,x:♯A⊢s:C, we also know that there are value distributions
w0,1,w0,2,w0,3,w0,4∈[[C]]
such that s⟨σ,x:=u0,j⟩≻≻w0,j
for all j=1..4.
Combining the linearity of evaluation with the uniqueness of normal
forms, we deduce from what precedes that
[TABLE]
Using the polarization identity (Prop. .6), we conclude that:
[TABLE]
Lemma .8**.**
Given a valid typing judgment of the form Δ,x:♯A,y:♯B⊢s:C, a substitution σ∈[[Δ]], and
value distributions u1,u2∈[[♯A]]
and v1,v2∈[[♯B]] such that
⟨u1∣u2⟩=⟨v1∣v2⟩=0,
there are value distributions
w1,w2∈[[C]] such that
[TABLE]
Proof.
From Lemma .5, we know that there are
u0∈[[♯A]],
v0∈[[♯B]] and λ,μ∈C such that
[TABLE]
For all j,k∈{0,1,2}, we have
σ,x:=uj,y:=vk∈[[Δ,x:♯A,y:♯B]], hence there is
wj,k∈[[C]] such that
s⟨σ,x:=uj,y:=vk⟩≻≻wj,k.
In particular, we can take w1:=w1,1 and
w2:=w2,2.
Now, we observe that
u1+λ⋅u0=u1+u2+(−1)⋅u1=u2+0⋅u1,
so that from the linearity of substitution, the linearity of
evaluation and from the uniqueness of normal forms, we get
as well as \begin{array}[b]{r@{~{}~}c@{~{}~}l}\vec{w}_{1,k}+\lambda\cdot\vec{w}_{0,k}~{}{}&=\hfil~{}{}&\vec{w}_{2,k}+0\cdot\vec{w}_{1,k}\\
\vec{w}_{2,k}+(-\lambda)\cdot\vec{w}_{0,k}~{}{}&=\hfil~{}{}&\vec{w}_{1,k}+0\cdot\vec{w}_{2,k}\\
\end{array} (for all k∈{0,1,2})
2. 2.
v1+μ⋅v0=v1+v2+(−1)⋅v1=v2+0⋅v1,
so that from the linearity of substitution, the linearity of
evaluation and from the uniqueness of normal forms, we get
as well as \begin{array}[b]{r@{~{}~}c@{~{}~}l}\vec{w}_{j,1}+\mu\cdot\vec{w}_{j,0}~{}{}&=\hfil~{}{}&\vec{w}_{j,2}+0\cdot\vec{w}_{j,1}\\
\vec{w}_{j,2}+(-\mu)\cdot\vec{w}_{j,0}~{}{}&=\hfil~{}{}&\vec{w}_{j,1}+0\cdot\vec{w}_{j,2}\\
\end{array} (for all j∈{0,1,2})
3. 3.
⟨u1∣u2⟩=0, so that from
Lemma .7 we get ⟨w1,k∣w2,k⟩=0 (for all k∈{0,1,2})
4. 4.
⟨v1∣v2⟩=0, so that from
Lemma .7 we get ⟨wj,1∣wj,2⟩=0 (for all j∈{0,1,2})
From the above, we get:
[TABLE]
Hence
⟨w1∣w2⟩=⟨w1,1∣w2,2⟩=−⟨w2,1∣w1,2⟩.
Exchanging the indices j and k in the above reasoning,
we also get
⟨w1∣w2⟩=⟨w1,1∣w2,2⟩=−⟨w1,2∣w2,1⟩,
so that we have
⟨w1∣w2⟩=−⟨w2,1∣w1,2⟩=−⟨w2,1∣w1,2⟩∈R.
If we now replace u2∈[[♯A]] with
iu2∈[[♯A]], the very same technique allows us
to prove that
i⟨w1∣w2⟩=⟨w1∣iw2⟩∈R.
Therefore ⟨w1∣w2⟩=0.
∎
Lemma .9**.**
Given a valid typing judgment of the form Δ,x:♯A,y:♯B⊢s:C, a substitution σ∈[[Δ]], and
value distributions u1,u2∈[[♯A]]
and v1,v2∈[[♯B]],
there are value distributions
w1,w2∈[[C]] such that
[TABLE]
Proof.
Let α=⟨u1∣u2⟩ and
β=⟨v1∣v2⟩.
We observe that
[TABLE]
and, similarly, that
⟨v1∣v2+(−β)⋅v1⟩=0.
From Lemma .5, we know that there are
u0∈[[♯A]],
v0∈[[♯B]] and λ,μ∈C such that
[TABLE]
For all j,k∈{0,1,2}, we have
σ,x:=uj,y:=vk∈[[Δ,x:♯A,y:♯B]], hence there is
wj,k∈[[C]] such that
s⟨σ,x:=uj,y:=vk⟩≻≻wj,k.
In particular, we can take w1:=w1,1 and
w2:=w2,2.
Now, we observe that
λ⋅u0+α⋅u1=u2+(−α)⋅u1+α⋅u1=u2+0⋅u1,
so that from the linearity of substitution, the linearity of
evaluation and from the uniqueness of normal forms, we get
[TABLE]
2. 2.
μ⋅v0+β⋅v1=v2+(−β)⋅v1+β⋅v1=v2+0⋅v1,
so that from the linearity of substitution, the linearity of
evaluation and from the uniqueness of normal forms, we get
[TABLE]
3. 3.
⟨u1∣λ⋅u0⟩=⟨u1∣u2+(−α)⋅u1⟩=0,
so that from Lemma .7 we get
[TABLE]
(The equality ⟨w1,k∣λ⋅w0,k⟩=0
is trivial when λ=0, and when λ=0, we deduce
from the above that ⟨u1∣u0⟩=0, from which we
get ⟨w1,k∣w0,k⟩=0 by
Lemma .7.)
4. 4.
⟨v1∣μ⋅v0⟩=⟨v1∣v2+(−β)⋅v1⟩=0,
so that from Lemma .7 we get
[TABLE]
5. 5.
⟨u1∣λ⋅u0⟩=⟨v1∣μ⋅v0⟩=0,
so that from Lemma .8 we get
[TABLE]
(Again, the equality
⟨w1,1∣λμ⋅w0,0⟩=0 is trivial
when λ=0 or μ=0, and when λ,μ=0, we
deduce from the above that
⟨u1∣u0⟩=⟨v1∣v0⟩=0, from
which we get ⟨w1,1∣w0,0⟩=0 by
Lemma .8.)
From the above, we get
[TABLE]
Therefore:
[TABLE]
from (5), (3) (with k=1) and (4) (with j=1), and concluding with
the definition of α and β.
∎
Lemma .10**.**
For all t,s,s1,s2∈Λ(X)
and v,v1,v2,w∈V(X):
inl(v)⟨x:=w⟩=inl(v⟨x:=w⟩)**
2. 2.
inr(v)⟨x:=w⟩=inr(v⟨x:=w⟩)**
3. 3.
If x∈/FV(v1), then (v1,v2)⟨x:=w⟩=(v1,v2⟨x:=w⟩)
4. 4.
If x∈/FV(v2), then (v1,v2)⟨x:=w⟩=(v1⟨x:=w⟩,v2)
5. 5.
If x∈/FV(s), then (st)⟨x:=w⟩=st⟨x:=w⟩
6. 6.
If x∈/FV(t), then (st)⟨x:=w⟩=s⟨x:=w⟩t
7. 7.
If x∈/FV(s), then (t;s)⟨x:=w⟩=t⟨x:=w⟩;s
8. 8.
If x∈/FV(s), then (let(x1,x2)=tins)⟨x:=w⟩=let(x1,x2)=t⟨x:=w⟩ins
9. 9.
If x∈/FV(s1,s2), then (matcht{inl(x1)↦s1∣inr(x2)↦s2})⟨x:=w⟩=matcht⟨x:=w⟩{inl(x1)↦s1∣inr(x2)↦s2}
∎
Proposition V.3.The typing rules of Table VI are valid.
Proof.
(Axiom) It is clear that dom♯(x:A)⊆{x}=dom(x:A).
Moreover, given σ∈[[x:A]], we have
σ={x:=v} for some v∈[[A]].
Therefore x⟨σ⟩=x⟨x:=v⟩=v⊩A.
(Sub) Obvious since {⊩A}⊆{⊩A′}.
(App) Suppose that both judgments
Γ⊢s:A⇒B and Δ⊢t:A
are valid, that is:
∙
dom♯(Γ)⊆FV(s)⊆dom(Γ) and s⟨σ⟩⊩A⇒B for all
σ∈[[Γ]].
∙
dom♯(Δ)⊆FV(t)⊆dom(Δ) and t⟨σ⟩⊩A for all
σ∈[[Δ]].
From the above, it is clear that
dom♯(Γ,Δ)⊆FV(st)⊆dom(Γ,Δ).
Now, given σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
And since FV(t)∩dom(σΓ)=∅
and FV(s)∩dom(σΔ)=∅, we
deduce from Lemma .10 (5), (6)
p. .10 that
[TABLE]
We conclude that (st)⟨σ⟩=s⟨σΓ⟩t⟨σΔ⟩⊩B from Lemma .4.
(PureLam) Given a context
Γ=x1:A1,…,xℓ:Aℓ such that
♭Ai≃Ai for all i=1..ℓ, we suppose that the
judgment Γ,x:A⊢t:B is valid, that is:
∙
dom♯(Γ,x:A)⊆FV(t)⊆dom(Γ,x:A) and t⟨σ⟩⊩B for all
σ∈[[Γ,x:A]].
From the above, it is clear that
dom♯(Γ)⊆FV(λx.t)⊆dom(Γ).
Now, given σ∈[[Γ]], we want to prove
that (λx.t)⟨σ⟩⊩A→B.
Due to our initial assumption on the context Γ, it is clear
that σ={x1:=v1,…,xℓ:=vℓ} for some closed
pure values v1,…,vℓ.
Hence
[TABLE]
(since the variables x1,…,xℓ are all distinct
from x).
For all v∈[[A]], we observe that
[TABLE]
since σ,{x:=v}∈[[Γ,x:A]].
Therefore (λx.t)⟨σ⟩⊩A→B.
(UnitLam) Suppose that the judgment
Γ,x:A⊢t:B is valid, that is:
∙
dom♯(Γ,x:A)⊆FV(t)⊆dom(Γ,x:A) and t⟨σ⟩⊩B for all
σ∈[[Γ,x:A]].
From the above, it is clear that
dom♯(Γ)⊆FV(λx.t)⊆dom(Γ).
Now, given σ∈[[Γ]], we want to prove
that (λx.t)⟨σ⟩⊩A⇒B.
For that, we write:
•
Γ=x1:A1,…,xℓ:Aℓ
(where x1,…,xℓ are all distinct from x);
•
σ={x1:=v1,…,xℓ:=vℓ}
(where vi∈[[Ai]] for all i=1..ℓ);
•
vi=∑j=1niαi,j⋅vi,j
(in canonical form) for all i=1..ℓ.
Now we observe that
[TABLE]
writing
•
I:=[1..n1]×⋯×[1..nℓ] the (finite) set of all multi-indices i=(i1,…,iℓ);
•
αi:=α1,i1⋯αℓ,iℓ and ti:=t[x1:=v1,i1]⋯[xℓ:=vℓ,iℓ] for each multi-index
i=(i1,…,iℓ)∈I.
We now want to prove that
\bigl{(}\sum_{i\in I}\alpha_{i}\cdot\lambda x\,{.}\,\vec{t}_{i}\bigr{)}\in\mathcal{S}_{1}.
For that, we first observe that
[TABLE]
Then we need to check that the λ-abstractions λx.ti (i∈I) are pairwise distinct.
For that, consider two multi-indices i=(i1,…,iℓ) and
i′=(i1′,…,iℓ′) such that i=i′.
This means that ik=ik′ for some k∈[1..ℓ].
From the latter, we deduce that nk≥2, hence
vk=∑j=1nkαk,j⋅vk,j is not a pure
value, and thus [[Ak]]=♭[[Ak]].
Therefore xk∈dom♯(Γ), from which we deduce that
xk∈FV(t) from our initial assumption.
Let us now consider the first occurrence of the variable xk in
the (raw) term distribution t.
At this occurrence, the variable xk is replaced
•
by vk,ik in the multiple substitution
t[x1:=v1,i1]⋯[xℓ:=vℓ,iℓ](=ti), and
•
by vk,ik′ in the multiple substitution
t[x1:=v1,i1′]⋯[xℓ:=vℓ,iℓ′](=ti′).
And since vk,ik=vk,ik′ (recall that
vk=∑j=1nkαk,j⋅vk,j is in
canonical form), we deduce that ti=ti′.
Which concludes the proof that
\bigl{(}\sum_{i\in I}\alpha_{i}\cdot\lambda x\,{.}\,\vec{t}_{i}\bigr{)}\in\mathcal{S}_{1}.
Now, given v∈[[A]], it remains to show that
∑i∈Iαi⋅ti⟨x:=v⟩⊩B.
For that, it suffices to observe that:
[TABLE]
since σ,{x:=v}∈[[Γ,x:A]].
Therefore
(λx.t)⟨σ⟩=∑i∈Iαi⋅ti∈[[A⇒B]]⊆{⊩A⇒B}.
(Void) Obvious.
(Seq) Suppose that the judgments
Γ⊢t:U and Δ⊢s:A are
valid, that is:
∙
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩≻≻∗ for all
σ∈[[Γ]].
∙
dom♯(Δ)⊆FV(s)⊆dom(Δ) and s⟨σ⟩⊩A for all
σ∈[[Δ]].
From the above, it is clear that
dom♯(Γ,Δ)⊆FV(t;s)⊆dom(Γ,Δ).
Now, given σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
From our initial hypotheses, we get
[TABLE]
(using Lemma .10 (7)
p. .10 and
Lemma .3 (7), (10) p. .3).
(SeqSharp) Suppose that the judgments
Γ⊢t:♯U and
Δ⊢s:♯A are
valid, that is:
∙
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩⊩♯U for all
σ∈[[Γ]].
∙
dom♯(Δ)⊆FV(s)⊆dom(Δ) and s⟨σ⟩⊩♯A for all
σ∈[[Δ]].
From the above, it is clear that
dom♯(Γ,Δ)⊆FV(t;s)⊆dom(Γ,Δ).
Now, given σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
From our first hypothesis, we get
t⟨σΓ⟩≻≻α⋅∗
for some α∈C such that ∣α∣=1.
And from the second hypothesis, we have
s⟨σΔ⟩⊩♯A, and thus
α⋅s⟨σΔ⟩⊩♯A
(since ∣α∣=1).
Therefore, we get
[TABLE]
(using Lemma .10 (7)
p. .10 and
Lemma .3 (7), (10) p. .3).
(Pair) Suppose that the judgments
Γ⊢v:A and Δ⊢w:B are valid,
that is:
∙
dom♯(Γ)⊆FV(v)⊆dom(Γ) and v⟨σ⟩⊩A for all
σ∈[[Γ]].
∙
dom♯(Δ)⊆FV(w)⊆dom(Δ) and w⟨σ⟩⊩B for all
σ∈[[Δ]].
From the above, it is clear that
dom♯(Γ,Δ)⊆FV((v,w))⊆dom(Γ,Δ).
Now, given σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
From our initial hypotheses, we deduce that
v⟨σΓ⟩⊩A and
w⟨σΔ⟩⊩B, which means that
v⟨σΓ⟩∈[[A]] and
w⟨σΔ⟩∈[[B]] (from
Lemma IV.3), since v⟨σΓ⟩ and
w⟨σΔ⟩ are value distributions.
And since FV(v)∩dom(σΔ)=∅
and FV(w)∩dom(σΓ)=∅, we
deduce from Lemma .10 (3), (4)
p. .10 that
[TABLE]
from the definition of [[A×B]].
(LetPair) Suppose that the judgments
Γ⊢t:A×B and
Δ,x:A,y:B⊢s:C are valid,
that is:
∙
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩⊩A×B for all
σ∈[[Γ]].
∙
dom♯(Δ,x:A,y:B)⊆FV(s)⊆dom(Δ,x:A,y:B) and
s⟨σ⟩⊩C for all
σ∈[[Δ,x:A,y:B]].
From the above, it is clear that
dom♯(Γ,Δ)⊆FV(let(x,y)=tins)⊆dom(Γ,Δ).
Now, given σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
Since σΓ∈[[Γ]], we know from our first
hypothesis that t⟨σΓ⟩⊩A×B, which
means that t⟨σΓ⟩≻≻(v,w)
for some v∈[[A]] and w∈[[B]].
So that we get
[TABLE]
using our second hypothesis with the substitution
σΔ,{x:=v,y:=w}∈[[Δ,x:A,y:B]].
(LetTens) Suppose that the judgments
Γ⊢t:A⊗B and
Δ,x:♯A,y:♯B⊢s:♯C are valid,
that is:
•
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩⊩A⊗B for all
σ∈[[Γ]].
•
dom♯(Δ,x:♯A,y:♯B)⊆FV(s)⊆dom(Δ,x:♯A,y:♯B) and
s⟨σ⟩⊩♯C for all
σ∈[[Δ,x:♯A,y:♯B]]
From the above, it is clear that
dom♯(Γ,Δ)⊆FV(let(x,y)=tins)⊆dom(Γ,Δ).
Now, given σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
Since σΓ∈[[Γ]], we know from our first
hypothesis that t⟨σΓ⟩⊩A⊗B, which
means that
t⟨σΓ⟩≻≻∑i=1nαi⋅(ui,vi) for some
α1,…,αn∈C,
u1,…,un∈[[A]] and
v1,…,vn∈[[B]], with
\bigl{\|}\sum_{i=1}^{n}\alpha_{i}\cdot(\vec{u}_{i},\vec{v}_{i})\bigr{\|}=1.
For each i=1..n, we also observe that
σΔ,x:=ui,y:=vi∈[[Δ,x:♯A,y:♯B]].
From our second hypothesis, we get
s⟨σΔ,x:=ui,y:=vi⟩⊩♯C,
hence there is wi∈[[♯C]] such that
s⟨σΔ,x:=ui,y:=vi⟩≻≻wi.
Therefore, we have:
[TABLE]
To conclude, it remains to show that
\bigl{\|}\sum_{i=1}^{n}\alpha_{i}\cdot\vec{w}_{i}\bigr{\|}=1.
For that, we observe that:
[TABLE]
(InL) Suppose that the judgment
Γ⊢v:A is valid, that is:
∙
dom♯(Γ)⊆FV(v)⊆dom(Γ) and v⟨σ⟩⊩A for all
σ∈[[Γ]].
From the above, it is clear that
dom♯(Γ)⊆FV(inl(v))⊆dom(Γ).
Now, given σ∈[[Γ]], we know that
v⟨σ⟩⊩A, which means that
v⟨σ⟩∈[[A]] (by Lemma IV.3),
since v⟨σ⟩ is a value distribution.
So that by Lemma .10 (1), we conclude that
inl(v)⟨σ⟩=inl(v⟨σ⟩)∈[[A+B]].
(InR) Analogous to (InL).
(PureMatch) Suppose that the judgments Γ⊢t:A+B, Δ,x1:A⊢s1:C and Δ,x2:B⊢s2:C are valid, that is:
•
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩⊩A+B for all
σ∈[[Γ]].
•
dom♯(Δ,x1:A)⊆FV(s1)⊆dom(Δ,x1:A) and s1⟨σ⟩⊩C for all
σ∈[[Δ,x1:A]].
•
dom♯(Δ,x2:B)⊆FV(s2)⊆dom(Δ,x2:B) and s2⟨σ⟩⊩C for all
σ∈[[Δ,x2:B]].
From the above, it is clear that
dom♯(Γ,Δ)⊆FV(matcht{inl(x1)↦s1∣inr(x2)↦s2})⊆dom(Γ,Δ).
Now, given a substitution σ∈[[Γ,Δ]], we observe
that σ=σΓ,σΔ for some
σΓ∈[[Γ]] and
σΔ∈[[Δ]].
And since
FV(s1,s2)∩dom(σΓ)=∅, we
deduce from Lemma .10 (9) that
[TABLE]
Moreover, since σΓ∈[[Γ]], we have
t⟨σΓ⟩⊩A+B (from our first hypothesis),
so that we distinguish the following two cases:
•
Either t⟨σΓ⟩≻≻inl(v)
for some v∈[[A]], so that
[TABLE]
using our second hypothesis with the substitution
σΔ,{x1:=v}∈[[Δ,x1:A]].
•
Either t⟨σΓ⟩≻≻inr(w)
for some w∈[[B]], so that
[TABLE]
using our third hypothesis with the substitution
σΔ,{x2:=w}∈[[Δ,x2:B]].
(Weak) Suppose that the judgment
Γ⊢t:B is valid, that is
•
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩⊩B for all
σ∈[[Γ]].
Given a type A such that ♭A≃A, it is clear from the
above that dom♯(Γ,x:A)(=dom♯(Γ))⊆FV(t)⊆dom(Γ,x:A).
Now, given σ∈[[Γ,x:A]], we observe that
σ=σ0,{x:=v} for some substitution
σ0∈[[Γ]] and for some pure value
v∈[[A]](=♭[[A]]).
Therefore, we get
[TABLE]
(Contr) Given a type A such that ♭A≃A,
suppose that Γ,x:A,y:A⊢t:B, that is:
•
dom♯(Γ,x:A,y:A)(=dom♯(Γ))⊆FV(t)⊆dom(Γ,x:A,y:A)
and t⟨σ⟩⊩B for all
σ∈[[Γ,x:A,y:A]].
From the above, it is clear that
dom♯(Γ,x:A)(=dom♯(Γ))⊆FV(t[y:=x])⊆dom(Γ,x:A).
Now, given σ∈[[Γ,x:A]], we observe that
σ=σ0,{x:=v} for some substitution
σ0∈[[Γ]] and for some pure value
v∈[[A]](=♭[[A]]).
Therefore, we have
[TABLE]
since σ0,{x:=v,y:=v}∈[[Γ,x:A,y:A]].
∎
Fact .11**.**
For all n=1, one has:
nˉ⊩(♯B⇒♯B)⇒(♯B⇒♯B).
Proof.
Let
F:=\frac{3}{5}\cdot\bigl{(}\lambda x\,{.}\,\frac{5}{6}\cdot x\bigr{)}+\frac{4}{5}\cdot\bigl{(}\lambda x\,{.}\,\frac{5}{8}\cdot x\bigr{)}.
We observe that
\bigl{|}\frac{3}{5}\bigr{|}^{2}+\bigl{|}\frac{4}{5}\bigr{|}^{2}=\frac{9+16}{25}=1.
Moreover, for all v∈[[B]], we have
[TABLE]
hence F⊩♯B⇒♯B.
Now, we observe that when n=1, we have
[TABLE]
since \frac{3}{5}\bigl{(}\frac{5}{6}\bigr{)}^{n}+\frac{4}{5}\bigl{(}\frac{5}{8}\bigr{)}^{n}=\frac{7}{5}>1 when n=0 and \frac{3}{5}\bigl{(}\frac{5}{6}\bigr{)}^{n}+\frac{4}{5}\bigl{(}\frac{5}{8}\bigr{)}^{n}<\frac{3}{5}\cdot\frac{5}{6}+\frac{4}{5}\cdot\frac{5}{8}=1 when n≥2.
Hence nˉFtt⊩♯B, and therefore nˉ⊩(♯B⇒♯B)⇒(♯B⇒♯B).
∎
Proposition V.7. *
The rule (UnitaryMatch) is valid.
*
Proof.
Suppose that the judgments
Γ⊢t:A1⊕A2 and
Δ⊢(x1:♯A1⊢s1)⊥(x2:♯A2⊢s2):♯C
are valid, that is:
•
dom♯(Γ)⊆FV(t)⊆dom(Γ) and t⟨σ⟩⊩A1⊕A2 for all σ∈[[Γ]].
•
For i=1,2, dom♯(Δ,xi:♯Ai)⊆FV(si)⊆dom(Δ,xi:♯Ai) and si⟨σ,σi⟩⊩♯C for all
σ∈[[Δ]] and σi∈[[xi:♯Ai]].
•
For i=1,2, si⟨σ,σi⟩≻≻vi with ⟨v1∣v2⟩=0.
From the above, it is clear the dom♯(Γ,Δ)⊆FV(matcht{inl(x1)↦s1∣inr(x2)↦s2})⊆dom(Γ,Δ). Now, given a
substitution σ∈[[Γ,Δ]], we observe that
σ=σΓ,σΔ for some σΓ∈[[Γ]] and
σΔ∈[[Δ]]. And since FV(s1,s2)∩dom(σΓ)=∅, we deduce from
Lemma .10 (8) that
[TABLE]
Moreover, since σΓ∈[[Γ]], we have t⟨σΓ⟩⊩A1⊕A2 (from our first hypothesis), so that
we have
t⟨σΓ⟩≻≻α⋅inl(v1)+β⋅inr(v2) for some v1∈[[A1]] and v2∈[[A2]]. Therefore
[TABLE]
using the last two hypotheses, with the substitution σΔ,⟨xi:=vi⟩∈[[Δ,xi:♯Ai]].
∎
Lemma VI.2.For all classical types A, ♭\llparenthesisA\rrparenthesis≃\llparenthesisA\rrparenthesis.
Proof.
We proceed by structural induction on A.
•
\llparenthesisU\rrparenthesis=U={∗}≃♭{∗}=♭U.
•
\llparenthesisA→B\rrparenthesis=\llparenthesisA\rrparenthesis→\llparenthesisB\rrparenthesis≃♭(\llparenthesisA\rrparenthesis→\llparenthesisB\rrparenthesis) by rule
(FlatPureArrow).
•
\llparenthesisA×B\rrparenthesis=\llparenthesisA\rrparenthesis×\llparenthesisB\rrparenthesis≃♭\llparenthesisA\rrparenthesis×♭\llparenthesisB\rrparenthesis≃♭(\llparenthesisA\rrparenthesis×\llparenthesisB\rrparenthesis), using the induction
hypothesis and rules (ProdMono) and (FlatProd).
•
\llparenthesisbit\rrparenthesis=B=U+U=♭U+♭U=♭(U+U)=♭\llparenthesisbit\rrparenthesis
using rules (SumMono) and (FlatSum).
•
\llparenthesisAQ⊸BQ\rrparenthesis=U→(\llparenthesisAQ\rrparenthesis⇒\llparenthesisBQ\rrparenthesis)≃♭(U→(\llparenthesisAQ\rrparenthesis⇒\llparenthesisBQ\rrparenthesis))
by rule (FlatPureArrow). ∎
Lemma VI.3.For all qbit types AQ, ♯\llparenthesisAQ\rrparenthesis≃\llparenthesisAQ\rrparenthesis.
Proof.
First notice that for any A from the unitary linear algebraic lambda-calculs,
we have ♯A≃♯♯A. Indeed, by rule (SharpIntro)
♯A≤♯♯A, and by rules (SubRefl) and (SharpLift),
♯♯A≤♯A. Now we proceed by structural induction on AQ.
If Γ⊢Qt:AQ then \llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisAQ\rrparenthesis.
2. 2.
If Δ∣Γ⊢Ct:A then \llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisA\rrparenthesis.
3. 3.
If [Q,L,t]:A then ⊢\llparenthesis[Q,L,t]\rrparenthesis:\llparenthesisA\rrparenthesis.
Proof.
Since ⊢Q depends on ⊢C, we prove items (1) and (2) at the same
time by induction on the typing derivation.
•
Δ,x:A⊢Cx:A
By Lemma VI.2,
♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence, by rules (Axiom) and (Weak), we have
\llparenthesisΔ\rrparenthesis,x:\llparenthesisA\rrparenthesis⊢x:\llparenthesisA\rrparenthesis.
•
Δ⊢C∗:U
By
Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence,
by rules (Void) and (Weak) we conclude \llparenthesisΔ\rrparenthesis⊢∗:U.
•
Δ⊢Cλx.t:A→BΔ,x:A⊢Ct:B
By the induction hypothesis, \llparenthesisΔ\rrparenthesis,x:\llparenthesisA\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisB\rrparenthesis and by Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence, by rule (PureLam),
\llparenthesisΔ\rrparenthesis⊢λx.\llparenthesist\rrparenthesis:\llparenthesisA\rrparenthesis→\llparenthesisB\rrparenthesis.
•
Δ⊢Ctr:B\lx@proof@logical@andΔ⊢Ct:A→BΔ⊢Cr:A
By the induction hypothesis, \llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisA\rrparenthesis→\llparenthesisB\rrparenthesis and \llparenthesisΔ\rrparenthesis⊢\llparenthesisr\rrparenthesis:\llparenthesisA\rrparenthesis. Hence, by rules
(SubArrows) and (Sub), we have \llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisA\rrparenthesis⇒\llparenthesisB\rrparenthesis, and also, we have \llparenthesisΔ\rrparenthesis[σ]⊢\llparenthesisr\rrparenthesis[σ]:\llparenthesisA\rrparenthesis, where
σ is a substitution of every variable in Δ by fresh
variables. Then, by rule
(App)
we can derive, \llparenthesisΔ\rrparenthesis,\llparenthesisΔ\rrparenthesis[σ]⊢\llparenthesist\rrparenthesis\llparenthesisr\rrparenthesis[σ]:\llparenthesisB\rrparenthesis. By Lemma VI.2, we have
♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence, by rule (Contr), we get
\llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis\llparenthesisr\rrparenthesis:\llparenthesisB\rrparenthesis.
By the induction hypothesis, \llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisA\rrparenthesis and
\llparenthesisΔ\rrparenthesis⊢\llparenthesisr\rrparenthesis:\llparenthesisB\rrparenthesis. Hence, by rule (Pair),
\llparenthesisΔ\rrparenthesis,\llparenthesisΔ\rrparenthesis⊢(\llparenthesist\rrparenthesis,\llparenthesisr\rrparenthesis):\llparenthesisA\rrparenthesis×\llparenthesisB\rrparenthesis.
•
Δ⊢Cπit:AiΔ⊢Ct:A1×A2
By the induction hypothesis, \llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisA1\rrparenthesis×\llparenthesisA2\rrparenthesis. By Lemma VI.2,
\llparenthesisAi\rrparenthesis≃♭\llparenthesisAi\rrparenthesis for i=1,2, hence, by rules
(Axiom) and (Weak), we have x1:\llparenthesisA1\rrparenthesis,x2:\llparenthesisA2\rrparenthesis⊢xi:\llparenthesisAi\rrparenthesis. Therefore, by rule (LetPair), we can derive
\llparenthesisΔ\rrparenthesis⊢let(x1,x2)=\llparenthesist\rrparenthesisinxi:\llparenthesisAi\rrparenthesis.
•
Δ⊢Ctt:bit
By Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, so,
by rules (Void), (InL), and (Weak), we can derive \llparenthesisΔ\rrparenthesis⊢tt:B.
•
Δ⊢Cff:bit
By Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, so,
by rules (Void), (InR), and (Weak), we can derive \llparenthesisΔ\rrparenthesis⊢ff:B.
By the induction hypothesis, \llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:B=U+U and for i=1,2, \llparenthesisΔ\rrparenthesis⊢\llparenthesisri\rrparenthesis:\llparenthesisA\rrparenthesis.
By rules (Axiom) and (Seq), we can derive \llparenthesisΔ\rrparenthesis,xi:U⊢xi;\llparenthesisri\rrparenthesis:\llparenthesisA\rrparenthesis we also have \llparenthesisΔ\rrparenthesis[σ]⊢\llparenthesist\rrparenthesis[σ]:U+U, where σ is a substitution of every variable in
Δ by fresh variables. Then, by rule (PureMatch),
\llparenthesisΔ\rrparenthesis,\llparenthesisΔ\rrparenthesis[σ]⊢match\llparenthesist\rrparenthesis[σ]{inl(x1)↦x1;\llparenthesisr\rrparenthesis∣inr(x2)↦x2;\llparenthesiss\rrparenthesis}:\llparenthesisA\rrparenthesis. By Lemma VI.2, we have
♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence, by rule (Cont), we conclude
\llparenthesisΔ\rrparenthesis⊢match\llparenthesist\rrparenthesis{inl(x1)↦x1;\llparenthesisr\rrparenthesis∣inr(x2)↦x2;\llparenthesiss\rrparenthesis}:\llparenthesisA\rrparenthesis
•
Δ∣x:AQ⊢x:AQ
By Lemma VI.2,
♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence, by rules (Axiom) and (Weak), we have
\llparenthesisΔ\rrparenthesis,x:\llparenthesisA\rrparenthesis⊢x:\llparenthesisA\rrparenthesis.
By the induction hypothesis, \llparenthesisΔ\rrparenthesis,\llparenthesisΓ1\rrparenthesis⊢\llparenthesiss\rrparenthesis:\llparenthesisAQ\rrparenthesis and \llparenthesisΔ\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢t:\llparenthesisBQ\rrparenthesis.
Then, we can derive \llparenthesisΔ\rrparenthesis[σ],\llparenthesisΓ1\rrparenthesis⊢\llparenthesiss\rrparenthesis[σ]:\llparenthesisAQ\rrparenthesis, where σ is a substitution on every variable
in Δ by fresh variables. Hence, by rule (Pair), we can derive
\llparenthesisΔ\rrparenthesis[σ],\llparenthesisΓ1\rrparenthesis,\llparenthesisΔ\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢(\llparenthesiss\rrparenthesis[σ],\llparenthesist\rrparenthesis):\llparenthesisAQ\rrparenthesis×\llparenthesisBQ\rrparenthesis. By
Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis, hence,
by rule (Contr), we have
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ1\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢(\llparenthesiss\rrparenthesis,\llparenthesist\rrparenthesis):\llparenthesisAQ\rrparenthesis×\llparenthesisBQ\rrparenthesis.
Finally, by rules (SharpIntro) and (Sub), we have
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ1\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢(\llparenthesiss\rrparenthesis,\llparenthesist\rrparenthesis):\llparenthesisAQ\rrparenthesis⊗\llparenthesisBQ\rrparenthesis.
•
Δ∣Γ⊢QU(t):qbitΔ∣Γ⊢Qt:qbit
By the induction hypothesis, \llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis:♯B. By Proposition IV.11, ⊢Uˉ:♯B→♯B, hence, by rules (SubArrows) and (Sub),
we have ⊢Uˉ:♯B⇒♯B. Therefore, by rule
(App), we can derive \llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis⊢Uˉ\llparenthesist\rrparenthesis:♯B.
By the induction hypothesis,
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ1\rrparenthesis⊢\llparenthesiss\rrparenthesis:\llparenthesisAQ\rrparenthesis⊗\llparenthesisBQ\rrparenthesis and
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ2\rrparenthesis,x:\llparenthesisAQ\rrparenthesis,y:\llparenthesisBQ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisCQ\rrparenthesis.
Then, we also have
\llparenthesisΔ\rrparenthesis[σ],\llparenthesisΓ1\rrparenthesis⊢\llparenthesiss\rrparenthesis[σ]:\llparenthesisAQ\rrparenthesis⊗\llparenthesisBQ\rrparenthesis, where σ is a substitution on every variable
in Δ by fresh variables.
By Lemma VI.3, \llparenthesisAQ\rrparenthesis≃♯\llparenthesisAQ\rrparenthesis,
\llparenthesisBQ\rrparenthesis≃♯\llparenthesisBQ\rrparenthesis, and \llparenthesisCQ\rrparenthesis≃♯\llparenthesisCQ\rrparenthesis. Hence,
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ2\rrparenthesis,x:♯\llparenthesisAQ\rrparenthesis,y:♯\llparenthesisBQ\rrparenthesis⊢\llparenthesist\rrparenthesis:♯\llparenthesisCQ\rrparenthesis.
Therefore, by rule (LetTens),
\llparenthesisΔ\rrparenthesis[σ],\llparenthesisΓ1\rrparenthesis,\llparenthesisΔ\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢let(x,y)=\llparenthesiss\rrparenthesis[σ]in\llparenthesist\rrparenthesis:♯\llparenthesisCQ\rrparenthesis.
By Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis,
hence, by rule (Contr), we get
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ1\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢let(x,y)=\llparenthesiss\rrparenthesisin\llparenthesist\rrparenthesis:♯\llparenthesisCQ\rrparenthesis.
Finally, using the fact that ♯\llparenthesisCQ\rrparenthesis≃\llparenthesisCQ\rrparenthesis, we get
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ1\rrparenthesis,\llparenthesisΓ2\rrparenthesis⊢let(x,y)=\llparenthesiss\rrparenthesisin\llparenthesist\rrparenthesis:\llparenthesisCQ\rrparenthesis.
Notice that we have used the following unproved rule: If
Γ,x:A⊢t:B and A≃C, then Γ,x:C⊢t:B.
Hence, we prove that this rule is true. Assume Γ,x:A⊢t:B, then,
t⟨σ⟩⊩[[B]] for every σ∈[[Γ,x:A]]=[[Γ,x:C]],
and so Γ,x:C⊢t:B.
•
Δ∣∅⊢Qnew(t):qbitΔ⊢Ct:bit
By the induction hypothesis, \llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:B. We conclude by
rules (SharpIntro) and (Sub) that
\llparenthesisΔ\rrparenthesis⊢\llparenthesist\rrparenthesis:♯B.
•
Δ⊢CλQx.t:AQ⊸BQΔ∣x:AQ⊢Qt:BQ
By the induction hypothesis \llparenthesisΔ\rrparenthesis,x:\llparenthesisAQ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisBQ\rrparenthesis. Since U≃♭U, by rule (Weak), we have
\llparenthesisΔ\rrparenthesis,z:U,x:\llparenthesisAQ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisBQ\rrparenthesis
Then, by rules (UnitLam) and (PureLam), we can derive
\llparenthesisΔ\rrparenthesis⊢λzx.\llparenthesist\rrparenthesis:U→(\llparenthesisAQ\rrparenthesis⇒\llparenthesisBQ\rrparenthesis).
By the induction hypothesis, \llparenthesisΔ\rrparenthesis⊢\llparenthesiss\rrparenthesis:U→(\llparenthesisAQ\rrparenthesis⇒\llparenthesisBQ\rrparenthesis) and
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis:\llparenthesisAQ\rrparenthesis.
Then,
\llparenthesisΔ\rrparenthesis[σ],\llparenthesisΓ\rrparenthesis⊢\llparenthesist\rrparenthesis[σ]:\llparenthesisAQ\rrparenthesis, where
σ is a substitution on every variable in Δ by fresh variables.
By rules (SubArrows) and (Sub), we have \llparenthesisΔ\rrparenthesis⊢\llparenthesiss\rrparenthesis:U⇒(\llparenthesisAQ\rrparenthesis⇒\llparenthesisBQ\rrparenthesis). In addition, by rule
(Void), ⊢∗:U. Hence, by rule (App) twice, we get
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis,\llparenthesisΔ\rrparenthesis[σ]⊢(\llparenthesiss\rrparenthesis∗)\llparenthesist\rrparenthesis[σ]:\llparenthesisBQ\rrparenthesis.
By Lemma VI.2, ♭\llparenthesisΔ\rrparenthesis≃\llparenthesisΔ\rrparenthesis,
hence, by rule (Contr),
\llparenthesisΔ\rrparenthesis,\llparenthesisΓ\rrparenthesis⊢(\llparenthesiss\rrparenthesis∗)\llparenthesist\rrparenthesis:\llparenthesisBQ\rrparenthesis.
Now we prove item (3).
Let
[TABLE]
that means ∅∣FV(t):qbit⊢Qt:AQ. We must show that
[TABLE]
that is
[TABLE]
From item (1) we have FV(t):♯B⊢\llparenthesist\rrparenthesis:\llparenthesisAQ\rrparenthesis. Then, by
definition, we have \llparenthesist\rrparenthesis⟨σ⟩⊩\llparenthesisAQ\rrparenthesis for every
σ∈[[FV(t):♯B]]. In particular, [σi]=[x1:=yˉp(1)i,…,xn:=yˉp(n)i]∈[[FV(t):♯B]], so \llparenthesist\rrparenthesis⟨σi⟩=\llparenthesist\rrparenthesis[σi]⊩\llparenthesisAQ\rrparenthesis. By
Lemma VI.3, \llparenthesisAQ\rrparenthesis≃♯\llparenthesisAQ\rrparenthesis, and so,
we have
∑i=1mαi⋅\llparenthesist\rrparenthesis[σi]⊩\llparenthesisAQ\rrparenthesis, which is, by
definition, the same as (1)
∎
Lemma .12**.**
For any terms t and r,
\llparenthesist[x:=r]\rrparenthesis=\llparenthesist\rrparenthesis[x:=\llparenthesisr\rrparenthesis].
Proof.
By a straightforward structural induction on t.
∎
Lemma .13**.**
For all value distributions v and v, for all term
distributions t, s, s1, s2 and for
all pure values w, we have the equalities:
Let us treat the case of the pair destructing let-construct.
Given term distributions t=∑i=1nαi⋅ti
and s, and a pure value w such that
x1,x2∈/FV(w)∪{x}, we observe that
[TABLE]
The other cases are treated similarly.
∎
Remark .14** (Parallel substitution).**
The operation of parallel substitution [x1:=w1,…,xn:=wn]
(where x1,…,xn are pairwise distinct variables) can be
easily implemented as a sequence of pure substitutions, by
temporarily replacing the xi’s with fresh names in order to avoid
undesirable captures between successive pure substitutions.
For instance, we can let
[TABLE]
where z1,…,zn are fresh names w.r.t. t,x1,…,xn,w1,…,wn.
Note that this precaution is useless when the substituands
w1,…,wn are closed, since in this case, parallel
substitution amounts to the following sequential substitution
(whose order is irrelevant):
[TABLE]
Lemma .15**.**
For all term distributions t and for all closed value
distributions v and w:
[TABLE]
Theorem VI.6 (Adequacy).If [Q,L,t]→[Q′,L′,r], then \llparenthesis[Q,L,t]\rrparenthesis≻≻\llparenthesis[Q′,L′,r]\rrparenthesis.
Proof.
We proceed by induction on the rewrite relation of λQ. We
only give the cases where C(⋅)={⋅}, as other cases are
simple calls to the induction hypothesis. In all the cases, we consider
Q=∑i=1mαi∣u1i,…,yni⟩,
L={x1:=p(1),…,xn:=p(n)}, and
[σi]=[x1:=yˉp(1)i,…,xn:=yˉp(n)i].
•
[Q,L,(λx.t)u]→[Q,L,t[x:=u]].
[TABLE]
•
[Q,L,(λQx.t)@u]→[Q,L,t[x:=u]].
[TABLE]
•
[Q,L,π1(u,v)]→[Q,L,u].
[TABLE]
•
[Q,L,πs(u,v)]→[Q,L,v].
[TABLE]
•
[Q,L,iftt{t∣r}]→[Q,L,t]
[TABLE]
•
[Q,L,ifff{t∣r}]→[Q,L,r]
[TABLE]
•
[Q,L,letx⊗y=t⊗rins]→[Q,L,s[x:=t,y:=r]].
[TABLE]
•
[∅,∅,new(tt)]→[∣1⟩,{x↦1},x]
[TABLE]
•
[∅,∅,new(ff)]→[∣0⟩,{x↦1},x]
[TABLE]
•
[∣ψ⟩,{x↦1},U(x)]→[U∣ψ⟩,{x↦1},x].
Let U∣0⟩=γ0∣0⟩+δ0∣1⟩ and U∣1⟩=γ1∣0⟩+δ1∣1⟩. Then,
[TABLE]
Bibliography29
The reference list from the paper itself. Each links out to its DOI / PubMed record.
1[1] P. Arrighi and G. Dowek, “Linear-algebraic λ 𝜆 \lambda -calculus: higher-order, encodings, and confluence.” in Rewriting Techniques and Applications , A. Voronkov, Ed. Berlin, Heidelberg: Springer Berlin Heidelberg, 2008, pp. 17–31.
2[2] ——, “Lineal: A linear-algebraic lambda-calculus,” Logical Methods in Computer Science , vol. 13, 2017.
3[3] B. Valiron, “A typed, algebraic, computational lambda-calculus,” Mathematical Structures in Computer Science , vol. 23, no. 2, pp. 504–554, 2013.
4[4] E. H. Knill, “Conventions for quantum pseudocode,” Los Alamos National Laboratory, Tech. Rep. LA-UR-96-2724, 1996.
5[5] A. S. Green, P. L. Lumsdaine, N. J. Ross, P. Selinger, and B. Valiron, “Quipper: a scalable quantum programming language,” ACM SIGPLAN Notices (PLDI’13) , vol. 48, no. 6, pp. 333–342, 2013.
6[6] J. Paykin, R. Rand, and S. Zdancewic, “Qwire: A core language for quantum circuits,” in Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages , ser. POPL 2017. New York, NY, USA: ACM, 2017, pp. 846–858.
7[7] A. van Tonder, “A lambda calculus for quantum computation,” SIAM Journal on Computing , vol. 33, pp. 1109–1135, 2004.
8[8] A. Díaz-Caro, “Du typage vectoriel,” Ph.D. dissertation, Université de Grenoble, France, Sep. 2011.