Abstract 1 Introduction 2 Preliminaries 3 The action of Dialectica on programs 4 A procedural language for Dialectica 5 Conclusion and Future Work References Appendix A Appendix

On the Algorithmic Structure of Dialectica Realisers

Davide Barbarossa ORCID Department of Computer Science, University of Bath, UK Thomas Powell ORCID Department of Computer Science, University of Bath, UK
Abstract

Gödel’s Dialectica interpretation is a fundamental tool for the extraction of computational content from proofs, and plays a central role in today’s proof mining program. In the past decades, it has also been studied from the perspective of programming languages, and our contribution is in that direction. Specifically, we present Dialectica as a collection of rules in the style of Hoare logic, where Dialectica is now viewed as a language for specifying procedural programs that come with a forward and backward direction. This viewpoint captures the interesting dynamics of realisers extracted by the Dialectica interpretation, and we illustrate this by defining a generalised backpropagation semantics for a fragment of this language. We envisage this work as providing a base for several future developments, both theoretical and practical, which we outline at the end.

Keywords and phrases:
Dialectica interpretation, Hoare logic, Programs from proofs
Copyright and License:
[Uncaptioned image] © Davide Barbarossa and Thomas Powell; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Proof theory
; Theory of computation Constructive mathematics
Related Version:
Full Version: https://arxiv.org/abs/2501.16208
Acknowledgements:
The authors thank Ulrich Berger (who first suggested looking at the frame rule) and Marie Kerjean (who among other things helped clarify several points from [16]).
Funding:
This work was funded by the Engineering and Physical Sciences Research Council, grant number EP/W035847/1.
Editors:
Stefano Guerrini and Barbara König

1 Introduction

Gödel’s Dialectica interpretation [12] (which we will often refer to as just “Dialectica”) is one of the most important methods for extracting computational content from proofs. Interest in this technique has grown rapidly in recent years, partially due to increased activity in two distinct strands of research.

The first is the proof mining program (an overview of which can be found in the monograph [18] or the survey papers [19, 20]), in which methods from proof theory are applied to obtain both quantitative and qualitative improvements of theorems in mainstream mathematics through the analysis of their proofs. Here, the Dialectica interpretation is used in particular to formulate so-called logical metatheorems, which involve extensions of Dialectica to sophisticated proof systems designed to explain the extractability of quantitative information in a specific setting (see e.g. the classic works [17, 11], or the most recent metatheorem in probability theory [25]).

The second, somewhat orthogonal strand, is represented by a variety of works that approach Dialectica from a programming or categorical point of view, where the focus is on its structural properties as a logical and program transformation, rather than on its concrete applications to mathematics. A crucial ingredient here is de Paiva’s Dialectica categories and the discovery of the links between Dialectica and linear logic [8] (recent developments of the categorical viewpoint can be found in e.g. [39]). Most relevant to this paper is the recent reformulation of Dialectica as a genuine higher-order functional program transformation [33], which also led to the discovery of its links with automatic differentiation and the differential λ-calculus [16].

This paper is a study of the Dialectica interpretation that can be related to both of these perspectives: We consider Dialectica in its traditional form as used in proof mining, but with a focus on the algorithmic structure of the terms it extracts (referred to here as “Dialectica realisers”). More specifically, we give an alternative presentation of the standard Dialectica interpretation, through a set of rules that that manipulate programs rather than logical formulas. The rules are set up in the style of Hoare logic [14], and act on what we call Dialectica triples, which are for now just realizing terms for implications between formulas (the characterising feature of Dialectica), but which we later connect with Hoare triples in the usual sense. Our rules formulate the standard soundness theorem for Dialectica by focusing on properties of extracted realizers, and in this way we seek to expose some of the elegant patterns and symmetries that govern programs extracted by the Dialectica.

We build on this perspective in two ways. First, we introduce a while loop for Dialectica into our term language, and show that it interprets a corresponding rule. We argue that this can be used to neatly describe iterative programs that arise from nonconstructive proofs in mathematics, where it is connected to the idea of interpreting classical proofs via learning or backtracking, a notion that dates back to Hilbert’s substitution method [1].

The fact that Dialectica admits a Hoare Logic presentation or, dually, that Hoare logic admits an extension as a logic for Dialectica realisers, raises the question of whether we can understand them from a procedural perspective. We take a first step in this direction in Section 4, where we consider a restricted set of proof rules whose Dialectica realisers can be regarded as stateful in a suitable sense (though we hesitate to characterise them as truly imperative due to the lack of variable assignment for now, discussed further in Section 5). We describe an operational semantics which demonstrates that our programs perform a generalised backpropagation algorithm, comprising a conventional forward part together with a backward pass that computes the reverse witness.

Our aim in all of this is to provide a perspective that can be properly developed in future work, and in that spirit, we conclude by discussing several concrete ideas, covering both theory and applications.

Our choice of formal system.

We will generally privilege a standard presentation of the Dialectica, over more program theoretic ones as found in e.g. [33]. In particular, we work in a higher-order version of Heyting arithmetic rather than a “modern” type theory. Extensions of the former have proven to be more than capable of capturing the application of Dialectica to a great variety of subsystems of ordinary mathematics: An instructive recent example is probability theory, which a-priori requires strong set-theoretic principles to carry out even the most basic tasks, but which is nevertheless amenable to program extraction via the Dialectica as set out in [25] and as exemplified by the numerous case studies that have appeared in the last years. It is open whether alternative systems based on e.g. dependent type theory are better suited to the very precise task of capturing applications of Dialectica to tame proofs in ordinary mathematics (see [21] for a discussion of “proof theoretic tameness” in this context), or can be as easily combined with logical relations such as majorizability [15] that are essential for capturing uniformities in extracted programs. Finally, even though as shown in [33] these traditional formulations usually lack a crucial proof/program theoretic property, namely they break β-equivalence, here we embrace this fact at it gives rise to a natural if-then-else case distinction construct which fits well with our procedural perspective.

2 Preliminaries

The base system 𝐖𝐄-𝐇𝐀𝝎

Essentially all applications of Dialectica to concrete proofs in mathematics can be described formally in terms of some theory based on arithmetic in all finite types, and accordingly we take as our base theory the weakly extensional version WE-HAω of higher-order Heyting arithmetic, the higher-order theory of intuitionistic arithmetic with all finite types, whose underlying programming language of terms corresponds to System T. This can be simultaneously used as a system for formalising mathematics, or as a logic for reasoning about higher-order programs, and we take both perspectives in this paper. Full details can be found in [18, Chapter 3], and the very brief overview here is merely used as an opportunity to fix notational conventions. The types of WE-HAω are the simple types

X,Y::=𝗇𝖺𝗍|XY

where 𝗇𝖺𝗍 represents a base type of natural numbers. As in conventional in proof mining, we work with sequences of types in the metalanguage rather than explicitly introducing product types, which in particular allows us to employ more liberal abbreviations in the logical system. We use boldface 𝑿=X1,,Xn to denote sequences of types, and from now on, when we say “type” we usually refer to a sequence. Similarly, we use boldface 𝒂=a1,,an to denote sequences of terms, writing 𝒂:𝑿 or 𝒂𝑿 to denote a1:X1,,an:Xn.

The terms of WE-HAω are those of the simply typed λ-calculus plus constants 𝟢:𝗇𝖺𝗍 and 𝗌𝗎𝖼:𝗇𝖺𝗍𝗇𝖺𝗍 for zero and successor (we use x+1 for 𝗌𝗎𝖼x) and, for each sequence 𝑿 of types, a constant 𝚛𝚎𝚌𝑿:(𝗇𝖺𝗍𝑿𝑿)𝑿𝗇𝖺𝗍𝑿 for primitive recursion. We include an explicit cases constructor 𝚒𝚏(b𝗇𝖺𝗍,𝒔,𝒕) for all types, even though this is definable from the recursor. We make free use of a number of standard abbreviations around sequences of types and terms. If 𝑿=X1,,Xn and 𝒀=Y1,,Ym then 𝑿𝒀 denotes the sequence (X1XnYj)j=1m, Similarly, if 𝒂:𝑿𝒀 and 𝒃:𝑿, then by 𝒂𝒃:𝒀 we mean (ajb1bn)j=1m, and if 𝒄:𝒀 are terms and 𝒙:𝑿 are variables, then by λ𝒙.𝒄:𝑿𝒀 we mean(λx1,,xn.cj)j=1m. We write 𝒃,𝒄:𝑿,𝒀 for the concatenation of two sequences.

Formulas of WE-HAω are built from atomic formulas of the form t=𝗇𝖺𝗍s for t,s:𝗇𝖺𝗍, the usual logical connectives ,,,, (where we write ¬A:=A), and quantifiers X,X for each simple type X (which we usually omit). We also write 𝒙A(𝒙) for X1x1,,XnxnA(x1,,xn) and similarly for . Equality =X at higher types is defined in terms of =𝗇𝖺𝗍, where for X=X1Xn𝗇𝖺𝗍 we set

t=Xs:=x1,,xn(tx1xn=𝗇𝖺𝗍sx1xn).

Equality for sequences is defined in the obvious way. The axioms and rules of WE-HAω are those of usual intuitionistic logic extended to all simple types, along with equality axioms for =𝗇𝖺𝗍, induction, and axioms for the arithmetical constants and terms of System T. For instance, the conditional satisfies

b=𝗇𝖺𝗍0𝚒𝚏(b,𝒔,𝒕)=𝒔andb𝗇𝖺𝗍0𝚒𝚏(b,𝒔,𝒕)=𝒕

and the axioms for the recursors are:

𝚛𝚎𝚌𝒛𝒚0=𝒚and𝚛𝚎𝚌𝒛𝒚(x+1)=𝒛x(𝚛𝚎𝚌𝒛𝒚x).

For equality, we consider the weak extensionality rule111We stress that extensionality issues are not a concern for what we do: Soundness theorems for Dialectica are formulated using WE-HAω for the simple reason that the extensionality axiom is not admissible. However, because our focus in on a descriptive system for realizers, we could equally well work in the fully extensional version of Heyting arithmetic E-HAω.

A0a=XbA0B[a/x]B[b/x]

where B is an arbitrary formula and A0 is quantifier free. For full details of WE-HAω the reader is directed to [18], though exact details at this level are unimportant for what follows.

The Dialectica interpretation

We give a brief overview of the Dialectica interpretation of formulas (as opposed to proofs). This is completely standard, and full details can be found in [18, Chapter 8]. In simple terms, the Dialectica interpretation is a mapping P𝒙𝒚|P|𝒚𝒙 that transforms formulas from some source logic (originally Heyting arithmetic) to some higher-order functional language (originally System T). The transformed formula |P|𝒚𝒙 contains two additional tuples of free variables, playing the role of witnesses 𝒙 and counterwitnesses 𝒚 for P, while the formula |P|𝒚𝒙 can be viewed as an orthogonality relation similarly to classical realisability. The aim is to establish that whenever P is provable in the source system, there exists terms 𝒂 such that 𝒚|P|𝒚𝒂 is provable in the target system. For a term t:𝗇𝖺𝗍, we introduce a new abbreviation t for the formula

AtB:=(t=𝗇𝖺𝗍0A)(t𝗇𝖺𝗍0B)

Using the fact that any quantifier-free formula ϕ of WE-HAω can be represented by a “characteristic term” χϕ:𝗇𝖺𝗍 with the same free variables satisfying χϕ=0ϕ, we extend this connective to such formulas by defining AϕB:=AχϕB.

Definition 1 (Dialectica interpretation [12], see also [18]).

For a formula P of WE-HAω, we define its Dialectica interpretation to be the formula 𝐱𝐲|P|𝐲𝐱, whose free variables are the same as P, and where |P|𝐲𝐱 is a quantifier-free formula, defined inductively along with the types of 𝐱 and 𝐲 as follows:

  • |P|:=P if P is atomic

  • |PQ|𝒚,𝒗𝒙,𝒖:=|P|𝒚𝒙|Q|𝒗𝒖

  • |PQ|𝒚,𝒗b,𝒙,𝒖:=|P|𝒚𝒙b|Q|𝒗𝒖

  • |PQ|𝒙,𝒗𝒇,𝑭:=|P|𝑭𝒙𝒗𝒙|Q|𝒗𝒇𝒙

  • |xP(x)|𝒚x,𝒖:=|P(x)|𝒚𝒖

  • |xP(x)|x,𝒚𝒇:=|P(x)|𝒚𝒇x

Note that if ϕ is quantifier-free then we can assume that it doesn’t contain (as it can be rewritten as χϕ=0) and therefore that |ϕ|=ϕ.

The characteristic feature of Dialectica, which sets it apart from realisability-like interpretations, is its treatment of implication, which comprises a forward-component 𝒇 as in realisability along with a backward component 𝑭, which together compose in a “backpropagation” style. The soundness theorem for the Dialectica interpretation (i.e. the Dialectica interpretation of proofs), for extensions of WE-HAω, usually takes the following general form:

Theorem 2 (Generic soundness theorem).

Suppose that Δ is a set of axioms whose Dialectica interpretation is witnessed by terms of WE-HAΔω (provably in this system) for some suitable extension of WE-HAω, and let 𝒰 be a set of purely universal formulas. Then whenever

WE-HAω+Δ+𝒰P

we can extract terms 𝐚, whose free variables are the same as those of P, such that

WE-HAΔω+𝒰𝒚|P|𝒚𝒂.

In particular, we can set Δ=𝒰= to obtain the Dialectica interpretation of WE-HAω. A common formulation (cf. [18, Theorem 8.6]) has Δ consisting of the axiom of choice (AC), the independence of premise scheme for universal formulas (IPω), and Markov’s principle (Mω) with WE-HAΔω=WE-HAω. A further extension is to add the double negation shift to Δ, and then WE-HAΔω=WE-HAω+(BR) i.e. Heyting arithmetic extended with bar recursion in all finite types (cf. [18, Chapter 11]).

3 The action of Dialectica on programs

We now present the soundness theorem for the Dialectica interpretation from a slightly different perspective, by providing a collection of specification rules for Dialectica realizers (terminology we use for programs extracted from proofs using Dialectica), all of which are sound in our base theory WE-HAω. The intention here is to construct a rich, descriptive language where the focus is on the realizing terms rather than the underlying logic, one which can be easily extended with new programming constructs, or new rules for describing extracted programs of a specific type. We give several examples of this in what follows.

Our basic approach is inspired by Hoare logic [14], in the sense that our rules apply to “triples” that describe properties of Dialectica realizers. Let us explain this in more detail. Viewed abstractly, a basic Hoare triple {P}c{Q} describes the effect of some command c in an imperative language on an underlying state. Here P (the precondition) and Q (the postcondition) are assertions about the state, and the meaning of the triple is that whenever the command executes on a state satisfying P, the resulting state satisfies Q. We can represent this basic idea in predicate logic by viewing the pre- and postconditions as formulas P(s),Q(s) acting on objects s:S for some state type S, and commands as functions c:SS. The Hoare triple then becomes the statement that c satisfies

s(P(s)Q(cs)).

If we now imagine that P(s) and Q(s) are quantifier-free formulas, and the state can be encoded in a suitable way in WE-HAω, the formula P(s)Q(cs) is exactly

|xP(x)xQ(x)|c.

With this loose correspondence in mind, we now generalise to formulas of arbitrary logical complexity and define a “Dialectica triple” as

P𝒂|𝜶Q:=𝒙,𝒗|PQ|𝒙,𝒗𝒂,𝜶.

where now 𝒂 and 𝜶 are sequences of terms of some type determined by the formulas P and Q. In terms of actions on a hypothetical state 𝒙, we visualise the pair 𝒂|𝜶 as comprising two components: A forward “command” 𝒂 satisfying

𝒙(𝒚|P|𝒚𝒙𝒗|Q|𝒗𝒂𝒙)

followed by a backward command 𝜶, that operates on a “dual state” 𝒗, satisfying

𝒙,𝒗(¬|Q|𝒗𝒂𝒙¬|P|𝜶𝒙𝒗𝒙)

This approach differs from the use of Hoare triples for realizability in [36], which is based on a monadic translation of proofs: Here Hoare triples are just the interpretation of implication, and a corresponding stateful interpretation in terms of backpropagation will be discussed in more detail in Section 4 below.

As we will see, our use of Hoare logic in the abstract allows us to view Dialectica realisers as “stateful” or procedural programs. However, we are cautious in drawing too strong a connection: The fundamental power of Hoare logic and its various extensions lies in its ability to reason explicitly about the structure of the state, something that in connection to Dialectica we leave to future work. Therefore at present, we do not characterise Dialectica realisers as truly imperative. However, we do believe that such view is possible and we think of this work as the first step towards it.

3.1 A Dialectica Hoare logic (𝐃𝐇𝐋)

Figure 1: Rules for Dialectica triples, definitions and abbreviations discussed in Section 3.1.

It is natural to ask what Hoare-like rules govern Dialectica realizers when viewed in this way. Fixing sets Ax,Rule of axioms and rules in WE-HAω, we define a judgment system DHL (for Dialectica Hoare Logic) which derives judgments of shape P𝒂|𝜶Q, where P,Q are formulas of WE-HAω and 𝒂,𝜶 are (sequences of) terms of System T, according to the rules in Figure 1. In all cases, the types of 𝒂,𝜶 are left implicit, but can be inferred from the rules and formulas, as usual in Dialectica. These rules are described in detail in the points below, where we also clarify the notations and abbreviations used.

  • We write P to denote a formula whose Dialectica interpretation is purely existential i.e. of the form 𝒙|P|𝒙. Similarly, P and Pqf mean that the Dialectica interpretation of P is purely universal resp. quantifier-free.

  • The sets Ax and Rule denote sets of universal axioms and rules that we add to the system: At the very least Ax would include the axioms and rules for =𝗇𝖺𝗍 along with those governing System T terms, while Rule would include the quantifier-free extensionality rule, but we leave open the possibility that other axioms and rules could be included.

  • For c:𝗇𝖺𝗍 we define c¯ by 0¯:=1 and n+1¯:=0.

  • 𝜶~ denotes a permutation of the arguments of 𝜶, whose precise definition varies but can be immediately inferred from the rule. For example, written out fully, the 𝜶~ in the conclusion of (pR) should be 𝜶~:=λ𝒙,𝒘,𝒗.𝜶𝒙𝒗𝒘 and the intuitive meaning of the triple is the formula 𝒙,𝒘,𝒗(|P|𝜶~𝒙𝒘𝒗𝒙|R|𝒘𝒃𝒙|Q|𝒗𝒂𝒙). This further illustrates our philosophy on implicit typing: The aim of our notation is to suppress bureaucratic λ-terms wherever these can be directly inferred.

  • In a similar way, 𝜶π denotes a projection (e.g. in (R), 𝜶π is shorthand for λ𝒙,𝒚,𝒗.𝜶𝒙𝒗), while 𝜶p denotes a coprojection, by which we mean the instantiation of certain arguments with canonical zero terms 𝟎 of the right type (e.g. in (R), 𝜶p is shorthand for λ𝒙,𝒗.𝜶𝒙𝒗𝟎).

  • λ_.t denotes the constant term λ𝒙.𝒕, where the types of 𝒙, not free in t, are to be inferred.

  • For the conditional rules, ϕ is always quantifier-free.

  • For composition, denotes the usual composition of functions, while denotes the special backwards composition for the Dialectica interpretation, with

    𝜶𝒂𝜷:=λ𝒙,𝒘.𝜶𝒙(𝜷(𝒂𝒙)𝒘)
  • For the quantifier rules we write Q(𝒙) to denote all occurrences of the free variables 𝒙 in Q, and note that there may be no occurrences. We assume the usual rules for substitution e.g. in (R) that 𝒕 is free for 𝒙 in Q, and similarly for the other rules.

  • Rule (cons) is the Dialectica version of the usual consequence rules, where the pre- and postconditions can be weakened/strengthened with no bearing on the program. More precisely, we define the WE-HAω-formula PDP by

    𝒙,𝒗(|P|𝒗𝒙|P|𝒗𝒙)

    i.e. the witnessing types of P and P coincide under the Dialectica and implication is interpreted by the identity.

  • Finally, 𝚛𝚎𝚌 denotes the usual recursor whose defining axiom is given in Section 2, while the backward recursor 𝚛𝚎𝚌 is defined (using the main recursor) as 𝚛𝚎𝚌𝒂𝜶𝒚x𝒗:=𝜷x for

    𝜷0:=𝒗and𝜷(z+1):=𝜶(xz1)(𝚛𝚎𝚌𝒂𝒚(xz1))(𝜷z).
Theorem 3.

Assuming that all elements of Ax and Rule are admissible in WE-HAω, if P𝐚|𝛂Q is derivable from the rules in Figure 1, then 𝐱,𝐯(|P|𝛂𝐱𝐯𝐱|Q|𝐯𝐚𝐱) is provable in WE-HAω.

The proof of Theorem 3 is routine, and involves no ideas fundamentally different to those already present in the usual soundness proofs of Dialectica for WE-HAω. Some of the more interesting rules are discussed in the appendix. We note that by restricting the rules of DHL so that the precondition is always purely existential, we obtain a simplified set of rules that act only on left-hand realizers, and very closely reflect traditional Hoare rules. These are also presented in the appendix, in Figure 9.

Using 𝐃𝐇𝐋

Figure 2: Rules for disjunction, derivable from those in Figure 1, which can be added to DHL.

Our system DHL is, above all, intended to be a useful system for constructing and describing realizing terms. It is certainly not a minimal system: Indeed, because (cons) ranges over all implications of form D derivable in WE-HAω, it can be used together with the quantifier introduction rules to derive all of the others. However, a human (or a machine) using the system would typically use (cons) only in in cases where PDP and QDQ are immediate (e.g. have no computational content), and would resort to the main rules for constructing complex terms.

We view the system as fundamentally extendible: The rules in Figure 1 provide the basic manipulations on terms required to show that the Dialectica is sound for WE-HAω, but in practice, especially if we envisage DHL being incorporated into some proof assistant as a way of reasoning about Dialectica realizers, we would add a range of derivable rules for dealing with specific mathematical structures in proofs, along with new rules for characterising additional constructs added to System T. We give several examples of these in what follows. As a simple illustration, in Figure 2 we note several rules involving disjunction that are easily derivable from those for b along with (cons) and the fact that PQDb(PbQ).

It is now natural to ask: What purely logical system is mirrored by DHL? This can be quite interesting, especially so when we consider extensions to our rules later on. We first note that if we remove (ϵL), (ϵR), (cons), (ext) from those of Figure 1, and then replace the disjunction rules with those of Figure 2, these rules can be adapted to form a logical system in the language of WE-HAω by just suppressing the realizing term. For example, we can simplify the rule (condL) as

and similarly for the others. Letting denote the resulting system, we have the following:

Theorem 4.

Whenever P is provable in WE-HAω, then P is provable in .

Again, the proof is straightforward, and a rough sketch of how we show this is provided in the appendix. Theorem 4 therefore represents an alternative soundness proof from the Dialectica interpretation of WE-HAω, and another way of using DHL: If P is provable in WE-HAω, we take an alternative derivation of P in and adding back the hidden realizing terms we obtain a derivation of

𝒂|P=𝒗|P|𝒗𝒂

where 𝒂 is constructed via the derivation (note that we can also force that the free variables of 𝒂 are contained in those of P by applying (L) on all superfluous variables and then (sL) instantiated with zero terms). We also observe that if PQ is any formula such that PDRDQ for some suitable R, then Pλ𝒙.𝒙|λ𝒙,𝒗.𝒗Q is immediately derivable from the (cons) rule and therefore PQ can be added to . In this way, we also regain that AC, IPω and Mω are admissible by the Dialectica.

There are still three rules we have not discussed. While (ext) is just an extensionality rule purely for reasoning about extracted terms, (ϵL) and (ϵR) are more interesting. These essentially allow us access to epsilon terms: Informally speaking, we can add these rules to our purely logical system as

where here we would add a countable set of epsilon terms (ϵi) to our language and use a fresh sequence of ϵ-terms for each instance of (ϵL), (ϵR) in a derivation. The hidden realizing terms allow us to always assign concrete values to these ϵ-terms, which can then be substituted in should any remain at the end of a derivation. However, some care is needed to set this up formally. Interestingly, the addition of ϵ-terms to intuitionistic logic is explored in [23]: There, doing this for arbitrary formulas does not give us a conservative extension of intuitionistic logic, as the full independence of premise axiom is then derivable222We are grateful to Cameron Allett for directing us to [23].. Our in-built restriction for (ϵR) that the left hand formula has purely universal Dialectica interpretation avoids this problem: We are then only able to derive independence of premise for universal formulas, and this is admissible by Dialectica!

Finally, we note that by taking advantage of the infrastructure is already available via Oliva’s unified approach to functional interpretations [30], it would not be hard to parametrise our own system DHL with abstract bounding relation and thereby obtain both the traditional Dialectica, modified realizability and the Diller-Nahm interpretation [10] as instances. For the latter, the conditional rule (condR) would then look like

for a union operation on finite sets.

3.2 A while rule for Dialectica, and its use in classical logic

We characterised DHL as being inspired by Hoare logic, but conspicuously absent so far are any kind of imperative control flow statements. To that end, we introduce a while construct and identify a corresponding rule that is sound in our base system. We argue that in the context of Dialectica, this while loop is well-suited to describing how programs extracted from classical logic implement “learning algorithms”.

For the present paper, we restrict our attention to programs that are total, so our while rule is specified relative to some wellfounded relation. We first introduce a decidable binary relation on objects of type 𝑿, which can be modelled in WE-HAω as a function :𝑿𝑿𝗇𝖺𝗍. We then expand WE-HAω with a wellfounded induction rule I given by

where A(𝒙) ranges over arbitrary formulas. Now, for a quantifier-free formula ϕ(𝒙𝑿) and a term 𝒂:𝑿𝑿, for any sequence of types 𝑼 we add to the language of WE-HAω a while recursor 𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌,ϕ,𝒂:(𝑿𝑼)(𝑿𝑼𝑼)𝑿𝑼 along with the schema

(ϕ(𝒙)𝒂𝒙𝒙)𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌,ϕ,𝒂𝒖𝑭𝒙=𝑼𝚒𝚏(ϕ(𝒙),𝑭𝒙(𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌,ϕ,𝒂𝒖𝑭(𝒂𝒙)),𝒖𝒙)

where here the premise ensures that triggering the condition of the while loop causes a descent along . We write WE-HAω+(𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌) for WE-HAω extended with the while recursor and its axiom for all ϕ and 𝒂. Now we define the forward while operator 𝚠𝚑𝚒𝚕𝚎+ϕ𝚍𝚘𝒂:𝑿𝑿 as

𝚠𝚑𝚒𝚕𝚎+ϕ𝚍𝚘𝒂:=𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌,ϕ,𝒂(λ𝒙.𝒙)(λ𝒙,𝒚.𝒚)

and the backward operator 𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘(𝒂,𝜶):𝑿𝑽𝑽 for 𝜶:𝑿𝑽𝑽 as

𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘(𝒂,𝜶):=𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌,ϕ,𝒂(λ𝒙,𝒗.𝒗)(λ𝒙,𝒇,𝒗.𝜶𝒙(𝒇𝒗)).

The following result, easily proven by expanding the definitions, guarantees that the forward while behaves indeed as a while loop. The backward direction is more subtle, and we discuss how it can be interpreted as part of a stateful program in Section 4.

Lemma 5.

Whenever ϕ(𝐱)𝐚𝐱𝐱 is provable in WE-HAω, the following are provable in WE-HAω+(𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌):

(𝚠𝚑𝚒𝚕𝚎+ϕ𝚍𝚘𝒂)𝒙=𝚒𝚏(ϕ(𝒙),(𝚠𝚑𝚒𝚕𝚎+ϕ𝚍𝚘𝒂)(𝒂𝒙),𝒙),
(𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘(𝒂,𝜶))𝒙𝒗=𝚒𝚏(ϕ(𝒙),𝜶𝒙((𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘(𝒂,𝜶))(𝒂𝒙)𝒗),𝒗).

We now define a corresponding rule for any decidable relation , namely

The rule W is closely connected to the wellfounded while rule of Hoare logic, with the difference that the descent condition is now presented separately. The following result (proven in the appendix) connects the rule to the recursor, and bears some relationship to the interpretation of wellfounded induction in [38].

Theorem 6.

The while rule (W) is admissible in WE-HAω+I+(𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌).

Discussion: The interpretation of classical logic and its interaction with 𝚠𝚑𝚒𝚕𝚎𝚛𝚎𝚌

Figure 3: Example rules for manipulating classical proofs under the double negation translation.

It is well known that classical logic can be given a computational interpretation via the Dialectica by first carrying out a negative translation (see [18, Chapter 10]), where the embedding of classical logic into intuitionistic makes use of a number of (semi-intuitionistic) laws governing negations. Expanding DHL with these laws as primitives would allow for a streamlined verification of programs extracted from classical proofs, and though detailed exploration of this is beyond the scope of the present paper, we give three examples of the kind of rules we have in mind, in Figure 3.

Here, (CP) and (N) are extremely useful (and reversible) symmetry rules that one often encounters when analysing classical proofs, while (comp¬) is a version of composition which illustrates one way in which the negative translation composed with Dialectica eliminates nonconstructive lemmas when proving purely existential formulas, as we discuss below.

Figure 4: Left: For g:XX we use the abbreviation ϕg(x):=gxxθ(gx) and ag:=𝚠𝚑𝚒𝚕𝚎+ϕg𝚍𝚘g. One completes the derivation by using x(θ(x)ϕg(x))g|yθ(y) and x(ϕg(x)gxx), which are easily provable. Right: we use the negative translation to obtain a constructive proof of the double negated statement that appears in the left branch.

An example of how our while rule in particular interacts with these new principles for handling double negation is given on the left side of Figure 4, where we use it to define a realiser for double-negated version of the following minimum principle:

xθ(x)x(θ(x)yx¬θ(y)),

where θ(xX) is a quantifier-free formula and is a wellfounded relation on X (we omit simple instances of (ext) to improve readability). This represents a derivation, in a Hoare style system, of the kind of intuitive algorithm for the minimum principle already described in e.g. [6, Section 7], and the imperative flavour of such constructions in relation to the Dialectica interpretation is also discussed in [34], where an explicit connection to learning algorithms is drawn. This general phenomenon of computing approximations to ideal objects via learning is present in almost all approaches to giving a computational meaning to classical reasoning: the epsilon calculus, modified realizability [7], game semantics [6], approaches based on learning [2], the λμ-calculus [32], call-cc [13], classical realizability [22, 24] and others (see [35] for a comparative study of some of these), and we propose that our approach via Hoare logic might help make explicit this intuition in the context of Dialectica.

Another example where we see our rules for classical logic in action is given by the frequently occurring proof pattern where an instance of a nonconstructive principle is eliminated by the Dialectica when used as a lemma in the proof of a -theorem. More precisely, suppose that we establish vuθ(v,u) by showing (constructively) that for any v we have xyφ(fv,x,y)uθ(v,u), for some function f, but where the premise is an instance of a principle only provable nonconstructively; for instance, x might be a minimal element in some set, a maximal ideal, or a point after which a sequence is 2fv stable. Abbreviating xyφ(fv,x,y) with Qv, the derivation on the right in Figure 4 provides a basic template for eliminating this nonconstructive principle via (comp¬), combining a witness a for the classical Dialectica interpretation of the latter with a realizing pair for the constructive implication above. There are many cases where the witness a for the double negated lemma could be built in a natural way via using our while loop, against some “counterexample function” provided by the backward witness β. It might then form a core component of a procedural-style program for computing a witness for vuθ(v,u).

4 A procedural language for Dialectica

So far, we have put forward the argument that having a rich library of rules for Dialectica triples, including imperative constructs like the while loop, is beneficial for describing programs naturally arising from mathematics in a procedural way. In this section, we consider this aspect of our system in a more formal manner. For now we consider a restricted system that aligns closely with traditional Hoare logic, comprising a small set of rules for generating “stateful” programs. Because these rules arise from the Dialectica interpretation, the result is a novel procedural language with nonstandard interpretation. To be more precise, we define a language LOOPD, representing a Dialectica-like extension of a toy procedural language LOOP, and provide both a Hoare logic and an operational semantics, where the latter captures the idea that

LOOPD=LOOP+backpropagation,

i.e. commands of the language consist of an ordinary forward part, together with a backward component that can be computed via a generalised form of backpropagation. We anticipate that this operational semantics that could eventually be extended to our entire system DHL.

In order to define LOOPD and its corresponding logic, we extend our ambient theory WE-HAω with two new abstract types S and T representing two sorts of state. The extension of WE-HAω with abstract types is standard in the proof mining literature (see [17]), where those types are typically used to represent abstract spaces from mathematics. We then extend the terms WE-HAω by introducing:

  • two equality symbols =S and =T, which we write as predicates but which will technically be terms =S:SS𝗇𝖺𝗍 and =T:TT𝗇𝖺𝗍 (indicating that equality between states is a decidable property). In addition, we extend all the usual constructs of WE-HAω e.g. quantifiers, recursors, lambda abstraction, so that they apply to our new states;

  • two sets of primitive command, the set 𝙲𝚘𝚖𝚖+ of forward commands of type SS, and the set 𝙲𝚘𝚖𝚖 of backward commands of type STT;

  • a set 𝙴𝚡𝚙 of boolean expressions, which are formally a set of decidable predicates on S represented in WE-HAω as characteristic functions of type SS𝗇𝖺𝗍;

  • a set 𝚁𝚎𝚕 of wellfounded relations on S.

We also assume that we have a set of purely universal axioms 𝒰 that characterise the meaning of commands and expressions. We then define the set 𝙲𝚘𝚖𝚖 of commands of LOOPD as follows, all of which represent new constants or term forming operations in WE-HAω for generating pairs of terms of types SS,STT:

C::=𝚜𝚔𝚒𝚙c|γC;C𝚒𝚏ϕ𝚝𝚑𝚎𝚗C𝚎𝚕𝚜𝚎C𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C

where c𝙲𝚘𝚖𝚖+, γ𝙲𝚘𝚖𝚖, ϕ𝙴𝚡𝚙 and 𝚁𝚎𝚕.

LOOPD(_)+(_)𝚜𝚔𝚒𝚙λs.sλs,t.tc|γcγC1;C2C2+C1+C1C1+C2𝚒𝚏ϕ𝚝𝚑𝚎𝚗C1𝚎𝚕𝚜𝚎C2λs.𝚒𝚏(ϕ(s),C1+s,C2+s)λs,t.𝚒𝚏(ϕ(s),C1st,C2st)𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C𝚠𝚑𝚒𝚕𝚎+ϕ𝚍𝚘C+𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘(C+,C)
Figure 5: Decomposition in WE-HAω of LOOPD terms in System T terms. Remember the Dialectica composition from Section 3 and the while constructors from Section 3.2.

The new constructors come equipped with the defining axiom

C=C+|C,

where | is a fixed representation of pairs in WE-HAω and C+:SS and C:STT are defined inductively over 𝙲𝚘𝚖𝚖 as in Figure 5. In particular, notice that by Lemma 5 we have that if ¬ϕ(s), then (𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C1)s=(𝚜𝚔𝚒𝚙)s, and whenever ϕ(s) and C+ss, then

(𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C)s=(C;𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C)s.

We denote by WE-HAω+(LOOPD) the extension of WE-HAω with all of the above (including the while recursor and well-founded induction axiom for all 𝚁𝚎𝚕).

Figure 6: Hoare rules for Dialectica triples in LOOPD. Notice that we use some abbreviations: Pϕ is sugar for the formula P(s,t)ϕ(s), and PϕQ for the formula P(s,t)ϕ(s)Q(s,t).

Figure 5 characterises our commands as comprising a standard imperative forward part, with a “Dialectica version” of the same component as the backward part. A corresponding set of specification rules is now given in terms of our Dialectica triples in Figure 6: Here we use the more compact and suggestive abbreviation

[P]C[Q]:=stP(s,t)C+|CstQ(s,t)=s,t(P(s,Cst)Q(C+s,t))

and restrict our attention to Dialectica triples whose pre- and postconditions are formulas of the form sStTP(s,t) where P(s,t) is quantifier-free, and s,t are the only free variables of type S,T that appear in them. In the second rule, Ax represents some set of axioms that govern the primitive commands, which we assume are included in 𝒰. All of these rules are either instances of the main rules from previous sections, or in the case of conditional, easily derivable, and so it is straightforward to prove the following:

Theorem 7.

All rules in Figure 6 are admissible in WE-HAω+(LOOPD).

We also note that Figure 6 only shows one set of rules corresponding to traditional Hoare logic: Plenty more are admissible (e.g. those for conjunction and disjunction).

An operational semantics for 𝐋𝐎𝐎𝐏𝑫 via backpropagation

Figure 7: Operational semantics for LOOPD.

So far, LOOPD is just an extension of System T, with equational rules that describe the meaning of terms. We now endow terms of LOOPD with a big step operational semantics, to highlight how they can be interpreted as “stateful” programs. We first introduce some notation: For any type X we let X denote the type of finite sequences of elements of X (while this is not formally part of WE-HAω, it can easily be encoded in the system, though we omit details). For σ,τ:X we write τ::σ:X for the concatenation of two sequences, and for x:X similarly write x::σ for concatenation with a single element. We write ϵ for the empty list (of any type). Our semantics comprises two components: A forward relation and a backward relation, which we write

s,C+s,σ,Γandσ,Γ,tσ,Γ,t

for s,s:S, t,t:T, C𝙲𝚘𝚖𝚖, σ,σ:S and Γ,Γ:(STT). Rules for the semantics are given in Figure 7. If we ignore the stacks, our forward semantics is isomorphic to a standard operational semantics for an imperative language. It is not difficult to show that semantics is sound with respect to the denotational semantics of WE-HAω+(LOOPD):

Theorem 8.

Let C be an arbitrary command in LOOPD, where we restrict the formation of 𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C1 to commands such that s(ϕ(s)C1+ss) is provable in WE-HAω. Then for any s there exist s, σ and Γ such that

s,C+s,σ,Γ

where s=C+s in WE-HAω, and such that for any t:T, σ0 and Γ0 there exists t such that

σ::σ0,Γ::Γ0,tσ0,Γ0,t

where t=Cst in WE-HAω.

A proof of Theorem 8 can be found in the appendix. Our operational semantics captures the idea that to evaluate a command C in state s, we perform a forward run

s,C+sk,[sk1,,s1,s],[γk,,γ1]

where for each j=1,,k we have sj=cjsj1 for cj|γj a primitive command, and sk=(ckc1)s=C+s. In other words, each time we are confronted with a primitive command cj|γj in some intermediate state sj1, we perform the forward component but push both the intermediate state sj1 and the backward command γj onto stacks. The backward run then just pops the intermediate states and commands, with

[sk1,,s1,s],[γk,,γ1],tϵ,ϵ,(γ1sγksk1)t

where (γ1sγksk1)t=Cst In this way, programs in LOOPD combine a generalised backpropagation algorithm, where in addition to composing functions we can also perform conditionals and loops. The fact that Dialectica is tightly related with manipulations of stacks in a “backward way” has been discovered in [33], therefore it is not a surprise that stacks also play an essential role in our framework.

Discussion: On automatic differentiation

The basic connection between Dialectica and backpropagation is not new: In particular, it was explored in the specific context of differentiation in [16]. We can phrase it within our framework as well: Suppose that our state S represent some space on which we can define functions c:SS and we have the notion of a differentials Ds(c):SS at points s:S. Suppose that we can also express the reverse differentials Ds(c):TT on the dual space T, defined by Ds(c)t:=tDs(c). Then for a pair c1,c2:SS of differentiable functions, it is well-known that we have the transpose version of the chain rule:

Ds(c1)(Dc1(s)(c2))

or, to put it another way,

c2c1|D()(c2c1)=c1|D()(c1);c2|D()(c2).

Therefore, if our primitive commands consist of pairs c|γ with the property that γs=Ds(c), this property is preserved under composition of commands, and the resulting semantics (restricted to composition) gives a version of the traditional backpropagation algorithm.

It should be stressed that our approach is not intended to equate the investigations around Dialectica and differentiation as done in [16], where among other things a precise translation into the differential λ-calculus is provided. In a certain sense, our presentation is orthogonal, presenting a general backpropagation procedure connected to imperative commands. Actually, for commands of the form c|D()(c) to have any real place within our framework, they have to connect to the overarching logic: For what kind of predicates P,Q on spaces S and their duals T is it naturally the case that sS,tSR(P(s,tDs(c))Q(cs,t)) holds? This is currently unclear to the authors.

5 Conclusion and Future Work

Towards a genuine imperative language, concurrency.

So far, our presentation of LOOPD gives no concrete data structure on the states S,T above, and our primitive commands c,γ are completely abstract. This is the only missing step in order transform LOOPD into a full imperative language with backpropagation. This can be achieved, for example, by introducing, as constants in our formal system, a countable collection of state variables 𝚡1,𝚡2, modeling a memory heap for the state S, which would be now seen as a partial function mapping state variables to 𝗇𝖺𝗍, and similarly we could ask for a further memory heap for the state T. In a similar way we could introduce arithmetic expressions, and include an assignment operation in our primitive commands. However, we leave the details to future work.

Figure 8: Frame-like rules admissible in DHL, P1P2𝒂|𝜶||𝒃|𝜷Q1Q2 is an abbreviation for P1P2𝒂,𝒃|𝜶,𝜷Q1Q2 under the condition that 𝐚,𝐛 and 𝛂,𝛃 operate on different variables.

Another feature that seems to naturally appear in our framework is concurrency, where in particular the rules we give in Figure 8 are admissible in DHL. The interpretation of the conclusion of the left hand rule is

𝒙,𝒚,𝒖,𝒗(|P1|𝜶𝒙𝒖𝒙|P2|𝜷𝒚𝒗𝒚|Q1|𝒖𝒂𝒙|Q2|𝒗𝒃𝒚)

i.e. Dialectica realisers act on independent variables. Accordingly, we also have the basic variant of the frame rule in the right of Figure 8. A proper incorporation of concurrency into Dialectica would be extremely interesting, making the kind local reasoning already implicit in Dialectica more formal. Strictly related with concurrency would be to extend Dialectica to bunched logic [29]. In fact, success here through our approach as Hoare Logic, would lead to further developments in the direction of its extension to separation logic [37] (or intermediate logics [3]). The existence of Dialectica interpretations of linear logic [31] demonstrate the possibility of handling the computational content of substructural logics with Dialectica.

Case studies in probability.

Over the last few years, proof mining has been rapidly expanding to probability theory. An entirely different route for expansion is then to investigate Dialectica for probabilistic programs, in order to make formal the extraction processes behind those new works. Here we could potentially combine our system for Dialectica with variants of Hoare logic for probabilistic programs, e.g. [9]. We anticipate that this is a fertile new territory for interesting algorithms: Here, iterative trial-and-error algorithms seem fundamental, with several different forms of probabilistic convergence represented computationally in terms of learning procedures, which, informally speaking, test elements of a stochastic processes until a region is found which is locally stable with some sufficiently high probability (see [26] for a more detailed account of this phenomenon in the specific context of stochastic convergence, and [27, 28] for examples of recent, relevant case studies, which in turn build on earlier work in ergodic theory [5]). We note that even elementary facts from probability have resulted in algorithms of extreme complexity, such as the analysis of Egorov’s theorem in [4], and propose that the procedural paradigm explored in this paper might be well suited to describing and simplifying such algorithms.

Operational semantics of Dialectica.

Finally, it would be interesting to try to extend the operational semantics of LOOPD terms to the more general class of realisers handled by the full system DHL. Here, of course, we have to contend with full functional programming, but we conjecture that e.g. through a sensible use of monads one could potentially characterise general Dialectica realisers more dynamically, by describing in more detail how the forward and backward directions interact. This perspective brings us closer to machine-based interpretations of proofs such as classical realizability [22], whose applicability to witness extraction from classical proofs as discussed in [24] is undoubtedly relevant, given the association with negative translations. The starting point would surely be the already mentioned [33], where a fundamental connection between Dialectica and the KAM is given.

References

  • [1] Wilhelm Ackermann. Begründung des “tertium non datur” mittels der Hilbertschen Theorie der Widerspruchsfreiheit. Mathematische Annalen, 93:1–36, 1924. doi:10.1007/BF01449946.
  • [2] Federico Aschieri and Stefano Berardi. Interactive learning-based realizability for Heyting arithmetic with EM1. Logical Methods in Computer Science, 6(3), 2010. doi:10.2168/LMCS-6(3:19)2010.
  • [3] Federico Aschieri, Adata Ciabattoni, and Francesco Genco. On the concurrent computational content of intermediate logics. Theoretical Computer Science, 813:375–409, 2020. doi:10.1016/j.tcs.2020.01.022.
  • [4] Jeremy Avigad, Edward T. Dean, and Jason Rute. A metastable dominated convergence theorem. Journal of Logic & Analysis, 4(3):1–19, 2012. doi:10.4115/jla.2012.4.3.
  • [5] Jeremy Avigad, Philipp Gerhardy, and Henry Towsner. Local stability of ergodic averages. Transactions of the American Mathematical Society, 362(1):261–288, 2010. doi:10.1090/S0002-9947-09-04814-4.
  • [6] Stefano Berardi, Marc Bezem, and Thierry Coquand. On the computational content of the axiom of choice. Journal of Symbolic Logic, 63(2):600–622, 1998. doi:10.2307/2586854.
  • [7] Ulrich Berger and Helmut Schwichtenber. Program extraction from classical proofs. In Logic and Computational Complexity workshop (LCC’94), volume 960 of Lecture Notes in Computer Science, pages 77–97, 1995. doi:10.1007/3-540-60178-3_80.
  • [8] Valeria de Paiva. The Dialectica categories. PhD thesis, University of Cambridge, 1991. Published as Technical Report 213, Computer Laboratory, University of Cambridge. doi:10.48456/tr-213.
  • [9] Jerry den Hartog and Erik P. de Vink. Verifying probabilistic programs using a Hoare like logic. International Journal of Foundations of Computer Science, 13:315–340, 2002. doi:10.1142/S012905410200114X.
  • [10] Justus Diller. Eine Variante zur Dialectica-Interpretation der Heyting-Arithmetik endlicher Typen. Archiv für mathematische Logik und Grundlagenforschung, 16(1–2):49–66, 1974. doi:10.1007/BF02025118.
  • [11] Philipp Gerhardy and Ulrich Kohlenbach. General logical metatheorems for functional analysis. Transactions of the American Mathematical Society, 360:2615–2660, 2008. doi:10.1090/S0002-9947-07-04429-7.
  • [12] Kurt Gödel. Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes. dialectica, 12(3–4):280–287, 1958. doi:10.1111/j.1746-8361.1958.tb01464.x.
  • [13] Timothy Griffin. A formulae-as-type notion of control. In Proceedings of Principles of Programming Languages (POPL’90), pages 47–58. ACM, 1990. doi:10.1145/96709.96714.
  • [14] Charles Antony Richard Hoare. An axiomatic basis for computer programming. Communications of the ACM, 12(10):576–580, 1969. doi:10.1145/363235.363259.
  • [15] William A. Howard. Hereditarily majorizable functionals of finite type. In Anne S. Troelstra, editor, Metamathematical Investigation of Intuitionistic Arithmetic and Analysis, volume 344 of Lecture Notes in Mathematics. Springer-Verlag, 1973. doi:10.1007/BFb0066739.
  • [16] Marie Kerjean and Pierre-Marie Pédrot. δ is for Dialectica. In Proceedings of Logic in Computer Science (LICS’24), pages 48:1–13. ACM, 2024. doi:10.1145/3661814.3662106.
  • [17] Ulrich Kohlenbach. Some logical metatheorems with applications in functional analysis. Transactions of the American Mathematical Society, 357(1):89–128, 2005. doi:10.1090/s0002-9947-04-03515-9.
  • [18] Ulrich Kohlenbach. Applied Proof Theory: Proof Interpretations and their Use in Mathematics. Springer Monographs in Mathematics. Springer, 2008. doi:10.1007/978-3-540-77533-1.
  • [19] Ulrich Kohlenbach. Recent progress in proof mining in nonlinear analysis. IFCoLoG Journal of Logics and their Applications, 10(4):3361–3410, 2017. URL: https://www2.mathematik.tu-darmstadt.de/˜kohlenbach/progress-new.pdf.
  • [20] Ulrich Kohlenbach. Proof-theoretic methods in nonlinear analysis. In Proceedings of the International Congress of Mathematicians 2018, volume 2, pages 61–82. World Scientific, 2019. doi:10.1142/9789813272880_0045.
  • [21] Ulrich Kohlenbach. Local formalizations in nonlinear analysis and related areas and proof-theoretic tameness. In Kreisel’s Interests: On the Foundations of Logic and Mathematics, volume 41 of Tributes, pages 45–61. College Publications, 2020. URL: https://www2.mathematik.tu-darmstadt.de/˜kohlenbach/Kreisel2018.pdf.
  • [22] Jean-Louis Krivine. Realizability in classical logic. in: Interactive models of computation and program behaviour. Panoramas et synthéses, 27:197–229, 2009. URL: https://hal.science/hal-00154500/document.
  • [23] Wilfried Meyer-Viol. Instantial Logic. PhD thesis, University of Amsterdam, 1985. URL: https://eprints.illc.uva.nl/id/eprint/1984/2/DS-1995-11.text.pdf.
  • [24] Alexandre Miquel. Existential witness extraction in classical realizability and via a negative translation. Logical Methods in Computer Science, 7(2:2):1–47, 2011. doi:10.2168/LMCS-7(2:2)2011.
  • [25] Morenikeji Neri and Nicholas Pischke. Proof mining and probability theory. Forum of Mathematics, Sigma, 13:e187, 2025. doi:10.1017/fms.2025.10138.
  • [26] Morenikeji Neri, Nicholas Pischke, and Thomas Powell. Generalized learnability of stochastic principles. In Proceedings of Computability in Europe (CiE’25), volume 15764 of LNCS, pages 333–348, 2025. doi:10.1007/978-3-031-95908-0_24.
  • [27] Morenikeji Neri and Thomas Powell. On quantitative convergence for stochastic processes: Crossings, fluctuations and martingales. Transactions of the American Mathematical Society, Series B, 12:974–1019, 2025. doi:10.1090/btran/229.
  • [28] Morenikeji Neri and Thomas Powell. A quantitative Robbins-Siegmund theorem. Annals of Applied Probability, 2025. To appear. doi:10.48550/arXiv.2410.15986.
  • [29] Peter O’Hearn and David Pym. The logic of bunched implications. Bulletin of Symbolic Logic, 5(2):215–244, 1999. doi:10.2307/421090.
  • [30] Paulo Oliva. Unifying functional interpretations. Notre Dame Journal of Formal Logic, 47(2):263–290, 2006. doi:10.1305/ndjfl/1153858651.
  • [31] Paulo Oliva. Functional interpretations of linear and intuitionistic logic. Information and Computation, 208(5):565–577, 2010. doi:10.1016/j.ic.2008.11.008.
  • [32] Michel Parigot. λμ-calculus: An algorithmic interpretation of classical natural deduction. In Proceedings of Logic Programming and Automated Reasoning (LPAR’92), pages 190–201. Springer Berlin Heidelberg, 1992. doi:10.1007/BFb0013061.
  • [33] Pierre-Marie Pédrot. A functional functional interpretation. In Joint proceedings of Computer Science Logic and Logic in Computer Science (CSL–LICS’14), pages 77:1–10. ACM, 2014. doi:10.1145/2603088.2603094.
  • [34] Thomas Powell. Gödel’s functional interpretation and the concept of learning. In Proceedings of Logic in Computer Science (LICS ’16), pages 136–145. ACM, 2016. doi:10.1145/2933575.2933605.
  • [35] Thomas Powell. Computational interpretations of classical reasoning: From the epsilon calculus to stateful programs. In Mathesis Universalis, Computability and Proof, volume 412 of Synthese Library, pages 255–290. Springer, 2019. doi:10.1007/978-3-030-20447-1_14.
  • [36] Thomas Powell. Proofs as stateful programs: A first-order logic with abstract Hoare triples. Logical Methods in Computer Science, 20(1):7:1–7:32, 2024. doi:10.46298/LMCS-20(1:7)2024.
  • [37] John C. Reynolds. Separation logic: a logic for shared mutable data structures. In Proceedings of Logic in Computer Science (LICS’02), pages 55–74. IEEE, 2002. doi:10.1109/LICS.2002.1029817.
  • [38] Helmut Schwichtenberg. Dialectica interpretation of well-founded induction. Mathematical Logic Quarterly, 54(3):229–239, 2008. doi:10.1002/malq.200710045.
  • [39] Davide Trotta, Jonathan Weinberger, and Valeria de Paiva. Skolem, Gödel, and Hilbert fibrations. available at https://arxiv.org/abs/2407.15765, 2024.

Appendix A Appendix

All proofs contained in the appendix are routine, involving a standard structural induction with multiple cases.

Proof of Theorem 3.

The proof follows the standard soundness theorem for the Dialectica, so we only give details of representative and interesting cases.

  • The axioms are admissible by definition.

  • For (pR), the premise is

    𝒙,𝒗,𝒘(|P|𝜶𝒙𝒗𝒘𝒙|Q|𝒗𝒂𝒙|R|𝒘𝒃𝒚)

    and therefore we have

    𝒙,𝒘,𝒘(|P|𝜶~𝒙𝒘𝒗𝒙|R|𝒘𝒃𝒚|Q|𝒗𝒂𝒙)

    for 𝜶~𝒙𝒘𝒗:=𝜶𝒙𝒗𝒘. All other basic actions are proved similarly.

  • (condR) is the more interesting of the conditionals. Here, we have

    𝒙,𝒗(|P|𝜶𝒙𝒗𝒙|Q|𝒗𝒂𝒙)

    and

    𝒙,𝒘(|P|𝜷𝒙𝒘𝒙|R|𝒘𝒃𝒙).

    Define 𝜸:=λ𝒙,𝒗,𝒘.𝚒𝚏(|P|𝜶𝒙𝒗𝒙,𝜷𝒙𝒘,𝜶𝒙𝒗). We need to prove that

    𝒙,𝒗,𝒘(|P|𝜸𝒙𝒗𝒘𝒙|Q|𝒗𝒂𝒙|R|𝒘𝒃𝒙)

    There are two possibilities: Fixing 𝒙,𝒗,𝒘, either |P|𝜶𝒙𝒗𝒙 holds, in which case

    |P|𝜸𝒙𝒗𝒘𝒙|P|𝜷𝒙𝒘𝒙|P|𝜶𝒙𝒗𝒙|P|𝜷𝒙𝒘𝒙

    and so the conclusion is true, or ¬|P|𝜶𝒙𝒗𝒙, and then |P|𝜸𝒙𝒗𝒘𝒙|P|𝜶𝒙𝒗𝒙, and so the result automatically follows by ex-falso-quodlibet.

  • (imp) and (exp) are immediate.

  • (comp) is standard and fundamental to Dialectica: If

    𝒙,𝒗(|P|𝜶𝒙𝒗𝒙|Q|𝒗𝒂𝒙)

    and

    𝒖,𝒘(|Q|𝜷𝒖𝒘𝒖|R|𝒘𝒃𝒖)

    then fixing 𝒙,𝒘, setting 𝒖:=𝒂𝒙 and 𝒗:=𝜷(𝒂𝒙)𝒘 gives the desired result.

  • The first four quantifier rules are also standard, though a little care is needed if we allow them to apply to tuples. The most involved in (R). If

    𝒚,𝒗(|P|𝜶𝒚𝒗𝒚|Q(𝒙)|𝒗𝒂𝒚)

    then

    𝒚,𝒗(|P|𝜶𝒚𝒗𝒚|Q(x1,,xn)|𝒗(λxn.𝒂𝒚)xn)

    which is just

    𝒚,𝒗(|P|𝜶𝒚𝒗𝒚|xnQ(x1,,xn)|xn,𝒗λxn.𝒂𝒚)

    and continuing for the rest of the tuple we obtain

    𝒚,𝒗(|P|𝜶𝒚𝒗𝒚|𝒙Q(𝒙)|𝒙,𝒗λ𝒙.𝒂𝒚)

    which is just

    𝒚,𝒗(|P|(λ𝒚,𝒙.𝜶𝒚)𝒚𝒙𝒗𝒚|𝒙Q(𝒙)|𝒙,𝒗(λ𝒚,𝒙.𝒂𝒚)𝒚)

    where here we note that the condition 𝒙 not free in P ensures that the free variables of |P𝒙Q(𝒙)|𝒚,𝒙,𝒗𝒇,𝑭 are the same as those of P𝒙Q(𝒙).

  • (sL) and (sR) follow in a straightforward way from the usual quantifier rules, and the conclusion and premise is identical for (ϵR) and (ϵL).

  • (cons) is immediate, and (exp) follows from the rule of extensionality in WE-HAω.

  • As usual, (ind) is proven by induction. We have

    𝒚,𝒗(|P(x)|𝜶(x)𝒚𝒗𝒚|P(x+1)|𝒗𝒂(x)𝒚)

    for all x:𝗇𝖺𝗍, so fixing 𝒚, 𝒗 and defining 𝒃:=𝚛𝚎𝚌𝒂𝒚 and 𝜷 as in Section 3, we prove by induction that

    |P(xz)|𝜷z𝒃(xz)|P(x)|𝒗𝒃x

    for z=0,,x. The base case is immediate, and for the induction step we use that |P(xz1)|𝜷(z+1)𝒃(xz1) is equivalent to

    |P(xz1)|𝜶(xz1)(𝒃(xz1))(𝜷z)𝒃(xz1)

    which by the premise of the rule allows us to obtain

    |P(xz)|𝜷z𝒂(xz1)(𝒃(xz1))

    which is just |P(xz)|𝜷z𝒃(xz). Thus we can apply the induction hypothesis. For x:=z we then have

    |P(0)|𝜷x𝒚|P(x)|𝒗𝒃x

    and the result follows by definition.

The remaining cases are straightforward.

Proof of Theorem 4.

We refer to the axiomatisation given in [18, Section 3]. We first note that, in our system, provability of PQ is equivalent to provability of PQ. With that in mind, for the axioms of intuitionistic logic, both contraction axioms follow from the conditional rules, while weakening, permutation, and ex falso quodlibet are clearly derivable. The quantifier axioms follow from (sR) and (sL). Both modus ponens and syllogism are instances of (comp), where for the former we note that if P and PQ, then also PQ, and thus Q. Exportation and importation are identical in both systems, while expansion is provable using a combination of the rules for . The quantifier rules are just (L) and (R). For arithmetic: We assume that the axioms and rules for equality and System T are included in Ax, and the quantifier-free rules of extensionality included in Rule, so all of these are then provable in our system. Replacing the induction axioms with the equivalent rule, it is not hard to show that the latter is derivable from (ind).

Proof of Theorem 6.

Figure 9: Simplified rules for Dialectica triples with empty backward realiser.

Suppose that the premises of the rule hold, and so in particular by the left hand premise

𝒙,𝒗(|P(𝒙)|𝜶𝒙𝒗ϕ(𝒙)|P(𝒂𝒙)|𝒗)

Writing 𝒃:=𝚠𝚑𝚒𝚕𝚎+ϕ𝚍𝚘𝒂 and 𝜷:=𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘(𝒂,𝜶), we are done if we can prove 𝒙A(𝒙) for

A(𝒙):=𝒗(|P(𝒙)|𝜷𝒙𝒗|P(𝒃𝒙)|𝒗¬ϕ(𝒃𝒙))

We do this using the wellfounded induction rule I. So fixing 𝒙, we assume that A(𝒚) holds for all 𝒚𝒙. To prove A(𝒙), we use Lemma 5, which is applicable for any 𝒙 thanks to the right hand premise of (W). There are two cases to consider. If ¬ϕ(𝒙) then 𝒃𝒙=𝒙 and 𝜷𝒙=λ𝒗.𝒗, and then A(𝒙) becomes

𝒗(|P(𝒙)|𝒗|P(𝒙)|𝒗¬ϕ(𝒙))

which is provable in this case. On the other hand, if ϕ(𝒙) then we have 𝒃𝒙=𝒃(𝒂𝒙), 𝜷𝒙=λ𝒗.𝜶𝒙(𝜷(𝒂𝒙)𝒗) and so A(𝒙) becomes

𝒗(|P(𝒙)|𝜶𝒙(𝜷(𝒂𝒙)𝒗)|P(𝒃(𝒂𝒙))|𝒗¬ϕ(𝒃(𝒂𝒙)))

But from ϕ(𝒙) we also obtain 𝒂𝒙𝒙, and so by the induction hypothesis we can assume

𝒗(|P(𝒂𝒙)|𝜷(𝒂𝒙)𝒗|P(𝒃(𝒂𝒙))|𝒗¬ϕ(𝒃(𝒂𝒙)))

It suffices therefore to show that

𝒗(|P(𝒙)|𝜶𝒙(𝜷(𝒂𝒙)𝒗)|P(𝒂𝒙)|𝜷(𝒂𝒙)𝒗)

and this is immediate from the left hand premise of (W) and the fact that ϕ(𝒙) holds, and so we have completed the induction step and therefore the proof.

Proof of Theorem 8.

For 𝚜𝚔𝚒𝚙 and the primitive commands this is immediate. The core of the proof lies in the composition rule. Here, for any s, by the induction hypothesis there exist s,σ,Γ and s′′,σ,Γ such that

{s,C1+s,σ,Γs,C2+s′′,σ,Γ

and therefore

s,C1;C2+s′′,σ::σ,Γ::Γ

for s=C1+s and s′′=C2+s=(C2+C1+)s=(C1;C2)+s. For the backward direction, again using the induction hypothesis, for any t,σ0 and Γ0 we have

{σ::σ::σ0,Γ::Γ::Γ0,tσ::σ0,Γ::Γ0,tσ::σ0,Γ::Γ0,tσ0,Γ0,t′′

and therefore

σ::σ::σ0,Γ::Γ::Γ0,tσ0,Γ0,t′′

for t=C2st and t′′=C1st=C1s(C2st)=C1s(C2(C1+s)t)=(C1;C2)st. The conditionals are straightforward, since whenever ϕ(s) then in WE-HAω we have

(𝚒𝚏ϕ𝚝𝚑𝚎𝚗C1𝚎𝚕𝚜𝚎C2)+s =C1+s
(𝚒𝚏ϕ𝚝𝚑𝚎𝚗C1𝚎𝚕𝚜𝚎C2)st =C1st

and similarly for ¬ϕ(s). Finally, for the while loop we use induction on , using that if ϕ(s) then (𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C)s=(C;𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C) (and also (𝚠𝚑𝚒𝚕𝚎ϕ𝚍𝚘C)s=(𝚜𝚔𝚒𝚙)s if ¬ϕ(s)), and so the induction step is essentially the same as the composition rule.