<figure><img src="image_1.png" /></figure>

HAL
open science

# A New Connective in Natural Deduction, and its Application to Quantum Computing

Alejandro Díaz-Caro, Gilles Dowek

► To cite this version:

Alejandro Díaz-Caro, Gilles Dowek. A New Connective in Natural Deduction, and its Application to Quantum Computing. Theoretical Computer Science, 2023, 957, pp.113840. 10.1016/j.tcs.2023.113840. hal-04398691

HAL Id: hal-04398691

https://inria.hal.science/hal-04398691v1

Submitted on 16 Jan 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
A New Connective in Natural Deduction,
and its Application to Quantum Computing★

Alejandro Díaz-Caro$^{a,b}$, Gilles Dowek$^{c,d}$

$^a$Departamento de Ciencia y Tecnología, Universidad Nacional de Quilmes, Argentina

$^b$Instituto de Ciencias de la Computación, CONICET-Universidad de Buenos Aires, Argentina

$^c$Inria, France

$^d$École Normale Supérieure Paris-Saclay, France

**Abstract**

We investigate an unsuspected connection between logical connectives with non-harmonious deduction rules, such as Prior's *tonk*, and quantum computing. We argue that these connectives model the information-erasure, the non-reversibility, and the non-determinism that occur, among other places, in quantum measurement. We introduce an intuitionistic propositional logic with a non-harmonious logical connective *sup* and two interstitial rules, and show that the proof language of this logic forms the core of a quantum programming language.

**Keywords:** Proof-reduction, Lambda calculus, Type theory, Quantum computing

**2020 MSC:** 03F05, 68N18, 03B38, 03B70, 81P68

# 1. Introduction

A puzzling question in quantum physics is whether, in a quantum superposition $\alpha|\phi\rangle + \beta|\psi\rangle$ of two states $|\phi\rangle$ and $|\psi\rangle$, there is the state $|\phi\rangle$ and the state $|\psi\rangle$ or the state $|\phi\rangle$ or the state $|\psi\rangle$.

Indeed, when we build such a superposition, that is when we prepare it, we need to have $|\phi\rangle$ and $|\psi\rangle$, but when we use this state, that is when we measure it, we get $|\phi\rangle$ or $|\psi\rangle$. Thus, this superposition is similar to a conjunction when we build it, but to a disjunction when we use it. This discrepancy between the way such a superposition is built and used is reminiscent of the natural deduction rules of the non-harmonious connectives such as Prior's *tonk*, and others. We defend, in this paper, the thesis that these non-harmonious connectives model the information-erasure, the non-reversibility, and the non-determinism that occur, among other places, in quantum measurement, while the harmonious ones model information preservation, reversibility, and determinism.

More concretely, after discussing the notion of harmonious and non-harmonious deduction rules (Section 2), we introduce an intuitionistic propositional logic with a logical connective $\odot$ (read: “sup”, for “superposition”) that has non-harmonious deduction rules, we introduce a language of proof-terms for this logic, the $\odot$-calculus (read: “the sup-calculus”), and we prove its main properties: subject reduction, the termination of proof-reduction, the introduction property, and partial confluence (Section 3). These proofs mostly use standard techniques with some specificities, to be adapted to this calculus. We then extend this calculus, introducing scalars to quantify the propensity of a proof to reduce to another (Section 4) and show that this proof language contains the core of a quantum programming language (Section 5). Note that that intuitionistic propositional logic with $\odot$ is not a logic to reason about quantum programs. It is a logic whose propositions are the types of quantum programs.

<footnote>* Funded by STIC-AmSud 21STIC10, PIP 11220200100368CO, PICT-2019-1272, PICT-2021-I-A-00090, and the French-Argentinian IRP SINFIN.</footnote>

<footnote>Email addresses: adiazcaro@icc.fcen.uba.ar (Alejandro Díaz-Caro), gilles.dowek@ens-paris-saclay.fr (Gilles Dowek)</footnote>
The idea to extend logic with a new connective for quantum superposition has already been investigated, for example in [32, 33]. While these papers address the question of the models of such a logic, we address that of the dynamic of its proofs.

A preliminary version of this paper has been published in the proceedings of the International Colloquium on Theoretical Aspects of Computing, 2021. In this journal version, we have replaced the symbol $\delta_{\odot}^{\parallel}$ with the symbols $\delta_{\odot}^{1}$, $\delta_{\odot}^{2}$, clarifying the two-face nature of the connective $\odot$. We have also introduced an elimination rule for the symbol $\top$. Such a rule is often considered as redundant, but it fully makes sense in natural deduction with generalized elimination rules, and even more in a proof system with scalars, such as that of Section 4. Besides providing the complete proofs of all theorems, we investigate, in this paper, the confluence of the deterministic part of the calculus, that was not addressed in the conference version. To our surprise, the system without scalars was confluent, but the system with scalars was not. This led us to modify the treatment of scalars and the definition of matrices to make this system confluent. Finally, the conference version of the paper only addressed quantum algorithms on one and two qubits. In this version, we have generalized this to arbitrary quantum algorithms, leading to a more systematic treatment of vectors, matrices, and measurement.

## 2. Harmony and excessiveness

### 2.1. Logical connectives with insufficient, harmonious, and excessive deduction rules

In natural deduction, to prove a proposition of the form $A \Delta B$, where $\Delta$ is an arbitrary connective, the introduction rules of this connective require to prove some propositions. Then, when we have a proof of $A \Delta B$ and we want to prove a proposition $C$, the generalized elimination rules [29, 8, 21, 14, 22, 19] of the connective $\Delta$ provide some hypotheses for proving this proposition. In general, the propositions required by the introduction rules and those provided by the elimination rules are the same.

For example, to prove the proposition $A \wedge B$, the introduction rule of the conjunction

$$ \frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \wedge B} \quad \wedge-i $$

requires proofs of $A$ and of $B$ and, to prove a proposition $C$, the generalized elimination rules of the conjunction

$$ \frac{\Gamma \vdash A \wedge B \quad \Gamma, A \vdash C}{\Gamma \vdash C} \quad \wedge-e1 $$

$$ \frac{\Gamma \vdash A \wedge B \quad \Gamma, B \vdash C}{\Gamma \vdash C} \quad \wedge-e2 $$

provide the same propositions $A$ and $B$. This principle of inversion, or of harmony, has been introduced by Gentzen [10] and developed, among others, by Prawitz [23, 24], Dummett [7], and Schoeder-Heister [29, 30] for natural deduction, by Miller and Pimentel [17] for sequent calculus, and by Read [26, 27, 28] and Martin-Löf [15] for the rules of equality. It enables the definition of a reduction process, where the proof

$$ \frac{\begin{array}{c} \pi_1 \\ \vdots \\ \Gamma \vdash A \quad \Gamma \vdash B \\ \hline \end{array}}{\Gamma \vdash A \wedge B} \quad \wedge-i \quad \frac{\begin{array}{c} \pi_2 \\ \vdots \\ \Gamma, A \vdash C \\ \hline \end{array}}{\Gamma \vdash C} \quad \wedge-e1 $$

reduces to $(\pi_1/A)\pi_3$, that is the proof $\pi_3$ where every occurrence of the rule axiom with the proposition $A$ has been replaced with the proof $\pi_1$. And, similarly, the proof

$$ \frac{\begin{array}{c} \pi_1 \\ \vdots \\ \Gamma \vdash A \quad \Gamma \vdash B \\ \hline \end{array}}{\Gamma \vdash A \wedge B} \quad \wedge-i \quad \frac{\begin{array}{c} \pi_2 \\ \vdots \\ \Gamma, B \vdash C \\ \hline \end{array}}{\Gamma \vdash C} \quad \wedge-e2 $$
reduces to $(\pi_2/B)\pi_3$.

This property that the elimination rules provide exactly the propositions required by the introduction rules can be split into two properties, that it provides no more and no less (called “harmony” and “stability” in [12]).

It is of course possible to imagine other deduction rules that do not respect this harmony principle, either because the introduction rules do not require some propositions, that are provided by the elimination rules (such rules may be called *insufficient*).

$$ \frac{\frac{\Gamma \vdash A}{\Gamma \vdash A \sqcup B} \sim_i}{\Gamma \vdash A \sqcup B \quad \Gamma, A, B \vdash C} \sim_e $$

or because the introduction rules require some propositions, that are not provided by the elimination rules (such rules may be called *excessive*).

$$ \frac{\frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \sqcap B} \sim_i}{\Gamma \vdash A \sqcap B \quad \Gamma, A \vdash C} \sim_e $$

or both, such as Prior's *tonk* [25].

$$ \frac{\frac{\Gamma \vdash A}{\Gamma \vdash A \text{ tonk } B} \text{ tonk-i}}{\Gamma \vdash A \text{ tonk } B \quad \Gamma, B \vdash C} \text{ tonk-e} $$

More generally, we can associate to each set of introduction rules a *required* proposition. When an introduction rule has several premisses, we take the conjunction of these premises, and when there are several such introduction rules, we take the disjunction of their premises. In the same way, we can associate to each set of elimination rules a *provided* proposition. As the provided propositions occur on the left of the sequent, when an elimination rule has several premisses, we take their disjunction, and when there are several such elimination rules, we take the conjunction of their premises.

<table><thead><tr><th></th><th>required</th><th>provided</th></tr></thead><tbody><tr><th>∧</th><td>A and B</td><td>A and B</td></tr><tr><th>∨</th><td>A or B</td><td>A or B</td></tr><tr><th>∩</th><td>A</td><td>A and B</td></tr><tr><th>∩</th><td>A and B</td><td>A</td></tr><tr><th>tonk</th><td>A</td><td>B</td></tr></tbody></table>

A set of rules is *harmonious* when the required and the provided propositions are the equivalent. It is *excessive* when the required proposition implies the provided proposition, but not the converse. It is *insufficient* when the provided proposition implies the required one, but not the converse. The connective $\wedge$ and $\vee$ are thus harmonious. The connective $\sqcap$ is insufficient. The connective $\sqcup$ is excessive. And, as both $A \Rightarrow B$ and $B \Rightarrow A$ are unprovable, the connective *tonk* is neither.

When a set of rules is excessive, a proof reduction process can still be defined, for example the proof

$$ \frac{\frac{\pi_1 \quad \pi_2 \quad \pi_3}{\Gamma \vdash A \quad \Gamma \vdash B \quad \Gamma, A \vdash C} \sim_i}{\Gamma \vdash A \sqcap B \quad \Gamma, A \vdash C} \sim_e $$

can still be reduced to $(\pi_1/A)\pi_3$.
Another example is the connective $\odot$ whose introduction rule

$$ \frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \odot B} \stackrel{\odot-i}{\longrightarrow} $$

similar to that of the conjunction, requires A and B and whose elimination rule

$$ \frac{\Gamma \vdash A \odot B \quad \Gamma, A \vdash C \quad \Gamma, B \vdash C}{\Gamma \vdash C} \stackrel{\odot-e}{\longrightarrow} $$

similar to that of the disjunction, provides A or B. In this case also, proofs can be reduced. Moreover, several proof reduction processes can be defined, exploiting, in different ways, the excess of the deduction rules. For example, the proof

$$ \frac{\begin{array}{c} \pi_1 \\ \vdots \\ \Gamma \vdash A \\ \vdots \\ \Gamma \vdash A \odot B \end{array} \stackrel{\odot-i}{\longrightarrow} \begin{array}{c} \pi_3 \\ \vdots \\ \Gamma, A \vdash C \\ \vdots \\ \Gamma, B \vdash C \end{array} \stackrel{\odot-e}{\longrightarrow} \begin{array}{c} \pi_4 \\ \vdots \\ \Gamma \vdash C \end{array}}{\Gamma \vdash C} $$

can be reduced to $(\pi_1/A)\pi_3$, it can be reduced to $(\pi_2/B)\pi_4$, it also can be reduced, in a non-deterministic way, either to $(\pi_1/A)\pi_3$ or to $(\pi_2/B)\pi_4$.

This notion of harmony can also be extended to the rules of quantifiers. Then, the quantifier $\exists$, whose introduction rule

$$ \frac{\Gamma \vdash A}{\Gamma \vdash \exists x A} \stackrel{\exists-i}{\longrightarrow} \text{ x not free in } \Gamma $$

similar to that of the universal quantifier, requires a proof of A for all x and whose elimination rule

$$ \frac{\Gamma \vdash \exists x A \quad \Gamma, A \vdash C}{\Gamma \vdash C} \stackrel{\exists-e}{\longrightarrow} \text{ x not free in } \Gamma, C $$

similar to that of the existential quantifier, provides a proof of A for some x, has excessive deduction rules. The proof

$$ \frac{\begin{array}{c} \pi_1 \\ \vdots \\ \Gamma \vdash A \\ \vdots \\ \Gamma \vdash \exists x A \end{array} \stackrel{\exists-i}{\longrightarrow} \begin{array}{c} \pi_2 \\ \vdots \\ \Gamma, A \vdash C \end{array} \stackrel{\exists-e}{\longrightarrow} \begin{array}{c} \pi_3 \\ \vdots \\ \Gamma \vdash C \end{array}}{\Gamma \vdash C} $$

can be reduced, in a non-deterministic way, to $((t/x)\pi_1/A)(t/x)\pi_2$, for any term t.

The quantifier $\nabla$ [18], defined in sequent calculus rather than natural deduction, may also be considered as a quantifier with excessive deduction rules, as it has the right rule of the universal quantifier and the left rule of the existential one. But it involves a clever management of variable scoping, which we do not address here.

## 2.2. Mixing excessiveness and harmony

The rules

$$ \frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \odot B} \stackrel{\odot-i}{\longrightarrow} $$

$$ \frac{\Gamma \vdash A \odot B \quad \Gamma, A \vdash C \quad \Gamma, B \vdash C}{\Gamma \vdash C} \stackrel{\odot-e}{\longrightarrow} $$

are excessive.
But, we can add another set of elimination rules for the connective $\odot$, similar to those of conjunction

$$ \frac{\Gamma \vdash A \odot B \quad \Gamma, A \vdash C}{\Gamma \vdash C} \stackrel{\odot-e1}{\longrightarrow} \frac{\Gamma \vdash A \odot B \quad \Gamma, B \vdash C}{\Gamma \vdash C} \stackrel{\odot-e2}{\longrightarrow} $$

Then, the connective $\odot$, with its four rules $\odot$-i, $\odot$-e, $\odot$-e1, and $\odot$-e2, appears as a two-face connective: the subset of its deduction rules $\{\odot$-i, $\odot$-e\}$ is excessive, while the subset $\{\odot$-i, $\odot$-e1, $\odot$-e2\}$ is harmonious. Note that the rules $\{\odot$-i, $\odot$-e1, $\odot$-e2\}$ are exactly those of the conjunction.

### 2.3. Information loss

We say that an occurrence of a sub-proof $\pi_1$ of a proof $\pi$ is accessible, if there exists a context $\kappa$ such that $\kappa\{\pi_X\}$, where $\pi_X$ is obtained by replacing this occurrence of $\pi_1$ with a variable $X$, reduces to $X$.

For example, the occurrence of $\pi_1$ in the proof

$$ \frac{\pi_1 \quad \pi_2}{\Gamma \vdash A \quad \Gamma \vdash B} \stackrel{\wedge-i}{\longrightarrow} \frac{\Gamma \vdash A \wedge B}{\Gamma \vdash A} $$

is accessible, as putting the proof

$$ \frac{X \quad \pi_2}{\Gamma \vdash A \quad \Gamma \vdash B} \stackrel{\wedge-i}{\longrightarrow} \frac{\Gamma \vdash A \wedge B}{\Gamma \vdash A} $$

in the context

$$ \frac{\{ \quad \dots \quad \Gamma \vdash A \wedge B \quad \Gamma, A \vdash A}{\Gamma \vdash A} \stackrel{\text{axiom}}{\longrightarrow} \stackrel{\text{\wedge-e1}}{\longrightarrow} $$

yields the proof

$$ \frac{X \quad \pi_2}{\Gamma \vdash A \quad \Gamma \vdash B} \stackrel{\wedge-i}{\longrightarrow} \frac{\Gamma \vdash A \wedge B}{\Gamma \vdash A} \stackrel{\text{axiom}}{\longrightarrow} \frac{\Gamma, A \vdash A}{\Gamma \vdash A} \stackrel{\text{\wedge-e1}}{\longrightarrow} $$

that reduces to $X$. In other words, the rule $\wedge-i$ puts the proofs $\pi_1$ and $\pi_2$ in a box, but the box can be opened and the proofs can be taken out of it.

With harmonious deduction rules, when a proof is built with an introduction rule, the proofs of its premises remain accessible. We call this property *information preservation*. The situation is different with excessive deduction rules: the excess of information, required by the introduction rule, and not returned by the elimination rule in the form of an extra hypothesis in the required proof of $C$ is lost. For example, the occurrence of $\pi_2$ in the proof

$$ \frac{\pi_1 \quad \pi_2}{\Gamma \vdash A \quad \Gamma \vdash B} \stackrel{\wedge-i}{\longrightarrow} \frac{\Gamma \vdash A \wedge B}{\Gamma \vdash A} $$

is inaccessible as there is no context such that putting the proof

$$ \frac{\pi_1 \quad X}{\Gamma \vdash A \quad \Gamma \vdash B} \stackrel{\wedge-i}{\longrightarrow} \frac{\Gamma \vdash A \wedge B}{\Gamma \vdash A} $$
in that context yields a proof that reduces to X. Again, the rule ⌜-i puts the proofs $\pi_1$ and $\pi_2$ in a box, the box can be partially opened and the proof $\pi_1$ can be taken out of it, but not the proof $\pi_2$, that is inaccessible. The information it contains is lost.

The accessibility of the occurrences of $\pi_1$ and $\pi_2$ of the proof

$$ \frac{\pi_1 \quad \pi_2 \quad \dots \quad \Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \odot B} \circled{i} $$

depends on the elimination rules we allow in the context and on the way we reduce the proof

$$ \frac{\pi_1 \quad \pi_2 \quad \dots \quad \Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \odot B} \circled{i} \quad \Gamma, A \vdash C \quad \Gamma, B \vdash C}{\Gamma \vdash C} \circled{e} $$

If we allow the rule ⌜-e in the context, but neither ⌜-e1 nor ⌜-e2, and reduce this proof systematically to $(\pi_1/A)\pi_3$, then $\pi_1$ is accessible, but $\pi_2$ is not. If we reduce it systematically to $(\pi_2/B)\pi_4$, then $\pi_2$ is accessible, but $\pi_1$ is not. If we reduce it, in a non-deterministic way, to $(\pi_1/A)\pi_3$ or to $(\pi_2/B)\pi_4$, then both $\pi_1$ and $\pi_2$ are accessible, but in a non-deterministic way. If we allow the rule ⌜-e1 and ⌜-e2 in the context, then both proofs are accessible. Once more, the rule ⌜-i puts the proofs $\pi_1$ and $\pi_2$ in a box, whether the box can be opened and the proofs taken out of it, depends on the tools we use to open it.

When a connective has non-harmonious deduction rules, its introduction rules alone do not define its meaning, and neither do the elimination rules alone. The discrepancy between the meaning conferred by the introduction rules and the elimination rules, and the information loss it implies, are part of the meaning of such a connective.

While connectives with harmonious deduction rules model information-preservation, reversibility, and determinism, those with excessive deduction rules model information-erasure, non-reversibility, and non-determinism. In particular, the elimination rules ⌜-e1 and ⌜-e2 will be used to model information-preservation, reversibility, and determinism, while the elimination rule ⌜-e will be used to model information-erasure, non-reversibility, and non-determinism.

Such information-erasure, non-reversibility, and non-determinism, occur, for example, in quantum physics, where the measurement of the superposition of two states does not yield both states back.

## 2.4. Quantum computing and quantum languages

In classical computing, the simplest datatype is that of bits, that contains two elements 0 and 1. In quantum computing, (see [20] for a more comprehensive introduction) this datatype is replaced with that of qubits, that contains all linear combinations $\alpha|0\rangle + \beta|1\rangle$, of 0 and 1, then written $|0\rangle$ and $|1\rangle$, with complex coefficients $\alpha$ and $\beta$ such that $|\alpha|^2 + |\beta|^2 = 1$. Thus, this datatype of qubits contains the vectors of norm 1 of the vector space $\mathbb{C}^2$.

In classical computing, a more complex datatype is that of n-bits. The elements of this datatype are n-tuples formed with 0 and 1, for instance the datatype of 3-bits contains the 8 elements 000, 001, 010, 011, 100, 101, 110, and 111. In quantum computing, this datatype is replaced with that of n-qubits, that contains all linear combinations of norm 1 of these tuples. The elements of this datatype are thus vectors of norm 1 of $\mathbb{C}^{2^n}$. The canonical basis of $\mathbb{C}^{2^n}$ is made of the $2^n$ tuples formed with 0 and 1. For instance the canonical basis of $\mathbb{C}^8$ is $\{|000\rangle, |001\rangle, |010\rangle, |011\rangle, |100\rangle, |101\rangle, |110\rangle, |111\rangle\}$. These vectors can also be written $\{|0\rangle, |1\rangle, |2\rangle, |3\rangle, |4\rangle, |5\rangle, |6\rangle, |7\rangle\}$ identifying a natural number with its binary notation. More generally, the datatypes contain the vectors of norm 1 of some Hilbert space.

Quantum algorithms are formed with two ingredients: unitary transformations, that are linear transformations preserving inner product, and measurements, that are probabilistic operations. It is in fact enough to consider the projection to the canonical basis which acts as follows: the measurement of an arbitrary
qubit $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ yields the result 0 and transforms the qubit into $|0\rangle$ with probability $|\alpha|^2$ and yields the result 1 and transforms the qubit into $|1\rangle$ with probability $|\beta|^2$. More generally, the measurement of the first qubit of the n-qubit $\sum_{i=0}^{2^n-1} \alpha_i|i\rangle$ yields 0 and transforms it into

$$ \sum_{i=0}^{2^n-1} \frac{\alpha_i}{\| \sum_{i=0}^{2^n-1} \alpha_i |i\rangle \|} |i\rangle $$

with probability $\sum_{i=0}^{2^n-1} |\alpha_i|^2$, and yields 1 and transforms it into

$$ \sum_{i=2^{n-1}}^{2^n-1} \frac{\alpha_i}{\| \sum_{i=2^{n-1}}^{2^n-1} \alpha_i |i\rangle \|} |i\rangle $$

with probability $\sum_{i=2^{n-1}}^{2^n-1} |\alpha_i|^2$.

Measuring any other of the n-qubits involves the swapping unitary transformation and consist into swapping each qubit to measure with the first one, perform the measurement, and swapping it back.

Several programming languages have been proposed to express quantum algorithms, for example [1, 31, 35, 2, 3, 9, 6]. The design of such quantum programming languages raises two main questions. The first is to take into account the linearity of the unitary operators and, for instance, avoid cloning, and the second is to express the information-erasure, non-reversibility, and non-determinism of the measurement. The ⊙ connective gives a new solution to this second problem. Qubits can be seen as proofs of the proposition $\top \odot \top$, in contrast with bits which are proofs of $\top \lor \top$, and measurement can be easily expressed with the elimination rule ⊙-e (Section 5.5).

In previous works, we have attempted to formalize superposition and measurement in the λ-calculus. The calculus Lambda-S [9] contains a primitive constructor + and a primitive measurement symbol π, together with a rule reducing π(t + u), in a non-deterministic way, to t or to u. The superposition t + u can also be considered as the pair ⟨t, u⟩. Hence, it should have the type A ∧ A. In other words, it should be a proof of the proposition A ∧ A. In System I [4], various type-isomorphisms have been taken as identities, in particular the commutativity isomorphism A ∧ B ≡ B ∧ A, hence t + u ≡ u + t. In such a system, where A ∧ B and B ∧ A are identical, it is not possible to define the two elimination rules as the two usual projections rules π₁ and π₂ of the λ-calculus. They were replaced with a single projection parametrized with a proposition A: π_A, such that if t : A and u : B then π_A(t + u) reduces to t and π_B(t + u) to u. When A = B, hence t and u both have type A, the proof-term π_A(t + u) reduces, in a non-deterministic way, to t or to u, like a measurement operator.

These works on Lambda-S and System I brought to light the fact that the pair superposition / measurement, in a quantum programming language, behaves like a pair introduction / elimination, for some connective, in a proof language, as the succession of a superposition and a measurement yields a term that can be reduced. In System I, this connective was assumed to be a commutative conjunction, with a modified elimination rule, leading to a non-deterministic reduction.

But, as the measurement of the superposition of two states does not yield both states back, this connective should probably be excessive. Moreover, as, to prepare the superposition $\alpha_0|0\rangle + \beta_0|1\rangle$, we need both $|0\rangle$ and $|1\rangle$ and the measurement in the basis $|0\rangle$, $|1\rangle$ yields either $|0\rangle$ or $|1\rangle$, this connective should have the introduction rule of the conjunction, and the elimination rule of the disjunction. Hence, it should be the connective ⊙.

### 3. Intuitionistic propositional logic with ⊙

We consider an intuitionistic propositional logic with the usual connectives $\top$, $\bot$, $\Rightarrow$, $\land$, and $\lor$ (as usual, negation is defined as $\neg A = (A \Rightarrow \bot)$), and the extra connective $\odot$. The syntax of the propositions of this logic is

$$ A = \top | \bot | A \Rightarrow A | A \land A | A \lor A | A \odot A $$
$$ \frac{\Gamma \vdash A \qquad \frac{\Gamma \vdash A \quad \Gamma \vdash A}{\Gamma \vdash A} \qquad \frac{\Gamma \vdash A \quad \Gamma \vdash A}{\Gamma \vdash A} \qquad \Gamma \vdash A}{\Gamma \vdash A} \text{ axiom } A \in \Gamma $$

$$ \frac{\Gamma \vdash \top \quad \frac{\Gamma \vdash \top \quad \Gamma \vdash C}{\Gamma \vdash C} \quad \top-e}{\Gamma \vdash \top} \quad \frac{\Gamma \vdash \bot \quad \frac{\Gamma \vdash \bot \quad \Gamma \vdash C}{\Gamma \vdash C} \quad \bot-e}{\Gamma \vdash \bot} $$

$$ \frac{\Gamma, A \vdash B}{\Gamma \vdash A \Rightarrow B} \Rightarrow -i \qquad \frac{\Gamma \vdash A \Rightarrow B \quad \Gamma \vdash A}{\Gamma \vdash B} \Rightarrow -e $$

$$ \frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \wedge B} \quad \wedge-i \qquad \frac{\Gamma \vdash A \wedge B \quad \Gamma, A \vdash C}{\Gamma \vdash C} \quad \wedge-e1 \qquad \frac{\Gamma \vdash A \wedge B \quad \Gamma, B \vdash C}{\Gamma \vdash C} \quad \wedge-e2 $$

$$ \frac{\Gamma \vdash A}{\Gamma \vdash A \vee B} \quad \vee-i1 \qquad \frac{\Gamma \vdash B}{\Gamma \vdash A \vee B} \quad \vee-i2 \qquad \frac{\Gamma \vdash A \vee B \quad \Gamma, A \vdash C \quad \Gamma, B \vdash C}{\Gamma \vdash C} \quad \vee-e $$

$$ \frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \odot B} \quad \odot-i \qquad \frac{\Gamma \vdash A \odot B \quad \Gamma, A \vdash C \quad \Gamma, B \vdash C}{\Gamma \vdash C} \quad \odot-e $$

$$ \frac{\Gamma \vdash A \odot B \quad \Gamma, A \vdash C}{\Gamma \vdash C} \quad \odot-e1 \qquad \frac{\Gamma \vdash A \odot B \quad \Gamma, B \vdash C}{\Gamma \vdash C} \quad \odot-e2 $$

<caption>**Figure 1:** The deduction rules of intuitionistic propositional logic with ⊙</caption>

For simplicity, we have not included propositional constants in this syntax, so $\top \Rightarrow \top$ is a proposition, but $P \Rightarrow P$ is not. Adding such constants only requires minors modifications in the proofs below.

The deduction rules are given in Figure 1. We use the generalized elimination rules for all connectives, except implication, for which the elimination rule is the usual *modus ponens*. This yields the usual application in the language of proof-terms, making the examples more readable.

The rules axiom, $\top$-i, $\top$-e, $\bot$-e, $\Rightarrow$-i, $\Rightarrow$-e, $\wedge$-i, $\wedge$-e1, $\wedge$-e2, $\vee$-i1, $\vee$-i2, and $\vee$-e are the usual rules of intuitionistic propositional logic. The rules $\odot$-i, $\odot$-e, $\odot$-e1, and $\odot$-e2 are those of the connective $\odot$. We also added two rules

$$ \frac{\Gamma \vdash A \quad \Gamma \vdash A}{\Gamma \vdash A} \text{ sum} $$

$$ \frac{\Gamma \vdash A}{\Gamma \vdash A} \text{ prod} $$

whose premises are identical to their conclusion. Although these rules are logically trivial, they introduce constructors in the proof language that will be of key importance when we extend the calculus with scalars, in Section 4. These rules are called *interstitial* as, as we shall see, they can create an interstice between the introduction rule of some connective and its elimination rule.

### 3.1. *Proof reduction*

The reduction rules in this logic are the usual ones for the connectives $\Rightarrow$, $\wedge$, and $\vee$, except that we use the generalized elimination rules for the conjunction.

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3}{\Gamma, A \vdash B \quad \Rightarrow -i \quad \Gamma \vdash A \quad \Rightarrow -e} \qquad \text{that reduces to} \qquad (\pi_2/A)\pi_1 $$

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3}{\frac{\Gamma \vdash A \quad \Gamma \vdash B}{\Gamma \vdash A \wedge B} \quad \wedge-i \quad \Gamma, A \vdash C}{\Gamma \vdash C} \quad \wedge-e1} \qquad \text{that reduces to} \qquad (\pi_1/A)\pi_3 $$
$$ \frac{\pi_1 \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots}{\frac{\Gamma \vdash A \quad \Gamma \vdash B \quad \dots}{\Gamma \vdash A \wedge B} \quad \Lambda^{-i} \quad \Gamma, B \vdash C \quad \Lambda^{-e2}} $$ that reduces to $(\pi_2/B)\pi_3$

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots}{\frac{\Gamma \vdash A \quad \dots \quad \Gamma, A \vdash C \quad \dots \quad \Gamma, B \vdash C \quad \dots}{\Gamma \vdash A \lor B \quad \Upsilon^{-i1} \quad \Gamma \vdash C \quad \Upsilon^{-e}}} $$ that reduces to $(\pi_1/A)\pi_2$

and

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots}{\frac{\Gamma \vdash B \quad \dots \quad \Gamma, A \vdash C \quad \dots \quad \Gamma, B \vdash C \quad \dots}{\Gamma \vdash A \lor B \quad \Upsilon^{-i2} \quad \Gamma \vdash C \quad \Upsilon^{-e}}} $$ that reduces to $(\pi_1/B)\pi_3$

For the connective $\vdash$, we have decided to take an elimination rule. This introduces a notion of reducible proof for the connective $\vdash$

$$ \frac{\overline{\Gamma \vdash \top} \quad \top^{-i} \quad \Gamma \vdash C \quad \dots \quad \pi \quad \dots}{\Gamma \vdash C} \quad \top^{-e} $$ and it reduces to $\frac{\pi \quad \dots}{\Gamma \vdash C} \quad \text{prod}$

that is to $\pi$ with an added interstitial rule. The role of this prod rule will be made clear when we add scalars.

The reduction rules of the connective $\odot$ are, as we have seen

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots \quad \pi_4 \quad \dots}{\frac{\Gamma \vdash A \quad \Gamma \vdash B \quad \dots}{\Gamma \vdash A \odot B} \quad \odot^{-i} \quad \Gamma, A \vdash C \quad \Gamma, B \vdash C \quad \dots} \quad \odot^{-e} $$ that reduces to $(\pi_1/A)\pi_3$ and $(\pi_2/B)\pi_4$

in a non-deterministic way, erasing some information

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots}{\frac{\Gamma \vdash A \quad \Gamma \vdash B \quad \dots}{\Gamma \vdash A \odot B} \quad \odot^{-i} \quad \Gamma, A \vdash C \quad \dots} \quad \odot^{-e1} $$ that reduces to $(\pi_1/A)\pi_3$

and

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots}{\frac{\Gamma \vdash A \quad \Gamma \vdash B \quad \dots}{\Gamma \vdash A \odot B} \quad \odot^{-i} \quad \Gamma, B \vdash C \quad \dots} \quad \odot^{-e2} $$ that reduces to $(\pi_2/A)\pi_3$

Finally, adding the interstitial rules, permits to build proofs that cannot be reduced, because the sum rule or the prod rule creates an interstice between the introduction rule of some connective and its elimination rule. For example

$$ \frac{\pi_1 \quad \dots \quad \pi_2 \quad \dots \quad \pi_3 \quad \dots \quad \pi_4 \quad \dots}{\frac{\Gamma \vdash A \quad \Gamma \vdash B \quad \dots}{\Gamma \vdash A \wedge B} \quad \Lambda^{-i} \quad \frac{\Gamma \vdash A \quad \Gamma \vdash B \quad \dots}{\Gamma \vdash A \wedge B} \quad \Lambda^{-i} \quad \sum \quad \Gamma, A \vdash C \quad \Lambda^{-e1}} $$
Reducing such a proof requires rules to commute the rule sum either with the elimination rule below or with the introduction rules above.

As the commutation with the introduction rules above is not always possible, for example in the proof

$$ \frac{\frac{\pi_1 \quad \dots \quad \Gamma \vdash A}{\Gamma \vdash A \lor B} \quad \dots \quad \pi_2 \quad \dots \quad \Gamma \vdash B}{\Gamma \vdash A \lor B} \quad \sum \text{v-i1} \quad \sum \text{v-i2} \\ \sum \text{sum} $$

the commutation with the elimination rule below is often preferred. In this paper, we favour the commutation of the interstitial rules with the introduction rules, rather than with the elimination rules, whenever it is possible, that is for all connectives except disjunction. For example the proof

$$ \frac{\frac{\pi_1 \quad \dots \quad \Gamma \vdash A \quad \dots \quad \pi_2 \quad \dots \quad \Gamma \vdash B}{\Gamma \vdash A \land B} \quad \dots \quad \pi_3 \quad \dots \quad \Gamma \vdash A \quad \dots \quad \pi_4 \quad \dots \quad \Gamma \vdash B}{\Gamma \vdash A \land B} \quad \sum \text{v-i} \quad \sum \text{sum} $$

reduces to

$$ \frac{\frac{\pi_1 \quad \dots \quad \Gamma \vdash A \quad \dots \quad \pi_3 \quad \dots \quad \Gamma \vdash A}{\Gamma \vdash A} \quad \dots \quad \pi_2 \quad \dots \quad \Gamma \vdash B}{\Gamma \vdash A \land B} \quad \sum \text{sum} \quad \frac{\pi_4 \quad \dots \quad \Gamma \vdash B \quad \dots \quad \Gamma \vdash B}{\Gamma \vdash B} \quad \sum \text{sum} $$

Such a commutation yields a stronger introduction property for the considered connective (Theorem 3.32). In the proof

$$ \frac{\pi \quad \dots \quad \frac{\Gamma \vdash A}{\Gamma \vdash A \lor B} \quad \dots \quad \pi \quad \dots \quad \frac{\Gamma \vdash A \lor B}{\Gamma \vdash A \land B}}{\Gamma \vdash A \land B} \quad \sum \text{v-i1} \quad \sum \text{prod} $$

the prod rule and the v-i1 rule can be commuted. For coherence, we have decided to commute both the sum rule and the prod rule with the elimination rule of the disjunction, rather that with its introduction rules, but both choices are possible.

### 3.2. Proof-terms

We introduce a term language, the ⊙-calculus, for the proofs of this logic. Its syntax is

$$ t = x \mid t \oplus t \mid \bullet t \mid \star \mid \delta_{\top}(t, t) \mid \delta_{\bot}(t) \\ \mid \lambda x.t \mid t \mid t \mid \langle t, t \rangle \mid \delta_{\wedge}^{1}(t, x.t) \mid \delta_{\wedge}^{2}(t, x.t) \\ \mid inl(t) \mid inr(t) \mid \delta_{\vee}(t, x.t, x.t) \\ \mid [t, t] \mid \delta_{\odot}(t, x.t, x.t) \mid \delta_{\odot}^{1}(t, x.t) \mid \delta_{\odot}^{2}(t, x.t) $$

The variables x express the proofs built with the rule axiom, the terms t + u those built with the rule sum, the terms • t those built with the rule prod, the term ★ that built with the rule ⊤-i, the terms δ_⊤(t, u) those built with the rule ⊤-e, the terms δ_⊥(t) those built with the rule ⊥-e, the terms λx.t those built with the rule ⇒-i, the terms t u those built with the rule ⇒-e, the terms ⟨t, u⟩ those built with the rule ∧-i, the terms δ_∧₁(t, x.u) and δ_∧₂(t, x.u) those built with the rules ∧-e1 and ∧-e2, the terms inl(t) and inr(t) those built with the rules ∨-i1 and ∨-i2, the terms δ_∨(t, x.u, y.v) those built with the rule ∨-e, the terms [t, u] those built with the rule ⊙-i, and the terms δ_⊙(t, x.u, y.v), δ_⊙₁(t, x.u), and δ_⊙₂(t, x.u) those built with the rules ⊙-e, ⊙-e1, and ⊙-e2.
$$ \overline{\Gamma \vdash x : A} \quad \text{axiom} \quad x : A \in \Gamma \quad \frac{\Gamma \vdash t : A \quad \Gamma \vdash u : A}{\Gamma \vdash t \boldsymbol{+} u : A} \quad \text{sum} \quad \frac{\Gamma \vdash t : A}{\Gamma \vdash \bullet t : A} \quad \text{prod} $$

$$ \frac{}{\Gamma \vdash \star : \top} \quad \top\text{-i} \quad \frac{\Gamma \vdash t : \top \quad \Gamma \vdash u : C}{\Gamma \vdash \delta_{\top}(t, u) : C} \quad \top\text{-e} \quad \frac{\Gamma \vdash t : \bot}{\Gamma \vdash \delta_{\bot}(t) : C} \quad \bot\text{-e} $$

$$ \frac{\Gamma, x : A \vdash t : B}{\Gamma \vdash \lambda x.t : A \Rightarrow B} \Rightarrow \text{-i} \quad \frac{\Gamma \vdash t : A \Rightarrow B \quad \Gamma \vdash u : A}{\Gamma \vdash t u : B} \Rightarrow \text{-e} $$

$$ \frac{\Gamma \vdash t : A \quad \Gamma \vdash u : B}{\Gamma \vdash \langle t, u \rangle : A \wedge B} \quad \wedge\text{-i} $$

$$ \frac{\Gamma \vdash t : A \wedge B \quad \Gamma, x : A \vdash u : C}{\Gamma \vdash \delta_{\wedge}^{1}(t, x.u) : C} \quad \wedge\text{-e1} \quad \frac{\Gamma \vdash t : A \wedge B \quad \Gamma, x : B \vdash u : C}{\Gamma \vdash \delta_{\wedge}^{2}(t, x.u) : C} \quad \wedge\text{-e2} $$

$$ \frac{}{\Gamma \vdash inl(t) : A \vee B} \quad \vee\text{-i1} \quad \frac{}{\Gamma \vdash inr(t) : A \vee B} \quad \vee\text{-i2} $$

$$ \frac{\Gamma \vdash t : A \vee B \quad \Gamma, x : A \vdash u : C \quad \Gamma, y : B \vdash v : C}{\Gamma \vdash \delta_{\vee}(t, x.u, y.v) : C} \quad \vee\text{-e} $$

$$ \frac{\Gamma \vdash t : A \quad \Gamma \vdash u : B}{\Gamma \vdash [t, u] : A \odot B} \quad \odot\text{-i} $$

$$ \frac{\Gamma \vdash t : A \odot B \quad \Gamma, x : A \vdash u : C \quad \Gamma, y : B \vdash v : C}{\Gamma \vdash \delta_{\odot}(t, x.u, y.v) : C} \quad \odot\text{-e} $$

$$ \frac{\Gamma \vdash t : A \odot B \quad \Gamma, x : A \vdash u : C}{\Gamma \vdash \delta_{\odot}^{1}(t, x.u) : C} \quad \odot\text{-e1} \quad \frac{\Gamma \vdash t : A \odot B \quad \Gamma, x : B \vdash u : C}{\Gamma \vdash \delta_{\odot}^{2}(t, x.u) : C} \quad \odot\text{-e2} $$

<caption>**Figure 2:** The typing rules of the ⊙-calculus</caption>

The proofs of the form $\star$, $\lambda x.t$, $\langle t, u \rangle$, $inl(t)$, $inr(t)$, and $[t, u]$ are called *introductions*, and those of the form $\delta_{\top}(t, u)$, $\delta_{\bot}(t)$, $t u$, $\delta_{\wedge}^{1}(t, x.u)$, $\delta_{\wedge}^{2}(t, x.u)$, $\delta_{\vee}(t, x.u, y.v)$, $\delta_{\odot}^{1}(t, x.u)$, and $\delta_{\odot}^{2}(t, x.u)$ *eliminations*. The variables and the proofs of the form $t \boldsymbol{+} u$ and $\bullet t$ are neither introductions nor eliminations.

The $\alpha$-equivalence relation and the free and bound variables of a proof-term are defined as usual. Proof-terms are defined modulo $\alpha$-equivalence. A proof-term is closed if it contains no free variables. We write $(u/x)t$ for the substitution of $u$ for $x$ in $t$.

The typing rules of the ⊙-calculus are given in Figure 2 and its reduction rules in Figure 3, they are the expression on proof-terms of the reduction rules presented above. An instance of the second rule of Figure 3 is

$$ (\lambda x.x) y \rightarrow y $$

and an instance of the third is

$$ \delta_{\wedge}^{1}(\langle \star, \star \rangle, x.x) \rightarrow \star $$

In this paper, we consider the usual reduction rules for natural deduction, but not the so-called *commuting cuts*, that yield the subformula property and the equivalence with cut-free sequent calculus. Although we believe proving the termination with commuting cuts is not difficult (in particular because we have included ultra-reduction rules), we leave this for future work.

**Remark 3.1.** This system is a higher-order rewrite system [13, 16]. A more rigorous notation would be to consider the symbol . as the abstraction, to add a symbol app for application, and to add a rewrite rule $\beta$, $app(x.t, u) \rightarrow (u/x)t$ used to build the instances of the rules of Figure 3.

Hence, the second rule of Figure 3 would be expressed as

$$ (\lambda x.\text{app}(T, x)) U \rightarrow \text{app}(T, U) $$
<figure><img src="image_3.png" /><figcaption>**Figure 3:** The reduction rules of the ⊙-calculus</figcaption></figure>

the third as

$$ \delta_{\wedge}^{1}(\langle T, U \rangle, x.\text{app}(V, x)) \rightarrow \text{app}(V, T) $$

etc.

Substituting the proof x.x for the variable T and the proof y for the variable U in the first rule and reducing, with the added rule, both sides of the rule yields the instance

$$ (\lambda x.x) y \rightarrow y $$

and substituting ⋆ for the variables T and U and the proof x.x for the variable V, in the second, and reducing both sides of the rule, with the added rule, yields the instance

$$ \delta_{\wedge}^{1}(\langle \star, \star \rangle, x.x) \rightarrow \star $$

etc.

### 3.3. Subject reduction

To prove subject reduction, we first prove, as usual, a substitution property.

**Proposition 3.2 (Substitution).** If Γ, x : B ⊢ t : A and Γ ⊢ u : B, then Γ ⊢ (u/x)t : A.

*Proof.* By induction on the structure of t.

☐

And use it to prove the theorem itself.

**Theorem 3.3 (Subject reduction).** If Γ ⊢ t : A and t —> u, then Γ ⊢ u : A.

*Proof.* By induction on the definition of the relation —>.

☐
### 3.4. Confluence

The introduction of the connective $\odot$ leads to a non-deterministic calculus with the rules

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (t/x)v $$

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (u/y)w $$

Hence, the system presented in Figure 3 is trivially non-confluent. But if we drop these two rules, the rest of the system is confluent.

**Theorem 3.4 (Confluence).** *The system of Figure 3 without the rules*

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (t/x)v $$

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (u/y)w $$

is confluent.

*Proof.* This system is left linear and it has no critical pairs. And, as proved in [16, Theorem 6.8], higher-order left linear systems without critical pairs are confluent. □

Note that the untyped calculus does have critical pairs, for example the proof $\delta_{\vee}(\star\star, x.x, y.y)$ reduces in two different ways, but these critical pairs are not well-typed.

### 3.5. Termination

We now prove the strong termination of proof reduction, that is that all reduction sequences are finite. The proof follows the same pattern as that for intuitionistic propositional natural deduction, that we recall in the Appendix.

The $\odot$-calculus introduces two new features: the connective $\odot$, its associated proof constructors $[\cdot]$, $\delta_{\odot}$, $\delta_{\odot}^1$, and $\delta_{\odot}^2$, and the constructors $\star$ and $\bullet$. The termination proof of intuitionistic propositional natural deduction extends smoothly when we add the connective $\odot$, but adding the constructors $\star$ and $\bullet$ is a bit more challenging. To handle these symbols, we prove the strong termination of an extended reduction system, in the spirit of Girard's ultra-reduction [11], whose strong termination obviously implies that of the rules of Figure 3.

**Definition 3.5 (Ultra-reduction).** *Ultra-reduction is defined with the rules of Figure 3, plus the rules*

$$ t \star u \rightarrow t $$

$$ t \star u \rightarrow u $$

$$ \bullet t \rightarrow t $$

In the proof below, Propositions 3.10, 3.15, 3.16, 3.17, 3.18, 3.19, 3.22, 3.23, 3.24, and 3.25 have the same proofs as Propositions Appendix A.6, Appendix A.9, Appendix A.10, Appendix A.11, Appendix A.12, Appendix A.13, Appendix A.15, Appendix A.16, Appendix A.17, and Appendix A.18 in the strong termination of proof reduction for intuitionistic propositional natural deduction (except that the references to Propositions Appendix A.6, Appendix A.7, and Appendix A.8 must be replaced with references to Propositions 3.10, 3.11, and 3.12). So we will omit these proofs. Propositions 3.11, 3.12, 3.21, and 3.26 have proofs similar to those of Propositions Appendix A.7, Appendix A.8, Appendix A.14, and Appendix A.19, but these proofs require minor tweaks. In contrast, Propositions 3.7, 3.8, 3.13, 3.14, 3.20, 3.27, 3.28, and 3.29 are specific.

**Definition 3.6 (Length of reduction).** *If $t$ is a strongly terminating proof, we write $|t|$ for the maximum length of a reduction sequence issued from $t$.*

**Proposition 3.7 (Termination of a sum).** *If $t$ and $u$ strongly terminate, then so does $t \star u$.*
*Proof.* We prove that all the one-step reducts of $t \boldsymbol{+} u$ strongly terminate, by induction first on $|t| + |u|$ and then on the size of $t$.

If the reduction takes place in $t$ or in $u$ we apply the induction hypothesis. Otherwise the reduction is at the root and the rule used is either

$$ 
\begin{align*}
& \star \boldsymbol{+} \star \rightarrow \star \\
& (\lambda x.t') \boldsymbol{+} (\lambda x.u') \rightarrow \lambda x.(t' \boldsymbol{+} u') \\
& \langle t'_1, t'_2 \rangle \boldsymbol{+} \langle u'_1, u'_2 \rangle \rightarrow \langle t'_1 \boldsymbol{+} u'_1, t'_2 \boldsymbol{+} u'_2 \rangle \\
& [t'_1, t'_2] \boldsymbol{+} [u'_1, u'_2] \rightarrow [t'_1 \boldsymbol{+} u'_1, t'_2 \boldsymbol{+} u'_2] \\
& t \boldsymbol{+} u \rightarrow t \\
& t \boldsymbol{+} u \rightarrow u
\end{align*}
$$

In the first case, the proof $\star$ is irreducible, hence it strongly terminates. In the second, by induction hypothesis, the proof $t' \boldsymbol{+} u'$ strongly terminates, thus so does the proof $\lambda x.(t' \boldsymbol{+} u')$. In the third and the fourth, by induction hypothesis, the proofs $t'_1 \boldsymbol{+} u'_1$ and $t'_2 \boldsymbol{+} u'_2$ strongly terminate, hence so do the proofs $\langle t'_1 \boldsymbol{+} u'_1, t'_2 \boldsymbol{+} u'_2 \rangle$ and $[t'_1 \boldsymbol{+} u'_1, t'_2 \boldsymbol{+} u'_2]$. In the fifth and the sixth, the proofs $t$ and $u$ strongly terminate. $\square$

**Proposition 3.8 (Termination of a product).** If $t$ strongly terminates, then so does $\bullet t$.

*Proof.* We prove that all the one-step reducts of $\bullet t$ strongly terminate, by induction first on $|t|$ and then on the size of $t$.

If the reduction takes place in $t$, we apply the induction hypothesis. Otherwise the reduction is at the root and the rule used is either

$$ 
\begin{align*}
& \bullet \star \rightarrow \star \\
& \bullet (\lambda x.t') \rightarrow \lambda x. \bullet t' \\
& \bullet \langle t'_1, t'_2 \rangle \rightarrow \langle \bullet t'_1, \bullet t'_2 \rangle \\
& \bullet [t'_1, t'_2] \rightarrow [\bullet t'_1, \bullet t'_2] \\
& \bullet t \rightarrow t
\end{align*}
$$

In the first case, the proof $\star$ is irreducible, hence it strongly terminates. In the second, by induction hypothesis, the proof $\bullet t'$ strongly terminates, thus so does the proof $\lambda x. \bullet t'$. In the third and the fourth, by induction hypothesis, the proofs $\bullet t'_1$ and $\bullet t'_2$ strongly terminate, hence so do the proofs $\langle \bullet t'_1, \bullet t'_2 \rangle$ and $[\bullet t'_1, \bullet t'_2]$. In the fifth, the proof $t$ strongly terminates. $\square$

**Definition 3.9.** We define, by induction on the proposition A, a set of proofs $[[A]]$:

* $t \in [[\top]]$ if $t$ strongly terminates,

* $t \in [[\bot]]$ if $t$ strongly terminates,

* $t \in [[A \Rightarrow B]]$ if $t$ strongly terminates and whenever it reduces to a proof of the form $\lambda x.u$, then for every $v \in [[A]]$, $(v/x)u \in [[B]]$,

* $t \in [[A \wedge B]]$ if $t$ strongly terminates and whenever it reduces to a proof of the form $\langle u, v \rangle$, then $u \in [[A]]$ and $v \in [[B]]$,

* $t \in [[A \vee B]]$ if $t$ strongly terminates and whenever it reduces to a proof of the form $\mathrm{inl}(u)$, then $u \in [[A]]$, and whenever it reduces to a proof of the form $\mathrm{inr}(v)$, then $v \in [[B]]$,

* $t \in [[A \odot B]]$ if $t$ strongly terminates and whenever it reduces to a proof of the form $[u, v]$, then $u \in [[A]]$ and $v \in [[B]]$.

**Proposition 3.10 (Variables).** For any A, the set $[[A]]$ contains all the variables.
**Proposition 3.11** (Closure by reduction). If $t \in [A]$ and $t \to^* t'$, then $t' \in [A]$.

*Proof.* If $t \to^* t'$ and $t$ strongly terminates, then $t'$ strongly terminates.

Furthermore, if A has the form $B \Rightarrow C$ and $t'$ reduces to $\lambda x.u$, then so does $t$, hence for every $v \in [B]$,
$(v/x)u \in [C]$.

If A has the form $B \wedge C$ and $t'$ reduces to $\langle u, v \rangle$, then so does $t$, hence $u \in [B]$ and $v \in [C]$.

If A has the form $B \vee C$ and $t'$ reduces to $inl(u)$, then so does $t$, hence $u \in [B]$ and if A has the form $B \vee C$ and $t'$ reduces to $inr(v)$, then so does $t$, hence $v \in [C]$.

And if A has the form $B \odot C$ and $t'$ reduces to $[u, v]$, then so does $t$, hence $u \in [B]$ and $v \in [C]$. $\square$

**Proposition 3.12** (Girard's lemma). Let $t$ be a proof that is not an introduction, such that all the one-step reducts of $t$ are in $[A]$. Then, $t \in [A]$.

*Proof.* Let $t, t_2, \dots$ be a reduction sequence issued from $t$. If it has a single element, it is finite. Otherwise, we have $t \to t_2$. As $t_2 \in [A]$, it strongly terminates and the reduction sequence is finite. Thus, $t$ strongly terminates.

Furthermore, if A has the form $B \Rightarrow C$ and $t \to^* \lambda x.u$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $\lambda x.u$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \to t_2 \to^* t_n$. We have $t_2 \in [A]$, thus for all $v \in [B]$, $(v/x)u \in [C]$.

If A has the form $B \wedge C$ and $t \to^* \langle u, v \rangle$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $\langle u, v \rangle$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \to t_2 \to^* t_n$. We have $t_2 \in [A]$, thus $u \in [B]$ and $v \in [C]$.

If A has the form $B \vee C$ and $t \to^* inl(u)$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $inl(u)$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \to t_2 \to^* t_n$. We have $t_2 \in [A]$, thus $u \in [B]$.

If A has the form $B \wedge C$ and $t \to^* inr(v)$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $inr(v)$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \to t_2 \to^* t_n$. We have $t_2 \in [A]$, thus $v \in [C]$.

And if A has the form $B \odot C$ and $t \to^* [u, v]$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $[u, v]$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \to t_2 \to^* t_n$. We have $t_2 \in [A]$, thus $u \in [B]$ and $v \in [C]$. $\square$

In Propositions 3.13 to 3.29, we prove the adequacy of each proof constructor.

**Proposition 3.13** (Adequacy of $+$). If $t_1 \in [A]$ and $t_2 \in [A]$, then $t_1 + t_2 \in [A]$.

*Proof.* By induction on A.

The proofs $t_1$ and $t_2$ strongly terminate. Thus, by Proposition 3.7, the proof $t_1 + t_2$ strongly terminates. Furthermore:

* If the proposition A has the form $B \Rightarrow C$, and $t_1 + t_2 \to^* \lambda x.v$ then either $t_1 \to^* \lambda x.u_1$, $t_2 \to^* \lambda x.u_2$, and $u_1 + u_2 \to^* v$, or $t_1 \to^* \lambda x.v$, or $t_2 \to^* \lambda x.v$.

In the first case, by Proposition 3.11, the proofs $\lambda x.u_1$ and $\lambda x.u_2$ are in $[A]$. Thus, for every $w$ in $[B]$, $(w/x)u_1 \in [C]$ and $(w/x)u_2 \in [C]$. By induction hypothesis, $(w/x)(u_1 + u_2) = (w/x)u_1 + (w/x)u_2 \in [C]$ and by Proposition 3.11, $(w/x)v \in [C]$.

In the second and the third, by Proposition 3.11, $\lambda x.v \in [A]$ hence, for every $w$ in $[B]$, $(w/x)v \in [C]$.

* If the proposition A has the form $B \wedge C$, and $t_1 + t_2 \to^* \langle v, v' \rangle$ then $t_1 \to^* \langle u_1, u'_1 \rangle$, $t_2 \to^* \langle u_2, u'_2 \rangle$, $u_1 + u_2 \to^* v$, and $u'_1 + u'_2 \to^* v'$, or $t_1 \to^* \langle v, v' \rangle$, or $t_2 \to^* \langle v, v' \rangle$.

In the first case, by Proposition 3.11, the proofs $\langle u_1, u'_1 \rangle$ and $\langle u_2, u'_2 \rangle$ are in $[A]$. Thus, $u_1$ and $u_2$ are in $[B]$ and $u'_1$ and $u'_2$ are in $[C]$. By induction hypothesis, $u_1 + u_2 \in [B]$ and $u'_1 + u'_2 \in [C]$ and by Proposition 3.11, $v \in [B]$ and $v' \in [C]$.

In the second and the third, by Proposition 3.11, $\langle v, v' \rangle \in [A]$ hence, $v \in [B]$ and $v' \in [C]$.
* If the proposition A has the form $B \lor C$, and $t_1 \bullet t_2 \to^* inl(v)$ then $t_1 \to^* inl(v)$ or $t_2 \to^* inl(v)$. Thus, by Proposition 3.11, $inl(v) \in [[A]]$, hence $v \in [[B]]$.

The proof is similar if $t_1 \bullet t_2 \to^* inr(v)$.

* If the proposition A has the form $B \odot C$, and $t_1 \bullet t_2 \to^* [v, v']$ then $t_1 \to^* [u_1, u'_1]$, $t_2 \to^* [u_2, u'_2]$, $u_1 \bullet u_2 \to^* v$, and $u'_1 \bullet u'_2 \to^* v'$, or $t_1 \to^* [v, v']$, or $t_2 \to^* [v, v']$.

In the first case, by Proposition 3.11, the proofs $[u_1, u'_1]$ and $[u_2, u'_2]$ are in $[[A]]$. Thus, $u_1$ and $u_2$ are in $[[B]]$ and $u'_1$ and $u'_2$ are in $[[C]]$. By induction hypothesis, $u_1 \bullet u_2 \in [[B]]$ and $u'_1 \bullet u'_2 \in [[C]]$ and by Proposition 3.11, $v \in [[B]]$ and $v' \in [[C]]$.

In the second and the third, by Proposition 3.11, $[v, v'] \in [[A]]$ hence, $v \in [[B]]$ and $v' \in [[C]]$. $\square$

**Proposition 3.14** (Adequacy of $\bullet$). If $t \in [[A]]$, then $\bullet t \in [[A]]$.

*Proof.* By induction on A.

The proofs $t$ strongly terminates. Thus, by Proposition 3.8, the proof $\bullet t$ strongly terminates.
Furthermore:

* If the proposition A has the form $B \Rightarrow C$, and $\bullet t \to^* \lambda x.v$ then either $t \to^* \lambda x.u$, and $\bullet u \to^* v$, or $t \to^* \lambda x.v$.

In the first case, by Proposition 3.11, the proof $\lambda x.u$ is in $[[A]]$. Thus, for every $w$ in $[[B]]$, $(w/x)u \in [[C]]$. By induction hypothesis, $(w/x) \bullet u = \bullet (w/x)u \in [[C]]$ and by Proposition 3.11, $(w/x)v \in [[C]]$.

In the second, by Proposition 3.11, $\lambda x.v \in [[A]]$ hence, for every $w$ in $[[B]]$, $(w/x)v \in [[C]]$.

* If the proposition A has the form $B \land C$, and $\bullet t \to^* \langle v, v' \rangle$ then $t \to^* \langle u, u' \rangle$, $\bullet u \to^* v$, and $\bullet u' \to^* v'$, or $t \to^* \langle v, v' \rangle$.

In the first case, by Proposition 3.11, the proof $\langle u, u' \rangle$ is in $[[A]]$. Thus, $u$ is in $[[B]]$ and $u'$ is in $[[C]]$. By induction hypothesis, $\bullet u \in [[B]]$ and $\bullet u' \in [[C]]$ and by Proposition 3.11, $v \in [[B]]$ and $v' \in [[C]]$.

In the second, by Proposition 3.11, $\langle v, v' \rangle \in [[A]]$ hence, $v \in [[B]]$ and $v' \in [[C]]$.

* If the proposition A has the form $B \lor C$, and $\bullet t \to^* inl(v)$ then $t \to^* inl(v)$. Thus, by Proposition 3.11, $inl(v) \in [[A]]$, hence $v \in [[B]]$.

The proof is similar if $\bullet t \to^* inr(v)$.

* If the proposition A has the form $B \odot C$, and $\bullet t \to^* [v, v']$ then $t \to^* [u, u']$, $\bullet u \to^* v$, and $\bullet u' \to^* v'$, or $t \to^* [v, v']$.

In the first case, by Proposition 3.11, the proofs $[u, u']$ is in $[[A]]$. Thus, $u$ is in $[[B]]$ and $u'$ is in $[[C]]$. By induction hypothesis, $\bullet u \in [[B]]$ and $\bullet u' \in [[C]]$ and by Proposition 3.11, $v \in [[B]]$ and $v' \in [[C]]$.

In the second, by Proposition 3.11, $[v, v'] \in [[A]]$ hence, $v \in [[B]]$ and $v' \in [[C]]$. $\square$

**Proposition 3.15** (Adequacy of $\star$). We have $\star \in [[\top]]$.

**Proposition 3.16** (Adequacy of $\lambda$). If, for all $u \in [[A]]$, $(u/x)t \in [[B]]$, then $\lambda x.t \in [[A \Rightarrow B]]$.

**Proposition 3.17** (Adequacy of $\langle, \rangle$). If $t_1 \in [[A]]$ and $t_2 \in [[B]]$, then $\langle t_1, t_2 \rangle \in [[A \land B]]$.

**Proposition 3.18** (Adequacy of $inl$). If $t \in [[A]]$, then $inl(t) \in [[A \lor B]]$.

**Proposition 3.19** (Adequacy of $inr$). If $t \in [[B]]$, then $inr(t) \in [[A \lor B]]$.

**Proposition 3.20** (Adequacy of $[ , ]$). If $t_1 \in [[A]]$ and $t_2 \in [[B]]$, then $[t_1, t_2] \in [[A \odot B]]$.

*Proof.* The proofs $t_1$ and $t_2$ strongly terminate. Consider a reduction sequence issued from $[t_1, t_2]$. This sequence can only reduce $t_1$ and $t_2$, hence it is finite. Thus, $[t_1, t_2]$ strongly terminates.

Furthermore, if $[t_1, t_2] \to^* [t'_1, t'_2]$, then $t_1 \to^* t'_1$ and $t_2 \to^* t'_2$. By Proposition 3.11, $t'_1 \in [[A]]$ and $t'_2 \in [[B]]$. $\square$
**Proposition 3.21** (Adequacy of $\delta_\top$). If $t_1 \in [\top]$ and $t_2 \in [C]$, then $\delta_\top(t_1, t_2) \in [C]$.

*Proof.* The proofs $t_1$ and $t_2$ strongly terminate. We prove, by induction on $|t_1| + |t_2|$, that $\delta_\top(t_1, t_2) \in [C]$. Using Proposition 3.12, we only need to prove that every of its one step reducts is in $[C]$. If the reduction takes place in $t_1$ or $t_2$, then we apply Proposition 3.11 and the induction hypothesis.

Otherwise, the proof $t_1$ is $\star$ and the reduct is $\bullet t_2$. We conclude with Proposition 3.14. $\square$

**Proposition 3.22** (Adequacy of $\delta_\perp$). If $t \in [\perp]$, then $\delta_\perp(t) \in [C]$.

**Proposition 3.23** (Adequacy of application). If $t_1 \in [A \Rightarrow B]$ and $t_2 \in [A]$, then $t_1 \ \& \ t_2 \in [B]$.

**Proposition 3.24** (Adequacy of $\delta_\wedge^1$). If $t_1 \in [A \wedge B]$ and, for all $u$ in $[A]$, $(u/x)t_2 \in [C]$, then $\delta_\wedge^1(t_1, x.t_2) \in [C]$.

**Proposition 3.25** (Adequacy of $\delta_\wedge^2$). If $t_1 \in [A \wedge B]$ and, for all $u$ in $[B]$, $(u/x)t_2 \in [C]$, then $\delta_\wedge^2(t_1, x.t_2) \in [C]$.

**Proposition 3.26** (Adequacy of $\delta_\vee$). If $t_1 \in [A \vee B]$, for all $u$ in $[A]$, $(u/x)t_2 \in [C]$, and, for all $v$ in $[B]$, $(v/y)t_3 \in [C]$, then $\delta_\vee(t_1, x.t_2, y.t_3) \in [C]$.

*Proof.* By Proposition 3.10, $x \in [A]$, thus $t_2 = (x/x)t_2 \in [C]$. In the same way, $t_3 \in [C]$. Hence, $t_1, t_2$, and $t_3$ strongly terminate. We prove, by induction on $|t_1| + |t_2| + |t_3|$, that $\delta_\vee(t_1, x.t_2, y.t_3) \in [C]$. Using Proposition 3.12, we only need to prove that every of its one step reducts is in $[C]$. If the reduction takes place in $t_1, t_2$, or $t_3$, then we apply Proposition 3.11 and the induction hypothesis. Otherwise, either:

* The proof $t_1$ has the form $\mathrm{inl}(w_2)$ and the reduct is $(w_2/x)t_2$. As $\mathrm{inl}(w_2) \in [A \vee B]$, we have $w_2 \in [A]$. Hence, $(w_2/x)t_2 \in [C]$.

* The proof $t_1$ has the form $\mathrm{inr}(w_3)$ and the reduct is $(w_3/x)t_3$. As $\mathrm{inr}(w_3) \in [A \vee B]$, we have $w_3 \in [B]$. Hence, $(w_3/x)t_3 \in [C]$.

* The proof $t_1$ has the form $t'_1 \diamond t''_1$ and the reduct is $\delta_\vee(t'_1, x.t_2, y.t_3) \diamond \delta_\wedge(t''_1, x.t_2, y.t_3)$. As $t_1 \to t'_1$ with an ultra-reduction rule, we have by Proposition 3.11, $t'_1 \in [A \vee B]$. In a similar way, $t''_1 \in [A \wedge B]$. Thus, by induction hypothesis, $\delta_\vee(t'_1, x.t_2, y.t_3) \in [A \vee B]$ and $\delta_\wedge(t''_1, x.t_2, y.t_3) \in [A \wedge B]$. We conclude with Proposition 3.13.

* The proof $t_1$ has the form $\bullet t'_1$ and the reduct is $\bullet \delta_\vee(t'_1, x.t_2, y.t_3)$. As $t_1 \to t'_1$ with an ultra-reduction rule, we have by Proposition 3.11, $t'_1 \in [A \vee B]$. Thus, by induction hypothesis, $\delta_\vee(t'_1, x.t_2, y.t_3) \in [A \vee B]$. We conclude with Proposition 3.14. $\square$

**Proposition 3.27** (Adequacy of $\delta_\odot$). If $t_1 \in [A \odot B]$, for all $u$ in $[A]$, $(u/x)t_2 \in [C]$, and, for all $v$ in $[B]$, $(v/y)t_3 \in [C]$, then $\delta_\odot(t_1, x.t_2, y.t_3) \in [C]$.

*Proof.* By Proposition 3.10, $x \in [A]$, thus $t_2 = (x/x)t_2 \in [C]$. In the same way, $t_3 \in [C]$. Hence, $t_1, t_2$, and $t_3$ strongly terminate. We prove, by induction on $|t_1| + |t_2| + |t_3|$, that $\delta_\odot(t_1, x.t_2, y.t_3) \in [C]$. Using Proposition 3.12, we only need to prove that every of its one step reducts is in $[C]$. If the reduction takes place in $t_1, t_2$, or $t_3$, then we apply Proposition 3.11 and the induction hypothesis.

Otherwise, the proof $t_1$ has the form $[u, v]$ and the reduct is either $(u/x)t_2$ or $(v/x)t_3$. As $[u, v] \in [A \odot B]$, we have $u \in [A]$ and $v \in [B]$. Hence, $(u/x)t_2 \in [C]$ and $(v/x)t_3 \in [C]$. $\square$

**Proposition 3.28** (Adequacy of $\delta_\odot^1$). If $t_1 \in [A \odot B]$ and, for all $u$ in $[A]$, $(u/x)t_2 \in [C]$, then $\delta_\odot^1(t_1, x.t_2) \in [C]$.

*Proof.* By Proposition 3.10, $x \in [A]$, thus $t_2 = (x/x)t_2 \in [C]$. Hence, $t_1$ and $t_2$ strongly terminate. We prove, by induction on $|t_1| + |t_2|$, that $\delta_\odot^1(t_1, x.t_2) \in [C]$. Using Proposition 3.12, we only need to prove that every of its one step reducts is in $[C]$. If the reduction takes place in $t_1$ or $t_2$, then we apply Proposition 3.11 and the induction hypothesis.

Otherwise, the proof $t_1$ has the form $[u, v]$ and the reduct is $(u/x)t_2$. As $[u, v] \in [A \odot B]$, we have $u \in [A]$. Hence, $(u/x)t_2 \in [C]$. $\square$
**Proposition 3.29** (Adequacy of $\delta_{\odot}^2$). If $t_1 \in [[A \odot B]]$ and, for all $u$ in $[[B]]$, $(u/x)t_2 \in [[C]]$, then $\delta_{\odot}^2(t_1, x.t_2) \in [[C]]$.

*Proof.* Similar to that of Proposition 3.28. □

**Theorem 3.30** (Adequacy). Let $t$ be a proof of $A$ in a context $\Gamma = x_1 : A_1, \dots, x_n : A_n$ and $\sigma$ be a substitution mapping each variable $x_i$ to an element of $[[A_i]]$, then $\sigma t \in [[A]]$.

*Proof.* By induction on the structure of $t$.

If $t$ is a variable, then, by definition of $\sigma$, $\sigma t \in [[A]]$. For the seventeen other proof constructors, we use the Propositions 3.15 to 3.29. As all cases are similar, we just give a few examples.

* If $t = [u, v]$, where $u$ is a proof of $B$ and $v$ a proof of $C$, then, by induction hypothesis, $\sigma u \in [[B]]$ and $\sigma v \in [[C]]$. Hence, by Proposition 3.20, $[\sigma u, \sigma v] \in [[B \odot C]]$, that is $\sigma t \in [[A]]$.

* If $t = \delta_{\odot}(u_1, x.u_2, y.u_3)$, where $u_1$ is a proof of $B \odot C$, $u_2$ a proof of $A$, and $u_3$ a proof of $A$, then, by induction hypothesis, $\sigma u_1 \in [[B \odot C]]$, for all $v$ in $[[B]]$, $(v/x)\sigma u_2 \in [[A]]$, and for all $w$ in $[[C]]$, $(w/x)\sigma u_3 \in [[A]]$. Hence, by Proposition 3.27, $\delta_{\odot}(\sigma u_1, x.\sigma u_2, y.\sigma u_3) \in [[A]]$, that is $\sigma t \in [[A]]$. □

**Corollary 3.31** (Termination). Let $t$ be a proof of $A$ in a context $\Gamma$. Then, $t$ strongly terminates.

*Proof.* Let $\sigma$ be the substitution mapping each variable $x_i : A_i$ of $\Gamma$ to itself. Note that, by Proposition 3.10, this variable is an element of $[[A_i]]$. Then, $t = \sigma t$ is an element of $[[A]]$. Hence, it strongly terminates. □

### 3.6. Introduction property

**Theorem 3.32** (Introduction). Let $t$ be a closed irreducible proof of $A$.

* If $A$ has the form $\top$, then $t$ is $\star$.

* The proposition $A$ is not $\bot$.

* If $A$ has the form $B \Rightarrow C$, then $t$ has the form $\lambda x.u$.

* If $A$ has the form $B \wedge C$, then $t$ has the form $\langle u, v \rangle$.

* If $A$ has the form $B \vee C$, then $t$ has the form $\mathrm{inl}(u)$, $\mathrm{inr}(u)$, $u \oplus v$, or $\bullet u$.

* If $A$ has the form $B \odot C$, then $t$ has the form $[u, v]$.

*Proof.* By induction on the structure of $t$.

We first remark that, as the proof $t$ is closed, it is not a variable. Then, we prove that it cannot be an elimination.

* If $t = \delta_{\top}(u, v)$, then $u$ is a closed irreducible proof of $\top$, hence, by induction hypothesis, it is $\star$ and the proof $t$ is reducible.

* If $t = \delta_{\bot}(u)$, then $u$ is a closed irreducible proof of $\bot$ and, by induction hypothesis, no such proof exists.

* If $t = u \ v$, then $u$ is a closed irreducible proof of $B \Rightarrow A$, hence, by induction hypothesis, it has the form $\lambda x.u_1$ and the proof $t$ is reducible.

* If $t = \delta_{\wedge}^1(u, x.v)$, then $u$ is a closed irreducible proof of $B \wedge C$, hence, by induction hypothesis, it has the form $\langle u_1, u_2 \rangle$ and the proof $t$ is reducible.

* If $t = \delta_{\wedge}^2(u, x.v)$, then $u$ is a closed irreducible proof of $B \wedge C$, hence, by induction hypothesis, it has the form $\langle u_1, u_2 \rangle$ and the proof $t$ is reducible.
• If $t = \delta_{\vee}(u, x.v, y.w)$, then $u$ is a closed irreducible proof of $B \vee C$, hence, by induction hypothesis, it has the form $\mathrm{inl}(u_1)$, $\mathrm{inr}(u_1)$, $u_1 \dashv u_2$, or $\bullet u_1$ and the proof $t$ is reducible.

• If $t = \delta_{\odot}(u, x.v, y.w)$, $t = \delta_{\odot}^1(u, x.v)$, or $t = \delta_{\odot}^2(u, x.v)$, then $u$ is a closed irreducible proof of $B \odot C$, hence, by induction hypothesis, it has the form $[u_1, u_2]$ and the proof $t$ is reducible.

Hence, $t$ is an introduction, a sum, or a product.

It $t$ is $\star$, then $A$ is $\top$. If it has the form $\lambda x.u$, then $A$ has the form $B \Rightarrow C$. If it has the form $\langle u, v \rangle$, then $A$ has the form $B \wedge C$. If it has the form $\mathrm{inl}(u)$ or $\mathrm{inr}(u)$, then $A$ has the form $B \vee C$. If it has the form $[u, v]$ then $A$ has the form $B \odot C$. We prove that, if it has the form $u \dashv v$ or $\bullet u$, $A$ has the form $B \vee C$.

• If $t = u \dashv v$, then the proofs $u$ and $v$ are two closed and irreducible proofs of $A$. If $A = \top$ then, by induction hypothesis, they are both $\star$ and the proof $t$ is reducible. If $A = \bot$ then, they are closed irreducible proofs of $\bot$ and, by induction hypothesis, no such proofs exist. If $A$ has the form $B \Rightarrow C$ then, by induction hypothesis, they are both abstractions and the proof $t$ is reducible. If $A$ has the form $B \wedge C$, then, by induction hypothesis, they are both pairs and the proof $t$ is reducible. If $A$ has the form $B \odot C$, then, by induction hypothesis, they are both superpositions and the proof $t$ is reducible. Hence, $A$ has the form $B \vee C$.

• If $t = \bullet u$, then the proof $u$ is a closed and irreducible proof of $A$. If $A = \top$ then, by induction hypothesis, $u$ is $\star$ and the proof $t$ is reducible. If $A = \bot$ then, it is a closed irreducible proof of $\bot$ and, by induction hypothesis, no such proof exists. If $A$ has the form $B \Rightarrow C$ then, by induction hypothesis, it is an abstraction and the proof $t$ is reducible. If $A$ has the form $B \wedge C$, then, by induction hypothesis, it is a pair and the proof $t$ is reducible. If $A$ has the form $B \odot C$, then, by induction hypothesis, it is a superposition and the proof $t$ is reducible. Hence, $A$ has the form $B \vee C$. $\square$

Note that we reap here the benefit of commuting, when possible, the interstitial rules with the introduction rules, as, except for the disjunction, closed irreducible proofs are genuine introductions.

**Proposition 3.33 (Disjunction).** If the proposition $A \vee B$ has a closed proof, then $A$ has a closed proof or $B$ has a closed proof.

*Proof.* Consider a closed proof of $A \vee B$ and its irreducible form $t$. We prove, by induction on the structure of $t$, that $A$ has a closed proof or $B$ has a closed proof. By Theorem 3.32, $t$ has the form $\mathrm{inl}(u)$, $\mathrm{inr}(u)$, $u \dashv v$, or $\bullet u$. If it has the form $\mathrm{inl}(u)$, $u$ is a closed proof of $A$. If it has the form $\mathrm{inr}(u)$, $u$ is a closed proof of $B$. If it has the form $u \dashv v$ or $\bullet u$, $u$ is a closed irreducible proof of $A \vee B$. Thus, by induction hypothesis, $A$ has a closed proof or $B$ has a closed proof. $\square$

# 4. Quantifying non-determinism

When we have a non-deterministic reduction system, we often want to quantify the propensity of a proof to reduce to another.

One way to do so is to consider a field $(S, +, \times)$ of scalars, for instance $\mathbb{Q}$, $\mathbb{R}$, or $\mathbb{C}$, with the usual sum $+$ and product $\times$, take a different rule $\top$-i for each scalar and a different rule prod for each scalar. So, for each scalar $a$, we have a closed irreducible proof of $\top$ and we write $a \star$ for this proof. In the same way, we write $a \bullet t$ for the proof obtained by applying, to the proof $t$, the rule prod corresponding to the scalar $a$. As the closed irreducible proofs of $\top$ are in one-to-one correspondence with the elements of $S$, those of $\top \odot \top$ are in one-to-one with the elements of $S^2$, those of $(\top \odot \top) \odot (\top \odot \top)$ are in one-to-one correspondence with the elements of $S^4$, etc.

In the $\odot$-calculus, the proof $\star \dashv \star$ reduces to $\star$. Now, the proof $a \star \dashv b \star$ reduces to $(a + b) \star$, where the scalars are added. In the same way the proof $a \bullet b \star$ reduces to $(a \times b) \star$, where the scalars are multiplied. In the $\odot$-calculus, the proof $\delta_{\top}(\star, t)$ reduces to $\bullet t$. Now, the proof $\delta_{\top}(a \star, t)$ reduces neither to $t$, as it does in the usual intuitionistic propositional logic, nor to $\bullet t$ as it does in the system of Section 3, but to $a \bullet t$.
### 4.1. The $\odot^S$-calculus

We define the $\odot^S$-calculus (read: “the sup-S-calculus”), by extending the grammar of proofs as follows

$$ 
\begin{align*}
t = & x \mid t \boldsymbol{\oplus} u \mid a \boldsymbol{\cdot} t \mid a.^{\star} \mid \delta_{\top}(t, u) \mid \delta_{\bot}(t) \\
& \mid \lambda x.t \mid t u \mid \langle t, u \rangle \mid \delta_{\wedge}^{1}(t, x.u) \mid \delta_{\wedge}^{2}(t, x.u) \\
& \mid inl(t) \mid inr(t) \mid \delta_{\vee}(t, x.u, y.v) \\
& \mid [t, u] \mid \delta_{\odot}(t, x.u, y.v) \mid \delta_{\odot}^{1}(t, x.u) \mid \delta_{\odot}^{2}(t, x.u)
\end{align*}
$$

where $a$ is a scalar.

The typing rules are similar to those of Figure 2 except the rule

$$ \overline{\Gamma \vdash \star : \top}^{\top-i} $$

which is replaced with

$$ \overline{\Gamma \vdash a.^{\star} : \top}^{\top-i(a)} $$

and the rule

$$ \frac{\Gamma \vdash t : A}{\Gamma \vdash \bullet t : A} \text{ prod} $$

which is replaced with

$$ \frac{\Gamma \vdash t : A}{\Gamma \vdash a \bullet t : A} \text{ prod}(a) $$

The reduction rules are those of Figure 4. Note that the scalar computation is implicit and the terms expressing scalars are just constants. For instance $2.^{\star} \boldsymbol{\oplus} 3.^{\star}$ reduces directly to $5.^{\star}$.

The $\odot^S$-calculus is thus a $\lambda$-calculus equipped with a notion of linear combination of terms, such as Linear [2], the Algebraic $\lambda$-calculus [34], etc.

### 4.2. Properties

**Theorem 4.1 (Subject reduction).** If $\Gamma \vdash t : A$ and $t \to u$, then $\Gamma \vdash u : A$.

*Proof.* We first prove a substitution property and then proceed by induction on the definition of the relation $\to$. $\square$

**Theorem 4.2 (Confluence).** This system of Figure 4 without the rules

$$ \delta_{\odot}([t, u], x.v, y.w) \to (t/x)v $$

$$ \delta_{\odot}([t, u], x.v, y.w) \to (u/y)w $$

is confluent.

*Proof.* This system also is left linear and it has no critical pairs. Thus, by [16, Theorem 6.8] it is confluent. $\square$

**Theorem 4.3 (Termination).** Let $t$ be a proof of $A$ in a context $\Gamma$. Then, $t$ strongly terminates.

*Proof.* Consider a translation $\circ$ of proofs from the $\odot^S$-calculus to the $\odot$-calculus obtained by replacing the rules $\top-i(a)$ with the rule $\top-i$ and the rules prod($a$) with the rule prod: $(a.^{\star})^{\circ} = \star$, $(a \bullet t)^{\circ} = \bullet t^{\circ}$, etc. If $t \to u$ in the $\odot^S$-calculus, then $t^{\circ} \to u^{\circ}$ in the $\odot$-calculus. Hence, the reduction in the $\odot^S$-calculus terminates. $\square$

**Theorem 4.4 (Introduction).** Let $t$ be a closed irreducible proof of $A$.

* If $A$ has the form $\top$, then $t$ is $a.^{\star}$.
<figure><img src="image_4.png" /><figcaption>Figure 4: The reduction rules of the $\odot^S$-calculus</figcaption></figure>

* The proposition A is not $\perp$.

* If A has the form $B \Rightarrow C$, then $t$ has the form $\lambda x.u$.

* If A has the form $B \wedge C$, then $t$ has the form $\langle u, v \rangle$.

* If A has the form $B \vee C$, then $t$ has the form $\text{inl}(u)$, $\text{inr}(u)$, $u \boldsymbol{+} v$, or $a \bullet u$.

* If A has the form $B \odot C$, then $t$ has the form $[u, v]$.

*Proof.* Similar to that of Theorem 3.32. $\square$

### 4.3. Quantifying non-determinism

When $S$ is $\mathbb{Q}$, $\mathbb{R}$, or $\mathbb{C}$, we can use the scalars $a$ and $b$ to assign probabilities to the reductions

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (t/x)v $$

and

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (u/y)w $$

### Example 4.5. We define a strategy where the rules

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (t/x)v $$

and

$$ \delta_{\odot}([t, u], x.v, y.w) \rightarrow (u/y)w $$

apply only when $t$ and $u$ are closed irreducible proofs.
In this case, if a and b are not both 0, we assign the probabilities $\frac{|a|^2}{|a|^2+|b|^2}$ and $\frac{|b|^2}{|a|^2+|b|^2}$ to the reductions

$$ \delta_{\odot}([a, \star, b, \star], x.v, y.w) \rightarrow (a. \star / x)v $$

and

$$ \delta_{\odot}([a, \star, b, \star], x.v, y.w) \rightarrow (b. \star / y)w $$

And if either $a = b = 0$ or $t$ and $u$ are proofs of propositions different from $\top$, we assign any probability, for instance $\frac{1}{2}$, to these reductions.

## 5. Application to quantum computing

We now show that the $\odot^C$-calculus, with the reduction strategy of Example 4.5, restricting the reduction of $\delta_{\odot}([t, u], x.v, y.w)$ to the cases where $t$ and $u$ are closed irreducible proofs, contains the core of a small quantum programming language.

### 5.1. Bits

**Definition 5.1 (Bit).** Let $\mathcal{B} = \top \lor \top$. The proofs $0 = \text{inl}(1.\star)$ and $1 = \text{inr}(1.\star)$ are closed irreducible proofs of $\mathcal{B}$.

Note that the proofs $\text{inl}(1.\star)$ and $\text{inr}(1.\star)$ are not the only closed irreducible proofs of $\mathcal{B}$, for example $\text{inl}(2.\star)$ and $\text{inl}(1.\star) \oplus \text{inr}(1.\star)$ also are.

**Definition 5.2 (Test).** The test operator is defined as

$$ \text{If}(t, u, v) = \delta_{\ominus}(t, x.u, y.v) $$

where $x$ and $y$ are variables not occurring in $u$ and $v$. Note that $\text{If}(0, u, v) \rightarrow u$ and $\text{If}(1, u, v) \rightarrow v$.

### 5.2. Qubits

A $n$-qubit, for $n \ge 1$, is a vector of $\mathbb{C}^{2^n}$ of norm 1. We show now how $n$-qubits, and more generally vectors of $\mathbb{C}^{2^n}$, for $n \ge 0$, can be expressed as proofs in the $\odot^C$-calculus.

**Definition 5.3 (The proposition $Q^{\otimes n}$).** The proposition $Q^{\otimes n}$ is defined by induction on $n$ as follows

* $Q^{\otimes 0} = \top$,

* $Q^{\otimes n+1} = Q^{\otimes n} \odot Q^{\otimes n}$.

Note that, in this definition, the binary connective $\odot$ is always used with two identical propositions: $A \odot A$.

The proposition $Q^{\otimes 1} = \top \odot \top$ is sometimes written $Q$.

The closed irreducible proofs of $Q^{\otimes n}$ and the vectors of $\mathbb{C}^{2^n}$ are in one-to-one correspondence: to each closed irreducible proof $t$ of $Q^{\otimes n}$, we associate a vector $\underline{t}$ of $\mathbb{C}^{2^n}$ and to each vector $u$ of $\mathbb{C}^{2^n}$, we associate a closed irreducible proof $\bar{u}$ of $Q^{\otimes n}$.

**Definition 5.4 (One-to-one correspondence).** To each closed irreducible proof $t$ of $Q^{\otimes n}$, we associate a vector $\underline{t}$ of $\mathbb{C}^{2^n}$ as follows.

* If $n = 0$, then $t = a.\star$. We let $\underline{t} = (a)$.

* If $n = n' + 1$, then $t = [u, v]$. We let $\underline{t}$ be the vector with two blocks $u$ and $v$: $\underline{t} = (\underline{u} \ \underline{v})$.

To each vector $u$ of $\mathbb{C}^{2^n}$, we associate a closed irreducible proof $\bar{u}$ of $Q^{\otimes n}$.

* If $n = 0$, then $u = (a)$. We let $\bar{u} = a.\star$.
• If $n = n' + 1$, let $\mathbf{u}_1$ and $\mathbf{u}_2$ be the two blocks of $\mathbf{u}$ of $2^{n'}$ lines, so $\mathbf{u} = (\frac{\mathbf{u}_1}{\mathbf{u}_2})$. We let $\bar{\mathbf{u}} = [\bar{\mathbf{u}}_1, \bar{\mathbf{u}}_2]$.

In particular, the proof $0_{Q^{\otimes n}}$ is defined as $\bar{0}$, where $0$ is the zero vector of $\mathbb{C}^{2^n}$.

**Example 5.5.** The $2$-qubit $|01\rangle = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix}$ is expressed as the proof $|01\rangle = [[0, \star, 1, \star], [0, \star, 0, \star]]$ and the entangled

$$2\text{-qubit } \frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\ 0 \\ 0 \\ \frac{1}{\sqrt{2}} \end{pmatrix} \quad \text{as the proof } \frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle = [[\frac{1}{\sqrt{2}}\star, 0, \star], [0, \star, \frac{1}{\sqrt{2}}\star]].$$

We extend the definition of $\underline{t}$ to any closed proof of $Q^{\otimes n}$, $\underline{t}$ is by definition $\underline{t'}$, where $t'$ is the irreducible form of $t$.

We also take the convention that any closed irreducible proof $u$ of $Q^{\otimes n}$, expressing a non-zero vector $\underline{u} \in \mathbb{C}^{2^n}$, is an alternative expression of the $n$-qubit $\frac{\underline{u}}{\|\underline{u}\|}$. For example, the qubit $\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$ is expressed as the proof $[\frac{1}{\sqrt{2}}\star, \frac{1}{\sqrt{2}}\star]$, but also as the proof $[1, \star, 1, \star] = |0\rangle + |1\rangle$.

The next Propositions show that the symbol $+$ expresses the sum of vectors and the symbol $\bullet$, the product of a vector by a scalar.

**Proposition 5.6 (Sum of vectors).** Let $u$ and $v$ be two closed proofs of $Q^{\otimes n}$. Then, $\underline{u} + \underline{v} = \underline{u} + \underline{v}$.

*Proof.* By induction on $n$.

• If $n = 0$, then $u \xrightarrow{\cdot} a, v \xrightarrow{\cdot} b$, $\underline{u} = (a)$, $\underline{v} = (b)$. Thus, $\underline{u} + \underline{v} = \underline{a} + \underline{b} = (a+b) = (a) + (b) = \underline{u} + \underline{v}$.

• If $n = n' + 1$, then $u \xrightarrow{\cdot} [u_1, u_2]$, $v \xrightarrow{\cdot} [v_1, v_2]$, $\underline{u} = (\frac{u_1}{u_2})$ and $\underline{v} = (\frac{v_1}{v_2})$. Thus, using the induction hypothesis, $\underline{u} + \underline{v} = [u_1, u_2] + [v_1, v_2] = [u_1 + v_1, u_2 + v_2] = (\frac{u_1+v_1}{u_2+v_2}) = (\frac{u_1}{u_2} + \frac{v_1}{v_2}) = (\frac{u_1}{u_2}) + (\frac{v_1}{v_2}) = \underline{u} + \underline{v}$. $\square$

**Proposition 5.7 (Product of a vector by a scalar).** Let $u$ be a closed proof of $Q^{\otimes n}$. Then, $\underline{a} \bullet \underline{u} = \underline{a} \underline{u}$.

*Proof.* By induction on $n$.

• If $n = 0$, then $u \xrightarrow{\cdot} b, \underline{u} = (b)$. Thus, $\underline{a} \bullet \underline{u} = \underline{a} \bullet \underline{b} = (a \times b) \star = (a \times b) = a(b) = \underline{a} \underline{u}$.

• If $n = n' + 1$, $u \xrightarrow{\cdot} [u_1, u_2]$, $\underline{u} = (\frac{u_1}{u_2})$. Thus, using the induction hypothesis, $\underline{a} \bullet \underline{u} = \underline{a} \bullet [u_1, u_2] = [\underline{a} \bullet u_1, \underline{a} \bullet u_2] = (\frac{\underline{a} \bullet u_1}{\underline{a} \bullet u_2}) = (\frac{a u_1}{a u_2}) = a(\frac{u_1}{u_2}) = \underline{a} \underline{u}$. $\square$

### 5.3. Matrices

The information-preserving, reversible, and deterministic unitary operators are expressed with the proof constructors $\delta_\circ^1$ and $\delta_\circ^2$.

**Theorem 5.8 (Matrices).** Let $M$ be a matrix with $2^m$ columns and $2^n$ lines, then there exists a closed proof $t$ of $Q^{\otimes m} \Rightarrow Q^{\otimes n}$ such that, for all vectors $\mathbf{u} \in \mathbb{C}^{2^m}$, $t \underline{\mathbf{u}} = M\mathbf{u}$.

*Proof.* By induction on $A$.

• If $m = 0$, then $M$ is a matrix of one column and $2^n$ lines. Hence, it is also a vector of $2^n$ lines. We take

$$t = \lambda x \cdot \delta_{\tau}(x, \bar{M})$$

Let $\mathbf{u} \in S^1$, $\mathbf{u}$ has the form $(a)$ and $\bar{\mathbf{u}} = a \star$.

Then, using Proposition 5.7, we have $t \underline{\mathbf{u}} = \delta_{\tau}(\bar{\mathbf{u}}, \bar{M}) = \delta_{\tau}(a, \star, \bar{M}) = \underline{a} \bullet \underline{M} = a \underline{M} = aM = M(a) = M\mathbf{u}$.
• If $m = m' + 1$, then let $M_1$ and $M_2$ be the two blocks of $M$ of $2^{m'}$ columns, so $M = (M_1 M_2)$.

By induction hypothesis, there exist closed proofs $t_1$ and $t_2$ of the proposition $\mathcal{Q}^{m'} \Rightarrow \mathcal{Q}^n$ such that, for all vectors $\mathbf{u}_1, \mathbf{u}_2 \in \mathbb{C}^{2^{m'}},$ we have $\underline{t_1 \mathbf{u}_1} = M_1 \mathbf{u}_1$ and $\underline{t_2 \mathbf{u}_2} = M_2 \mathbf{u}_2$. We take

$$t = \lambda x.(\delta_{\odot}^{1}(x, y.(t_1 y)) + \delta_{\odot}^{2}(x, z.(t_2 z)))$$

Let $\mathbf{u} \in \mathbb{C}^{2^m}$, and $\mathbf{u}_1$ and $\mathbf{u}_2$ be the two blocks of $2^{m'}$ lines of $\mathbf{u}$, so $\mathbf{u} = (\underline{\mathbf{u}_1 \ u_2})$, and $\mathbf{u} = [\underline{\mathbf{u}_1 \ u_2}]$.

Then, using Proposition 5.6, $\underline{t \mathbf{u}} = \delta_{\odot}^{1}([\underline{\mathbf{u}_1 \ u_2}], y.(t_1 y)) + \delta_{\odot}^{2}([\underline{\mathbf{u}_1 \ u_2}], z.(t_2 z)) = \underline{t_1 \mathbf{u}_1} + \underline{t_2 \mathbf{u}_2} = M_1 \mathbf{u}_1 + M_2 \mathbf{u}_2 = (M_1 M_2)(\underline{\mathbf{u}_1 \ u_2}) = M \mathbf{u}$. $\square$

**Example 5.9** (Matrices with two columns and two lines). The matrix $(\begin{smallmatrix} a & c \\ b & d \end{smallmatrix})$ is expressed as the proof

$$t = \lambda x.(\delta_{\odot}^{1}(x, y.\delta_{\oplus}(y, [a.\star, b.\star])) + \delta_{\odot}^{2}(x, z.\delta_{\oplus}(z, [c.\star, d.\star]))))$$

Then

$$ 
\begin{align*}
t [e.\star, f.\star] &\rightarrow \delta_{\odot}^{1}([e.\star, f.\star], y.\delta_{\oplus}(y, [a.\star, b.\star])) + \delta_{\odot}^{2}([e.\star, f.\star], z.\delta_{\oplus}(z, [c.\star, d.\star])) \\
&\rightarrow^* \delta_{\oplus}(e.\star, [a.\star, b.\star]) + \delta_{\oplus}(f.\star, [c.\star, d.\star]) \\
&\rightarrow^* e \bullet [a.\star, b.\star] + f \bullet [c.\star, d.\star] \\
&\rightarrow^* [(a \times e).\star, (b \times e).\star] + [(c \times f).\star, (d \times f).\star] \\
&\rightarrow^* [(a \times e + c \times f).\star, (b \times e + d \times f).\star]
\end{align*}
$$

For instance, the Hadamard matrix $H = \begin{pmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{pmatrix}$ is expressed as the proof

$$\lambda x.\delta_{\odot}^{1}(x, y.\delta_{\oplus}(y, [\frac{1}{\sqrt{2}}.\star, \frac{1}{\sqrt{2}}.\star])) + \delta_{\odot}^{2}(x, z.\delta_{\oplus}(z, [\frac{1}{\sqrt{2}}.\star, -\frac{1}{\sqrt{2}}.\star]))$$

## 5.4. Probabilities

**Definition 5.10** (Norm). Let $t$ be a closed irreducible proof of $\mathcal{Q}^{\otimes n}$, we define the square of the norm $\|t\|^2$ of $t$ by induction on $n$.

• If $n = 0$, then $t = a.\star$ and we take $\|t\|^2 = |a|^2$.

• If $n = n' + 1$, then $t = [u_1, u_2]$ and we take $\|t\|^2 = \|u_1\|^2 + \|u_2\|^2$.

If $t$ is a closed irreducible proof of $\mathcal{Q}^{\otimes n}$ of the form $[u_1, u_2]$, where $\|u_1\|^2$ and $\|u_2\|^2$ are not both 0, then we assign the probability $\frac{\|u_1\|^2}{\|u_1\|^2+\|u_2\|^2}$ to the reduction

$$\delta_{\odot}([u_1, u_2], x.v, y.w) \rightarrow (u_1/x)v$$

and the probability $\frac{\|u_2\|^2}{\|u_1\|^2+\|u_2\|^2}$ to the reduction

$$\delta_{\odot}([u_1, u_2], x.v, y.w) \rightarrow (u_2/y)w$$

If $\|u_1\|^2 = \|u_2\|^2 = 0$, or $u_1$ and $u_2$ are proofs of propositions of a different form, we associate any probability, for example $\frac{1}{2}$, to both reductions.

**Example 5.11.** If $t$ is a closed irreducible proof of $\mathcal{Q}$ of the form $[a.\star, b.\star]$, where $a$ and $b$ are not both 0, then we assign the probability $\frac{|a|^2}{|a|^2+|b|^2}$ to the reduction

$$\delta_{\odot}([a.\star, b.\star], x.v, y.w) \rightarrow (a.\star/x)v$$
$$ \pi_n = \lambda x \cdot \delta_{\odot}(x, y, [y, 0_{Q^{\otimes n-1}}], z, [0_{Q^{\otimes n-1}}, z]) $$

$$ \pi'_{n} = \lambda x \cdot \delta_{\odot}(x, y, \mathbf{0}, z, \mathbf{1}) $$

$$ \pi''_{n} = \lambda x \cdot \delta_{\odot}(x, y, \langle [y, 0_{Q^{\otimes n-1}}], \mathbf{0} \rangle, z, \langle [0_{Q^{\otimes n-1}}, z], \mathbf{1} \rangle) $$

<caption>Figure 5: Measurement operators</caption>

and $\frac{|b|^2}{|a|^2+|b|^2}$ to the reduction

$$ \delta_{\odot}([a, b], x, y, w) \rightarrow (b, c, y, w) $$

If $t$ is a closed irreducible proof of $Q^{\otimes 2}$ of the form $[[a, b], [c, d]]$ where $a, b, c$, and $d$ are not all 0, then we assign the probability

$\frac{|a|^2+|b|^2}{|a|^2+|b|^2+|c|^2+|d|^2}$ to the reduction

$$ \delta_{\odot}([a, b], [c, d]), x, y, w) \rightarrow ([a, b]/x)v $$

and $\frac{|c|^2+|d|^2}{|a|^2+|b|^2+|c|^2+|d|^2}$ to the reduction

$$ \delta_{\odot}([a, b], [c, d]), x, y, w) \rightarrow (([c, d])/y)w $$

### 5.5. Measure

The information-erasing, non-reversible, and non-deterministic measurement operators are expressed with the proof constructor $\delta_{\odot}$.

Several such operators are defined in Figure 5. Let $n$ be a non-zero natural number and $t$ be a closed irreducible proof of $Q^{\otimes n}$ of the form $[u_1, u_2]$, such that $\|t\|^2 = \|u_1\|^2 + \|u_2\|^2 \neq 0$, expressing the state of an $n$-qubit. The proof $\pi_n t$ of the proposition $Q^{\otimes n}$ reduces, with probabilities $\frac{\|u_1\|^2}{\|u_1\|^2+\|u_2\|^2}$ and $\frac{\|u_2\|^2}{\|u_1\|^2+\|u_2\|^2}$ to $[u_1, 0_{Q^{\otimes n-1}}]$ and to $[0_{Q^{\otimes n-1}}, u_2]$. It is the state of the $n$-qubit, after the partial measure of the first qubit. The proof $\pi'_n t$ of the proposition $\mathcal{B}$ reduces, with the same probabilities, to $\mathbf{0}$ and to $\mathbf{1}$. It is the “classical” result of the measure. The proof $\pi''_n t$ of the proposition $Q^{\otimes n} \wedge \mathcal{B}$ reduces, with the same probabilities, to $\langle [u_1, 0_{Q^{\otimes n-1}}], \mathbf{0} \rangle$ and to $\langle [0_{Q^{\otimes n-1}}, u_2], \mathbf{1} \rangle$. It is the pair formed with the state of the $n$-qubit, after the measure, and the “classical” result of the measure.

**Example 5.12.** In the case $n = 1$, if $t$ is a closed irreducible proof of $Q^{\otimes 1}$ of the form $[a, b]$, such that $a$ and $b$ are not both 0, then the proof $\pi_1 t$ of the proposition $Q^{\otimes 1}$ reduces, with probabilities $\frac{|a|^2}{|a|^2+|b|^2}$ and $\frac{|b|^2}{|a|^2+|b|^2}$, to $[a, 0, 0]$, that is an expression of $|0\rangle$, and to $[0, a, b]$, that is an expression of $|1\rangle$. The proof $\pi'_1 t$ of the proposition $\mathcal{B}$ reduces, with the same probabilities, to $\mathbf{0}$ and to $\mathbf{1}$. The proof $\pi''_1 t$ of the proposition $Q^{\otimes 1} \wedge \mathcal{B}$ reduces, with the same probabilities, to $\langle [a, 0, 0], 0 \rangle$ and to $\langle [0, a, b], 1 \rangle$.

**Example 5.13.** In the case $n = 2$, if $t$ is a closed irreducible proof of $Q^{\otimes 2}$ of the form $[[a, b], [c, d]]$ where $a, b, c$, and $d$ are not all 0, then the proof $\pi_2 t$ of the proposition $Q^{\otimes 2}$ reduces, with probabilities $\frac{|a|^2+|b|^2}{|a|^2+|b|^2+|c|^2+|d|^2}$ and $\frac{|c|^2+|d|^2}{|a|^2+|b|^2+|c|^2+|d|^2}$, to $[[a, b], [0, 0, 0]]$ and to $[[0, a, 0], [c, d]]$. The proof $\pi'_2 t$ of the proposition $\mathcal{B}$ reduces, with the same probabilities, to $\mathbf{0}$ and to $\mathbf{1}$. The proof $\pi''_2 t$ of the proposition $Q^{\otimes 2} \wedge \mathcal{B}$ reduces, with the same probabilities, to $\langle [[a, b], [0, 0, 0]], 0 \rangle$ and to $\langle [[0, a, 0], [c, d]], 1 \rangle$.

Using the representation of matrices, it is possible to define measurement operators that measure in any basis, by changing basis, measuring, and changing basis again. This way, it is also possible to define measurement operators that partially measure, not the first qubit of a $n$-qubit, but any.

### 5.6. An example: Deutsch's algorithm

Deutsch's algorithm allows to decide whether a 1-bit to 1-bit function $f$ is constant or not, applying an oracle $U_f$, implementing $f$, only once. It is an algorithm operating on 2-qubits. It proceeds in four steps.
1. Prepare the initial state $|+-\rangle = \frac{1}{2}|00\rangle - \frac{1}{2}|01\rangle + \frac{1}{2}|10\rangle - \frac{1}{2}|11\rangle$.

2. Apply to it the unitary operator

$$U_f = \begin{pmatrix} \text{if}(f(0,1,0)) & \text{if}(f(0,0,1)) & 0 & 0 \\ \text{if}(f(0,0,1)) & \text{if}(f(0,1,0)) & 0 & 0 \\ 0 & 0 & \text{if}(f(1,1,0)) & \text{if}(f(1,0,1)) \\ 0 & 0 & \text{if}(f(1,0,1)) & \text{if}(f(1,1,0)) \end{pmatrix}$$

where $\text{if}(0, n, m) = n$ and $\text{if}(1, n, m) = m$.

Note that $U_f|x, y\rangle = |x, y \oplus f(x)\rangle$ for $x, y \in \{0, 1\}$, where $\oplus$ is the exclusive disjunction.

3. Apply to it the unitary operator

$$H \otimes I = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{pmatrix}$$

4. Measure the first qubit. The output is 0, if $f$ is constant and 1 if it is not.

In the $\odot^C$-calculus, the initial state is

$$|+\rangle = [[\frac{1}{2}, \star, \frac{-1}{2}, \star], [\frac{1}{2}, \star, \frac{-1}{2}, \star]]$$

the function mapping the function $f$ to the operator $U_f$ is expressed as in the proof of Theorem 5.8

$$U = \lambda f. \lambda t. (\delta_{\odot}^{1}(t, x.(\delta_{\odot}^{1}(x, z_{0}.M_{0} z_{0}))) + \delta_{\odot}^{2}(x, z_{1}.M_{1} z_{1}))) + \delta_{\odot}^{2}(t, y.(\delta_{\odot}^{1}(y, z_{2}. M_{2} z_{2}))) + \delta_{\odot}^{2}(y, z_{3}. M_{3} z_{3})))$$

with

$$M_0 = \lambda s. \delta_{\top}(s, \text{If}(f \mathbf{0}, [[1.\star, 0.\star], [0.\star, 0.\star]], [[0.\star, 1.\star], [0.\star, 0.\star]])))$$

$$M_1 = \lambda s. \delta_{\top}(s, \text{If}(f \mathbf{0}, [[0.\star, 1.\star], [0.\star, 0.\star]], [[1.\star, 0.\star], [0.\star, 0.\star]])))$$

$$M_2 = \lambda s. \delta_{\top}(s, \text{If}(f \mathbf{1}, [[0.\star, 0.\star], [1.\star, 0.\star]], [[0.\star, 0.\star], [0.\star, 1.\star]])))$$

$$M_3 = \lambda s. \delta_{\top}(s, \text{If}(f \mathbf{1}, [[0.\star, 0.\star], [0.\star, 1.\star]], [[0.\star, 0.\star], [1.\star, 0.\star]])))$$

The operator $H \otimes I$ is also expressed as in the proof of Theorem 5.8 and Deutsch's algorithm is the proof of $(\mathcal{B} \Rightarrow \mathcal{B}) \Rightarrow \mathcal{B}$

$$Deutsch = \lambda f. \pi_2'((H \otimes I) (U f |+\rangle))$$

Let $f$ be a proof of $\mathcal{B} \Rightarrow \mathcal{B}$. If $f$ is a constant function, we have Deutsch $f \rightarrow^* \mathbf{0}$, while if $f$ is not constant, Deutsch $f \rightarrow^* \mathbf{1}$.

## 6. Conclusion

We have extended intuitionistic propositional logic with a connective $\odot$, that has both excessive and harmonious deduction rules, and with interstitial rules. We have then extended this logic again with scalars. We have shown that the proof language of this logic forms the core of a quantum programming language.

The connective $\odot$, with its elimination symbol $\delta_{\odot}$, models information-erasure, non-reversibility, and non-determinism, that occur, for example, in quantum measurement. With its elimination symbols $\delta_{\odot}^1$ and $\delta_{\odot}^2$, it models the information-preservation, reversibility, and determinism that occur, for example, in unitary transformations.

There are several points that we did not address in this paper. First, we leave open the question of the interpretation of this logic in a model, in particular a categorical one, besides the obvious Lindenbaum algebra.

Then, these notions of insufficient and excessive deduction rules are not specific to natural deduction and similar notions could be defined and investigated, for instance, in sequent calculus. Note that in the sequent calculus, harmony can be defined in a stronger sense, that includes, not only the possibility to reduce proofs, but also to reduce the use of the rule axiom on non-atomic propositions to smaller ones [17]—an analogue of the $\eta$-expansion, but generalized to arbitrary connectives.
Finally, the $\odot^C$-calculus can express all quantum circuits, as it can express matrices and measurement operators. However, it is not restricted to quantum algorithms, since the $\odot$ connective addresses the question of the information-erasure, non-reversibility, and non-determinism of measurement, but not that of linearity and unitarity. We have started investigating, in [5], a restriction of the $\odot$-calculus to linear operators, forbidding, for example, the non-linear proof of the proposition $Q \Rightarrow Q^{\otimes 2}$

$$ \lambda x. \delta_{\odot}^{1}(x, y. \delta_{\odot}^{1}(x, y_1.[[\delta_{\uparrow}(y, y_1), 0.\star], [0.\star, 0.\star]]]) + \delta_{\odot}^{2}(x, z_1.[[0.\star, \delta_{\uparrow}(y, z_1)], [0.\star, 0.\star]])) \\ + \delta_{\odot}^{2}(x, z. \delta_{\odot}^{1}(x, y_2.[[0.\star, 0.\star], [\delta_{\uparrow}(z, y_2), 0.\star]]]) + \delta_{\odot}^{2}(x, z_2.[[0.\star, 0.\star], [0.\star, \delta_{\uparrow}(z, z_2)]])) $$

that maps $[a.\star, b.\star]$ to $[[a^2.\star, ab.\star], [ab.\star, b^2.\star]]$, that is $a.|0\rangle + b.|1\rangle$ to $a^2.|00\rangle + ab.|01\rangle + ab.|10\rangle + b^2.|11\rangle$ and thus expresses cloning.

## Acknowledgements

The authors want to thank Jean-Baptiste Joinet, Jean-Pierre Jouannaud, Dale Miller, Alberto Naibo, and Alex Tsokurov for useful discussions.

## References

[1] Altenkirch, T., Grattage, J., 2005. A functional quantum programming language, in: Proceedings of LICS 2005, IEEE. pp. 249-258.

[2] Arrighi, P., Dowek, G., 2017. Linear-algebraic lambda-calculus. Logical Methods in Computer Science 13.

[3] Coecke, B., Kissinger, A., 2017. Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning. Cambridge University Press. doi:10.1017/9781316219317.

[4] Díaz-Caro, A., Dowek, G., 2019. Proof normalisation in a logic identifying isomorphic propositions, in: Geuvers, H. (Ed.), 4th International Conference on Formal Structures for Computation and Deduction (FSCD 2019), Schloss Dagstuhl-Liebniz-Zentrum fuer Informatik. pp. 14:1-14:23.

[5] Díaz-Caro, A., Dowek, G., 2022. Linear lambda-calculus is linear, in: Felty, A. (Ed.), Formal Structures for Computation and Deduction, Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik. pp. 21:1-21:17. doi:10.4230/LIPIcs.FSCD.2022.21.

[6] Díaz-Caro, A., Guillermo, M., Miquel, A., Valiron, B., 2019. Realizability in the unitary sphere, in: Proceedings of the 34th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS 2019), pp. 1-13.

[7] Dummett, M., 1991. The Logical basis of metaphysics. Duckworth.

[8] Dyckhoff, R., 1987. Implementing a simple proof assistant, in: Derrick, Lewis (Eds.), Proceedings of the Workshop on Programming for Logic Teaching. Centre for Theoretical Computer Science and Departments of Pure Mathematics and Philosophy, Univ. of Leeds. volume 23.88, pp. 49-59.

[9] Díaz-Caro, A., Dowek, G., Rinaldi, J., 2019. Two linearities for quantum computing in the lambda calculus. Biosystems.

[10] Gentzen, G., 1969. Untersuchungen über das logische Schliessen, in: Szabo, M. (Ed.), The Collected Papers of Gerhard Gentzen. North-Holland, pp. 68-131.

[11] Girard, J.Y., Interprétation fonctionnelle et élimination des coupures dans l'arithmétique d'ordre supérieur. Doctoral thesis, Université de Paris 7, 1972.

[12] Jacinto, B., Read, S., 2017. General-elimination stability. Studia Logica 105, 361-405.

[13] Klop, J.W., van Oostrom, V., van Raamsdonk, F., 1993. Combinatory reduction systems: introduction and survey. Theoretical Computer Science 121, 279-308. doi:10.1016/0304-3975(93)90091-7.

[14] Lopez-Escobar, E., 1999. Standardizing the n systems of gentzen, in: Models, algebras, and proofs. Dekker. volume 203 of Lecture Notes in Pure and Appl. Math., pp. 411-434.

[15] Matin-Löf, P., 1971. Hauptsatz for the intuitionistic theory of iterated inductive definitions. Studies in Logic and the Foundations of Mathematics 63, 179-216.

[16] Mayr, R., Nipkow, T., 1998. Higher-order rewrite systems and their confluence. Theoretical Computer Science 192, 3-29. doi:10.1016/S0304-3975(97)00143-6.

[17] Miller, D., Pimentel, E., 2013. A formal framework for specifying sequent calculus proof systems. Theoretical Computer Science 474, 98-116.

[18] Miller, D., Tiu, A., 2005. A proof theory for generic judgments. ACM Transactions on Computational Logic 6, 749-783.

[19] Negri, S., von Plato, J., 2008. Structural Proof Theory. Cambridge University Press.

[20] Nielsen, M.A., Chuang, I.L., 2000. Quantum Computation and Quantum Information. Cambridge University Press.

[21] Parigot, M., 1991. Free deduction: an analysis of computations in classical logic, in: Proceedings of Russian Conference on Logic Programming. Springer. Lecture Notes in Computer Science, pp. 361-380.

[22] von Plato, J., 2001. Natural deduction with general elimination rules. Arch. Math. Log. 40, 541-567. doi:10.1007/s001530100091.

[23] Prawitz, D., 1965. Natural deduction. A proof-theoretical study. Almqvist & Wiksell.
[24] Prawitz, D., 1976. Proofs and the meaning and completeness of the logical constants, in: Essays on Mathematical and Philosophical Logic, Springer. pp. 25–40.

[25] Prior, A., 1960. The runabout inference-ticket. Analysis 21, 38–39.

[26] Read, S., 2004. Identity and harmony. Analysis 64, 113–119.

[27] Read, S., 2010. General-elimination harmony and the meaning of the logical constants. Journal of Philosophical Logic 39, 557–576.

[28] Read, S., 2014. Identity and harmony revisited. https://www.st-andrews.ac.uk/~slr/identity_revisited.pdf.

[29] Schroeder-Heister, P., 1984. A natural extension of Natural deduction. The Journal of Symbolic Logic 49, 1284–1300.

[30] Schroeder-Heister, P., 2014. The calculus of higher-level rules, propositional quantification, and the foundational approach to proof-theoretic harmony. Studia Logica 102, 1185–1216.

[31] Selinger, P., Valiron, B., 2006. A lambda calculus for quantum computation with classical control. Mathematical Structures in Computer Science 16, 527–552.

[32] Tzouvaras, A., 2017. Propositional superposition logic. Logic Journal of the IGPL 26, 149–190.

[33] Tzouvaras, A., 2019. Semantics for first-order superposition logic. Logic Journal of the IGPL 27, 570–595.

[34] Vaux, L., 2009. The algebraic lambda calculus. Mathematical Structures in Computer Science 19, 1029–1059.

[35] Zorzi, M., 2016. On quantum lambda calculi: a foundational perspective. Mathematical Structures in Computer Science 26, 1107–1195.

# Appendix A. Strong termination of proof reduction in intuitionistic propositional natural deduction

## Definition Appendix A.1 (Syntax).

$$ 
\begin{align*}
A &= \top | \bot | A \Rightarrow A \mid A \wedge A \mid A \vee A \\
t &= x \mid \star \mid \delta_{\top}(t, u) \mid \delta_{\bot}(t) \mid \lambda x.t \mid t u \\
  &\qquad \mid \langle t, u \rangle \mid \delta_{\wedge}^{1}(t, x.u) \mid \delta_{\wedge}^{2}(t, x.u) \\
  &\qquad \mid inl(t) \mid inl(r) \mid \delta_{\vee}(t, x.u, y.v)
\end{align*}
$$

The proofs of the form $\star$, $\lambda x.t$, $\langle t, u \rangle$, $inl(t)$, and $inr(t)$ are called *introductions*.

## Definition Appendix A.2 (Typing rules).

$$ 
\begin{align*}
\overline{\Gamma \vdash x : A} & \quad \text{axiom } x : A \in \Gamma \\
\overline{\Gamma \vdash \star : \top} & \quad \top \text{-i} \\
\frac{\overline{\Gamma \vdash t : \top \quad \Gamma \vdash u : C}}{\Gamma \vdash \delta_{\top}(t, u) : C} & \quad \top \text{-e} \\
\frac{\overline{\Gamma \vdash t : \bot \quad \Gamma \vdash \delta_{\bot}(t) : C}}{\Gamma \vdash \delta_{\bot}(t) : C} & \quad \bot \text{-e} \\
\frac{\overline{\Gamma \vdash x : A \vdash t : B}}{\Gamma \vdash \lambda x.t : A \Rightarrow B} & \quad \Rightarrow \text{-i} \\
\frac{\overline{\Gamma \vdash t : A \Rightarrow B \quad \Gamma \vdash u : A}}{\Gamma \vdash t u : B} & \quad \Rightarrow \text{-e} \\
\frac{\overline{\Gamma \vdash t : A \quad \Gamma \vdash u : B}}{\Gamma \vdash \langle t, u \rangle : A \wedge B} & \quad \wedge \text{-i} \\
\frac{\overline{\Gamma \vdash t : A \wedge B \quad \Gamma, x : A \vdash u : C}}{\Gamma \vdash \delta_{\wedge}^{1}(t, x.u) : C} & \quad \wedge \text{-e1} \\
\frac{\overline{\Gamma \vdash t : A \wedge B \quad \Gamma, x : B \vdash u : C}}{\Gamma \vdash \delta_{\wedge}^{2}(t, x.u) : C} & \quad \wedge \text{-e2} \\
\frac{\overline{\Gamma \vdash t : A \quad \Gamma \vdash inl(t) : A \vee B}}{\Gamma \vdash t : B} & \quad \vee \text{-i1} \\
\frac{\overline{\Gamma \vdash t : B \quad \Gamma \vdash inr(t) : A \vee B}}{\Gamma \vdash \delta_{\vee}(t, x.u, y.v) : C} & \quad \vee \text{-i2} \\
\frac{\overline{\Gamma \vdash t : A \vee B \quad \Gamma, x : A \vdash u : C \quad \Gamma, y : B \vdash v : C}}{\Gamma \vdash \delta_{\vee}(t, x.u, y.v) : C} & \quad \vee \text{-e}
\end{align*}
$$
**Definition Appendix A.3 (Reduction rules).**

$$
\begin{align*}
\delta_{\top}(\star, v) &\rightarrow v \\
(\lambda x.t) u &\rightarrow (u/x)t \\
\delta_{\wedge}^{1}(\langle t, u \rangle, x.v) &\rightarrow (t/x)v \\
\delta_{\wedge}^{2}(\langle t, u \rangle, x.v) &\rightarrow (u/x)v \\
\delta_{\vee}(\mathrm{inl}(t), x.v, y.w) &\rightarrow (t/x)v \\
\delta_{\vee}(\mathrm{inr}(u), x.v, y.w) &\rightarrow (u/y)w
\end{align*}
$$

**Definition Appendix A.4.** We define, by induction on the proposition A, a set of proofs $[[A]]$:

* $t \in [[\top]]$ if $t$ strongly terminates,

* $t \in [[\bot]]$ if $t$ strongly terminates,

* $t \in [[A \Rightarrow B]]$ if $t$ strongly terminates and whenever it reduces to a proof of the form $\lambda x.u$, then for every $v \in [[A]]$, $(v/x)u \in [[B]]$,

* $t \in [[A \wedge B]]$ if $t$ strongly terminates, whenever it reduces to a proof of the form $\langle u, v \rangle$, then $u \in [[A]]$ and $v \in [[B]]$,

* $t \in [[A \vee B]]$ if $t$ strongly terminates, whenever it reduces to a proof of the form $\mathrm{inl}(u)$, then $u \in [[A]]$, and whenever it reduces to a proof of the form $\mathrm{inr}(v)$, then $v \in [[B]]$.

**Definition Appendix A.5.** If $t$ is a strongly terminating proof, we write $|t|$ for the maximum length of a reduction sequence issued from $t$.

**Proposition Appendix A.6 (Variables).** For any A, the set $[[A]]$ contains all the variables.

*Proof.* A variable is irreducible, hence it strongly terminates. Moreover, it never reduces to an introduction.

<figure><img src="image_5.png" /></figure>

**Proposition Appendix A.7 (Closure by reduction).** If $t \in [[A]]$ and $t \rightarrow^* t'$, then $t' \in [[A]]$.

*Proof.* If $t \rightarrow^* t'$ and $t$ strongly terminates, then $t'$ strongly terminates.

Furthermore, if A has the form $B \Rightarrow C$ and $t'$ reduces to $\lambda x.u$, then so does $t$, hence for every $v \in [[B]]$, $(v/x)u \in [[C]]$.

If A has the form $B \wedge C$ and $t'$ reduces to $\langle u, v \rangle$, then so does $t$, hence $u \in [[B]]$ and $v \in [[C]]$.

If A has the form $B \vee C$ and $t'$ reduces to $\mathrm{inl}(u)$, then so does $t$, hence $u \in [[B]]$ and if A has the form $B \wedge C$ and $t'$ reduces to $\mathrm{inr}(v)$, then so does $t$, hence $v \in [[C]]$.

<figure><img src="image_6.png" /></figure>

**Proposition Appendix A.8 (Girard's lemma).** Let $t$ be a proof that is not an introduction, such that all the one-step reducts of $t$ are in $[[A]]$. Then, $t \in [[A]]$.

*Proof.* Let $t, t_2, \dots$ be a reduction sequence issued from $t$. If it has a single element, it is finite. Otherwise, we have $t \rightarrow t_2$. As $t_2 \in [[A]]$, it strongly terminates and the reduction sequence is finite. Thus, $t$ strongly terminates.

Furthermore, if A has the form $B \Rightarrow C$ and $t \rightarrow^* \lambda x.u$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $\lambda x.u$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \rightarrow t_2 \rightarrow^* t_n$. We have $t_2 \in [[A]]$, thus for all $v \in [[B]]$, $(v/x)u \in [[C]]$.

And if A has the form $B \wedge C$ and $t \rightarrow^* \langle u, v \rangle$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $\langle u, v \rangle$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \rightarrow t_2 \rightarrow^* t_n$. We have $t_2 \in [[A]]$, thus $u \in [[B]]$ and $v \in [[C]]$.

If A has the form $B \vee C$ and $t \rightarrow^* \mathrm{inl}(u)$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $\mathrm{inl}(u)$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \rightarrow t_2 \rightarrow^* t_n$. We have $t_2 \in [[A]]$, thus $u \in [[B]]$.

If A has the form $B \wedge C$ and $t \rightarrow^* \mathrm{inr}(v)$, then let $t, t_2, \dots, t_n$ be a reduction sequence from $t$ to $\mathrm{inr}(v)$. As $t_n$ is an introduction and $t$ is not, $n \ge 2$. Thus, $t \rightarrow t_2 \rightarrow^* t_n$. We have $t_2 \in [[A]]$, thus $v \in [[C]]$.

<figure><img src="image_7.png" /></figure>
In Propositions Appendix A.9 to Appendix A.19, we prove the adequacy of each proof constructor.

**Proposition Appendix A.9** (Adequacy of $\star$). We have $\star \in [[\top]]$.

*Proof.* As $\star$ is irreducible, it strongly terminates, hence $\star \in [[\top]]$.

<figure><img src="image_8.png" /></figure>

**Proposition Appendix A.10** (Adequacy of $\lambda$). If, for all $u \in [[A]]$, $(u/x)t \in [[B]]$, then $\lambda x.t \in [[A \Rightarrow B]]$.

*Proof.* By Proposition Appendix A.6, $x \in [[A]]$, thus $t = (x/x)t \in [[B]]$. Hence, $t$ strongly terminates. Consider a reduction sequence issued from $\lambda x.t$. This sequence can only reduce $t$ hence it is finite. Thus, $\lambda x.t$ strongly terminates.

Furthermore, if $\lambda x.t \to^* \lambda x.t'$, then $t \to^* t'$. Let $u \in [[A]]$, $(u/x)t \to^* (u/x)t'$. By Proposition Appendix A.7, $(u/x)t' \in [[B]]$.

<figure><img src="image_9.png" /></figure>

**Proposition Appendix A.11** (Adequacy of $\langle, \rangle$). If $t_1 \in [[A]]$ and $t_2 \in [[B]]$, then $\langle t_1, t_2 \rangle \in [[A \wedge B]]$.

*Proof.* The proofs $t_1$ and $t_2$ strongly terminate. Consider a reduction sequence issued from $\langle t_1, t_2 \rangle$. This sequence can only reduce $t_1$ and $t_2$, hence it is finite. Thus, $\langle t_1, t_2 \rangle$ strongly terminates.

Furthermore, if $\langle t_1, t_2 \rangle \to^* \langle t'_1, t'_2 \rangle$, then $t_1 \to^* t'_1$ and $t_2 \to^* t'_2$. By Proposition Appendix A.7, $t'_1 \in [[A]]$ and $t'_2 \in [[B]]$.

<figure><img src="image_10.png" /></figure>

**Proposition Appendix A.12** (Adequacy of $\text{inl}$). If $t \in [[A]]$, then $\text{inl}(t) \in [[A \vee B]]$.

*Proof.* The proof $t$ strongly terminates. Consider a reduction sequence issued from $\text{inl}(t)$. This sequence can only reduce $t$, hence it is finite. Thus, $\text{inl}(t)$ strongly terminates.

Furthermore, if $\text{inl}(t) \to^* \text{inl}(t')$, then $t \to^* t'$. By Proposition Appendix A.7, $t' \in [[A]]$. And $\text{inl}(t)$ never reduces to $\text{inr}(t')$.

<figure><img src="image_11.png" /></figure>

**Proposition Appendix A.13** (Adequacy of $\text{inr}$). If $t \in [[B]]$, then $\text{inr}(t) \in [[A \vee B]]$.

*Proof.* Similar to that of Proposition Appendix A.12.

<figure><img src="image_12.png" /></figure>

**Proposition Appendix A.14** (Adequacy of $\delta_\top$). If $t_1 \in [[\top]]$ and $t_2 \in [[C]]$, then $\delta_\top(t_1, t_2) \in [[C]]$.

*Proof.* The proofs $t_1$ and $t_2$ strongly terminate. We prove, by induction on $|t_1| + |t_2|$, that $\delta_\top(t_1, t_2) \in [[C]]$. Using Proposition Appendix A.8, we only need to prove that every of its one step reducts is in $[[C]]$. If the reduction takes place in $t_1$ or $t_2$, then we apply Proposition Appendix A.7 and the induction hypothesis.

Otherwise, the proof $t_1$ is $\star$ and the reduct is $t_2 \in [[C]]$.

<figure><img src="image_13.png" /></figure>

**Proposition Appendix A.15** (Adequacy of $\delta_\perp$). If $t \in [[\perp]]$, then $\delta_\perp(t) \in [[C]]$.

*Proof.* The proof $t$ strongly terminates. Consider a reduction sequence issued from $\delta_\perp(t)$. This sequence can only reduce $t$, hence it is finite. Thus, $\delta_\perp(t)$ strongly terminates. Moreover, it never reduces to an introduction.

<figure><img src="image_14.png" /></figure>

**Proposition Appendix A.16** (Adequacy of application). If $t_1 \in [[A \Rightarrow B]]$ and $t_2 \in [[A]]$, then $t_1, t_2 \in [[B]]$.

*Proof.* The proofs $t_1$ and $t_2$ strongly terminate. We prove, by induction on $|t_1| + |t_2|$, that $t_1, t_2 \in [[B]]$. Using Proposition Appendix A.8, we only need to prove that every of its one step reducts is in $[[B]]$. If the reduction takes place in $t_1$ or in $t_2$, then we apply Proposition Appendix A.7 and the induction hypothesis.

Otherwise, the proof $t_1$ has the form $\lambda x.u$ and the reduct is $(t_2/x)u$. As $\lambda x.u \in [[A \Rightarrow B]]$, we have $(t_2/x)u \in [[B]]$.

<figure><img src="image_15.png" /></figure>

**Proposition Appendix A.17** (Adequacy of $\delta_\wedge^1$). If $t_1 \in [[A \wedge B]]$ and, for all $u$ in $[[A]]$, $(u/x)t_2 \in [[C]]$, then $\delta_\wedge^1(t_1, x.t_2) \in [[C]]$.
*Proof.* By Proposition Appendix A.6, $x \in [A]$ thus $t_2 = (x/x)t_2 \in [C]$. Hence, $t_1$ and $t_2$ strongly terminate. We prove, by induction on $|t_1| + |t_2|$, that $\delta_{\wedge}^1(t_1, x.t_2) \in [C]$. Using Proposition Appendix A.8, we only need to prove that every of its one step reducts is in $[C]$. If the reduction takes place in $t_1$ or $t_2$, then we apply Proposition Appendix A.7 and the induction hypothesis.

Otherwise, the proof $t_1$ has the form $\langle u, v \rangle$ and the reduct is $(u/x)t_2$. As $\langle u, v \rangle \in [A \wedge B]$, we have $u \in [A]$. Hence, $(u/x)t_2 \in [C]$. $\square$

**Proposition Appendix A.18 (Adequacy of $\delta_{\wedge}^2$).** If $t_1 \in [A \wedge B]$ and, for all $u$ in $[B]$, $(u/x)t_2 \in [C]$, then $\delta_{\wedge}^2(t_1, x.t_2) \in [C]$.

*Proof.* Similar to that of Proposition Appendix A.17. $\square$

**Proposition Appendix A.19 (Adequacy of $\delta_{\vee}$).** If $t_1 \in [A \vee B]$, for all $u$ in $[A]$, $(u/x)t_2 \in [C]$, and, for all $v$ in $[B]$, $(v/y)t_3 \in [C]$, then $\delta_{\vee}(t_1, x.t_2, y.t_3) \in [C]$.

*Proof.* By Proposition Appendix A.6, $x \in [A]$, thus $t_2 = (x/x)t_2 \in [C]$. In the same way, $t_3 \in [C]$. Hence, $t_1, t_2$, and $t_3$ strongly terminate. We prove, by induction on $|t_1| + |t_2| + |t_3|$, that $\delta_{\vee}(t_1, x.t_2, y.t_3) \in [C]$. Using Proposition Appendix A.8, we only need to prove that every of its one step reducts is in $[C]$. If the reduction takes place in $t_1, t_2$, or $t_3$, then we apply Proposition Appendix A.7 and the induction hypothesis. Otherwise, either:

* The proof $t_1$ has the form $\mathrm{inl}(w_2)$ and the reduct is $(w_2/x)t_2$. As $\mathrm{inl}(w_2) \in [A \vee B]$, we have $w_2 \in [A]$. Hence, $(w_2/x)t_2 \in [C]$.

* The proof $t_1$ has the form $\mathrm{inr}(w_3)$ and the reduct is $(w_3/x)t_3$. As $\mathrm{inr}(w_3) \in [A \wedge B]$, we have $w_3 \in [B]$. Hence, $(w_3/x)t_3 \in [C]$. $\square$

**Theorem Appendix A.20 (Adequacy).** Let $t$ be a proof of $A$ in a context $\Gamma = x_1 : A_1, \dots, x_n : A_n$ and $\sigma$ be a substitution mapping each variable $x_i$ to an element of $[A_i]$, then $\sigma t \in [A]$.

*Proof.* By induction on the structure of $t$.

* If $t$ is a variable, then, by definition of $\sigma$, $\sigma t \in [A]$.

* If $t = \star$, then, by Proposition Appendix A.9, $\star \in [\top]$, that is $\sigma t \in [A]$.

* If $t = \lambda x.u$, where $u$ is a proof of $C$, then, by induction hypothesis, for every $v \in [B]$, $(v/x)\sigma u \in [C]$. Hence, by Proposition Appendix A.10, $\lambda x.\sigma u \in [B \Rightarrow C]$, that is $\sigma t \in [A]$.

* If $t = \langle u, v \rangle$, where $u$ is a proof of $B$ and $v$ a proof of $C$, then, by induction hypothesis, $\sigma u \in [B]$ and $\sigma v \in [C]$. Hence, by Proposition Appendix A.11, $\langle \sigma u, \sigma v \rangle \in [B \wedge C]$, that is $\sigma t \in [A]$.

* If $t = \mathrm{inl}(u)$, where $u$ is a proof of $B$, then, by induction hypothesis, $\sigma u \in [B]$. Hence, by Proposition Appendix A.12, $\mathrm{inl}(\sigma u) \in [B \vee C]$, that is $\sigma t \in [A]$.

* If $t = \mathrm{inr}(v)$, the proof is similar, using Proposition Appendix A.13.

* If $t = \delta_{\top}(u, v)$, where $u$ is a proof of $\top$ and $v$ is a proof of $A$, then, by induction hypothesis, $\sigma u \in [\top]$, and $\sigma v \in [A]$. Hence, by Proposition Appendix A.14, $\delta_{\top}(\sigma u, \sigma v) \in [A]$, that is $\sigma t \in [A]$.

* If $t = \delta_{\bot}(u)$, where $u$ is a proof of $\bot$, then, by induction hypothesis, $\sigma u \in [\bot]$. Hence, by Proposition Appendix A.15, $\delta_{\bot}(\sigma u) \in [A]$, that is $\sigma t \in [A]$.

* If $t = uv$, where $u$ is a proof of $B \Rightarrow A$ and $v$ a proof of $B$, then, by induction hypothesis, $\sigma u \in [B \Rightarrow A]$ and $\sigma v \in [B]$. Hence, by Proposition Appendix A.16, $(\sigma u)(\sigma v) \in [A]$, that is $\sigma t \in [A]$.

* If $t = \delta_{\wedge}^1(u_1, x.u_2)$, where $u_1$ is a proof of $B \wedge C$ and $u_2$ a proof of $A$, then, by induction hypothesis, $\sigma u_1 \in [B \wedge C]$, for all $v$ in $[B]$, $(v/x)\sigma u_2 \in [A]$. Hence, by Proposition Appendix A.17, $\delta_{\wedge}^1(\sigma u_1, x.\sigma u_2) \in [A]$, that is $\sigma t \in [A]$.
* If $t = \delta_{\wedge}^2(u_1, x.u_2)$, the proof is similar, using Proposition Appendix A.18.

* If $t = \delta_{\vee}(u_1, x.u_2, y.u_3)$, where $u_1$ is a proof of $B \lor C$, $u_2$ a proof of $A$, and $u_3$ a proof of $A$, then, by induction hypothesis, $\sigma u_1 \in [[B \lor C]]$, for all $v$ in $[[B]]$, $(v/x)\sigma u_2 \in [[A]]$, and for all $w$ in $[[C]]$, $(w/x)\sigma u_3 \in [[A]]$. Hence, by Proposition Appendix A.19, $\delta_{\vee}(\sigma u_1, x.\sigma u_2, y.\sigma u_3) \in [[A]]$, that is $\sigma t \in [[A]]$. $\square$

**Corollary Appendix A.21 (Termination).** Let $t$ be a proof of $A$ in a context $\Gamma$. Then, $t$ strongly terminates.

*Proof.* Let $\sigma$ be the substitution mapping each variable $x_i : A_i$ of $\Gamma$ to itself. Note that, by Proposition Appendix A.6, this variable is an element of $[[A_i]]$. Then, $t = \sigma t$ is an element of $[[A]]$. Hence, it strongly terminates. $\square$