
mathematics Article On Correspondence between Selective CPS Transformation and Selective Double Negation Translation Hyeonseung Im Department of Computer Science and Engineering, Interdisciplinary Graduate Program in Medical Bigdata Convergence, Kangwon National University, Chuncheon-si, Gangwon-do 24341, Korea; [email protected]; Tel.: +82-33-250-8441 Abstract: A double negation translation (DNT) embeds classical logic into intuitionistic logic. Such translations correspond to continuation passing style (CPS) transformations in programming lan- guages via the Curry-Howard isomorphism. A selective CPS transformation uses a type and effect system to selectively translate only nontrivial expressions possibly with computational effects into CPS functions. In this paper, we review the conventional call-by-value (CBV) CPS transformation and its corresponding DNT, and provide a logical account of a CBV selective CPS transformation by defining a selective DNT via the Curry-Howard isomorphism. By using an annotated proof system derived from the corresponding type and effect system, our selective DNT translates classical proofs into equivalent intuitionistic proofs, which are smaller than those obtained by the usual DNTs. We believe that our work can serve as a reference point for further study on the Curry-Howard isomorphism between CPS transformations and DNTs. Keywords: CPS transformation; double negation translation; simply typed lambda-calculus; propositional logic; Curry-Howard isomorphism Citation: Im, H. On Correspondence between Selective CPS Transformation and Selective Double Negation Translation. Mathematics 1. Introduction 2021, 9, 385. https://doi.org/ The Curry-Howard isomorphism [1,2] states that formulas and proofs in mathemat- math9040385 ical logic correspond to types and programs in programming languages. For example, propositions and proofs in intuitionistic propositional logic (IPL) correspond to types and Academic Editor: Josep Lluis terms in the simply typed l-calculus (l!). A similar correspondence also exists between Usó-Doménech classical propositional logic (CPL) and the simply typed l-calculus with control operators such as callcc (call-with-current continuation) and throw (lcont)[3,4]. Received: 5 January 2021 Classical logic differs from intuitionistic logic, also known as constructive logic, in Accepted: 8 February 2021 _: Published: 15 February 2021 that it includes the law of excluded middle (EM), A A, as a theorem, which states that for any proposition A, either A is true or its negation :A is true (i.e., A is false). Classical ((A ⊃ B) ⊃ A) ⊃ A Publisher’s Note: MDPI stays neutral logic also includes Peirce’s law, , and double negation elimination :: ⊃ with regard to jurisdictional claims in (DNE), A A. Any of these three theorems can be added as an axiom to proof systems published maps and institutional affil- for intuitionistic logic in order to obtain a sound and complete proof system for classical iations. logic. Taking Peirce’s law and DNE as axioms corresponds to the control operators such as callcc and Felleisen et al.’s C operator, which allow a nonlocal transfer of program control, respectively [3–5]. A double negation translation (DNT), also known as a negative translation, translates a classically valid formula into an intuitionistically valid one [6–11], for example, by Copyright: © 2021 by the author. :: Licensee MDPI, Basel, Switzerland. placing a double negation in front of every subformula of the given formula [9]. More ⊃ :: This article is an open access article precisely, while intuitionistic logic admits double negation introduction, A A, it only distributed under the terms and rejects double negation elimination, ::A ⊃ A. In other words, ::A is weaker than A conditions of the Creative Commons in intuitionistic logic, but they are equivalent in classical logic. Hence, in general, an Attribution (CC BY) license (https:// instance of A in a classical proof derivation only corresponds to a weaker proposition ::A creativecommons.org/licenses/by/ in an intuitionistic proof derivation. In this regard, DNTs can be thought of as a proof 4.0/). transformation which eliminates every instance of DNE (or equivalently, EM or Peirce’s Mathematics 2021, 9, 385. https://doi.org/10.3390/math9040385 https://www.mdpi.com/journal/mathematics Mathematics 2021, 9, 385 2 of 14 law) used in a classical derivation of A, yielding an intuitionistic proof of ::A∗, where A∗ is the formula obtained by placing :: in front of every proper subformula of A. One important consequence of DNTs is the equivalence between the consistency of classical Peano arithmetic and the consistency of intuitionistic Heyting arithmetic. The programming language counterpart of DNTs is continuation passing style (CPS) transformations [4,12,13], which are often used in compiler optimization [14,15]. Oper- ationally, a continuation of type A cont is a reification of an evaluation context, i.e., the rest of the program, that expects the result of the current expression of type A. Hence, a continuation type A cont can be understood as a function type A ! Ans, where Ans stands for the type of final results. If we interpret Ans as ? and define :A as a syntactic abbreviation of A !? as usual, then DNTs correspond to CPS transformations, which translate an expression M of type A into a CPS function of type (A∗ !?) !? that explicitly takes a continuation k as an argument and applies it to the result of M in its body. Here, the continuation k expects a value of type A∗ because, as in DNTs, CPS transfor- mations also recursively translate every subexpression of the given expression into CPS expressions. The CPS transformations from lcont into l! [3,4], which eliminate control operators, correspond to a DNT from CPL with Peirce’s law or DNE into IPL. In this paper, we study the logical meaning of a selective CPS transformation [16] and present a selective DNT for CPL via the Curry-Howard isomorphism. The usual CPS transformations translate into CPS functions not only “nontrivial” expressions (possibly) with control operators (computational effects) but also “trivial” expressions, which lack them, yielding unnecessarily large expressions. In contrast, the selective CPS transformation only translates nontrivial expressions into CPS functions and keeps trivial expressions intact. To do so, it uses a type and effect system to keep track of the uses of control operators. Similarly, when viewed as a proof transformation, the usual DNTs also yield unnecessarily large proofs because they translate even intuitionistically valid proof derivations. Our selective DNT uses an annotated proof system to keep track of the uses of only classical axioms, which is similar to the type and effect system in [16], and only selectively translates the part of the given proof that exploits such axioms. The main contributions of our paper are summarized as follows: • We review the Curry-Howard isomorphism between the standard call-by-value (CBV) CPS transformation with control operators and the corresponding DNT from CPL into IPL. • We review a CBV selective CPS transformation based on a type and effect system [16] and propose a corresponding selective DNT based on an annotated proof system, with its correctness proof showing that provability is preserved under the translation. • Our work can serve as a reference point for the close correspondence between the selective CPS transformation and the selective DNT and further research on this topic. The remainder of the paper is organized as follows. Section2 reviews the standard CBV CPS transformation from lcont with control operators into l! without these oper- ators [3]. In Section3, we present the corresponding DNT from CPL with Peirce’s law into IPL. Section4 reviews a CBV selective CPS transformation based on a type and effect system. In Section5, we present an annotated proof system and propose a selective DNT corresponding to the selective CPS transformation via the Curry-Howard isomorphism. We also prove the correctness of the translation by showing that provability is preserved under the translation. Finally, Section6 discusses related work and concludes. 2. A Call-by-Value CPS Transformation In this section, we review the standard CBV CPS transformation [3] which translates a program in the source language lcont with control operators callcc and throw into an operationally equivalent program in the target language l! without control operators. Mathematics 2021, 9, 385 3 of 14 2.1. Simply Typed l-Calculus with Control Operators The source language lcont is the simply typed l-calculus with two control operators: callcc and throw [3]. Its abstract syntax is defined as follows. Definition 1 (Abstract syntax of lcont). expressions M, N ::= p j x j lx.M j MN j callcc x.M j throw MN types A, B, C ::= P j A ! B j A cont An expression M is either a constant p, a variable x, a lambda abstraction (anonymous function) lx.M, a lambda application (function application) MN, or a control operator to be explained below. As for types, P ranges over an arbitrary but fixed set of primitive types, A ! B denotes the type of functions from domain A to range B, and A cont denotes the type of continuations that expect a value of type A. We consider a left-to-right CBV operational semantics for lcont using evaluation contexts, where a well-typed expression evaluates to a value. Definition 2 (Operational semantics of lcont). extended expressions M, N ::= · · · j hEi evaluation contexts E ::= [ ] j EN j VE j throw EN j throw VE values V ::= p j lx.M j hEi E[(lx.M) V] 7! E[M[V/x]] E[callcc x.M] 7! E[M[hEi/x]] E[throw hE1i V] 7! E1[V] An evaluation context E is an expression with a hole []. Every expression M can be decomposed into a unique context E and a unique reducible expression (redex) N, i.e., M = E[N], where E[N] denotes the expression obtained by filling the hole in E with N. An evaluation context can be considered a pending computation which expects the result of another computation.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages14 Page
-
File Size-