Docsity

Um título do documento, Notas de estudo de Matemática

Pré-visualização parcial do texto

Baixe Um título do documento e outras Notas de estudo em PDF para Matemática, somente na Docsity!

Computability and Complexity

A Mathematical Primer

incomplete draft – do not distribute without permission from the authors

Amílcar Sernadas Jaime Ramos João Rasga Cristina Sernadas

Departamento de Matemática, Instituto Superior Técnico, ULisboa, Portugal

December 2008, revised and extended December 2013

CONTENTS 7

This draft represents work in progress towards self-contained notes for a semester course on computability and complexity for late undergraduate students of mathematics or theoretical computer science who already took a course in mathematical logic. We aim to reflect in these notes our long experience in teaching com- putability theory (albeit in most cases within the scope of a broader course on mathematical logic) and acknowledge from the beginning influences by some of the classics in the field (namely, the textbooks by Bridges, Co- hen, Cutland, Epstein & Carnielli, Rogers, and Shen & Vereshchagin), as well as from the brief introduction to the subject in our own textbook on mathematical logic. Intuitively, a function is computable if there is a procedure written in some appropriate programming language that when executed on input x computes f (x). This idea is developed in the chapters of Part I using the Mathematica programming language, having in mind the reader’s expected experience in programming with high level languages. In most cases the details of the adopted programming language are immaterial. In the chapters of Part II, much simpler programming systems are con- sidered. Such frugal, abstract systems are more amenable to theoretical studies, but in the end they are all equivalent in the sense that all detect as computable precisely the same functions – this equivalence is discussed in Chapter 6. The basics of complexity are covered in Part III, encompassing both Kolmogorov complexity and computational complexity, taking an approach independent of the underlying computation model. The authors acknowl- edge the contributions by André Souto to the material on Kolmogorov com- plexity and those by Paulo Mateus to that on computational complexity. In fact, Part III is mostly a pedagogical outgrowth of a selection of the working draft [20].

8 CONTENTS

Chapter 1

Basic concepts and results

Exercise 1 Recall the material in Chapter 1 and Section 1 of Chapter 3 of [30].

1.1 Computation universe and areas

Let AM denote the native alphabet of the programming language Mathemat- ica. Recall that AM is endowed with a total ordering defined as follows:

a < b if ToCharacterCode[“a”] < ToCharacterCode[“b”].

Furthermore, in the sequel we may write kAM for FromCharacterCode[k] and JAM (a) for ToCharacterCode[“a”]. In Mathematica, computing is carried out within the universe

WM = A∗ M

composed of the words written with symbols in the alphabet AM.

Exercise 2 What is the cardinality of WM?

Given n ∈ N, a (formal) set of type n is a subset of Wn M. The set Wn M is known as the universe of type n. The type 0 is also known as the nil type. The universe W^0 M is the singleton set composed of the empty tuple () which we usually denote by

11

1.1. COMPUTATION UNIVERSE AND AREAS 13

instead of

Function[k, ToString[ToExpression[k] + 1] ]

for computing the function that on receiving a number x produces the result x + 1. If input x is not a number, both programs above produce an error message which is fair enough because the envisaged function is not defined in that case. Clearly, the former program when applied to expression 259 returns expression 260, while the latter when applied to string “ 259 ” returns string “ 260 ”. Recall that by an enumeration of a set C one understands a surjective (or onto) map f : N → C. Using the strict order of AM, the objective now is to show that, for each n > 0 , there exists an injective enumeration for the universe Wn M. As expected, the proof is carried out by induction on n: that is, there is an enumeration when n = 1 and if there is an enumeration for n then there is an enumeration for n + 1.

Proposition 3 The strict total order of AM induces an injective enumera- tion of WM.

Proof: Consider the function SAM : AM ⇀ AM such that SAM (a) is the least of all elements greater than a, whenever these exist. For each m ∈ N, SAM is extended to the set of words of length m using the lexicographic order. Finally, it is extended to WM by requiring that, for each m, the last word of length m be followed by the first word of length m + 1. The envisaged enumeration λk.kWM is the map that for each k returns the k-th element of WM as follows: (^0) WM is the empty sequence and (k+1)WM is SWM (kWM ). By construction, this map is injective and an enumeration of universe WM. QED

Proposition 4 If there exists an injective enumeration of Wn M then there exists an injective enumeration of Wn M+.

14 CHAPTER 1. BASIC CONCEPTS AND RESULTS
J 0 1 2 3...

Figure 1.1: Bijection J between N^2 and N

Proof: The result is easy to establish using the previous result and the fact that there is a bijection

J : λ i, j. i +

((i + j)(i + j + 1)) : N × N → N

with inverse zigzag : N → N × N.^2

Indeed, given an injective enumeration h of Wn M and using the injective enu- meration of WM built in the proof of Proposition 3, an injective enumeration of W Mn+1 can be obtained as follows:

Function[k, Append[h[zigzag[k][[1]]], (zigzag[k][[2]])WM ] ] QED

The maps J and zigzag introduced above will be used frequently in the sequel. It is also sometimes convenient to use the component maps of the latter:

  • K : λ j. zigzag[j][[1]] : N → N;
  • L : λ j. zigzag[j][[2]] : N → N. (^2) Adapting Georg Cantor’s idea for a bijection between N and Q.
16 CHAPTER 1. BASIC CONCEPTS AND RESULTS

Notwithstanding this fact, we do not always assume that the computa- tion area at hand is denumerable, having in mind the purpose of making explicit the role of that assumption in some results. Chosen a computation area W , by a (formal) set of type (n : W ), or W -set of type n, we mean a subset of W n. We may refer to a W -set of, at the time irrelevant, type n, simply, as a W -set. Set W n^ is known as the W -universe of type n. Clearly, the WM-universe of type n is the universe of type n.

Exercise 7 Verify that C is a set of type (n : WM) if and only if C is a set of type n.

Exercise 8 Chosen a non-empty computation area W ⊆ WM and given n ∈ N+, using the canonical enumeration of the universe of type n, build an enumeration of W n.

Given some computation area W , a function

f : C 1 ⇀ C 2

is said to be a W -function, or a function defined within W , if both C 1 and C 2 are W -sets. Observe that, when C is of type (m : W ), for each n ∈ N, we accept Cn as being of type (mn : W ). Furthermore, given C 1 and C 2 of types (m 1 : W ) and (m 2 : W ), respec- tively, we accept C 1 × C 2 as being of type (m 1 + m 2 : W ). Finally, observe that if the chosen computation area W is a set of type m and C is a set of type (n : W ) then C is also of type mn. That is, C is also of type (mn : WM). Clearly, in this scenario, Co^ is of type (no : W ) and also of type mno. The following exercise provides an injective enumeration of each universe of non-nil type for the computation area N. This enumeration is frequently used in the sequel.

Exercise 9 For each n ∈ N+^ show that the following maps are bijections between Nn^ and N and, furthermore, inverse of each other:

  • β 1 n = λ k. kNn^ : N → Nn^ such that:^3 (^3) Here we use ⊕ for adding an element at the head of a tuple.
1.2. COMPUTABLE FUNCTIONS 17
  • kN = k for each k ∈ N;
  • kNn+1 = K(k) ⊕ L(k)Nn^ for each n ∈ N+^ and k ∈ N.
  • β n^1 = JNn^ : Nn^ → N such that:
  • JN(k) = k for each k ∈ N;
  • JNn+1 (k 1 ,... , kn+1) = J(k 1 , JNn (k 2 ,... , kn+1)) for each n ∈ N+ and k 1 ,... , kn+1 ∈ N.

Exercise 10 Verify that βnm = β 1 m ◦ β^1 n : Nn^ → Nm^ is a bijection for each m, n ∈ N+.

1.2 Computable functions

Let C 1 and C 2 be sets of arbitrary types (n 1 : W 1 ) and (n 2 : W 2 ), re- spectively. A function f : C 1 ⇀ C 2 is said to be computable if there is a procedure p, written in the Mathematica programming language, such that:^4

  • given an element c in C 1 for which f is defined, the computation of p[c] terminates within a finite number of steps, producing f (c) as the result;
  • given an element c in C 1 for which f is not defined, the computation of p[c] either ends in error or runs forever, in any case without producing an output.

In this situation, function f is said to be computed by procedure p. It should be stressed that nothing is imposed on the behavior of p when given an input outside of C 1. Henceforth, the class of all computable functions (in Mathematica) is denoted by CM, and the class of all computable functions within a compu- tation area W is denoted by C MW.^5 We may refer to functions in CW M as being W -computable. Clearly, CM = CW M M. (^4) Assuming unbounded memory available for executing the procedure. (^5) In fact, these classes are sets in the NBG theory of sets. The same applies to all classes mentioned in this book. We use class when referring to collections of functions and sets in order to avoid confusion with the (formal) sets within the computation realm at hand. This terminology is traditional in the field of computability and complexity.

1.2. COMPUTABLE FUNCTIONS 19

Exercise 17 For m, n ∈ N+, show that f : Nn^ ⇀ Nm^ is computable if and only if β m^1 ◦ f ◦ βn 1 : N ⇀ N

is computable.

Given n, i, j ∈ N+^ and a set C of type (n : W ) with i ≤ j ≤ n, we denote by C[i, j]

the set of type (j − i + 1 : W )

{(ui,... , uj ) : ∃u 1 ,... , ui− 1 , uj+1,... , un (u 1 ,... , un) ∈ C}.

Furthermore, for each i = 1,... , n, we may write

C[i]

for the set C[i, i] of type (1 : W ). It is also useful to extend this notation to the following set of type (0 : W )

C[0] =

{ε} if C 6 = ∅ ∅ otherwise.

Finally, when k < i by C[i, k] we mean C[0].

Exercise 18 Show that, given n, i, j and C 6 = ∅ as above, the following projection maps are computable:

  • projC [i,j] = λ u 1 ,... , un. (ui,... , uj ) : C → C[i, j];
  • projC [i] = projC [i,i] = λ u 1 ,... , un. ui : C → C[i];
  • projC [0] = λ u 1 ,... , un. ε : C → C[0].

Discuss the case C = ∅.

Given a set C 1 of type (m + 1 : W 1 ), a well-founded total order  in W 1 , a set C 2 of type (n : W 2 ), w ∈ W 2 n and f : C 1 ⇀ C 2 , let

min f w : C 1 [1, m] ⇀ C 1 [m + 1],

be the function defined as follows:^6 (^6) Writing, as usual, (v, x) for (v 1 ,... , vn, x) when v is an element of a set of type n.

20 CHAPTER 1. BASIC CONCEPTS AND RESULTS
  • min f w(v) = x if f (v, x) = w and, for every x′^ ≺ x, f is defined at (v, x′) with f (v, x′) 6 = w;
  • min f w(v) is otherwise undefined.

Function min f w, frequently denoted by

λ v. (μ x. f (v, x) = w)

when  is clear from the context, is said to be the minimization of f on w for .

Exercise 19 Show that if w 6 ∈ range f then min f w is the empty function. Does the converse hold?

Given  and f : C 1 ⇀ C 2 as above, function

min f = λ v, w. min f w(v) : C 1 [1, m] × C 2 ⇀ C 1 [m + 1]

is said to be the parameterized minimization of f for  and is usually denoted by λ v, w. (μ x. f (v, x) = w)

when  is clear from the context.

Exercise 20 Show that:

  • CW M Mis closed under minimization and parameterized minimization for the standard ordering in WM;
  • CN M is closed under minimization and parameterized minimization for the usual ordering in N.

What can be said in this respect about other computation areas?

Exercise 21 Let h : N → D 1 be a computable enumeration of D 1 and f : D 1 → D 2 an injective computable map. Show that f −^1 : f (D 1 ) → D 1 is also a computable map.