Primitive recursive functions: decidability problems

Similar documents
Primitive recursive functions

About the relationship between formal logic and complexity classes

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

CPSC 421: Tutorial #1

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

Theory of Computation (IX) Yijia Chen Fudan University

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

TURING MAHINES

Introduction to Turing Machines. Reading: Chapters 8 & 9

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Final exam study sheet for CS3719 Turing machines and decidability.

Limits of Computability

Informal Statement Calculus

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS154, Lecture 10: Rice s Theorem, Oracle Machines

4.2 The Halting Problem

Opleiding Informatica

6.8 The Post Correspondence Problem

Functions on languages:

CMPS 217 Logic in Computer Science. Lecture #17

Decidability: Church-Turing Thesis

Computability Crib Sheet

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

CS481F01 Solutions 8

CSCI3390-Lecture 6: An Undecidable Problem

Automata Theory and Formal Grammars: Lecture 1

CSCE 551: Chin-Tser Huang. University of South Carolina

Undecidable Problems and Reducibility

ACS2: Decidability Decidability

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Theory of Computer Science

17.1 The Halting Problem

UNIT-VIII COMPUTABILITY THEORY

Computability Theory. CS215, Lecture 6,

uring Reducibility Dept. of Computer Sc. & Engg., IIT Kharagpur 1 Turing Reducibility

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Part I: Definitions and Properties

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Non-emptiness Testing for TMs

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

Homework 8. a b b a b a b. two-way, read/write

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Theory Bridge Exam Example Questions

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Notes for Lecture Notes 2

Reductions in Computability Theory

The Unsolvability of the Halting Problem. Chapter 19

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

258 Handbook of Discrete and Combinatorial Mathematics

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

CS 125 Section #10 (Un)decidability and Probability November 1, 2016

Decidability (What, stuff is unsolvable?)

Computational Models Lecture 8 1

Undecibability. Hilbert's 10th Problem: Give an algorithm that given a polynomial decides if the polynomial has integer roots or not.

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability

Computational Models Lecture 8 1

Lecture 1: The arithmetic hierarchy

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Theory of Computer Science. Theory of Computer Science. D8.1 Other Halting Problem Variants. D8.2 Rice s Theorem

The complexity of recursive constraint satisfaction problems.

V Honors Theory of Computation

Chap. 4 Computability

Section 14.1 Computability then else

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

1 Computational Problems

Bjorn Poonen. MSRI Introductory Workshop on Rational and Integral Points on Higher-dimensional Varieties. January 18, 2006

Chapter 2 Algorithms and Computation

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Further discussion of Turing machines

MA/CSSE 474 Theory of Computation

Computability THEORY OF COMPUTATION

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

DM17. Beregnelighed. Jacob Aae Mikkelsen

Large Numbers, Busy Beavers, Noncomputability and Incompleteness

An Intuitively Complete Analysis of Gödel s Incompleteness

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

GTI. Undecidability. Total Recall 3. Halting. Undecidability. A. Ada, K. Sutner Carnegie Mellon University. Spring 2018

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

Theory of Computation - Module 4

Handbook of Logic and Proof Techniques for Computer Science

Theory of Computer Science

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Recap (1) 1. Automata, grammars and other formalisms can be considered as mechanical devices to solve mathematical problems

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013

Mathematics Review for Business PhD Students

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM. Turing 1936

CST Part IB. Computation Theory. Andrew Pitts

Computability and Complexity

1 Showing Recognizability

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

16.1 Countability. CS125 Lecture 16 Fall 2014

Computational Models Lecture 8 1

Transcription:

Primitive recursive functions: decidability problems Armando B. Matos October 24, 2014 Abstract Although every primitive recursive (PR) function is total, many problems related to PR functions are undecidable. In this work we study several questions associated with PR functions and characterize their degree of undecidability. For instance, we show that the injectivity problem belongs to the class Π 0 1 \ 0 0 of the arithmetic hierarchy, while the surjectivity and the bijectivity problems belong to Π 0 2 \ (Σ 0 1 Π 0 1). It follows that these subclasses of PR functions can not be enumerated and thus cannot be characterized by an effective property. Several other PR decision problems are studied such as, problems related to the existence and number of zeros, and problems related to the size of the codomain. We consider a specific but important decision problem, does a given PR function has at least one zero?, and establish the necessary and sufficient input and output restrictions for decidability the frontiers of decidability of this problem. We also study undecidability results for a more general class of problems, namely existential first order logic with equality and composition of PR functions. A PR function as a part of an acyclic PR function graph is also studied. This setting may be useful to evaluate the relevance of a specific PR function as a component of a larger PR structure. 1

Contents 1 Introduction 3 2 Preliminaries 5 2.1 Languages, reductions and the arithmetic hierarchy........ 6 2.2 Decision problems.......................... 8 2.3 Models of computation........................ 9 2.4 Primitive recursive functions.................... 10 2.5 Context free grammars........................ 10 3 Decision problems associated with PR functions 12 3.1 Some undecidable problems..................... 12 3.2 Size of the codomain......................... 18 3.3 Injectivity, surjectivity, and bijectivity............... 19 3.4 Primitive recursive versus partial recursive problems....... 22 4 Frontiers of decidability: the HAS-ZEROS problem 29 4.1 The meaning of restricted HAS-ZEROS problems......... 31 4.2 The HAS-ZEROS-f g class of problems.............. 32 4.3 The HAS-ZEROS-h f class of problems.............. 34 4.4 The HAS-ZEROS-h f g class of problems............. 34 4.5 A generalization: the output of g is a tuple............ 35 4.6 Using HAS-ZEROS-h f g to analyze other decision problems.. 35 4.7 Classifying a problem testing the properties of g and h..... 35 5 Generalizations of the PR decision problems 36 5.1 Existential first order logic with PR functions........... 37 5.2 A PR function f in an acyclic PR structure: normal form.... 38 5.3 Composition of f with itself..................... 42 6 Comment: on a paper by Stefan Kahrs 45 7 Conclusions and open problems 47 2

1 Introduction The primitive recursive (PR) functions form a vast and important enumerable sub-class of the class of recursive (total) functions. Its vastness is obvious from the fact that every total recursive function whose time complexity is bounded by a primitive recursive function is itself primitive recursive, while its importance is well expressed by the Kleene normal form Theorem [23, 3, 32] and by the fact that every recursively enumerable set can be enumerated by a primitive recursive function 1. The meta-mathematical and algebraic properties of PR functions have been widely studied, see for instance [23, 36, 34, 41, 37]. Special subclasses (such as unary PR functions, see for instance [35, 39]) and hierarchies (see for instance [18, 1, 28, 30, 2, 14] and [44, Ch. VI]) of PR functions were also analyzed. Efficiency lower bounds of primitive recursive algorithms have also been studied, see [4, 5, 6, 8, 30, 31, 12, 43, 42]. In this work we concentrate on decidability questions related to PR functions. There are several questions related to PR functions that are known to be undecidable. For instance, the question given a PR function f(x, y) and an integer x, is there some y such that f(x, y) = 0? is undecidable ([3]). In this paper we show that many other questions related to PR functions are undecidable, and classify their degree of undecidability according to the arithmetic hierarchy. Let us mention two examples of the problems studied in this work: does a given PR function have exactly one zero?, and is a given PR function surjective (onto)?. The undecidability of some of these problems has consequences. For instance, when studying reversible computations, it would be useful to have a method for enumerating the bijective PR functions. As we will see, that is not possible: although the set of PR functions is enumerable, the set of bijective PR functions is not: it belongs Π 0 2 \ (Σ0 1 Π0 1 ). We also study classes of PR problems in which a PR function f is a part of a larger PR system S. We obtained a simple decidability condition for the case in which S(x) = h(f(g(x))), where g and h are fixed PR functions, but not for the general case illustrated in Figure 1 (page 4). Organization and contents of the paper. The main concepts and results needed for the rest of the paper are presented in Section 2 (page 5). The rest of the paper can be divided in two parts. 1 In the sense that, if L is recursively enumerable, there is a primitive recursive function f such that L {0} = {f(i) : i N}. 3

x f y S Figure 1: A PR function f is considered to be an important part of a complex structure S if the following problem is undecidable: instance: f, question: x : S(x) = 0?. We will show that an arbitrary acyclic system S containing one occurrence of f can always be reduced to the normal form illustrated in Figure 9 (page 43). Part I, specific problems In Section 3 (page 12) several decision problems associated with PR functions are studied. These problems include the existence of zeros, the equivalence of functions, domain problems, and problems related with the injectivity, surjectivity, and bijectivity of PR functions. For each of these problems the degree of undecidability is established in terms of their exact location in the in the arithmetic hierarchy; see Figures 2 (page 23) and 3 (page 23). Part II, classes of problems Suppose that the PR function f, the instance of a decision problem, is placed somewhere inside a larger PR system S, see Figure 1. In algebraic terms this means that S is obtained by composing fixed PR functions with the instance f. A more general form of composition, based on acyclic graphs is also studied, see Figure 8 (page 40). Then we ask an important question about y = S(x), namely, x : S(x) = 0? This is in fact a fundamental question: In terms of the Kleene normal form, the existence of a zero is the basic undecidable question, and it is intimately related in fact, equivalent to the halting problem. Many other decision problems can be reduced to this problem. The class of problems, parametrized by S, is: Instance: A PR function f. Question: Is there some x such that S(x) = 0? In some sense we can say that f can be considered an important component of S if (and only if) this problem is undecidable. 4

Part II of this work includes Section 4 (page 29), where we study the frontiers of decidability of the problem does a given PR function has at least one zero?. More precisely, we find the input and output restrictions that are necessary and sufficient for decidability; these restrictions are obtained by pre- or post-applying fixed PR functions to the PR function which is the instance of the problem. This is a particular form of the arbitrary composition described above. A more general setting in considered in Section 5 (page 36), where we study existential first order logic with equality and composition of PR functions and also acyclic PR structures. The problem of composing the instance PR function f with itself is also studied. Section 6 includes some comments on Kahrs enumeration method. The initial motivation for this work was to generalize Rice Theorem to PR functions. Rice Theorem is simple: for any non trivial mathematical property of a partial recursive function, it is undecidable whether the function, defined by a given description (or index), has that property. A version of Rice Theorem applicable to to PR functions is necessarily more complex because, unlike the case of partial recursive functions, only quantified questions can be undecidable. Questions like given a description of f, is f(2) = 5? are clearly decidable. A result of this paper that can be seen as a first step to such a Rice-like PR Theorem is Theorem 24 (page 34). 2 Preliminaries The notation used in this paper is straightforward. Iff denotes if and only if and def = denotes is defined as. The logical negation is denoted by. The complement of the set A is denoted by A, while the difference between the sets A and B is denoted by A \ B. A function f : A B is injective (or oneto-one) if x y implies f(x) f(y); it is surjective (or onto) if for every y B there is at least one x A such that f(x) = y; and it is bijective if it is both injective and surjective. By f 1 (y) we denote the set {x : f(x) = y}. The letters of the alphabet are denoted by 0, 1, a, b... ; the words by x, y... The length of the word x is denoted by x. For n 0, the sequence of arguments x 1, x 2,..., x n is denoted by x. A function f(x) with zero arguments (n = 0) is a constant. Definition 1 Let x = x 1,..., x n and y = y 1,..., y m ; by y = f(x) we mean that, for 1 i m, each of the y i is a function of x. We say that f is a multiple function. Some fixed computable bijection for coding words as integers is assumed. 5

We will use the following word order, where x and y are words, see for instance [27]. x < y iff (i) x < y or (ii) x = y and x < y in lexicographic order. 2.1 Languages, reductions and the arithmetic hierarchy The terms unsolvable, recursively unsolvable ([38]), and undecidable will be used interchangeably. It is assumed that the reader is familiar with the arithmetic hierarchy of languages (AH), see for instance [32, 38, 23, 26, 25, 24, 20]. The arithmetic hierarchy is used in this paper with the purpose of measuring the degree of undecidability of PR decision problems. This is usual in Recursion Theory, see for instance its use for rewriting problems studied in [10, 40]. This is similar to the classification of the difficulty of a (decidable) problem in the polynomial hierarchy (PH). The only important definitions and results that the reader should be aware are mentioned in the beginning of the Chapter 14 of [38], namely: A relation R is in the arithmetic hierarchy if R is recursive (Class Σ 0 0 = Π0 0 ) or if there is a recursive relation S such that R can be obtained from S by a finite sequence of complement and/or projection operations. Theorem I, page 302, Theorem III, page 307. The relationship between the classes of the AH (and of the PH) and the sequence of alternating quantifiers in the question associated with the decision problem. Se for instance Sections 14.1 and 14.2 of [38]. More precisely, a decision (or complexity problem) belongs to Σ 0 n or Π 0 n iff the formula of the associated question, written in prenex normal form, has n (alternating) quantifiers in the prefix, the outer one being, respectively, existential or universal (partial transcription from [32]). See for instance [32] (Definition IV.1.6, page 367), [38] (Chapter 14, Theorem I, page 302), and [13] (Chapter 7, Theorem 7.4, page 163). A relation R is in AH iff R is definable in elementary arithmetic (definition in [38]). This property justifies the name arithmetic for a hierarchy of relations or functions. In the literature the superscript 0 is sometimes omitted. We denote by the set Σ 0 0 = Π0 0 = 0 0. Thus the class of recursively enumerable, but not recursive sets is Σ 0 1 \. The following table lists some AH classes (languages) and the descriptions of the corresponding decision problems. 6

AH class Σ 0 1 Σ 0 1 \ Π 0 1 Π 0 1 \ Σ 0 2 \ (Σ0 1 Π0 1 ) Decision problem Semi-decidable Undecidable, semi-decidable Complement of a semi-decidable problem Undecidable, complement of a semi-decidable problem Neither semi-decidable nor the complement of a semi-decidable problem, but expressible as x y : P (x, y), where P is decidable (see the references to the AH cited above) and x and y represent tuples of variable. Given this correspondence, we will sometimes abuse the language, using an AH class to denote either a decision problem or the corresponding language. Definition 2 (many-one, PR reduction) Suppose that the languages L and M are defined over the alphabets Σ L and Σ M respectively. L reduces (many-one) to M, L m M, if there is a primitive recursive function f : Σ L Σ M such that x L if and only if f(x) M. If L m M, 1. M implies L. Proof. To decide if x L compute f(x) and use the decision algorithm for f(x) M. 2. L m M. Proof. x L iff f(x) M is the same as x L iff f(x) M. 3. M Σ 0 1 implies L Σ0 1. Proof. Assuming that M is enumerable, use the following procedure to enumerate L Y loop Enumerate the next element y of M. Y Y {y}. Consider the next element x of Σ L. Compute f(x). If f(x) Y, list x. For every x < x that was not listed, if f(x ) = y, list x. endloop 4. M Π 0 1 implies L Π0 1. Proof. Use properties 2 and 3. Note. Properties 3 and 4 imply Property 1. A set P is m -complete in the class C if P C and Q m P for every Q C. 7

2.2 Decision problems The following three well known decision problems are undecidable, but semidecidable, i.e. they belong to the class Σ 0 1 \ [3, 19, 32, 9]. Definition 3 HP, halting problem. Instance: a Turing machine T and a word x. Question: does the computation T (x) halt? Definition 4 SHP, self halting problem. Instance: a Turing machine T. Question: does the computation T (i) halt, where i is a Gödel index of T? Definition 5 PCP, Post correspondence problem. Instance: two finite sets of non-null words, {x 1,..., x n } and {y 1,..., y n }, defined over the same finite alphabet with at least two letters. Question: is there a finite non-null sequence i 1,..., i k such that x i1 x i2... x ik = y i1 y i2... y ik? Another important undecidable problem is the following. Definition 6 TOTAL, is a function total? Instance: a partial recursive function f(x) given by a Turing machine T. Question: Is f(x) defined for every x? Theorem 1 The language associated with the TOTAL problem belongs to the class Π 0 2 \ (Σ0 1 Π0 1 ). Proof. (See for instance [33]). (i) L TOTAL Π 0 2. The TOTAL question, with instance f(x), can be written x t : (F (x, t) = 1) where F (x, t) is the PR function { 0 if T (x) does not converge in t steps F (x, t) = 1 otherwise and T is a Turing machine that computes f. (ii) L TOTAL Σ 0 1. Reduction ( HP) m TOTAL: using a Turing machine T that computes f, define g as follows (using the S mn Theorem) g x (t) def = f(x, t) = { 1 if T (x) does not converge in t steps undefined otherwise Clearly g x is a total function iff T (x) does not halt. (iii) L TOTAL Π 0 1. 8

Reduction HP m TOTAL: given the instance T, x of HP, define the function g(y) that (ignores the input y and) simulates the computation T (x); if it halts, the output is 0; if not, g(y) is undefined. The function g(y) is total iff the computation T (x) halts. 2.3 Models of computation Deterministic finite automata (DFA), Turing machines (TM), and Context free grammars (CFG) and examples of models of computation. In order to find the properties that a model of computation should satisfy, let us begin with an example. Every Turing machine M can be uniquely described by a word 2 d(m) that encodes its properties: states, initial state, final states, transition function. Alternatively a Turing machine can be described by its Gödel index. Thus, the descriptions of all Turing machines can be effectively enumerated by the following method, where for simplicity, we assume that the alphabet of the description is a, b. Successively generate in order all words x = ε, a, b, aa, ab,... Whenever x is the description of a Turing machine, output x. If i is a Gödel index of the Turing machine T, the partial function implemented by T is denoted by φ i or alternatively by {i}. When we write φ i (x) = y we mean two things: 1. The corresponding computation halts; we write (the computation corresponding to) φ i (x) halts ; instead of φ i (x) we can of course write {i}(x). 2. The output of the computation is y. The dovetailing technique Consider a recursively enumerable set of Turing machines M 1, M 2... and suppose that we want to list the outputs of all the computations M i (x) for some fixed x. That is, for every i, if the computation M i (x) halts, its output is listed. This can be effectively done by the following method: Successively simulate one step of computation for each machine, in the following order Machine: M 1 M 1 M 2 M 1 M 2 M 3 M 1 M 2 M 3 M 4 M 1... Step: (1) (2) (1) (3) (2) (1) (4) (3) (2) (1) (5) Note that every machine M i is completely simulated: either forever or until it halts. During this simulation, whenever some machine M i halts, print its output. 2 In fact by an infinity of equivalent words. 9

Properties of a model of computation The fundamental assumptions associated with the intuitive idea of model of computation are the following. Assumption 1 Every instance of a model of computation is codified in a word such that (i) There is an algorithm that tests if a given word is a valid characterization of an instance of the model. As a consequence, the set of valid characterizations is effectively enumerable. (ii) From a valid word it is be possible to effectively extract the semantic properties of the instance it represents. We may for instance conclude that no model of computation characterizes the set of total recursive functions because that set is not enumerable (see for instance [33]). 2.4 Primitive recursive functions It is assumed that the reader is familiar with the classical definition of primitive recursive functions [3, 32], with the usage of register languages to characterize those functions (particularly with the Loop language [28, 29]), and with the Kleene normal form theorem [23, 3]. The binary function defined below is PR { x y if x y x y = 0 otherwise The following property will be useful. Property 1 Let a and b be arbitrary integers. (a b) + (b a) = 0. Then a = b if and only if The S mn Theorem will often be used without mention. Theorem 2 (S mn Theorem) Given a Gödel numbering ϕ of PR functions, there is a PR function s of two arguments such that: for every Gödel number p of a partial recursive function f(x, y) with two arguments, x, y : f(x, y) = ϕ s(p,x) (y). In the sequel the function ϕ s(p,x) (y) will often be denoted by f x (y). 2.5 Context free grammars The language generated by the context-free grammar (CFG) G is denoted by L(G). A CFG G is ambiguous if there is at least one word in L(G) with 10

more than one leftmost derivation. In this definition we can replace leftmost derivation by parsing tree. The symbols and will be used with the usual meaning. Definition 7 A CFG is ε-free if it has no productions of the form A ε. Theorem 3 For every CFG G there is an ε-free grammar G such that L(G ) = L(G) \ {ε}. Theorem 4 For every CFG G there is a primitive recursive parser that recognizes L(G). Proof. In an ε-free grammar, w z implies w z. To see if x L(G), we can use a brute force search in which every derivation that contains the same word twice, S... w... w..., is discarded, i.e. the search tree is pruned. A PR bound on the length of every possible derivation can thus be established and this algorithm can be implemented as a primitive recursive function. Definition 8 Given a CFG G, the extended grammar G is the CFG that contains all the letters, non-terminals, and productions of G plus the productions S C, C c, and C Cc where S is the initial symbol of G (and of G ), C is a new non-terminal symbol, c is a new letter. We say that G is an extended context free grammar or E-CFG. The problem of deciding if a given E-CFG is ambiguous is called the E-CFG ambiguity problem, or E-CFG-amb. Clearly, G is ambiguous iff G is ambiguous, and L(G ) = L(G) {c, cc, ccc...} (disjoint union). Theorem 5 The E-CFG ambiguity problem is undecidable. Proof. We reduce PCP to the E-CFG ambiguity problem. Let the PCP instance be {x 1,..., x n }, {y 1,..., y n } (n 1) and let a 1,..., a n, and c be new letters. Consider the E-CFG G S A B C A x i Aa i x i a i for i = 1, 2..., n B y i Ba i y i a i for i = 1, 2..., n C c Cc In G every derivation is leftmost. There are at most two possible derivations of a word not containing the letter c, starting with S A and S B. Due to the presence on the right of the new letters a i, they correspond to a solution of the PCP problem. Conversely, if the PCP has a solution, the E-CFG G is ambiguous. 11

3 Decision problems associated with PR functions We study the decidability of some problems in which one (f) or two (f and g) primitive recursive functions are given as the instance. First, in Section 3.1, we study several problems related to the existence of zeros of the function f and to the equivalence of the functions f and g, then, in Section 3.2, some properties related to the codomain of f are studied, and finally, in Section 3.3 we prove results associated to the injectivity, surjectivity, and bijectivity of f. The reader can find a summary of some of these results in Figure 2 (page 23). In Section 3.4 (page 22) we consider also the case in which the instance is a partial recursive function and compare the two cases. Figures 5 (page 25) and 6 (page 30) contain a summary of this comparision. 3.1 Some undecidable problems Several decision problems related with the zeros and the equivalence of PR functions are studied. They are all proved to be undecidable. In particular we present a new proof of the undecidability of the PR equivalence problem. 3.1.1 Problems In the decision problems listed below the corresponding class in the arithmetic hierarchy is listed. In every case it is assumed that a PR function is specified by a primitive recursive index. Definition 9 In the following decision problems the specification of the particular instance is: a primitive recursive function f(x, y), and the value of x. Using the S mn Theorem (page 10), this instance is equivalent 3 to the simpler form a primitive recursive function g(y). This form will be often used. HAS-ZEROS, f(x, y) has at least one zero. Question: Is there some y such that f(x, y) = 0? Class: Σ 0 1 \, Theorem 6 (page 14). EXACTLY-ONE-ZERO. Question: Does f(x, y) have exactly one zero? Class: Σ 0 2 \ (Σ0 1 Π0 1 ), Theorem 7 (page 14). AT-LEAST-k-ZEROS. Question: Does f(x, y) have at least k 0 s? (k 1 fixed). Class: Σ 0 1 \, Theorem 8 (page 15). 3 Where g(y) f x(y). 12

EXACTLY-k-ZEROS. Question: Does f(x, y) have exactly k zeros? (k 1 fixed). Class: Σ 0 2 \ (Σ0 1 Π0 1 ), Theorem 9 (page 15). EQUAL-NEXT. Question: Is there some y such that f(x, y) = f(x, y + 1)? Class: Σ 0 1 \, Theorem 10 (page 15). ZERO-FUNCTION. Question: Is f(x, y) the 0(y) 0 function? Class: Π 0 1 \, Theorem 11 (page 15). -ZEROS. Question: Does f(x, y) have infinitely many zeros? Class: Π 0 2 \ (Σ0 1 Π0 1 ), Theorem 12 (page 16). Definition 10 EQUAL-AT-ONE-POINT, functions equal at one point. Instance: primitive recursive functions f(x) and g(x). Question: Is there an input x such that f(x) = g(x)? Class: Σ 0 1 \, Theorem 13 (page 16). Definition 11 EQUIVALENCE. Instance: primitive recursive functions f(x) and g(x). Question: Is f(x) = g(x) for every x? Class: Π 0 1 \, Theorem 14 (page 16). We also consider the equivalence of f to any particular (i.e. fixed) primitive recursive function. Definition 12 Problem EQUIVALENCE i for each i N. Comment. For each problem the value i N is fixed. Instance: primitive recursive function f(x). Question: Is f(x) = φ i (x) for every x? Class: Π 0 1 \, Theorem 16 (page 17). 3.1.2 Polynomials and the HAS-ZEROS problems For each instance f(x) of the HAS-ZEROS problem there is an integer (with integer coefficients) polynomial p(x 1,..., x n ), such that p has a zero iff f(x) has a zero. Let us begin by quoting [11]. In an unpublished and undated manuscript from the 1930s found in Gödel s Nachlass and reproduced in Vol. III of the Collected Works, he showed that every statement of the form x : R(x) with R primitive recursive [relation] is equivalent to one in the form x 1,..., x n y 1,..., y m : [p(x 1,... x n, y 1... y m ) = 0] 13

in which the variables range over natural numbers and p is a polynomial with integer coefficients; it is such problems that Gödel referred to as Diophantine in the Gibbs lecture. It follows from the later work on Hilbert s 10th problem by Martin Davis, Hilary Putnam, Julia Robinson and in the end Yuri Matiyasevich that, even better, one can take m = 0 in such a representation, when the = relation is replaced by [that is, x : R(x) iff x : P (x) 0]. In terms of PR functions, a PR relation R(x) can be represented by a PR function f(x) such that R(x) holds iff f(x) 0. This is of course one, among many, possible representations. We have (with m = 0) the equivalences x : R(x) x 1,..., x n : [p(x 1,... x n ) 0] x : f(x) 0 x 1,..., x n : [p(x 1,... x n ) 0] x : f(x) = 0 x 1,..., x n : [p(x 1,... x n ) = 0] Thus, given that there is an algorithm that computes p from f, and relatively to the decidability of the HAS-ZEROS problem, an arbitrary PR function is no more general than a (multiple variable) integer polynomial. 3.1.3 Results Theorem 6 The HAS-ZEROS problem is undecidable but semi-decidable (see [3]). Proof. The semi-decidability is obvious. The undecidability follows from two facts: the Kleene normal form Theorem and the undecidability of the halting problem. Corollary 1 Let f(x 1,..., x n, y) and g(x 1,..., x n, y) be primitive recursive functions, with n 1. The following problem is undecidable but semi-decidable: given x 1,..., x n, is there some y such that f(x 1,..., x n, y) = g(x 1,..., x n, y)? Proof. Using the S mn Theorem (page 10), we replace f(x, y) and g(x, y) by f(y) and g(y) respectively. Property 1 (page 10) says that f(y) = g(y) iff (f(y) g(y)) + (g(y) f(y)) = 0. The result follows from Theorem 6 (page 14) Theorem 7 The language associated with the EXACTLY-ONE-ZERO problem is Σ 0 2 \ (Σ0 1 Π0 1 ). Proof. In Σ 0 2. Given the PR function f(x), the question associated with the problem can be expressed as x x : [(f(x) = 0) (x x f(x ) 0)]? which shows that the language belongs to Σ 0 2. Not in Π 0 1. Reduce HAS-ZEROS to EXACTLY-ONE-ZERO: 14

let f be the instance of HAS-ZEROS. Define g as { 0 if f(x) = 0 and [x g(x) = < x f(x ) 0] 1 otherwise Clearly g is PR and f has at least one zero iff g has exactly one zero. Thus the problem EXACTLY-ONE-ZERO is undecidable and is not the complement of a semi-decidable problem. Not in Σ 0 1. Reduce (HAS-ZEROS) to EXACTLY-ONE-ZERO: let f be the instance of (HAS-ZEROS). Define g as 0 if x = 0 g(x) = 1 if x 1 and f(x 1) 0 0 if x 1 and f(x 1) = 0 The function g has exactly one zero iff the function f has no zeros. It follows that EXACTLY-ONE-ZERO is not a semi-decidable problem. Theorem 8 The AT-LEAST-k-ZEROS problem is undecidable but semi-decidable. Proof. The AT-LEAST-k-ZEROS problem is clearly semi-decidable and HAS- ZEROS (instance f(x)) reduces easily to AT-LEAST-k-ZEROS (instance g(x)) if we define for each x 0 g(kx) = g(kx + 1) =... = g(kx + (k 1)) = f(x) so that each zero of f corresponds to k zeros of g. Theorem 9 For every k 1 the language associated with the EXACTLY-k- ZEROS problem is in Σ 0 2 \ (Σ0 1 Π0 1 ). Proof. Similar to the proof of Theorem 7. Theorem 10 The EQUAL-NEXT problem is undecidable but semi-decidable. Proof. Let g(x) def = (f(x + 1) f(x)) + (f(x) f(x + 1)) and h(x) def = i=x 1 i=0 f(i). We have g(x) = 0 iff f(x) = f(x + 1) and h(x) = h(x + 1) iff f(x) = 0. It follows that HAS-ZEROS m EQUAL-NEXT and EQUAL-NEXT m HAS-ZEROS. The proposition follows. Theorem 11 The language associated with the problem ZERO-FUNCTION is in Π 0 1 \. Proof. The complement of ZERO-FUNCTION is semi-decidable (belongs to the class Σ 0 1 ) so that ZERO-FUNCTION belongs to Π0 1. 15

Undecidability (not in ): reduce HAS-ZEROS to (ZERO-FUNCTION). Given an instance f of HAS-ZEROS, define the function g as { 0 if f(x) 0 g(x) = 1 if f(x) = 0 Clearly, g is PR; also g has at least one zero iff f has at least one nonzero. Theorem 12 The language associated with the problem -ZEROS is in Π 0 2 \ (Σ 0 1 Π0 1 ). Proof. In Π 0 2. The question associated with the problem can be expressed as m x : (x m) (f(x) = 0)? or: m x, y : (x = m + y) (f(x) = 0)? Not in Π 0 1 :. Reduction HAS-ZEROS to -ZEROS: let f be an instance of HAS-ZEROS. Define g as { 0 if x, written in binary notation is in 10 g(x) = n 1(0 + 1) and f(n) = 0 1 otherwise where the standard notation for regular expressions is used. Clearly, f(x) has at least one zero iff g(x) has infinitely many zeros. Not in Σ 0 1. Reduction (HAS-ZEROS) m -ZEROS: let f be an instance of (HAS-ZEROS). Define g as { 1 if f(x g(x) = ) = 0 for some x x 0 otherwise The function f(x) has no zero iff g(x) has infinitely many zeros. Theorem 13 The EQUAL-AT-ONE-POINT problem is undecidable but semidecidable. Proof. Easy, consider the PR function (f(x) g(x)) + (g(x) f(x)). Theorem 14 The EQUIVALENCE problem is undecidable; its complement is semi-decidable. Proof. The complement of the EQUIVALENCE problem is clearly semi-decidable. Two CFG languages are equal iff the functions defined by the corresponding parsers are equal. A CFG parser can be written as an primitive recursive algorithm having as input an integer that codes the words of the alphabet and an output which is either 0 (reject) or 1 (accept), see Theorem 4 (page 11). Thus, as the CFG language equivalence is undecidable (see for instance [21]), the EQUIVALENCE problem is also undecidable. 16

Another proof. The following function is PR Given the description d(m) of a Turing machine T and an input x, the following function is primitive recursive 4. { 0 if M(x) has halted by time t f(d(m), x, t) = 1 otherwise We reduce the SHP to EQUIVALENCE. The function { f 0 if M(d(M)) has halted by time t (d(m), t) = 1 otherwise is also PR. Given d(m), instance of the SHP, the computation φ d(m) (d(m)) does not halt iff the unary function f (d(m), t) (with d(m) fixed, t is the argument) is equivalent to the zero function 0(t); this is a particular case of EQUIVALENCE. Thus EQUIVALENCE cannot be decidable. In fact, the last sentence of the proof above gives us another very simple proof: Theorem 11 (page 15) shows that a particular case of EQUIVALENCE is already undecidable; thus, so is EQUIVALENCE. A reduction of EQUIVALENCE to ZERO-FUNCTION is also possible: by Property 1 (page 10) f(y) = g(y) iff (f(y) g(y)) + (g(y) f(y)) = 0. Thus EQUIVALENCE reduces to ZERO-FUNCTION. Theorem 15 For every integer i the problem EQUIVALENCE i is undecidable; its complement is semi-decidable. Proof. We only prove the undecidability of EQUIVALENCE i, the other part is easy (see the proof of Theorem 14). Let i be any fixed integer. We reduce ZERO-FUNCTION to EQUIVALENCE i. Let f be an instance of ZERO-FUNCTION. Define the primitive recursive function g(x) = f(x) + φ i (x). Clearly, the function f is the zero function 0(x) iff g(x) is equivalent to φ i (x). We can further generalize Theorem 16, considering the equality of the functions f(x) and φ i (x), not for all x N but only for an infinite PR predetermined subset of the domain. By this, and anticipating the terminology used in Section 4, page 29, we mean that there is a fixed primitive recursive function g, such that the equality f(y) = φ i (y) is only considered for the values y = g(x) with x N. Theorem 16 For every integer i and for every primitive recursive function g with infinite domain, the problem is f(y) = φ i (y) for every y in the codomain of g? is undecidable; its complement is semi-decidable. Proof. (Brief sketch). Consider the problem is f(g(x)) = 0 for every x N?. Note that f(g(x)) has a zero iff (f(y) 1) + 1 is not zero for all y in the 4 The function f is related to one PR function of the Kleene normal form, namely to the function under the scope of the unbounded minimization operator. 17

codomain of g. Assume that this codomain is infinite and continue the proof as in Theorem 16, but using the idea of the proof of Theorem 22, page 33. 3.2 Size of the codomain The size of the codomain cod(f) of a PR function f may determine if a problem belonging to a certain class (see Section 4.2, page 32) is decidable or not. We study two decision problems related with this size. In the following problems, the instance is the PR function f. The problem INFINITE-CODOMAIN is also mentioned in Section 4.7 (page 35). Problem CODOMAIN-k, Finite, fixed size codomain, where k is any fixed positive integer. Question: Does the codomain of f have size k? Class: Π 0 1 \ for k = 1 (Theorem 17, page 18) Class: Σ 0 2 \ (Σ0 1 Π0 1 ) for k 2 (Theorem 18, page 18) Theorem 17 For k = 1 the language associated with the problem CODOMAIN-k belongs to the class Π 0 1 \. Proof. A positive answer to CODOMAIN-k for k = 1 can be expressed as x : (f(x) = f(0)), so that CODOMAIN-k for k = 1 is in Π 0 1. Reduce ZERO-FUNCTION to CODOMAIN-k (k = 1) as follows. Given an instance f of ZERO-FUNCTION consider the instance g of CODOMAIN-k { g(0) = 0 g(x) = f(x 1) for x 1 The function g has codomain with size 1 iff f(x) 0. Thus CODOMAIN-k (k = 1) is undecidable. Theorem 18 For any integer k 2 the language associated with the problem CODOMAIN-k belongs to the class Σ 0 2 \ (Σ0 1 Π0 1 ). Proof. In Σ 0 2. A positive answer to CODOMAIN-k can be expressed as a expression; we exemplify for the case k = 2 y 1, y 2, x 1, x 2 z : (f(x 1 ) = y 1 ) (f(x 2 ) = y 2 ) (y 1 y 2 ) (f(z) = y 1 f(z) = y 2 ) so that CODOMAIN-k is in Σ 0 2 for any k 2. Not in Σ 0 1. Reduce ZERO-FUNCTION to CODOMAIN-k: let f be an instance of ZERO-FUNCTION. Define g as { x for 0 x < k g(x) = 2kf(x k) for x k Clearly cod(g) = k iff f(x) 0. Thus CODOMAIN-k is not in Σ 0 1 (Property 4, page 7). 18

Not in Π 0 1. Reduce ( ZERO-FUNCTION) to CODOMAIN-k: let f be an instance of ( ZERO-FUNCTION). For each x N define the k values g(kx + i) = { 0 if f(x) = 0 i if f(x) 0 (for 0 i < k) Clearly cod(g) = k iff f(x) 0 for some x. Thus CODOMAIN-k is not in Π 0 1 (Property 3, page 7). Problem FINITE-CODOMAIN, finite codomain Question: Is the codomain of f finite? Theorem 19 FINITE-CODOMAIN belongs to the class Σ 0 2 \ (Σ0 1 Π0 1 ). Proof. In Σ 0 2. The FINITE-CODOMAIN statement can be expressed as m x : f(x) m. Not in Σ 0 1. Reduce ZERO-FUNCTION to FINITE-CODOMAIN: let f be an instance of ZERO-FUNCTION. Define g as { 0 if f(0) = f(1) =... = f(x) = 0 g(x) = x otherwise The codomain of g is finite (with size 1) iff f(x) 0. It follows that FINITE-CODOMAIN is not in Σ 0 1. Not in Π 0 1. Reduce HAS-ZEROS to FINITE-CODOMAIN: use the function { 0 if f(y) 0 for some y x g(x) = x otherwise The codomain of g is finite iff f(x) is nonzero for some x. It follows that FINITE-CODOMAIN is not in Π 0 1. The problem INFINITE-CODOMAIN is the negation of the problem FINITE-CODOMAIN. It follows from Theorem 19 that INFINITE-CODOMAIN belongs to the class Π 0 2 \ (Σ0 1 Π0 1 ). 3.3 Injectivity, surjectivity, and bijectivity The problems of deciding if a given PR function is injective, surjective, or bijective are considered in this section. First we define the three problems studied in this section. Definition 13 INJECTIVE, primitive recursive injectivity. Instance: a PR function f, specified by a Loop program. Question: is f an injective function? Definition 14 ONTO, primitive recursive surjectivity. 19

Instance: a PR function f, specified by a Loop program. Question: is f a surjective function? Definition 15 BIJECTIVE, primitive recursive bijectivity. Instance: a PR function f, specified by a Loop program. Question: is f a bijective function? Clearly, if the INJECTIVE and the ONTO problems were decidable then BI- JECTIVE would also be decidable. However, all these problems are undecidable (with various degrees of undecidability). 3.3.1 Injectivity We will use the following lemma to prove that the problem of determining if a given PR function is injective is undecidable. Lemma 1 For every CFG G there is a PR function f G whose input is an integer n that codifies some word d and with the following output. f G (n) = y if n codifies a word d which is a leftmost derivation of some word x in G; suppose that the integer y codifies the word x, say y = c(x), and assume that y starts with 10. This situation is illustrated in the following diagram. n d f G G x y = 10... N Σ Σ N f G (n) = 11n if d is not a leftmost derivation in G. Proof. The PR function f G checks if n codifies a leftmost derivation of a word x. If it does, the result is the integer y = c(x) = 10.... Otherwise, the result is the integer 11n. Theorem 20 The problem INJECTIVE is undecidable, being the complement of a semi-decidable problem, that is, it belongs to the class Π 0 1 \. As a consequence of this result the injective PR functions can not be effectively enumerated and can not be characterized by a model of computation, see Assumption 1 (page 10). Proof. The INJECTIVE statement can be expressed as m, n : (m n) (f(m) f(n)) 20

This INJECTIVE belongs to the class Π 0 1. The E-CFG ambiguity problem, E-CFG-amb (page 11) is undecidable and the set of E-CFG ambiguous grammars belongs to Σ 0 1. We reduce E-CFG-amb to INJECTIVE. Let G be an E-CFG. Using Lemma 1, define a PR function f G as described in the Lemma. It is clear that G is ambiguous iff the function f G is not injective. Thus INJECTIVE is not decidable. 3.3.2 Surjectivity and bijectivity An instance f of ONTO can be expressed as y x : f(x) = y. It follows the problem is in the class Π 0 2. An instance f of BIJECTIVE can be expressed as y, x 1, x 2 x : [f(x) = y] [x 1 x 2 f(x 1 ) f(x 2 )] Thus BIJECTIVE also belongs to the class Π 0 2. We first prove that neither of these two problems is semi-decidable, and then that neither is the complement of a semi-decidable problem. 3.3.3 Neither problem is semi-decidable Given the description d(m) of a Turing machine T and an input x, the following function is PR. { 0 if M(x) is halted at time t f(d(m), x, t) = 1 otherwise Given a Turing machine M described by d(m), the function g below is also PR. { 0 if f(d(m), d(m), t) = 0 [M(d(M)) is halted at time t] g(t) = t if f(d(m), d(m), t) = 1 [otherwise] Notice that M(d(M)) diverges iff the PR function g is surjective; thus, we have a reduction SHP m ONTO (1) As the self-halting problem is undecidable but semi-decidable, we have proved that ONTO is undecidable and not semi-decidable otherwise SHP would be semi-decidable, which is false (see also the Property 4 in page 7). Thus, ONTO Σ 0 1 Note that the function g defined above also satisfies: g is a bijection iff M(d(M)) diverges, so we also have a reduction SHP m BIJECTIVE (2) which proves that BIJECTIVE Σ 0 1 21

Neither problem is the complement of a semi-decidable problem Consider now the PR function h(t) { t t0 the computation M(d(M)) halted at time t h(t) = 0 t 0 not halted at time t Clearly h(t) is surjective iff the the answer to the HP is yes, so that we have a reduction SHP m ONTO (3) As the self-halting problem is undecidable but semi-decidable, we have proved that ONTO is not the complement of a semi-decidable problem, ONTO Π 0 1. Finally, consider the PR function 0 if the computation M(d(M)) halts at time t h(t) = t + 1 not halted yet t otherwise (halted before t) As an example, we list the first values of h(t) in two cases. First, when the computation M(d(M)) diverges: and then when it halts at time 5: t : 0 1 2 3 4 5 6 7 8 9... h(t) : 1 2 3 4 5 6 7 8 9 10... t : 0 1 2 3 4 5 6 7 8 9... h(t) : 1 2 3 4 5 0 6 7 8 9... We see that h(t) is bijective iff the the answer to the HP is yes, so that we have a reduction SHP m BIJECTIVE (4) Thus BIJECTIVE Π 0 1. Note. This reduction could also have been used to prove that ONTO Π 0 1. The table in Figure 2 (page 23) summarizes our undecidability results about PR functions. The reductions used in the proofs of this section are represented in Figure 4 (page 24). 3.4 Primitive recursive versus partial recursive problems It is interesting to compare the degree of undecidability of the same problem about a function f in two cases: (i) f if primitive recursive, (ii) f is partial recursive. Theorem 21 Let A be a PR decision problem corresponding to the question does a given PR function have the property P? and let X be any decision 22

Num PR problem Class Proof 1 HAS-ZEROS Σ 0 1 \ page 14 2 EXACTLY-ONE-ZERO Σ 0 2 \ (Σ0 1 Π0 1 ) page 14 3 AT-LEAST-k-ZEROS Σ 0 1 \ page 15 4 EXACTLY-k-ZEROS Σ 0 2 \ (Σ0 1 Π0 1 ) page 15 5 ZERO-FUNCTION Π 0 1 \ page 15 6 -ZEROS Π 0 2 \ (Σ0 1 Π0 1 ) page 16 7 CODOMAIN-k, k = 1 Π 0 1 \ page 18 8 CODOMAIN-k, k 2 Σ 0 2 \ (Σ0 1 Π0 1 ) page 18 9 FINITE-CODOMAIN Σ 0 2 \ (Σ0 1 Π0 1 ) page 19 10 INJECTIVE Π 0 1 \ page 20 11 ONTO Π 0 2 \ (Σ0 1 Π0 1 ) Section 3.3.2 12 BIJECTIVE Π 0 2 \ (Σ0 1 Π0 1 ) Section 3.3.2 Figure 2: Some decision problems studied in this paper. In every problem the instance is a PR function. The problems are numbered (first column, in this color) for reference in Figure 3, page 23. Π 0 2 6, 11,12 2, 4, 8, 9 Σ 0 2 Π 0 1 5, 7, 10 0 0 (decidable problems) 1, 3 Σ 0 1 Figure 3: Location in the arithmetic hierarchy of the problems mentioned in Figure 2, page 23. The problem numbers (1 to 12 in this color) refer to the numbers in the first column of Figure 2. 23

PCP SHP SHP E-CFG-amb INJECTIVE ONTO BIJECTIVE ONTO BIJECTIVE Figure 4: Reductions used in the proofs of Section 3.3. problem. If X m A, then X m A, where A corresponds to the question does a given partial recursive function have the property P?. Proof. Let f be the function corresponding to the reduction X m A. The image by f of a (positive or negative) instance x of X is a PR function, thus it is also a partial function. So, we can use the same function f for the reduction X m A. Let F (x, t) be the Boolean function that outputs true iff the computation f(x) halts at time t. We should have some care when dealing with a partial recursive function f because when we say something like f(x) = 0 we really mean two things: (i) the computation of f(x) converges and (ii) its output is 0. We now justify the classes in the last column of Figure 5 (page 25). 1. f(0) = 0: well known result. 2. TOTAL: see Theorem 1, page 8. 3. HAS-ZEROS: well known result. 4. NO-ZEROS, f has no zeros. The statement can be expressed as [ x, t : F (x, t) f(x) = 0] Thus it belongs to Π 0 1. We describe a reduction SHP m NO-ZEROS: let n be an instance of SHP; define { 0 if φn (n) halts in time t g(t) = 1 otherwise The function g has no zeros iff φ n (n) does not halt. We conclude that NO-ZEROS belongs to Π 0 1 \. 5. EXACTLY-ONE-ZERO: it is easy to see that this problems belongs to the same class as HALTS-ONE whose question is is f(x) defined for exactly one value of x?. The statement corresponding to HALTS-ONE is x, t : F (x, t) [ y : (y x) ( t : F (y, t))] 24

Problem f is primitive rec. f is partial rec. f(0) = 0 Σ 0 1 \ TOTAL Π 0 2 \ (Σ0 1 Π0 1 ) = HAS-ZEROS Σ 0 1 \ Σ0 1 \ = NO-ZEROS Π 0 1 \ Π0 1 \ = EXACTLY-ONE-ZERO Σ 0 2 \ (Σ0 1 Π0 1 ) Σ0 2 \ (Σ0 1 Π0 1 ) = AT-LEAST-k-ZEROS Σ 0 1 \ Σ0 1 \ = EXACTLY-k-ZEROS Σ 0 2 \ (Σ0 1 Π0 1 ) Σ0 2 \ (Σ0 1 Π0 1 ) ZERO-FUNCTION Π 0 1 \ Π0 2 \ (Σ0 1 Π0 1 ) = -ZEROS Π 0 2 \ (Σ0 1 Π0 1 ) Π0 2 \ (Σ0 1 Π0 1 ) CODOMAIN-k, k = 1 Π 0 1 \ Π0 2 \ (Σ0 1 Π0 1 ). CODOMAIN-k, k 2 Σ 0 2 \ (Σ0 1 Π0 1 ) Π0 2 \ (Σ0 1 Π0 1 ) = INJECTIVE Π 0 1 \ Π0 1 \ = ONTO Π 0 2 \ (Σ0 1 Π0 1 ) Π0 2 \ (Σ0 1 Π0 1 ). = BIJECTIVE Π 0 2 \ (Σ0 1 Π0 1 ) Π0 2 \ (Σ0 1 Π0 1 ). Figure 5: The degree of undecidability of some decision problems about a function f. Two cases are compared: f is a primitive recursive function (PR) and f is a partial recursive function. The symbol means that the partial recursive function problem is more undecidable than the corresponding PR problem. The symbols = and mean equally undecidable (in the same class of the ARithmetic Herarchy) or incomparable. 25

or x, t y, t : F (x, t) [(y x) ( F (y, t))] Thus, HALTS-ONE (and EXACTLY-ONE-ZERO) belong to the class Σ 0 2. (ii) EXACTLY-ONE-ZERO Σ 0 1. Reduction ( HP) m EXACTLY-ONE-ZERO: Let T, x be the instance of HP where the Turing machine T computes f. Define g as follows g x (t) def = f(x, t) = 0 if t = 0 1 if T (x) does not converge in t steps 0 otherwise Clearly g x (t) has exactly one zero iff T (x) does not halt. (iii) EXACTLY-ONE-ZERO Π 0 1. Reduction HP m EXACTLY-ONE-ZERO: given the instance T, x of HP, define the function g(y) that, for y = 0 outputs 0; and for y 0 simulates the computation T (x); if it halts, the output is 0; if not, g(y) is undefined. The function g(y) has exactly one zero iff the computation T (x) halts. Thus EXACTLY-ONE-ZERO belongs to Σ 0 2 \ (Σ0 1 Π0 1 ). 6. AT-LEAST-k-ZEROS (k fixed): easy to show that it is in Σ 0 1 ( dovetailing technique); HAS-ZEROS reduces easily to AT-LEAST-k-ZEROS, see the proof of Theorem 8 (page 15). 7. EXACTLY-k-ZEROS (k fixed): proof similar to EXACTLY-ONE-ZERO, see item 5. For instance, the statement corresponding to HALTS-TWO 5 can be written x 1, x 2, t 1, t 2 y, t : F (x 1, t 1 ) F (x 2, t 2 ) [(y x 1 ) (y x 2 ) ( F (y, t))] Thus EXACTLY-k-ZEROS belongs to Σ 0 2. As in item 5, both HP and HP can be reduced to EXACTLY-k-ZEROS. It follows that EXACTLY-k-ZEROS belongs to Σ 0 2 \ (Σ0 1 Π0 1 ). 8. ZERO-FUNCTION: The corresponding question can be expressed as [ [ x, t : F (x, t) (f(x) 0)] [ x t : F (x, t)] ] so that ZERO-FUNCTION belongs to Π 0 2. HP with instance n reduces to ZERO-FUNCTION using the function { 0 if φn (n) converges f(x) = undefined otherwise (The input is ignored) HP with instance n reduces to ZERO-FUNCTION 5 Which is equivalent (in the sense that each one reduces to the other) to the problem AT- LEAST-k-ZEROS for k = 2. 26

using the function { 0 if φn (n) does not converge in t steps f(t) = 1 otherwise It follows that ZERO-FUNCTION belongs to Σ 0 2 \ (Σ0 1 Π0 1 ). 9. -ZEROS: In Π 0 2. The question associated with the problem can be expressed as m x, t : (x m) F (x, t) (f(x) = 0) or: m x, y, t : (x = m + y) F (x, t) (f(x) = 0) Thus -ZEROS belongs to Π 0 2. By Theorem 21 (page 22) the reductions used in the proof of Theorem 12 (page 16) are also valid in this case. It follows that -ZEROS (for partial recursive functions) belongs to Π 0 2 \ (Σ0 1 Π0 1 ). 10. CODOMAIN-k, k = 1: can be expressed as the negation of (1) {}}{ [ x, t : F (x, t)] (2) {}}{ x, x, t, t, : F (x, t) F (x, t ) f(x) f(x ) The part (1) means f it is the totally undefined function while part (2) means there are at least two values for which f is defined and has different results. We can rewrite this logical statement, which is the negation of CODOMAIN-k for k = 1, as x 1, x 2, t 1, t 2 x, t : [ F (x, t)] [F (x 1, t 1 ) F (x 2, t 2 ) f(x 1 ) f(x 2 )] Thus CODOMAIN-k for k = 1 belongs to Π 0 2. We reduce SHP to (CODOMAIN-k, k = 1). Let n be the instance of SHP. Define f(t) = 0 if t = 0 0 if φ n (n) does not converge in t steps (t 1) 1 otherwise (t 1) Clearly φ n (n) diverges iff the codomain of f has size 1. Now reduce SHP to (CODOMAIN-k, k = 1). Let n be the instance of SHP. Define { undefined if φn (n) does not converge in t steps f(t) = 0 otherwise The computation φ n (n) halts iff the codomain of f has size 1. CODOMAIN-k for k = 1 belongs to Π 0 2 \ (Σ0 1 Π0 1 ). Thus 11. CODOMAIN-k, k 2: we exemplify for the case k = 2, the cases k 3 27

being similar. The negation of the statement is [ x, t : F (x, t)] size=0 [ x, t x, t : P (x, t, x, t )] size=1 [ x 1, x 2, x 3, t 1, t 2, t 3 : Q(x 1, x 2, x 3, t 1, t 2, t 2 )] size 3 where P (x, t, x, t ) denotes and Q(x 1, x 2, x 3, t 1, t 2, t 2 ) denotes F (x, t ) (F (x, t ) f(x ) = f(x )) F (x 1, t 1 ) F (x 2, t 2 ) F (x 3, t 3 ) f(x 1 ) f(x 2 ) f(x 2 ) f(x 3 ) f(x 3 ) f(x 1 ) The negation of the statement can be rewritten as x, t, x 1, x 2, x 3, t 1, t 2, t 3 x, t, x, t : F (x, t) P Q where the arguments of P and Q have been omitted. It follows that CODOMAIN-k for k = 2 belongs to Π 0 2. To prove that CODOMAIN-k for k = 2 is not in Π 0 1, reduce SHP (instance n) to CODOMAIN-k, k = 2 0 if t = 0 f(t) = 0 if φ n (n) did not converge in t 1 steps (t 1) 1 if φ n (n) converges in t 1 steps (t 1) (the case f(0) = 0 is considered because the possibility of convergence for t = 0). The function f has codomain with size 2 iff φ n (n). To prove that CODOMAIN-k for k = 2 is not in Σ 0 1, reduce SHP (instance n) to CODOMAIN-k, k = 2 0 if t = 0 1 if t = 1 f(t) = 0 if φ n (n) did not converge in t 2 steps (t 2) 2 if φ n (n) converges in t 2 steps (t 1) The function f has codomain with size 2 iff φ n (n). 12. FINITE-CODOMAIN: 13. : the function f diverves at infinitely many points. It can be stated as It follows that belongs to Π 0 3. Unfinished. n m t : (m n) ( F (m, t)) (a) Reductions TOTAL m and m TOTAL? (b) The problem is f defined at least at one point? is Σ 0 1. 28

(c) The negation can be expressed as m : f m is total. The corresponding parameterized problem is given f and m, is f m total?. 14. INJECTIVE: for partial recursive functions the INJECTIVE statement can be expressed as [ x, y, t, t : F (x, t) F (y, t ) (f(x) = f(y))] (5) where F (x, t) has the same meaning as before (page 24). Notice that in a logic statement like this, when we talk about f(x) we implicitly assume that t : F (x, t); however this assumption, and a similar assumption for f(y), are already included in (5). It is easy to see that INJECTIVE is undecidable. Thus it belongs to the class Π 0 1 \. 15. ONTO: for partial recursive functions the ONTO statement can be expressed as y x, t : F (x, t) (f(x) = y) Thus ONTO is in Π 0 2. As PR functions are partial recursive functions, the reductions (1) (page 21) and (3) (page 22) are also valid here. It follows that, as in the PR function case, ONTO belongs to the class Π 0 2 \ (Σ0 1 Π0 1 ). 16. BIJECTIVE: for partial recursive functions the BIJECTIVE statement can be expressed as y, x, x 1, x 2 t : F (x, t) f(x) = y [(x 1 x 2 ) f(x 1 ) f(x 2 )] Note that this implies x t : F (x, t), so that we can talk about f(x 1 ) and f(x 2 ) without more proviso. Thus BIJECTIVE is in Π 0 2. As PR functions are partial recursive functions, the reductions (2) (page 21) and (4) (page 22) are also valid here. It follows that, as in the PR function case, BIJECTIVE belongs to the class Π 0 2 \ (Σ0 1 Π0 1 ). 4 Frontiers of decidability: the HAS-ZEROS problem In this section we consider the problem of determining whether a given unary PR function has at least one zero. As explained below, the function which is studied is a restriction of a general PR function f. The set of possible input (argument) values and the set of outputs will be restricted. We will find necessary and sufficient conditions for decidability of the problem does the modified function has a zero?. A possible way of restricting the inputs of a PR function f is to pre-apply to f some PR function 6 g. The outputs of f can be similarly restricted by post-applying to f some fixed PR function h. Both operations restrict the 6 We use a different text font for fixed PR functions like g and h. 29