Appendix A Basics of Computability The Appendix follows closely [1]. Intuitively, a function is computable if there is a procedure that calculates its values, that is, when the function f is defined for a given argument w, the execution of the procedure on w will necessarily terminate in a finite number of steps returning f (w).Otherwise,if f is not defined for w then the execution of the procedure on w either does not terminate or it does but no meaningful result will be returned. So function f can be computable even when it is partial (possibly not defined everywhere). For the moment, by a procedure we mean a program composed of a finite sequence of basic commands. An algorithm is a procedure whose execution always terminates in a finite number of steps, for the relevant input data. For instance, there is an algorithm for determining whether or not a natural number is even based on the known fact that a natural number x is even if and only if the remainder of the division of x by 2 is zero. On the other hand, consider the function f = (x → x/2) over the natural numbers. This function is defined whenever x is an even number and undefined otherwise. Thus, f is a partial function and is computable since there is a procedure such that its execution over an even number x returns x/2 and its execution elsewhere does not terminate. For defining computable functions, we need to adopt a computational formal- ism for describing procedures and algorithms. We adopt the Church-Turing Thesis (see [2, 3]) stating that any computational formalism should be equivalent to Tur- ing’s computational model. However, some of them are more flexible than the others taking into account the functions we want to consider and the results we want to obtain. In the examples above, we are in the setting of natural numbers. This means that we concentrate on functions from Nn to Nm where n ∈ N and m ∈ N+.Inthis setting, Turing and Kleene models of computation are commonly used. Showing that a function is computable using Turing machines, see [4], consists of finding a Turing machine that computes the function. On the other hand, proving that a function is computable using Kleene recursive functions, see [5], means that we must prove that © Springer Nature Switzerland AG 2020 161 J. Rasga and C. Sernadas, Decidability of Logical Theories and Their Combination, Studies in Universal Logic, https://doi.org/10.1007/978-3-030-56554-1 162 Appendix A: Basics of Computability the function is recursive which consists of writing a program where the construction of the function is reflected. However, in many cases, we want to work outside the natural number setting (although everything we do could be done in this setting). For instance, we can be interested in reasoning about formulas and theorems in a logic from a decidable point of view. In this case, we have two possibilities: either we convert formulas and theorems to the setting of natural numbers via a Gödelization (see [1]) or we can define the concept of computable function in the appropriate setting by adopting a more flexible computational formalism. In both cases, we must identify the alphabet at hand and define the set of formulas as a subset of the set of all finite sequences that we can write with the alphabet. In this book, we use an abstract high-level programming language for writing procedures and algorithms following closely mathematical notations (see [1]). We omit non-essential details and simplify the presentation so that the book can be read by anyone with a very shallow contact with programming. For showing that a function is computable, no matter the setting, we must find a procedure that computes the function. A.1 Preliminaries GivenasetS and s1,...,sn ∈ S, we denote by |s1 ... sn| the length n of the sequence s1 ... sn over S. Moreover, we denote by ε the empty sequence, that is, the sequence with length 0. Finally, we denote by S∗ the set of all finite sequences over S also called the universe over S. We assume fixed a finite non-empty alphabet A containing capital and small letters, digits, punctuation marks, whitespace characters and logical, numerical and comparison symbols. We denote by W the universe A∗. Example A.1 For instance, the sequences function(x)(return 1) and functionwhile are in W. In order to improve readability, letters in A may be presented in sans-serif font. Appendix A: Basics of Computability 163 Definition A.2 A working universe is an infinite subset of W. Example A.3 For instance, N, Z, Q, {1}∗, {0, 1}∗ are working universes. Definition A.4 Let W be a working universe and n ∈ N+.AsetC ⊆ W n is called a set of type n over W,orsimplyaset over W. Definition A.5 Let W1 and W2 be working universes, C1 and C2 sets over W1 and W2, respectively, and f a function from C1 to C2.Thedomain of f is the set dom f ={w ∈ C1 : f (w)↓ and f (w) ∈ C2} where the notation f (w)↓ indicates that f is defined for w.Therange of f is range f = f (dom f ). Moreover, we say that C1 and C2 are the source and the target sets of f , respectively. Note A.6 We use the notation f : C1 C2 to indicate that f is a function from C1 to C2 (the domain may be a proper subset of C1). We say that f is a map or a total function, written as f : C1 → C2 whenever dom f = C1. Example A.7 Consider the function x f = x → : N N. 2 Then dom f is the set of all even natural numbers and range f = N Definition A.8 Let W be a working universe and C ⊆ W n. Then, the function w ∈ 1if C n χC:W = w → : W → N 0 otherwise is called the characteristic map of C over W. When W is W we write χC and say that it is the characteristic map of C. Definition A.9 An enumeration of a set C ⊆ W n is a map h : N → W n such that range h = C. 164 Appendix A: Basics of Computability A.2 Computational Model Many approaches have been proposed to define formally the notion of computable function, namely, among others: Turing machines [4, 6–8], Kleene’s μ-recursive functions [5, 9], Church’s λ-definable functions [5, 10–12], Post’s canonical sys- tems [13–17], Shepherdson-Sturgis register machines [13, 18], Aanderaa-Cohen modular machines [19] and Diophantine sets [20–22]. The equivalence of the first three definitions in the list above inspired Stephen Kleene (in [3]) to state the fol- lowing postulate, which has become known as the Church-Turing Thesis: Any function that can be accepted as computable is formally computable by some Turing machine. The discussion of the thesis in Kleene’s book [23] is highly recommended (see also [24]). For a recent survey see [25]. Since then, it has been shown that these and other formal notions of computability are all equivalent. In other words, any reasonable formalization of the notion of computability identifies only Turing com- putable functions. Notice that the Church-Turing thesis is not provable. Only on a case-by-case basis can it be shown that a particular formalization of computability identifies as computable precisely the Turing computable functions. We adopt as model of computation an abstract high-level programming language over the alphabet A.Aprogram also called a procedure is an element in W of the form function (args)(body) where args is a finite list of variables and body is a non-empty finite sequence of commands (separated by ;). We use five main commands: return statement, assignment, loop, alternative and null statement. The return statement command ,..., return exp1 expn when executed interrupts the execution of the function and returns the values of ,..., expressions exp1 expn. Example A.10 Consider the following program Padd: function (x, y)(return 2x + 3y) The execution of Padd on (k1, k2) terminates returning the value 2k1 + 3k2. Example A.11 Consider the following program P: function (w1,w2)(return w1 · “+“ · w2) where the operation · when receiving two strings returns the concatenation of the strings. The execution of P on strings s1 and s2 returns the string composed of the symbols in s1 followed by the symbol + followed by the symbols in s2. Appendix A: Basics of Computability 165 The assignment command ,..., = ,..., var1 varn exp1 expn ,..., when executed assigns simultaneously the values of the expressions exp1 expn to the variables var1,...,varn, respectively. Example A.12 Consider the following program P: function (n)( f = function (x, y)(return 2x + 3y); return n + f (n, n + 1) ) The execution of P on a natural number n returns 6n + 3. An alternative program doing the same thing as P is as follows: function (n)(return n + Padd(n, n + 1)) where Padd is defined in Example A.10. The loop command while cond do (body) when executed repeatedly executes the commands in the body while the Boolean expression cond is true. To simplify the presentation, we may omit the parentheses when the body has just one command. Example A.13 Consider the following program Pfact: function (n)( k = 1; r = 1; while k ≤ n do ( r = r × k; k = k + 1 ); return r ) The execution of P on a natural number n returns n!. An alternative solution could be achieved by defining a recursive function: Pfactr = function (n)(if n == 0 then return 1 else return n × Pfactr(n − 1)) The null statement Null when executed does nothing.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-