Certified Undecidability of Intuitionistic Linear Logic Via Binary Stack Machines and Minsky Machines Yannick Forster, Dominique Larchey-Wendling
Total Page:16
File Type:pdf, Size:1020Kb
Certified Undecidability of Intuitionistic Linear Logic via Binary Stack Machines and Minsky Machines Yannick Forster, Dominique Larchey-Wendling To cite this version: Yannick Forster, Dominique Larchey-Wendling. Certified Undecidability of Intuitionistic Linear Logic via Binary Stack Machines and Minsky Machines. The 8th ACM SIGPLAN International Con- ference on Certified Programs and Proofs, CPP 2019, Jan 2019, Cascais, Portugal. pp.104-117, 10.1145/3293880.3294096. hal-02333390 HAL Id: hal-02333390 https://hal.archives-ouvertes.fr/hal-02333390 Submitted on 9 Nov 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Certified Undecidability of Intuitionistic Linear Logic via Binary Stack Machines and Minsky Machines Yannick Forster Dominique Larchey-Wendling Saarland University Université de Lorraine, CNRS, LORIA Saarbrücken, Germany Vandœuvre-lès-Nancy, France [email protected] [email protected] Abstract machines (BSM), Minsky machines (MM) and (elementary) We formally prove the undecidability of entailment in intu- intuitionistic linear logic (both eILL and ILL): itionistic linear logic in Coq. We reduce the Post correspond- PCP ⪯ BPCP ⪯ iBPCP ⪯ BSM ⪯ MM ⪯ eILL ⪯ ILL ence problem (PCP) via binary stack machines and Minsky machines to intuitionistic linear logic. The reductions rely on Combined with the reduction Halt ⪯ PCP of [11], this yields several technically involved formalisations, amongst them a a fully formalised reduction from the halting problem of binary stack machine simulator for PCP, a verified low-level Turing machines to entailment in ILL. compiler for instruction-based languages and a soundness PCP is a problem over a finite set of cards, each having a proof for intuitionistic linear logic with respect to trivial string at the top and bottom. Such a PCP instance is solvable phase semantics. We exploit the computability of all func- if there is a non-empty finite sequence of those cards with tions definable in constructive type theory and thus do not an equal upper and lower string. We follow [11] in giving a have to rely on a concrete model of computation, enabling definition of PCP with countably many symbols. We reduce the reduction proofs to focus on correctness properties. PCP to BPCP, where symbols are restricted to Booleans and to iBPCP, where the sequence of cards is represented by a Keywords Undecidability, many-one reduction, binary stack sequence of their indices (natural numbers). machines, Minsky machines, intuitionistic linear logic, low- We describe a general framework for the semantics of level compiler, constructive type theory, Coq instruction-based machine models and explain how it can be used for compositional reasoning. We then define bin- 1 Introduction ary stack machines as an instance of such instruction-based Undecidability of advanced problems is usually established machines. BSMs have a fixed number of binary stacks and using computable (many-one) reductions from a problem programs consist of consecutively indexed PUSH and POP already known to be undecidable. Such reductions rely on instructions, the latter allowing conditional jumps based many subtle details and could thus be a prime example for on the obtained Boolean or if the stack is empty. A BSM the use of interactive theorem provers to assist ongoing re- program terminates if it jumps to a non-existing index. We search. However, formalisations of undecidability proofs are verify an iBPCP simulator — which is a BSM program ter- not common in the literature. There are two main obstacles minating if and only if a given iBPCP instance is solvable — in our eyes: (1) proofs on paper mostly omit the invariants by enumerating all possible sequences of cards. The pro- needed for the verification of the reduction; (2) they omit gram size is linear in the size of the instance and always has the computability proof, which amounts to the formal veri- more than 80 instructions. It consists of several independ- fication of a program in the chosen model of computation. ent sub-programs, making the verification crucially rely on Constructive type theory, as implemented in the proof compositional reasoning. assistant Coq [36], provides a particularly convenient set- We define Minsky machines32 [ ] with a fixed number of ting for decidability and undecidability proofs. Since every natural-number registers as another instance of instruction- function definable in constructive type theory is computable, based machines. MM-programs consist of INC and DEC op- one can use a synthetic approach to computability. This ap- erations, the latter allowing conditional jumps if the re- proach makes an explicit model of computation and explicit gister is zero. We describe and verify a general compiler computability proofs unnecessary, enabling the proofs to for instruction-based languages and use it to compile BSM focus on the invariants needed for the reduction. programs to MM programs. The main challenge is to re- In this paper we contribute a formalised chain of reduc- arrange jumps using a linker. For the reduction we have tions, starting at the Post correspondence problem (PCP), via to prove correctness of the compiler for both terminating binary PCP (BPCP), BPCP with indices (iBPCP), binary stack and non-terminating programs, a notable difference to other verified compilers (e.g. [6, 28]). CPP’19, January 14–15 2019, Lisbon, Portugal We formalise intuitionistic linear logic with a sequent cal- 2018. culus SILL. We introduce the elementary fragment of ILL [26, 1 CPP’19, January 14–15 2019, Lisbon, Portugal Yannick Forster and Dominique Larchey-Wendling 1 27] together with a goal directed sequent calculus GeILL a problem p can never be actually proven. However, in which is equivalent to SILL on this fragment: both define the practice, the undecidability of a problem is rarely established same entailment predicate. We give a denotational semantics directly anyway. Most proofs are by reduction from another for ILL using trivial phase semantics based on commutat- undecidable problem, and ultimately most problems are thus ive monoids and prove soundness of SILL for this semantics. proven undecidable by reduction from an initial undecidable Finally, we show that entailment in GeILL is complete for problem. In most textbook presentations, it is the halting trivial phase semantics, yielding a reduction of eILL to ILL. problem (Halt) which is seen as a seed of undecidability. Our arguments slightly generalise those of the proof in [27] The idea to exploit reductions to prove the undecidability to formalise the reduction chain MM ⪯ eILL ⪯ ILL. of problems is well-known. It was first used to formalise We conclude the paper by summarising our efforts to build undecidability proofs in a proof assistant without referring a library of undecidable problems in Coq [14] and by giving to an explicit model of computation in [11]. They define an overview of related work. The library should contain (many-one) reductions from a problem (X;p) to (Y;q) as both entry points for plugging new undecidability results a (computable) function f : X ! Y such that 8x; p x $ and tools to mechanise the corresponding reductions. We q (f x). We write p ⪯ q and say that p reduces to q if a discuss some ongoing additions to our library. reduction of (X;p) to (Y;q) exists. In the case of axiom- The axiom-free Coq formalisation of all the results in this free Coq, all such reductions are inherently computable and paper is available online and the main lemmas and theorems thus, computability can be dropped from the definition. This in the pdf version of the paper are hyper-linked with the coincides with usual practice in non-formalised papers where html version of the Coq source code: the computability of reductions is left out most of the time. https://uds-psl.github.io/ill-undecidability Actually, many-one reductions are only an instance of the more general notion of Turing-reductions (see e.g. [33]): 2 Type Theory and Formal Undecidability (X;p) is Turing-reducible to (Y;q), written p ⪯T q, if p is decidable given that q is decidable. 2.1 Definitions We write P to denote the type of propositions. The basic Lemma 2.1. If p ⪯ q then p ⪯T q. inductive data structures we use are natural numbers (n : The structure of undecidability proofs can be comprehens- N ::= 0 j S n), Booleans (b : B ::= 0 j 1), the option type ively described using an inductive predicate undec p: (O X ::= (x : X ) j ?) and lists (l : L X ::= [] j x :: l). We write ⪯ l1 ++l2 for the concatenation of two lists, jl j for the length p T q undec p of a list, l for the reversal of a list, and [ f s j s 2 l ] for a undec Halt undec q map over a list. We define l[i]: O X as the i-th element of l. The first rule establishes the halting problem for Turing Moreover, we write s 2 l if s is a member of l, and l1 ⊆ l2 if machines as a seed of undecidability. By the second rule, every member of l1 is a member of l2. We will overload the notation for lists and use it for vectors undecidability can be transferred via (Turing) reductions. as well. Given a type X, we write the type of vectors of Lemma 2.2. undec (λx: :p x) implies undec p.