On Synthetic Undecidability in Coq, with an Application to the Entscheidungsproblem
Total Page:16
File Type:pdf, Size:1020Kb
On Synthetic Undecidability in Coq, with an Application to the Entscheidungsproblem Yannick Forster Dominik Kirst Gert Smolka Saarland University Saarland University Saarland University Saarbrücken, Germany Saarbrücken, Germany Saarbrücken, Germany [email protected] [email protected] [email protected] Abstract like decidability, enumerability, and reductions are avail- We formalise the computational undecidability of validity, able without reference to a concrete model of computation satisfiability, and provability of first-order formulas follow- such as Turing machines, general recursive functions, or ing a synthetic approach based on the computation native the λ-calculus. For instance, representing a given decision to Coq’s constructive type theory. Concretely, we consider problem by a predicate p on a type X, a function f : X ! B Tarski and Kripke semantics as well as classical and intu- with 8x: p x $ f x = tt is a decision procedure, a function itionistic natural deduction systems and provide compact д : N ! X with 8x: p x $ ¹9n: д n = xº is an enumer- many-one reductions from the Post correspondence prob- ation, and a function h : X ! Y with 8x: p x $ q ¹h xº lem (PCP). Moreover, developing a basic framework for syn- for a predicate q on a type Y is a many-one reduction from thetic computability theory in Coq, we formalise standard p to q. Working formally with concrete models instead is results concerning decidability, enumerability, and reducibil- cumbersome, given that every defined procedure needs to ity without reference to a concrete model of computation. be shown representable by a concrete entity of the model. For instance, we prove the equivalence of Post’s theorem To avoid this tedium, many presentations resort to informal with Markov’s principle and provide a convenient technique arguments regarding the algorithmic properties at the core for establishing the enumerability of inductive predicates of their constructions. such as the considered proof systems and PCP. Enabling the outlined synthetic approach to computability as explored by Richman [36] and Bauer [2, 3], constructive CCS Concepts • Theory of computation → Logic; type thoery is well-suited for formalising positive statements about decision problems. Turning to negative statements like Keywords synthetic undecidability, Entscheidungsproblem, undecidability and non-enumerability, however, the situation Coq, Post’s theorem, Markov’s principle, first-order logic becomes more intricate. Typical formulations of construc- ACM Reference Format: tive type theory such as Martin-Löf type theory (MLTT) or Yannick Forster, Dominik Kirst, and Gert Smolka. 2019. On Syn- Coq’s underlying calculus of inductive constructions (CIC) thetic Undecidability in Coq, with an Application to the Entschei- are consistent with the assumption that every predicate is de- dungsproblem. In Proceedings of the 8th ACM SIGPLAN International cidable, so proving a concrete decision problem undecidable Conference on Certified Programs and Proofs (CPP ’19), January 14– is not outright possible. A potential way out would be to roll 15, 2019, Cascais, Portugal. ACM, New York, NY, USA, 14 pages. back to a concrete model and establish negative results w.r.t. https://doi.org/10.1145/3293880.3294091 the modelled computation – again producing unwelcome technical overhead. The preferable solution, employed in 1 Introduction this work, is to verify a synthetic reduction from a problem Every function definable in constructive type theory is com- informally known to be undecidable – establishing negative putable. Thus, standard notions from computability theory results relative to the chosen base in a transparent way. The base we choose is the Post correspondence problem Permission to make digital or hard copies of all or part of this work for (PCP), an easy to formulate combinatorial problem concern- personal or classroom use is granted without fee provided that copies ing matching sequences of strings. Proven undecidable by are not made or distributed for profit or commercial advantage and that Post in 1946 [34], PCP became a powerful tool in computabil- copies bear this notice and the full citation on the first page. Copyrights ity theory, often admitting elegant reductions. In previous for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or work [12], we formalised a reduction from the halting prob- republish, to post on servers or to redistribute to lists, requires prior specific lem of Turing machines to PCP in Coq, hence providing permission and/or a fee. Request permissions from [email protected]. reliable evidence that the assumption that PCP is undecid- CPP ’19, January 14–15, 2019, Cascais, Portugal able in the synthetic sense can be safely added to constructive © 2019 Copyright held by the owner/author(s). Publication rights licensed type theory. Concretely, (locally) assuming that PCP is not to ACM. co-enumerable implies that every problem it reduces to is ACM ISBN 978-1-4503-6222-1/19/01...$15.00 https://doi.org/10.1145/3293880.3294091 not co-enumerable and hence undecidable. CPP ’19, January 14–15, 2019, Cascais, Portugal Yannick Forster, Dominik Kirst, and Gert Smolka In this work, we use the outlined strategy to address an- Outline The technical part of this paper is organised in two other seminal decision problem in computability theory, sections. First, in Section2, we develop the basics of synthetic namely the Entscheidungsproblem. Asking for a decision pro- computability theory addressing decidability and enumer- cedure for the validity of first-order formulas, it was pro- ability, many-one reductions, Post’s theorem and Markov’s grammatically posed by Hilbert and Ackermann in 1928 [11] principle, the Post correspondence problem, and infinite data and famously answered to the negative by Turing [44] and types. Secondly, in Section3, we apply the synthetic frame- Church [8]. We verify a simple reduction following Floyd work to proving the undecidability of validity, provability, and Manna [31] from PCP to the Entscheidungsproblem for satisfiability, their intuitionistic counterparts, and classical formulas in the universal-implicative fragment of first-order provability of first-order formulas. We conclude in Section4 logic over a small signature. Furthermore, we give similar with general comments as well as some remarks concerning reductions to related problems such as intuitionistic and clas- the Coq formalisation, related work, and future work. sical variants of natural deduction systems and satisfiability of formulas including negation. To this end, we develop the 2 Elementary Synthetic Computability metatheory of first-order logic to an extent necessary to ver- We work in a constructive type theory providing a hierarchy ify the reductions, including soundness and a generalised of predicative universes T of computational types, an impred- double negation translation. We refrain from a comprehen- icative universe P of propositions, and a general scheme for sive account covering further standard results like complete- inductive types subject to pattern matching and structural ness since they do not yield shorter undecidability proofs recursion. We employ the standard notation for (dependent) and (mostly) rely on additional assumptions. products, (dependent) sums, and logical connectives placed As we formalise our results using the Coq proof assistant in P. The inductive type of booleans is defined as B := tt j ff, based on CIC, which comes with an impredicative universe the unit type is defined as 1 := ∗, and the natural numbers of propositions, we deviate in some aspects from a develop- are defined as N := 0 j Sn for n : N. ment using alternative provers such as Agda based on pure We define the option type over a type X as O¹Xº := ; j pxq MLTT. Most importantly, CIC allows for a propositional ver- for x : X. Moreover, the type of lists over X is defined as sion of existence that hides witnesses from elimination into L¹Xº := »¼ j x :: A for x : X and A : L¹Xº. We write A ++ B for the computational fragment. Thus, an operation definable concatenation, x 2 A for membership, and A ⊆ B for inclusion. 1 in Coq we call guarded minimisation computing minimal Finally, we write »f x j x 2 A¼ for map, »x 2 A j p x¼ for filter witnesses for satisfiable decidable predicates on enumerable and A»n¼ : O¹Xº for element access. types is crucial for our results surrounding Post’s theorem. 2.1 Decidability and Enumerability Contributions Our main contribution is a compact Coq We begin by defining the standard notions of decidability formalisation2 of elementary synthetic computability (900 and enumerability in the synthetic setting. lines of code), various decision problems in first-order logic (750 loc), and their respective undecidability (550 loc). All Definition 2.1. Given a type X, a predicate p : X ! P is definitions and propositions in the PDF version of this paper • decidable if there is a decider f : X ! B such that are hyperlinked with the corresponding statements in the 8x: p x $ f x = tt. browsable HTML version of the formalisation. We elaborate • enumerable if there is an enumerator f : N ! O¹Xº on some formalisation tricks like tagged inductive types for such that 8x: p x $ 9n: f n = pxq. fragments of syntax and deduction systems and an enumer- The complement p is defined as p := λx: :px and we say that p ability technique using cumulative lists in the discussion. is co-enumerable if p is enumerable and that p is co-decidable As mathematical results, we examine synthetic renderings if p is decidable. These definitions generalise to predicates with of standard notions in computability theory such as decidabil- more than one argument as one would expect. ity, enumerability, and many-one reductions and prove basic results culminating in the observed equivalence of Post’s Since every function definable in a constructive type the- theorem and Markov’s principle.