4. Computability on the Real Numbers Real numbers are the basic objects in analysis. For most non-mathematicians a real number is an infinite decimal fraction, for example π = 3•14159 . . . . Mathematicians prefer to define the real numbers axiomatically as follows: (R, +, ·, 0, 1, <) is, up to isomorphism, the only Archimedean ordered field satisfying the axiom of continuity [Die60]. The set of real numbers can also be constructed in various ways, for example by means of Dedekind cuts or by completion of the (metric space of) rational numbers. We will neglect all foundational problems and assume that the real numbers form a well-defined set R with all the properties which are proved in analysis. We will denote the real line topology, that is, the set of all open subsets of R, by τR . In Sect. 4.1 we introduce several representations of the real numbers, three of which (and the equivalent ones) will survive as useful. We introduce a representation ρn of Rn by generalizing the definition of the main representation ρ of the set R of real numbers. In Sect. 4.2 we discuss the computable real numbers. Sect. 4.3 is devoted to computable real functions. We show that many well known functions are computable, and we show that partial summation of sequences is computable and that limit operator on sequences of real numbers is computable, if a modulus of convergence is given. We also prove a computability theorem for power series. Convention 4.0.1. We still assume that Σ is a fixed finite alphabet containing all the symbols we will need. 4.1 Various Representations of the Real Numbers According to the principles of TTE we introduce computability on R by naming systems. Since the set R is not countable, it has no notation ν :⊆ Σ ∗ → R (onto) but only representations. Most of its numerous representations have no applications. In this section we introduce three representations ρ, ρ< and ρ> of the set of real numbers (and some equivalent ones) which induce the most important computability concepts. We will also discuss some other representations which, for various reasons, are only of little interest in computable analysis. 86 4. Computability on the Real Numbers Since the set Q of rational numbers is dense in R, every real number has arbitrarily tight lower and arbitrarily tight upper rational bounds. Every real number x can be identified by the set {(a; b) | a, b ∈ Q, a < x < b} of all open intervals with rational endpoints containing x, by the set {a ∈ Q | a < x} of all rational numbers smaller than x or by the set {a ∈ Q | a > x} of all rational numbers greater than x. According to the concept of standard admissible representations (Definitions 3.2.1, 3.2.2) a name of x will be a list of all open intervals with rational endpoints containing x, a list of all rational lower bounds of x or a list of all rational upper bounds of x, respectively. (w) by w where Convention 4.1.1. In the following we will abbreviate νQ νQis our standard notation of the rational numbers (Definition 3.1.2). First, we introduce a standard notation In of all rational n-dimensional cubes with edges parallel to the coordinate axes and rational vertices. Definition 4.1.2 (notation of rational cubes). Assume n ≥ 1. 1. For (a1 , . . . , an ) ∈ Rn define the (maximum) norm ||(a1 , . . . , an )|| := max |a1 |, . . . , |an| and for x, y ∈ Rn define the (maximum) distance by d(x, y) := ||x − y|| . 2. Let Cb(n) := {B(a, r) | a ∈ Qn, r ∈ Q, r > 0} be the set of open rational balls (or cubes), where B(a, r) := {x ∈ Rn | d(x, a) < r}. 3. Define a notation In of the set Cb(n) by In (ι(v1 ) . . . ι(vn )ι(w)) := B((v1 , . . . , vn ), w) . n 4. By I (w) we denote the closure of the cube In (w) . In particular, Cb(1) is the set of all open intervals with rational endpoints and I1 (ι(v)ι(w)) is the open interval (v − w; v + w), Cb(2) is the set of all open squares with rational vertices (edges parallel to the coordinate axes) and I2 (ι(v1 )ι(v2 )ι(w)) is the open square (v1 − w; v1 + w) × (v2 − w; v2 + w), Cb(3) is the set of all open cubes with rational vertices (edges parallel to the coordinate axes), etc. . We introduce representations ρ, ρ< and ρ> as our standard representations of computable topological spaces as follows. 4.1 Various Representations of the Real Numbers 87 Definition 4.1.3 (the representations ρ, ρ< and ρ> ). Define computable topological spaces • S= := (R, Cb(1), I1 ) , • S< := (R, σ<, ν<) , ν<(w) := (w; ∞) , • S> := (R, σ>, ν>) , ν>(w) := (−∞; w) , and let ρ := δS= , ρ< := δS< and ρ> := δS> . (The sets σ< and σ> are defined implicitly.) Notice that S= , S< and S> are computable topological spaces (Definition 3.2.1), since the properties νQ (u) = νQ (v) and I1 (u) = I1 (v) are decidable in (u, v). By Definition 3.2.2, ρ(p) = x ⇐⇒ {J ∈ Cb(1) | x ∈ J} = {I1 (w) | ι(w) p} , or roughly speaking, iff p is a list of all J ∈ Cb(1) such that x ∈ J. Similarly, ρ< (p) = x, iff p is a list of all rational numbers a such that a < x, and ρ> (p) = x, iff p is a list of all rational numbers a such that a > x. Fig. 4.1 shows some open intervals J ∈ Cb(1) with x ∈ J and some rational numbers a with a < y. x y - Fig. 4.1. Some open intervals J ∈ Cb(1) with x ∈ J and some rational numbers a with a < y The final topologies of the above representations can be characterized easily (Definition 3.1.3.2, Lemma 3.2.5.3): Lemma 4.1.4 (final topologies of ρ, ρ< and ρ> ). 1. The final topology of ρ is the real line topology τR . 2. The final topology of ρ< is τρ< := {(x; ∞) | x ∈ R}. 3. The final topology of ρ> is τρ> := {(−∞; x) | x ∈ R}. Proof: Cb(1) generates τR , σ< generates τρ< and σ> generates τρ> . Another important representation of the real numbers is the Cauchy representation. Since every real number is the limit of a Cauchy sequence of rational numbers, such sequences can be used as names of real numbers. However, the “naive Cauchy representation” which considers all converging sequences of rational numbers as names is not very useful (Example 4.1.14.1). 88 4. Computability on the Real Numbers For the Cauchy representation we consider merely the “rapidly converging” sequences of rational numbers. Definition 4.1.5 (Cauchy representation). Define the Cauchy representation ρC :⊆ Σ ω → R by ) there are words w0 , w1 . . . ∈ dom(νQ such that p = ι(w0 )ι(w1 )ι(w2 ) . . . , ρC (p) = x : ⇐⇒ |w i − w k | ≤ 2−i for i < k and x = limi→∞ w i . The representation ρ, the Cauchy representation ρC and many variants of them are equivalent: Lemma 4.1.6 (representations equivalent to ρ). The following representations of the real numbers are equivalent to the standard representation ρ :⊆ Σ ω → R: 1. the Cauchy representation ρC , 2. the representations ρ0C , ρ00C and ρ000 C obtained by substituting |wi − w k | < 2−i , |wi − x| < 2−i or |wi − x| ≤ 2−i , respectively, for |wi − w k | ≤ 2−i in the definition of ρC , 3. there are words u0 , u1 . . . ∈ dom(I1 ) such that p = ι(u0 )ι(u1 ) . . . , 1 ρa (p) = x : ⇐⇒ 1 1 −k I (u ) ⊆ I (u ) and length(I (u )) < 2 (∀k) k+1 k k and {x} = I1 (u0 ) ∩ I1 (u1 ) ∩ . . . , 4. ρb (p) = x : ⇐⇒ {x} = o \n 1 I (v) | ι(v) p . The representations ρ0C , ρ00C and ρ000 C are inessential modifications of the Cauchy representation, and ρa is a representation by strongly nested, rapidly converging sequences of open intervals. A ρb -name of x is a list of closed rational intervals for which x is the only common point. While a ρ-name of x is a list of all open rational intervals containing x, these characterizations show that it suffices to list merely “sufficiently many” of them. Proof: ρb ≤ ρa : Define representations δ1 and δ2 of R by δ1 (p) = x, iff 1 1 1 1 p = ι(u0 )ι(u1 ) . . . , I (uk+1 ) ⊆ I (uk ) and {x} = I (u0 ) ∩ I (u1 ) ∩ . . . , and δ2 (p) = x, iff 4.1 Various Representations of the Real Numbers 89 1 p = ι(u0 )ι(u1 ) . . . , I (uk+1 ) ⊆ I1 (uk ) and {x} = I1 (u0 ) ∩ I1 (u1 ) ∩ . . . . There is a computable function h :⊆ Σ ω → Σ ω such that o \n 1 1 I (v) | ι(v) p<i+ip , h(p) = ι(v0 )ι(v1 ) . . . where I (vi ) = where ip is the smallest number k such that ι(v) p<k for some v ∈ dom(I1 ). Then obviously, the function h translates ρb to δ1 . There is a computable function g : N × Σ ∗ → Σ ∗ such that I1 (w) = B(a, r) =⇒ I1 ◦ g(i, w) = B(a, (1 + 2−i ) · r) . There is a computable function f :⊆ Σ ω → Σ ω such that f(ι(w0 )ι(w1 )ι(w2 ) . . .) = ι ◦ g(0, w0 )ι ◦ g(1, w1 )ι ◦ g(2, w2 ) . . . . Then f translates δ1 to δ2 . It remains to select from any δ2 -name a rapidly converging subsequence of intervals. There is a Type-2 machine M which on input p = ι(u0 )ι(u1 ) . . . ∈ dom(δ2 ) computes a sequence q = ι(um0 )ι(um1 ) . . . where mk is the smallest number i > mk−1 such that length(I1 (ui )) < 2−k . Then fM , the function computed by the machine M , translates δ2 to ρa . Therefore, ρb ≤ ρa . ρa ≤ ρ0C and ρa ≤ ρ00C : There is a computable function f :⊆ Σ ω → Σ ω mapping any p = ι(u0 )ι(u1 )ι(u1 ) . . . ∈ dom(ρa ) to q = ι(v0 )ι(v1 )ι(v1 ) . . . such that νQ (vi ) = inf(I1 (ui )) for all i. If ρa (p) = x, then v 0 < v1 < v 2 < . . . < x and |v i − x| < 2−i for all i. Therefore, f translates ρa to ρ0C and ρ00C . ω 0 00 ρ0C ≤ ρC and ρ00C ≤ ρ000 C : The identity in Σ translates ρC into ρC and ρC 000 into ρC . −i ρC ≤ ρ000 for i < k and x = limi→∞ w i . Since C : Suppose |wi − w k | ≤ 2 |wi − x| ≤ |wi − w k | + |wk − x| ≤ 2−i + |wk − x| for all i < k, |wi − x| ≤ 2−i , and so the identity translates ρC to ρ000 C. 000 1 ≤ ρ: If ρ (ι(w )ι(w )ι(w ) . . .) = x, then for any v ∈ dom(I ): ρ000 0 1 2 C C x ∈ I1 (v) ⇐⇒ (∃ i)[w i − 2−i ; w i + 2−i ] ⊆ I1 (v) . Let νΣ be the standard numbering of Σ ∗ (Sect. 1.4). There is a Type-2 machine M mapping every p = ι(w0 )ι(w1 )ι(w2 ) . . . ∈ dom(ρ000 C ) to a sequence q = ι(v0 )ι(v1 )ι(v2 ) . . . such that νΣ (k) if νΣ (k) ∈ dom(I1 ) vhi,ki = and [wi − 2−i ; wi + 2−i ] ⊆ I1 (νΣ (k)) u otherwise where u is a word with I1 (u) = (w 0 − 2; w0 + 2). If ρ000 C (p) = x, then q is a list of all words v such that x ∈ I1 (v). Therefore, the function fM translates ρ000 C to ρ. 90 4. Computability on the Real Numbers ρ ≤ ρb : The identity on Σ ω translates ρ to ρb . Therefore, the given representations are equivalent. The representation δ informally introduced in Sect. 1.3.2 has the property ρa ≤ δ ≤ ρb (Lemma 4.1.6) and so is equivalent to ρ. By definition, a ρ-name of x is a list of all intervals (a; b) with rational endpoints such that x ∈ (a; b). Every arbitrarily tight lower and every arbitrarily tight upper rational bound of x can be obtained from a finite prefix of p. This is the characteristic common property of all representations equivalent to ρ: Lemma 4.1.7 (characterization of ρ). For every representation δ :⊆ Σ ω → R, )-r.e. and {(x, a) ∈ R × Q | a < x} is (δ, νQ δ ≤ ρ ⇐⇒ {(x, a) ∈ R × Q | x < a} is (δ, νQ )-r.e. . This is essentially a special case of Theorem 3.2.10. For a proof see Exercise 4.1.3. Therefore, ρ is up to equivalence the “poorest” representation δ of the real numbers such that the properties “a < x” and “x < a” are r.e. Also the representations ρ< and ρ> can be simplified. Lemma 4.1.8 (representations equivalent to ρ< ). The following representations of the real numbers are equivalent to the representation ρ< :⊆ Σ ω → R: ) there are u0 , u1 . . . ∈ dom(νQ ρa< (p) = x : ⇐⇒ such that p = ι(u0 )ι(u1 ) . . . , 1. u0 < u1 < . . . < x and x = limi→∞ ui , 2. ρb< (p) = x : ⇐⇒ x = sup{v | ι(v) p} . The proof is left as Exercise 4.1.5. However, if we force rapid convergence, we obtain a representation equivalent to ρ (Exercise 4.1.6). Lemma 4.1.7 holds correspondingly for ρ< replacing ρ. Therefore, ρ< is the “poorest” representation δ of the real numbers such that the property “a < x” is r.e. The above considerations hold correspondingly for ρ> replacing ρ< . The following lemma is obvious already from our informal characterizations of ρ, ρ< and ρ> . Lemma 4.1.9. 1. ρ ≡ ρ< ∧ ρ> (that is, ρ is the greatest lower bound of ρ< and ρ> ), in particular, ρ ≤ ρ< and ρ ≤ ρ> . 2. ρ< 6≤t ρ , ρ> 6≤t ρ , ρ< 6≤t ρ> and ρ> 6≤t ρ< . 4.1 Various Representations of the Real Numbers 91 Proof: 1. By Definition 3.3.7, (ρ< ∧ ρ> )hp, qi = x ⇐⇒ ρ< (p) = ρ> (q) = x. There is a Type-2 machine M which on input p ∈ dom(ρ) produces a list of all ι(w) for which there is some word v such that ι(v) p and w is the left endpoint of the interval I1 (v). Then the function fM translates ρ to ρ< . For a similar reason, ρ ≤ ρ> . By Lemma 3.3.8, ρ ≤ ρ< ∧ ρ> . For the other direction it suffices to prove ρa< ∧ ρa> ≤ ρb . There is a Type-2 machine M which on input hp, qi ∈ dom(ρa< ∧ ρa> ), where p = ι(u0 )ι(u1 ) . . . and q = ι(v0 )ι(v1 ) . . . , produces a sequence ι(w0 )ι(w1 ) . . . , such that I1 (wi ) = (ui ; vi ). The function fM translates ρa< ∧ ρa> to ρb . 2. This follows from the simple observation that a lower bound cannot be obtained from a finite set of upper bounds and vice versa. More formally we can use the fact γ 0 ≤t γ =⇒ τγ ⊆ τγ 0 from Theorem 3.1.8: ρ< 6≤t ρ since τρ 6⊆ τρ< etc. . To sum up, one can roughly say that for a real number x, a ρ< -name consists of all rational lower bounds of x, a ρ> -name consists of all rational upper bounds of x, and a ρ-name consists of all rational lower bounds and all rational upper bounds of x. Since by Corollary 3.2.12 for admissible representations only continuous functions can be computable, Lemma 4.1.4 tells us which of the three computability concepts is adequate in a given topological setting. Computability of elements and functions induced by the representations ρ, ρ< and ρ> will be discussed in the following sections. As an instructive example we discuss the problem of finding a rational upper bound for a real number. Example 4.1.10. Consider the multi-valued function F : R Q, RF := {(x, a) ∈ R × Q | x < a} . We 1. 2. 3. prove the following effectiveness properties (Definition 3.1.3): F is not (ρ< , νQ )-continuous. )-computable (and therefore, (ρ, νQ )-computable). F is (ρ> , νQ F has no (ρ, νQ )-continuous choice function (and therefore, no (ρ> , νQ )continuous choice function). Remember, that νQis admissible with discrete final topology τνQ (Example 3.2.4.1) . )-continuous. Then F has a continuous (ρb< , νQ )1. Suppose F is (ρ< , νQ ω ∗ realization g :⊆ Σ → Σ (Lemma 4.1.8). Consider ρb< (p) = x. By assump(w) = w for some w ∈ Σ ∗ . Since g is continuous, tion, g(p) = w with x < νQ there is some number n with g[p<n Σ ω ] = {w}. For some k ≥ n, 11 is the suf) with w < u and define q := p<k ι(u)ι(u) . . . . fix of p<k . Choose u ∈ dom(νQ Then ρb< (q) = u and νQ◦ g(q) = w, since q ∈ p<n Σ ω ∩ dom(g). However, by assumption on g we must have u = ρb< (q) < νQ◦ g(q) = w. Contradiction! 2. Let M be a Type-2 machine which for any input p = ι(w0 )ι(w1 ) . . . prints the word w0 and halts. Then ρ> (p) < w 0 = νQ◦ fM (p) for all 92 4. Computability on the Real Numbers p = ι(w0 )ι(w1 ) . . . ∈ dom(ρ> ). Therefore, fM is a (ρ> , νQ )-realization of the relation R. 3. Since the final topology τRof the admissible representation ρ is connected, every (ρ, νQ )-continuous function is constant by Corollary 3.2.13. But a choice function of F cannot be constant. The definitions of ρ, ρC , ρ< and ρ> (and their variants) can be modified in various other ways without affecting the induced continuity or computability, respectively. So far we have used the set Q of the rational numbers as a “standard” dense countable subset of the real numbers and νQas its standard notation. Can we replace νQby some other notation νQ of a dense subset Q of R such that the resulting representations induce the same continuity or computability concepts on R? The following “robustness” theorem gives an answer. Theorem 4.1.11 (robustness). For any representation δ of the real numbers introduced in Definitions 4.1.3, 4.1.5, 4.1.6 and 4.1.8 consider δ as a , that is, δ = D(νQ ). Then for every notation νQ of a dense function of νQ subset Q ⊆ R, 1. δ ≡t D(νQ ) , 2. δ ≡ D(νQ ) , if νQand νQ are r.e.-related (that is, if {(v, w, i) | |νQ (v) − νQ (w)| < 2−i } is r.e.). The proof is left as Exercise 4.1.8. Examples for notations r.e.-related to νQare any notation of Q equivalent to νQand any standard notation of the binary rational numbers Q2 := {z/2n | z ∈ Z, n ∈ N}. Computability concepts introduced via robust definitions are not sensitive to “inessential” modifications. It can be expected that they occur in many applications. On the other hand, computability concepts introduced via nonrobust definitions are not very relevant. The Turing machine is another famous example of a robust definition. Numerous variants of the original definition are used in the literature, all of which define the same notion of computable functions. Usually the representation by infinite decimal fractions is considered to be the most natural representation of the real numbers. Definition 4.1.12 (finite and infinite base-n fractions). For n ≥ 2 define the notation νb,n of the finite base-n fractions and the representation ρb,n :⊆ Σ ω → R of the real numbers by infinite -n fractions as follows: dom(νb,n ) := {λ, -}(Γ ∗ \ 0Γ ∗)•Γ ∗, dom(ρb,n ) := {λ, -}(Γ ∗ \ 0Γ ∗)•Γ ω , X νb,n (sak . . . a0 •a−1 a−2 . . . a−m ) := s · ai · n i , k≥i≥−m ρb,n (sak . . . a0 •a−1 a−2 . . .) := s · X i≤k ai · n i , 4.1 Various Representations of the Real Numbers 93 where ai ∈ Γn := {0, 1, . . . , n − 1} for all i ≤ k, s := 1, if s = λ, and s := −1, if s = -. (We assume tacitly Γn ⊆ Σ.) (Remember that λ is the empty word.) The following theorem summarizes some interesting properties of the representations by infinite base-n fractions. Theorem 4.1.13 (infinite base-n fractions). For any m, n ≥ 2 (assuming Γm , Γn ⊆ Σ) 1. ρb,n |Ir ≡ ρ|Ir (where Ir := R \ Q is the set of irrational real numbers), 2. x is ρb,n -computable, iff x is ρ-computable. 3. ρb,n ≤ ρ and ρ 6≤t ρb,n , 4. ρb,m ≤ ρb,n , if pd(n) ⊆ pd(m), ρb,m 6≤t ρb,n otherwise (where pd(n) denotes the set of prime divisors of n), . 5. ρb,n has the final topology τR 6. ρb,n is not admissible, 7. f :⊆ R → R is (ρb,n , ρ)-computable (-continuous), iff it is (ρ, ρ)-computable (-continuous). Proof: 1. and 2. See Exercise 4.1.10 3. There is a Type-2 machine M which maps any sequence p = sak . . . a0 •a−1 a−2 . . . ∈ dom(ρb,n ) to a sequence ι(u0 )ι(u1 ) . . . with uj = νb,n (sak . . . a0 •a−1 a−2 . . . a−j ). Then M translates ρb,n to ρC . The relation ρ 6≤t ρb,n will be concluded from Property 4. 4. Suppose, pd(n) ⊆ pd(m). Then for each k ∈ N numbers lk , bk ∈ N can be determined such that mlk = bk · nk . For computing a ρb,n -name of x = ρb,m (p), it suffices to compute integers c0 , c1 , . . . such that ck ≤ nk · x ≤ ck +1 for all k. There is a Type-2 machine M , which on input (p, u) (x := ρb,m (p), k := νN(u)) determines (names of) numbers lk , bk ∈ N such that mlk = bk · nk and then (a name of) a number ck such that ck · bk ≤ mlk · x ≤ (ck + 1) · bk . (For this purpose, M must read only the first lk digits of p after the dot.) Since mlk = bk · nk , we obtain immediately ck ≤ nk · x ≤ ck + 1, as required. Therefore, ρb,m can be translated to ρb,n by a Type-2 machine. Now consider that the prime number r ∈ N divides n but not m. There is some c ∈ N, 1 ≤ c < n, with n = c · r. The number 1/r has a ρb,m -name p := •a−1 a−2 . . . which has neither the period 0 nor the period (m − 1). Suppose some continuous function f :⊆ Σ ω → Σ ω translates ρb,m to ρb,n . Then f(p) = •c00 . . . or f(p) = •0(c − 1)(n − 1)(n − 1) . . . . Consider the first case f(p) = •c00 . . . . By continuity of f there is some l such that f[•a−1 a−2 . . . a−l Σ ω ] ⊆ •cΣ ω . Choose p0 := •a−1 a−2 . . . a−l 00 . . . . Then f(p0 ) ∈ •cΣ ω . We have ρb,m (p0 ) < 1/r (since p does not have the period 0) and ρb,n (f(p0 )) ∈ ρb,n [•cΣ ω ], hence ρb,n (f(p0 )) ≥ 1/r (contradiction). Therefore, ρb,m 6≤t ρb,n . The second case can be treated similarly. 94 4. Computability on the Real Numbers 3. (continued) Suppose ρ ≤t ρb,n . Choose some prime number m which does not divide n. Then ρb,m ≤t ρ ≤t ρb,n by Property 1, but ρb,m 6≤t ρb,n as proved above (contradiction). This shows ρ 6≤t ρb,n . 5. If X ⊆ R is open, then it is ρ-open by Lemma 4.1.4. Since ρb,n ≤ ρ by Property 3, X is ρb,n -open by Theorem 3.1.8. Let X ⊆ R be ρb,n -open. Then ω ∗ ρ−1 b,n [X] = AΣ ∩ dom(ρb,n ) for some A ⊆ Σ . Consider x ∈ X, x > 0. j Case 1: x = a/n for some integer a and some natural number j. Then x has two ρb,n -names p := “ak . . . a0 •a−1 . . . ” and q := “bk . . . b0 •b−1 . . . ”, such that there is some some m ≤ k with am > 0, ai = 0 for i < m, bm = am − 1 and bi = n − 1 for i < m. Since ρ−1 b,n [X] is open in dom(ρb,n ), there is a number l > m such that ρb,n [“ak . . . a0 •a−1 . . . a−l ”Σ ω ] ⊆ X and ρb,n [“bk . . . b0 •b−1 . . . b−l ”Σ ω ] ⊆ X. We obtain [x; x + n−l ) ⊆ X and (x − n−l ; x] ⊆ X, i,e, x has the open neighborhood (x − n−l ; x + n−l ) ⊆ X. Case 2: Not Case 1. Then x has a ρb,n -name p := “ak . . . a0 •a−1 . . . ” which has neither the period 0 nor the period (n−1). Since ρ−1 b,n [X] is open in dom(ρb,n ), there is a number l such that ρb,n [“ak . . . a0 •a−1 . . . a−l ”Σ ω ] ⊆ X. Then x ∈ (y; z) ⊆ X, where y := ρb,n (“ak . . . a0 •a−1 . . . a−l 00 . . . ”) and z := ρb,n (“ak . . . a0 •a−1 . . . a−l (n−1)(n−1) . . . ”), hence x has an open neighborhood in X. For the case x < 0 the proof is similar. If x = 0 consider the two names “•00 . . . ” and “-•00 . . . ”. 6. By Lemma 4.1.4, the representation ρ is admissible with final topology . By Theorem 3.2.8.1 any two admissible representations with final topology τR τRare continuously equivalent. Since the representation ρb,n has the final topology τRbut is not continuously equivalent to ρ, it cannot be admissible. 7. See Exercise 4.1.12. Restricted to the irrational numbers, ρb,n and ρ are equivalent. Therefore, a real number x is ρb,n -computable, iff it is ρ-computable (notice that the rational numbers are ρb,n -computable and ρ-computable). Since ρb,n is not admissible, a ρb,n -name cannot be interpreted as a (sufficiently rich) list of atomic properties from a subbase of its final topology . Although ρb,n -names are richer than ρ-names by Property 3, this adτR ditional information is useless for computing real functions by Property 7. From Property 7 we conclude also that every (ρb,n , ρb,m )-computable function is (ρ, ρ)-computable. However, already the simple (ρ, ρ)-computable real function x 7→ 3 · x is not (ρb,10 , ρb,10 )-continuous (Example 2.1.4.7). We discuss some further representations of the real numbers which, however, have only very few applications. Example 4.1.14 (further representations of R). 1. Naive Cauchy representation: Define the naive Cauchy representation ρCn of the real numbers by ρCn (p) = x : ⇐⇒ p = ι(w0 )ι(w1 ) . . . and lim wi = x . i→∞ 4.1 Various Representations of the Real Numbers 95 Since ρC , ρ< and ρ> are restrictions of ρCn , we have ρC , ρ<, ρ> ≤ ρCn . ρCn has the final topology {∅, R} (no property of x = ρCn (p) can be concluded from a finite prefix w of p). From this fact and Theorem 3.1.8 we conclude ρCn 6≤t ρC , ρCn 6≤t ρ< and ρCn 6≤t ρ> . 2. Cut representations: Define computable topological spaces • S≤ = (R, σ≤, ν≤) by ν≤(w) := [νQ (w); ∞) and • S≥ = (R, σ≥, ν≥) by ν≥(w) := (−∞; νQ (w)] (cf. Definition 4.1.3). Define the left cut representation and the right cut representation by ρ≤ := δS≤ and ρ≥ := δS≥ , respectively. If ρ≤ (p) = x (ρ≥ (p) = x), then p is a list of all a ∈ Q with a ≤ x (a ≥ x). The final topology of ρ≤ is τρ< ∪ σ≤ , that is, also intervals (“atomic properties”) [a; ∞) with a ∈ Q are called “open”. We have ρ≤ ≤ ρ< , but neither ρ< , ρ> , ρC nor ρ≥ are t-reducible to ρ≤ . As an example assume ρC ≤t ρ≤ . Then τρ≤ ⊆ τρ by Theorem 3.1.8. But [0; ∞) ∈ τρ≤ \ τρ . Restricted to the irrational numbers ρ< and ρ≤ are equivalent: ρ< |Ir ≡ ρ≤ |Ir. (The properties hold accordingly for ρ≥ .) The definitions of ρ≤ and ρ≥ are not topologically robust, that is, replacement of Q in the definitions by another dense subset Q yields representations which are not continuously equivalent to ρ≤ and ρ≥ , respectively. 3. Continued fraction representation: For any real number x ≥ 0 define its continued fraction fr(x) := [a0 , a1 , . . .] (ai ∈ N) inductively by: x0 := x , 1 an := bxn c , xn+1 := xn −an 0 if an 6= xn otherwise. Then, informally x = a0 + 1 a1 + 1 a2 +... , where the fraction is finite (an = 0 for all n ≥ n0 ), iff the number x is rational. Define the continued fraction representation ρcf of the real numbers by ρcf (p) = x, iff (x ≥ 0 and p = 1a0 01a1 0 . . . where fr(x) := [a0 , a1 , . . .]) or (x < 0 and p = -1a0 01a1 0 . . . where fr(−x) := [a0 , a1 , . . .]). One can show ρcf ≡ ρ≤ ∧ ρ≥ , in particular, ρcf ≤ ρ≤ and ρcf ≤ ρ≥ . Furthermore, ρcf ≤ ρb,n for all n ≥ 2. Neither ρ≤ , ρ≥ nor ρb,n for n ≥ 2 are t-reducible to ρcf . Restricted to the irrational numbers, ρ and ρcf are equivalent: ρ|Ir ≡ ρcf |Ir . The definitions of the cut representations ρ≤ and ρ≥ are not even topologically robust. Neither the representations by infinite base-n fractions and the naive Cauchy representation nor the cut representations ρ≤ and ρ≥ and their greatest lower bound ρcf are of much interest in computable analysis. Fig. 4.2 shows the reducibility order of the representations of the real numbers we 96 4. Computability on the Real Numbers have introduced so far. Many other representations of the real numbers are introduced and compared in [Hau73, Dei84]. ρCn , @@ , , @ρ ρ< > @@ ,, @ρ, ρ≤ @ , @ , ρb,n ρ≥ @ρ , cf Fig. 4.2. Reducibility order of some representations of R Our main representation ρ :⊆ Σ ω → R of the real numbers is not a total function and it is not injective. The same holds for all representations equivalent to it which we have discussed. It would be convenient to have an injective representation δ of the real numbers which is equivalent to ρ. Unfortunately this is not possible. Theorem 4.1.15. 1. There is no total representation δ : Σ ω → R with δ ≡ ρ. 2. There is no injective representation δ :⊆ Σ ω → R with δ ≡ ρ. The two statements hold accordingly for ρ< and ρ> instead of ρ. Proof: 1. Let δ : Σ ω → R be a total function with δ ≡ ρ. δ is continuous, since ρ is continuous. By Lemma 2.2.5 the metric space (Σ ω , d) with Cantor topology τC is compact. A continuous function maps compact sets to compact sets, therefore, range(δ) = δ[Σ ω ] is compact. Since R is not compact (for example the open cover {(z; z + 2) | z ∈ Z} has no finite subcover), R 6= range(δ). 2. Let δ :⊆ Σ ω → R be an injective function with δ ≡ ρ. By Lemma 3.2.5, τRis the final topology of δ, that is, X is open, iff δ −1 [X] is open in dom(δ). Since δ is injective, there is some w ∈ Σ ∗ such that 0 ∈ δ[wΣ ω ] and 1 6∈ δ[wΣ ω ]. Since wΣ ω and Σ ω \ wΣ ω are open, A := δ[wΣ ω ] and 4.1 Various Representations of the Real Numbers 97 B := δ[Σ ω \ wΣ ω ] are open subsets of R such that 0 ∈ A, 1 ∈ B, A ∪ B = R and A ∩ B = ∅. This is impossible. The proofs for ρ< and ρ> are left for Exercise 4.1.17. In the “real-RAM” model of computation which is used, for example, in computational geometry [PS85] and studied in detail by Blum et al. [BCSS98] one uses the test x < y for real numbers x, y as a basic operation. We show that no representation makes this test decidable. The test x < y is “absolutely non-decidable”, at least in the framework of TTE. Theorem 4.1.16 (x ≤ y is absolutely undecidable). For every representation δ :⊆ Σ ω → R the relations “x = y” and “x ≤ y” are not (δ, δ)-open and the relation “x < y” is not (δ, δ)-clopen. Proof: Assume that the relation “x = y” is (δ, δ)-open. By Definitions 2.4.1 and 3.1.3.2 there is a continuous function f :⊆ Σ ω × Σ ω → Σ ∗ such that f(p, q) = 0, if δ(p) = δ(q), and f(p, q) = div otherwise for all p, q ∈ dom(δ). Consider z and p with δ(p) = z. We obtain f(p, p) = 0. Since f is continuous, f[wΣ ω × wΣ ω ] = {0} for some prefix w ∈ Σ ∗ of p. We obtain x = y for any x, y ∈ δ[wΣ ω ], hence {z} = δ[wΣ ω ]. Therefore, for every z ∈ R there is some w ∈ Σ ∗ with {z} = δ[wΣ ω ]. But this is impossible, since Σ ∗ is countable and R is uncountable. If “x ≤ y” is (δ, δ)-open, then also “x ≥ y” is (δ, δ)-open, hence “x = y” is (δ, δ)-open by Theorem 2.4.5. If “x < y” is (δ, δ)-clopen, then “x ≥ y” is (δ, δ)-open. Among the representations of the real numbers discussed in this section, ρ, ρ< and ρ> (and equivalent ones) are the most natural ones. For representations of Rn (n ≥ 2) we generalize Definition 4.1.3 straightforwardly. Definition 4.1.17 (standard representation ρn of Rn). For n ≥ 1 let ρn be the standard representation of Rn derived from the computable topological space Sn := (Rn, Cb(n) , In ) (Definition 4.1.2). A sequence p ∈ Σ ω is a ρn -name of x ∈ Rn, iff it is a list of all ndimensional open rational cubes J ∈ Cb(n) such that x ∈ J. Fig. 4.3 shows some rational squares J ∈ Cb(2) and a point x ∈ R2 such that x ∈ J. The definitions of the other representations equivalent to ρ given above can be generalized straightforwardly to n dimensions by substituting the ndimensional norm || . || for the absolute value | . | and the notation In for I1 . Lemma 4.1.18 (representations equivalent to ρn ). For n ≥ 2 genera b alize the definitions of ρ, ρC , ρ0C , ρ00C , ρ000 C , ρ and ρ from Definitions 4.1.3, 4.1.5 and Lemma 4.1.6, respectively, from R to Rn by substituting the Bdimensional norm || . || for the absolute value | . | and the notation In for I1 . Then all the resulting representations are equivalent to ρn . 98 4. Computability on the Real Numbers x r Fig. 4.3. Some open rational squares J ∈ Cb(2) such that x ∈ J Proof: The proof of Lemma 4.1.6 can be generalized straightforwardly. Instead of maximum norm, distance and balls, sometimes we will use Euclidean norm (absolute value), distance and balls: p + . . . + a2n , • |(a1 , . . . , an )| = a21 p e • d (x, y) := |x − y| = (x1 − y1 )2 + . . . + (xn − yn )2 , • B e (a, r) := {x ∈ Rn | |x − a| < r}. The two metrics are related by d(x, y) ≤ de(x, y) ≤ √ n d(x, y) and generate the same topology on the set Rn. If we replace the maximum metric by the Euclidean metric in the above definitions, we obtain representations of Rn which are equivalent to ρn . We leave the proofs to the reader. According to Definition 3.3.3, the product [ρ]n = [ρ, . . . , ρ] is defined by [ρ]n hp1 , . . . , pn i = (ρ(p1 ), . . . , ρ(pn )) . The following lemma summarizes some useful properties. Lemma 4.1.19. n. 1. [ρ]n ≡ ρn , ρn is admissible with final topology τR 2. A tuple (x1 , . . . , xn ) is (ρ, . . . , ρ)-computable, iff it is ρn -computable. 3. A set X ⊆ Rn is (ρ, . . . , ρ)-decidable (-r.e. , -clopen, -open), iff it is ρn -decidable (-r.e. , -clopen, -open). 4. A function or multi-valued function f :⊆ Rn M is (ρ, . . . , ρ, δ)computable (-continuous), iff it is (ρn , δ)-computable (-continuous). 5. A function f :⊆ M → Rk is (δ, ρk )-computable (-continuous), iff pri ◦ f is (δ, ρ)-computable (-continuous) for i = 1, . . . , k. 4.1 Various Representations of the Real Numbers 99 Proof: 1. Every ρn -name of (x1 , . . . , xn) essentially consists of arbitrarily tight upper and arbitrarily tight lower bounds for every component xi . The same is true for every [ρ]n -name of (x1 , . . . , xn). Translations from ρn to [ρ]n and from [ρ]n to ρn can be constructed straightforwardly. 2.-5. These properties follow from Property 1 and Lemma 3.3.6. Convention 4.1.20. From now on we will consider as standard the nota, νQand idΣ ∗ of the natural numbers, the integers, rational numtions νN, νZ bers and the set Σ ∗ , respectively, and the representations idΣ ω : Σ ω → Σ ω , ρ and ρn of Σ ω , R and Rn, respectively. Occasionally, we will omit prefixes -, νZ -, νQ -, idΣ ∗ -, idΣ ω - ρ- and ρn - and say computable instead of ρ-compuνN table, recursively enumerable (r.e.) instead of (νN , ρ)-r.e. , computable instead of (ρ, νQ , ρ)-computable etc. . Often we will use representations which we have proved to be equivalent to ρ or ρn . The representations ρ, ρ< and ρ> can be extended to representations of R, the closure of R under supremum and infimum. We now modify Definition 4.1.3. Definition 4.1.21 (representations of R). For R := R ∪ {−∞, ∞} define computable topological spaces • S< := (R, σ<, ν<) , • S> := (R, σ>, ν>) , ν<(w) := (w; ∞] , ν>(w) := [−∞; w) , and let ρ< := δS< , ρ> := δS> and ρ := ρ< ∧ ρ> . Exercises 4.1. 1. 2. 3. 4. Show that the set of real numbers is not countable. ≡ νZ , νQ≤ ρ and ρ|Q6≤t νQ(Sect. 1.4). Show ρ|N≡ νN, ρ|Z Prove Lemma 4.1.7. Show that a representation δ of the real numbers is reducible to ρ< , iff the set {(x, a) ∈ R × Q | a < x} is (δ, νQ )-r.e. (cf. Lemma 4.1.7). 5. Prove Lemma 4.1.8. (See the proof of Lemma 4.1.6.) 6. Define a representation ρC< : Σ ω → R by: ρC< (p) = x, iff ρC (p) = x and w 0 < w 1 < . . . < x (wi from Definition 4.1.5). Show ρC< ≡ ρ. 7. Show that ρ ≡ ρG where ) there are words w0 , w1 . . . ∈ dom(νZ )ι(w )ι(w ) . . . such that p = ι(w 0 1 2 ρG (p) = x : ⇐⇒ (wi ) 1 and x − νZ i+1 < i+1 for all i . 8. Prove that the definitions of ρ, ρ< and ρ> are topologically and computationally robust (Theorem 4.1.11). 100 4. Computability on the Real Numbers 9. a) Show that multiplication by 3 is not continuous with respect to ρb,2 . b) Show that neither addition nor multiplication are continuous with respect to ρb,n for n ≥ 2. 10. Prove Theorem 4.1.13.1 and 4.1.13.2. 11. The representations by infinite base-n fractions can be studied as members of a larger class of representations [Wei92a]: Let ν : N → Q be a numbering of a dense subset Q ⊆ R. Define a representation ϑν of the real numbers by ν(i) < x =⇒ p(i) = 0 ϑν (p) = x : ⇐⇒ (∀i) ν(i) > x =⇒ p(i) = 1 . Show: a) If µ is a standard numbering of the finite base-n fractions, for example µhi, j, ki := (i − j)/nk , then ρb,n ≡ ϑµ . b) For any two numberings µ : N → P and ν : N → Q of dense subsets of R we have: • ϑν ≤t ρ , ρ 6≤t ϑν , • ϑν ≤ ρ , if ν and νQare r.e.-related, • Q ⊆ P ⇐⇒ ϑµ ≤t ϑν , • ν ≤ µ =⇒ ϑµ ≤ ϑν . c) Define ν0 : N → Q by ν0 hi, j, ki := (i − j)/(1 + k). Then ϑν0 ≡ ρb,2 ∧ ρb,3 ∧ . . . , that is, ϑν0 is the greatest lower bound of all ρb,n (Definition 3.3.7). d) Let ν and νQbe r.e.-related. Then f :⊆ R → R is (ϑν , ρ)-computable, iff it is (ρ, ρ)-computable. e) f :⊆ R → R is (ρb,n , ρ)-computable, iff it is (ρ, ρ)-computable. 12. Prove Theorem 4.1.13.7 without using Exercise 4.1.11 [Her99b]. 13. Let ρCn be the naive Cauchy representation. Prove: a) ρCn 6≤t ρ< , b) ρCn has the final topology {∅, R}, c) there is a (ρCn , ρCn )-computable function, which is not (ρ, ρ)-computable (hint: consider a constant function with value xA (Example 1.3.2) where A is an r.e. non-recursive set), d) A real function is continuous, iff it is (ρCn , ρCn)-continuous [BH00]. 14. Prove the properties of the cut representations ρ≤ and ρ≥ stated in Example 4.1.14.2. 15. For an arbitrary notation µ :⊆ Σ ∗ → Q of a dense subset Q ⊆ R define the effective topological space Sµ = (R, σµ, νµ ) by νµ (w) := [µ(w); ∞) and δµ := δSµ (cf. Example 4.1.14.2). For notations µ :⊆ Σ ∗ → Q and µ0 :⊆ Σ ∗ → Q0 show: δµ ≤t δµ0 , iff Q0 ⊆ Q. 16. Prove the properties of the continued fraction representation stated in Example 4.1.14.3. 17. Show that there is neither a total nor an injective representation of the real numbers which is equivalent to ρ< . 4.2 Computable Real Numbers 101 18. Complete the proof of Lemma 4.1.18. Let δ and δ 0 be representations of an uncountable set M . Show that the set {(x, y) | x, y ∈ M, x = y} is not (δ, δ 0 )-open. 20. Show that the definition of ρn is computationally robust, that is, replacement of νQin Definition 4.1.17 by a notation νQ of a dense subset of R which is r.e.-related to it (Theorem 4.1.11) yields an equivalent representation. 21. Show that ρ< and ρ> are the restrictions of ρ< and ρ> , respectively, to R and that ρ is equivalent to the restriction of ρ to R. (See Definition 4.1.21.) 22. Show that the function f : R → R, f(x) := 1/x2, is (ρ, ρ< )-computable. 19. 4.2 Computable Real Numbers We will denote the set of computable (that is, ρ-computable) real numbers by Rc. Informally, a real number x is computable, iff arbitrarily tight lower and arbitrarily tight upper rational bounds of x can be computed. This is formalized by each of the following characterizations. Lemma 4.2.1. For any x ∈ R the following properties are equivalent: 1. x is ρ-computable. 2. [Tur36] x is ρb,n -computable, that is, the number x has a computable infinite base-n fraction (n ∈ N, n ≥ 2). 3. There is a computable function g : N → Σ ∗ such that |x − νQ g(n)| ≤ 2−n for all n ∈ N . 4. [Grz55] There is a computable function f : N → N such that |x| − f(n) < 1 for all n ∈ N . n + 1 n + 1 5. [PER89] There are computable functions s, a, b, e : N → N with x − (−1)s(k) a(k) ≤ 2−N , if k ≥ e(N ), for all k, N ∈ N . b(k) Proof: 1 ⇐⇒ 2: This follows from Theorem 4.1.13. 1 =⇒ 3: Let ι(u0 )ι(u1 ) . . . be a computable ρC -name of x. Then |x − νQ (un )| ≤ 2−n for all n. Define g(n) := un . 102 4. Computability on the Real Numbers 3 =⇒ 5: There are computable functions s, a, b with g(k) = (−1)s(k) a(k) . Define e(N ) := N . νQ b(k) 5 =⇒ 4: From Property 5 we obtain | |x| − aN /bN | ≤ 2−(N+2) < 1/(2(N + 1)), where aN := a ◦ e(N + 2) and bN := b ◦ e(N + 2). There is a computable function f : N → N with |aN (N + 1)/bN − f(N )| ≤ 1/2. We obtain 1 1 |x| − f(N ) ≤ |x| − aN + aN − f(N ) < 2 ≤ . N +1 bN bN N +1 2(N + 1) N +1 4 =⇒ 1: Assume x ≥ 0. There is a computable function g : N → Σ ∗ such g(n) = f(2n+1 )/(2n+1 + 1). We obtain that νQ 1 f(2n+1 ) < n+1 < 2−n−1 . |x − νQ g(n)| = |x| − n+1 2 +1 2 +1 Define p ∈ Σ ω by p := ι(g(0))ι(g(1)) . . . . Then p is computable, |νQ g(n) − νQ g(m)| ≤ |νQ g(n) − x| + |x − νQ g(m)| ≤ 2−n for m > n and limn→∞ νQ g(n) = x, hence ρC (p) = x. If x < 0, define g such that g(n) = −f(2n )/(2n + 1) . νQ Every rational number a is computable (if νQ (u) = a, define g(n) √ := u for all n in Lemma 4.2.1.3). In Example 1.3.1 we have shown that 2 and log3 5 are computable real numbers. Many other examples will follow from theorems below (Example 4.3.13.8). By Lemma 4.1.19, a vector (x1 , . . . , xn) of real numbers is ρn -computable, iff all its components xi are computable. Definition 4.2.2 (modulus of convergence). A function e : N → N is called a modulus of convergence of a sequence (xi )i∈N, iff |xi − xk | ≤ 2−n for i, k ≥ e(n). If e is a modulus of convergence then e0 with e0 (n) := maxk≤n e(k) is a modulus of convergence, which is computable, if e is computable. Therefore we may assume in most cases that the modulus of convergence is nondecreasing. If e is a modulus of convergence then |x − xi | ≤ 2−n for i ≥ e(n), where x = limi→∞ xi . If e0 is a function with |x−xi | ≤ 2−n for i ≥ e0 (n), then e with e(n) := e0 (n + 1) is a modulus of convergence, which is computable, if e0 is computable. Therefore, it follows from Lemma 4.2.1.5 that the limit of any computa)-computable) sequence of rational numbers with ble (more precisely (νN, νQ computable modulus of convergence is a computable real number. This observation can be generalized as follows: Theorem 4.2.3. Let (xi )i∈N be a (νN, ρ)-computable sequence of real numbers with computable modulus of convergence e : N → N. Then its limit x = limi→∞ xi is computable. 4.2 Computable Real Numbers 103 Proof: Since the sequence is (νN, ρC )-computable, for any i, j ∈ N, a word uij can be computed such that xi = ρC (ι(ui0 )ι(ui1 ) . . .). Define vi := ue(i+2),i+2 and q := (ι(v0 )ι(v1 ) . . .). For all k < m we obtain |vk − x| ≤ |ue(k+2),k+2 − xe(k+2)| + |xe(k+2) − x| ≤ 2−k−2 + 2−k−2 ≤ 2−k−1 and |vk − v m | ≤ |vk − x| + |v m − x| ≤ 2−k−1 + 2−m−1 ≤ 2−k . Therefore, x = ρC (q) and x is ρC -computable, since q ∈ Σ ω is computable. Example 4.2.4. P i 1. Define xi := k=0 1/k!. Then e = limi→∞ xi . Obviously the sequence (xi )i∈Nis (νN, νQ )-computable, hence (νN, ρ)-computable. Define e(n) := n+1. Then |xi −xj | ≤ 2−n for i, j ≥ e(n). By Theorem 4.2.3, the number e is computable. 2. A famous result by Leibnitz states π/4 = 1 − 1/3 + 1/5 − 1/7 . . . . Define Pi xi := k=0 (−1)k ak where ak = 1/(2k + 1). Then the sequence (xi )i∈N is computable. For i ≤ j and even j − i, 0≤ = = ≤ (ai − ai+1 ) + (ai+2 − ai+3 ) + . . . + (aj−2 − aj−1 ) + aj P (−1)i jk=i (−1)k ak ai − (ai+1 − ai+2 ) − . . . − (aj−1 − aj ) ai Pj and similarly for odd j−i, 0 ≤ (−1)i k=i (−1)k ak ≤ ai −aj ≤ ai . In both Pj cases, | k=i (−1)k ak | ≤ ai . Define e(n) := 2n . Then for e(n) ≤ i < j, Pj |xj − xi | = | k=i+1 (−1)k ak | ≤ ai+1 = 1/(2i + 3) < 1/i ≤ 2−n . By Theorem 4.2.3, the number π/4 is computable, hence π is computable. 3. By Example 1.3.2 for any set A ⊆ N of numbers, the sum X 2−i xA := i∈A is a computable real number, iff A is a recursive set. Let A be recursively enumerable but not recursive. Then there is a computable injective function f : N → N with A = range(f). We obtain xA := X 2−f(j) = lim j∈N n→∞ n X 2−f(j) . j=0 Pn Therefore, (an )n∈Nwith an := j=o 2−f(j) is a computable increasing sequence of rational numbers. Its limit xA is ρ< -computable. Since xA is 104 4. Computability on the Real Numbers not computable, by Theorem 4.2.3 the sequence (an )n∈Ncannot have a computable modulus of convergence. Since the set A is not recursive, the enumerating function f cannot have a computable lower bound which is monotone and unbounded. Therefore, unforseeable values f(n) are very small and terms 2−f(n) are large. The ρ< -computable numbers are also called left-computable or left-r.e. and the ρ> -computable numbers are also called right-computable or rightr.e.. By Specker’s example there is a left-computable real number which is not computable (Examples 1.3.2, 4.2.4.3). Lemma 4.2.5. A real number x 1. is left-computable, iff −x is right-computable, 2. is computable, iff it is left-computable and right-computable. Proof: A direct proof is easy. Property 2 follows also from ρ ≡ ρ< ∧ ρ> (Lemma 4.1.9). The computable real numbers are a countable set which, however, cannot be enumerated “effectively”. We prove a “positive” version of this statement by diagonalization. Theorem 4.2.6. 1. Let (xi )i∈Nbe a (νN, ρ)-computable sequence of real numbers. Then there is a computable real number x such that x 6= xi for all i ∈ N. 2. There is no numbering or notation ν of the set Rc of the computable real numbers with r.e. domain such that ν ≤ ρ. Proof: 1. We construct x by diagonalization. We may assume that the sequence is (νN , ρC )-computable. For any i ∈ N we can determine a sequence qi := ι(ui0 )ι(ui1 ) . . . with xi = ρC (qi ). Therefore, there is a computable func◦g(0i )−xi | ≤ 2−2i−2. We tion g : Σ ∗ → Σ ∗ with g(0i ) = ui,2i+2 . We obtain |νQ compute a nested sequence ([ui ; vi ])i∈Nof closed intervals with v i − ui = 3−i such that xi 6∈ [ui ; vi ] as follows: (u0 , v0 ) := (νQ◦ g(λ) + 1, u0 + 1) (ui , ui+1 + 13 · 3−i ) if νQ◦ g(0i+1 ) ≥ ui + (ui+1 , vi+1 ) := (ui + 23 · 3−i , vi ) otherwise. 1 2 · 3−i If νQ◦ g(0i+1 ) ≥ ui + 12 · 3−i , then xi+1 ≥ ui + 12 · 3−i − 2−2(i+1)−2 > ui + 13 · 3−i , and if νQ◦ g(0i+1 ) 6≥ ui + 12 · 3−i , then xi+1 < ui + 23 · 3−i . We obtain xi+1 6∈ [ui+1 ; vi+1 ]. There is a computable sequence i 7→ wi of words such that I1 (wi ) = [ui ; vi ]. Therefore, q := ι(w0 )ι(w1 ) . . . is computable and x := ρb (q) (ρb from Lemma 4.1.6) differs from all numbers xi . Since ρb ≡ ρ, x is computable. 4.2 Computable Real Numbers 105 2. Assume that there is such a numbering ν :⊆ N → Rc. There is a computable function f : N → N with range(f) = dom(ν). Then νf is a total numbering of Rc with νf ≤ ν ≤ ρ. Therefore, (νf(i))i∈Nis a (νN, ρ)computable sequence of all computable real numbers. This is impossible by Property 1. If ν is a notation, there is a computable function f : N → Σ ∗ with range(f) = dom(ν). Continue as above. We derive a notation of the computable real numbers canonically from the representation ρ using the standard notation ξ ∗ω of the computable functions f :⊆ Σ ∗ → Σ ω (Definition 2.3.4). Definition 4.2.7. Define the notation νρ :⊆ Σ ∗ → Rc of the computable real numbers by ∗ω (λ) . νρ (w) := ρ ◦ ξw For w ∈ dom(νρ ), νρ (w) = ρ(p) where p ∈ Σ ω is the sequence computed by the Turing machine with code w on input λ. By the utm-theorem for ∗ω ξ ∗ω , νρ ≤ ρ. By Theorem 4.2.6 the domain dom(νρ ) = {w ∈ Σ ∗ | ξw (λ) ∈ dom(ρ)} is not r.e. Every countable subset X ⊆ R can be covered by arbitrarily small open sets. The (countable) set Rc of computable real numbers can be covered by arbitrarily small “r.e. open” sets [Spe59] (cf. Sect. 5.1). Theorem 4.2.8. For each N ∈ N there is a computable sequence i 7→ wi of words wi ∈ dom(I1 ), such that [ X Rc ⊆ UN := I1 (wi ) and length(I1 (wi )) ≤ 2−N . i∈N i∈N Proof: For each i = hk, ti define the word wi as follows: If the Turing machine with code νΣ (k) on input λ in t steps (but not in (t−1) steps) writes an output ι(u0 )ι(u1 ) . . . ι(uk+N+4 ) ∈ Σ ∗ with |uj − um | ≤ 2−j for 0 ≤ j ≤ m ≤ k + N + 4, then I1 (wi ) = uk+N+4 − 2−k−N−3 ; uk+N+4 + 2−k−N−3 , otherwise I1 (wi ) = 0 ; 2−i−N−2 . Suppose x is computable. Then x = ρC (p) for some computable p ∈ Σ ω . (λ) = p. Then there is some t such There is some number k such that ξν∗ω Σ (k) that the machine with code νΣ (k) on input λ in t steps computes a prefix ). For i = hk, ti we ι(u0 )ι(u1 ) . . . ι(uk+N+4 ) ∈ Σ ∗ of p with ui ∈ dom(νQ 106 4. Computability on the Real Numbers S obtain x ∈ I1 (wi ). Therefore, Rc ⊆ i∈NI1 (wi ). For each k there is at most one t such that the first condition holds, therefore, X X −i−N−2 X −k−N−2 length I1 (wi ) ≤ 2 + 2 = 2−N . i∈N i∈N k∈N Since the function (w, t) 7→ v, where v is the word which the machine with code w on input λ produces in t steps, is computable, the sequence i 7→ wi is computable (cf. Lemma 2.1.5). Exercises 4.2. 1. Show that a real number x is computable, iff there are computable functions f, g, h : N → N with |x − (f(n) − g(n))/(1 + h(n))| ≤ 2−n for all n ∈ N. 2. a) Define a (νN, ρ< )-computable sequence (xi )i∈Nwhich lists all ρ< computable real numbers. b) Construct by diagonalization a ρ> -computable real number which is not ρ< -computable. 3. Let a : N → R be a computable sequence of real numbers with infinite range. Then there is an injective computable sequence of real numbers b : N → R with range(a) = range(b). 4. Let (ak )k∈Nbe a computable sequence of real numbers converging to 0. a) Show that the sequence (ak )k∈Nhas a computable modulus of convergence, if ak ≤ ak+1 for all k. b) Show that there is an increasing computable function f : N → N with |af(n) | ≤ 2−n for all n (hence n 7→ n is a modulus of convergence of the computable subsequence n 7→ af(n) ). c) Show that there is a computable sequence (bk )k∈Nof real numbers converging to 0 which has no computable modulus of convergence. (Hint: define bk := 2−f(k) where f is an injective enumeration of a non-recursive r.e. set.) 5. Show that the sequence (an )n∈Nin Example 4.2.4.3 is (νN, νQ )-compu, ρ)-computable and (ν , ρ )-computable (Example 4.1.14.2). table, (νN N ≤ P 6. Consider n ∈ N, n > 2. Is i∈A n−i computable, if A ⊆ N is recursive (r.e.)? 7. Show that there is a sequence (ai )i∈Nof rational numbers which is (νN, ρ)computable but not (νN, νQ )-computable. Hint: Let a : N → N be a computable injective function such that range(a) is not recursive. Define xn := 0, if n 6∈ range(a), xn := 2−k , if a(k) = n. , ρ)-computable function f : Q → R such that range(f) ⊆ Q 8. Define a (νQ and the restriction f|Q: Q → Q is not (νQ , νQ )-computable. [Hau87] 4.2 Computable Real Numbers 107 9. Show that there is a computable sequence y : N → R of real numbers, such that the sequence sgn ◦ y is not computable (where sgn(x) := 0, if x ≤ 0, 1 otherwise). √ 1 k 2 10. By Taylor’s theorem, 1 + t = P∞ k=0 k · t for all t ∈ R with |t| < 1. The series converges also for |t| = 1. For t = −1 we obtain 0 =1− 1 1·3 1·3·5 1 − − − −... . 2 2·4 2·4·6 2·4·6·8 Determine a modulus of convergence P (find an expression in elementary functions and do not use summation ) for the sequence i 7→ xi with Pi 1 xi := k=0 k2 · (−1)k . (Consult, for example, [BB85].) 11. Show that for every bounded (νN, ρ< )-computable sequence (xi )i∈Nof real numbers, supi∈Nxi is ρ< -computable. P 12. There is a left-computable real number x ∈ (0; 2) such that x 6= i∈A 2−i for every r.e. set A ⊆ N. Hint: Let B ⊆ N be recursively enumerable but not recursive and define X X 2−(2i+1) + 2−(2i+2) . yB := i∈B i6∈B 13. Let P (xi )i∈Nbe a computable sequence of real numbers such that i∈N|xi+1 − xi | is finite. Show that x is the sum of a left-computable and a right-computable real number. There are real numbers of this type, which are neither left- nor right-computable. Left-computable and more general types of real numbers are investigated in [WZ98a]. 14. Show that the multi-valued function F :⊆ R × R Q, defined by RF := )-computable. {((x, y), a) | x < a < S y}, is (ρ> , ρ< , νQ 15. The open set UN := i∈NI1 (wi ) from Theorem 4.2.8 containing all computable real numbers can be written as a disjoint union of open intervals. Let K ⊆ UN be the interval of this partition of UN containing the (computable) number 0 ∈ R and let c := sup(K) be its right-hand endpoint. a) Show c is not computable, that is, c 6∈ Rc. b) S Let cn be the right-hand endpoint of the longest interval J ⊆ n 1 i=0 I (wi ) with 0 ∈ J. Show that (cn )n∈Nis a non-decreasing computable sequence with c = supn∈Ncn . (Hence c is left-computable.) c) Show that cn ≤ a or cn ≥ b, if n ≥ i and (a, b) := I1 (wi ). d) Show that f :⊆ R N, defined by Rf := {(x, n) ∈ Rc × N | (∀k > n)|ck − x| ≥ 2−n } , is (ρ, νN)-computable. 108 4. Computability on the Real Numbers 16. Effectivize Theorem 4.2.6.1. Define a multi-valued function D : RN R by RD := {((x0 , x1 , . . . , ), x) | (∀i) x 6= xi } . a) Show that D is ([ρ]ω , ρ)-computable. b) Show that D has no ([ρ]ω , ρ)-continuous choice function. 17. By Theorem 4.1.13.2, x ∈ R is ρb,2 -computable, iff it is ρb,10 -computable. By Theorem 4.1.13.4, ρb,2 6≤t ρb,10 . Show that there is a [ρb,2 ]ω computable sequence (x0 , x1 , . . .) which is not [ρb,10 ]ω -computable [Mos57]. Hint: There are injective computable functions a, b : N → N such that A := range(a) and B := range(b) are recursively inseparable, that is, A ∩ B = ∅ and for no recursive set C, A ⊆ C and B ⊆ N \ C [Rog67, Odi89]. Let ρb,2 (0•d1 d2 . . .) = 1/5 and define for n 6∈ A ∪ B , ρb,2 (0•d1 d2 . . .) xn := ρb,2 (0•d1 d2 . . . dk 00 . . .) for a(k) = n , ρb,2 (0•d1 d2 . . . dk 11 . . .) for b(k) = n . 4.3 Computable Real Functions A real function f :⊆ R → R is computable (more precisely (ρ, ρ)-computable), iff some Type-2 machine transforms any ρ-name p of any x ∈ dom(f) to a ρ-name of f(x), where a ρ-name of y is a list of all rational open intervals J ∈ Cb(1) such that y ∈ J. Since equivalent representations induce the same computability, ρ can be replaced by any representation equivalent to it, for example by the Cauchy representation ρC (Lemma 4.1.6). Computable functions with n real arguments are realized accordingly by machines with n input tapes. Since the representation ρ is admissible with final topology τR(Lemma 4.1.4), we obtain as a special case of our Main Theorem 3.2.11: Theorem 4.3.1 (continuity). Every computable real function is continuous. More precisely, every (ρn , ρ)-computable real function is continuous w.r.t. . Many easily definable functions like the step functhe real line topology τR tion or the Gauß staircase (Fig. 1.3) are not (ρ, ρ)-computable, since they are not continuous. Some people reject TTE and similar approaches to computable analysis since they think that a reasonable computability theory for analysis should make such functions computable. This objection can be removed, since TTE admits various natural computable topological spaces which make the step function, the Gauß staircase and similar functions computable (for example the Gauß staircase is (ρ, ρ> )-computable). The following theorem lists some computable real functions. 4.3 Computable Real Functions 109 Theorem 4.3.2 (some computable real functions). The following real functions are computable: 1. (x1 , . . . , xn ) 7→ c (where c ∈ R is a computable constant), 2. (x1 , . . . , xn ) 7→ xi (1 ≤ i ≤ n), 3. x 7→ −x, 4. (x, y) 7→ x + y, 5. (x, y) 7→ x · y, 6. x 7→ 1/x, 7. (x, y) 7→ min(x, y), (x, y) 7→ max(x, y), 8. x 7→ |x|, 9. every polynomial function in n variables with computable coefficients, 10. (i, x) 7→ xi for i ∈ N and x ∈ R (00 := 1). Proof: We will use the representations ρC and ρ000 C which are equivalent to ρ by Lemma 4.1.6. 1. Let M be a Type-2 machine with n input tapes which on every input computes some computable ρ-name of c. Then fM realizes the constant function with value c. 2. Let M be a Type-2 machine with n input tapes which copies the i-th input tape to the output tape. Then fM realizes the i-th projection. 3. There is a computable word function f : Σ ∗ → Σ ∗ such that (w) = νQ f(w) for all w ∈ dom(νQ ). There is a Type-2 machine M , which −νQ transforms any input p := ι(u0 )ι(u1 ) . . . ∈ dom(ρC ) (where ui ∈ dom(νQ )) to the sequence q := ι(f(u0 ))ι(f(u1 )) . . . . Obviously, ρC (q) = −x, if ρC (p) = x. Therefore, fM realizes negation on R. 4. Since addition on Q is (νQ , νQ , νQ )-computable, there is a computable function f :⊆ Σ ∗ × Σ ∗ → Σ ∗ such that u + v = νQ f(u, v) for all u, v ∈ ). There is a Type-2 machine M , which transforms any input (p, q), dom(νQ 000 p := ι(u0 )ι(u1 ) . . . ∈ dom(ρ000 C ) and q := ι(v0 )ι(v1 ) . . . ∈ dom(ρC ) (where )) to the sequence r := ι(y0 )ι(y1 ) . . . with yi := f(ui+1 , vi+1 ). ui , vi ∈ dom(νQ Since y i = ui+1 + v i+1 , we have 000 000 000 −i−1 |yi − (ρ000 = 2−i . C (p) + ρC (q))| ≤ |ui+1 − ρC (p)| + |v i+1 − ρC (q)| ≤ 2 · 2 000 We obtain r = fM (p, q) ∈ dom(ρ000 C ) and ρC (r) = x + y. Therefore, fM is a 000 000 000 (ρC , ρC , ρC )-realization of addition. , νQ , νQ )-computable, there is a com5. Since multiplication on Q is (νQ f(u, v) for all putable function f :⊆ Σ ∗ × Σ ∗ → Σ ∗ such that u · v = νQ ). There is a Type-2 machine M which transforms any input u, v ∈ dom(νQ 000 (p, q), p := ι(u0 )ι(u1 ) . . . ∈ dom(ρ000 C ) and q := ι(v0 )ι(v1 ) . . . ∈ dom(ρC ), to the sequence r := ι(y0 )ι(y1 ) . . . with yi := f(um+i , vm+i ), where m ∈ N is the smallest number with |u0 | + 2 ≤ 2m−1 and |v0 | + 2 ≤ 2m−1 . For all n we have 000 m−1 |un | ≤ |un − ρ000 C (p)| + |ρC (p) − u0 | + |u0 | ≤ 2 + |u0 | ≤ 2 110 4. Computability on the Real Numbers 000 and accordingly |vn | ≤ 2m−1 . With x := ρ000 C (p) and y := ρC (q) we obtain |yi − x · y| = ≤ ≤ ≤ = |um+i · v m+i − x · y| |um+i · v m+i − um+i · y| + |um+i · y − x · y| |um+i · (v m+i − y)| + |(um+i − x) · y| 2 · 2m−1 · 2−m−i 2−i . 000 We obtain r = fM (p, q) ∈ dom(ρ000 C ) and ρC (r) = x · y. Therefore, fM is a 000 000 000 (ρC , ρC , ρC )-realization of multiplication. 6. There is a Type-2 machine M which works as follows on input p := ι(u0 )ι(u1 ) . . . ∈ dom(ρ000 C ): First M searches for the smallest N ∈ N with |uN | > 3 · 2−N . As soon as such a number N has been found, M starts to write the sequence r := ι(y0 )ι(y1 ) . . . with y i = 1/u2N+i . −N Suppose that x := ρ000 for all k ≥ N C (p) 6= 0. Then N exists and |uk | > 2 −N and hence |x| ≥ 2 . We obtain y i − 1 = 1 − 1 = |x − u2N+i | ≤ 2−2N−i · 2N · 2N = 2−i . x u2N+i x |u2N+i | · |x| 000 Therefore, fM is a (ρ000 C , ρC )-realization of inversion. Notice that fM (p) does 000 not exist, if ρC (p) = 0. 7. There is a Type-2 machine M which transforms any input (p, q), p := 000 ι(u0 )ι(u1 ) . . . ∈ dom(ρ000 C ) and q := ι(v0 )ι(v1 ) . . . ∈ dom(ρC ), to the sequence r := ι(y0 )ι(y1 ) . . . with y i = min(ui , vi ). If x = min(x, y, ui , vi ), then |yi − min(x, y)| = min(ui , vi ) − x ≤ ui − x ≤ 2−i . If ui = min(x, y, ui , v i ), then |y i − min(x, y)| = min(x, y) − ui ≤ x − ui ≤ 2−i . For the cases y = min(x, y, ui , vi ) and v i = min(x, y, ui , vi ), |yi −min(x, y)| ≤ 000 000 2−i can be concluded similarly. Therefore, fM is a (ρ000 C , ρC , ρ )-realization of min. Since max(x, y) = (x + y) − min(x, y), max is computable by Properties 3 and 4 and the composition theorem 3.1.6. 8. |x| = max(x, −x), apply Properties 3 and 7. 9. We apply the composition theorem 3.1.6. Every monomial f of degree 0 (that is, f(x1 , . . . , xn) := c) with computable constant c is computable by Property 1. Suppose that all monomials of degree k with computable coefficients are computable. If fk+1 is a monomial of degree k + 1 with computable coefficient, then fk+1 (x1 , . . . , xn) = fk (x1 , . . . , xn ) · pri (x1 , . . . , xn ) for some monomial of degree k with computable coefficient and some i. By induction and Properties 2 and 5, fk+1 is computable. Another easy induction shows that every polynomial function with computable coefficients is computable. 4.3 Computable Real Functions 111 10. For h(i, x) := xi we have h(0, x) = 1 , h(n + 1, x) = x · h(n, x) . If we define f(x) := 1 and f 0 (n, y, x) := x · y, then f and f 0 are computable by Properties 1 and 5 above, and h is computable by Theorem 3.1.7.2 on primitive recursion. Example 4.3.3. The exponential function exp : R → R is computable. We use the estimation exp(x) = N X xi i=0 i! + rN (x) , where rN (x) ≤ 2 · N |x|N+1 , if |x| ≤ 1 + . (N + 1)! 2 Let M be a Type-2 machine which for any p = ι(u0 )ι(u1 ) . . . ∈ dom(ρC ) computes a sequence q = ι(v0 )ι(v1 ) . . ., where for each n, vn is determined as follows. 1. M determines the smallest N1 ∈ N with |u0 | + 1 ≤ 1 + N1 /2. 2. M determines the smallest N ∈ N, N ≥ N1 , with 2· |1 + N1 /2|N+1 ≤ 2−n−2 . (N + 1)! 3. M determines the smallest m ∈ N with 2−m · N X i · (1 + N1 /2)i−1 ≤ 2−n−2 . i! i=1 ∗ 4. M determines vn ∈ Σ such that vn = N X ui m i=0 i! . Assume x = ρC (p) = ρC (ι(u0 )ι(u1 ) . . .). Then |x| ≤ 1 + N1 /2 and |um | ≤ 1 + N1 /2. We obtain | exp(x) − vn | ≤ | N X xi i=0 i! − ≤ |x − um | · N X ui m i=0 i! N X |xi−1 + xi−2 um + . . . + ui−1 | m i=1 ≤ 2−m · N X i=1 | + |rN (x)| i! i · (1 + N1 /2)i−1 + 2−n−2 i! ≤ 2−n−2 + 2−n−2 ≤ 2−n−1 . + 2−n−2 112 4. Computability on the Real Numbers We obtain furthermore exp(x) = ρC (ι(v0 )ι(v1 ) . . .), since for i < j, |vi − vj | ≤ |vi − exp(x)| + | exp(x) − vj | ≤ 2−i−1 + 2−j−1 ≤ 2−i . Therfore, fM realizes the exponential function. The computable real functions are closed under composition (Theorem 3.1.6) and under primitive recursion (Theorem 3.1.7). There are some other useful operations which map computable real functions to computable real functions. Corollary 4.3.4. If f, g :⊆ Rn → R are computable functions and a ∈ R is a computable number, then x 7→ a·f(x), x 7→ f(x)+g(x), x 7→ f(x)·g(x), x 7→ max(f(x), g(x)), x 7→ min(f(x), g(x)) and x 7→ 1/f(x) are computable functions. Proof: By Theorem 3.1.6 the computable real functions are closed under composition. Apply Theorem 4.3.2. The join of two computable functions at a computable point is a computable function (Fig. 4.4). f(x) 6 f c f2 a -x f1 Fig. 4.4. The join f of f1 and f2 at a Lemma 4.3.5 (join of functions). Let f1 , f2 :⊆ R → R be computable real functions and let c ∈ R be a computable real number. Then the function f :⊆ R → R, defined by f1 (x) if x < c, f2 (x) if x > c, f(x) := f1 (a) if x = c and f1 (a) = f2 (a), div otherwise, is computable. 4.3 Computable Real Functions 113 Proof: First consider the case c = 0. We may assume that f1 and f2 are (ρa , ρa )-computable, ρa from Lemma 4.1.6. There are Type-2 machines M1 and M2 such that fM1 and fM2 realize f1 and f2 , respectively. For i = 1, 2 let Mi (p, k) be the output written by the machine Mi in k steps. For any w ∈ Σ ∗ let N (w) := (λ, if w has no subword ι(w 0 ), its rightmost subword ι(w 0 ) otherwise). There is a Type-2 machine M which on input p = ι(u0 )ι(u1 ) . . . ∈ dom(ρa ) operates in stages k = 0, 1, 2 . . . as follows: Stage k: • If 0 ∈ I1 (uk ) and if N ◦ M1 (p, k) = λ or N ◦ M2 (p, k) = λ, then M goes to the next stage; • If 0 ∈ I1 (uk ) and if N ◦ M1 (p, k) = ι(w1 ) and N ◦ M2 (p, k) = ι(w2 ), then M writes some word ι(w), such that I1 (w) is the smallest interval with I1 (w1 ) ∪ I1 (w2 ) ⊆ I1 (w); • If I1 (uk ) < 0, then M writes N ◦ M1 (p, k); • if I1 (uk ) > 0, then M writes N ◦ M2 (p, k). Suppose that x = ρa (p) and f(x) exists. If x < 0, then M finally produces the output intervals of M1 on input p. If x > 0, then M finally produces the output intervals of M2 on input p. If x = 0, then M produces a combination of both outputs which converges to f1 (0) = f2 (0). The result is always a ρb -name of f(x), ρb from Lemma 4.1.6. Therefore, f is (ρa , ρb )-computable. If c 6= 0, apply the above join operation to the functions f10 and f20 , f10 (x) := f1 (x + c) and f20 := f2 (x + c), which are computable by Theorem 4.3.2, and shift the result f 0 : f(x) := f 0 (x − c). We turn now to functions on infinite sequences of real numbers. We use the representation [ρ]ω (Definition 3.3.3) which is equivalent to [νN→ ρ]Nby Lemma 3.3.16. Projection and partial summation are computable: Lemma 4.3.6 (sequences). For sequences (x0 , x1 , . . .) of real numbers 1. The projection pr : (x0 , x1 , . . .),i 7→ xi is ([ρ]ω , νN , ρ)-computable; 2. The function S0 : (x0 , x1 , . . .), i 7→ x0 + x1 + . . . + xi is ([ρ]ω , νN , ρ)-computable; 3. the function S : (x0 , x1 , . . .) 7→ (y0 , y1 , . . .) where yi := x0 + x1 + . . . + xi , is ([ρ]ω , [ρ]ω )-computable. Proof: 1. The function (hp0 , p1, . . .i, w) 7→ pνN(w) realizes the projection. 2. We apply Theorem 3.1.7 on primitive recursion. Define h 0, (x0 , x1, . . .) = x0 h n + 1, (x0 , x1 , . . .) = h n, (x0 , x1 , . . .) + xn+1 . Since f(x0 , x1, . . .) := x0 and f 0 (n, y, (x0 , x1 , . . .)) := y+xn+1 are computable (x , x , . . .), i = by Property 1, h is computable by Theorem 3.1.7. Since S 0 0 1 ω , ρ)-computable. x0 + x1 + . . . + xi = h i, (x0 , x1 , . . .) , S0 is ([ρ] , νN 114 4. Computability on the Real Numbers 3. By Property 2 and Theorem 3.3.15, S is ([ρ]ω , [νN→ ρ]N)-computable, and so ([ρ]ω , [ρ]ω )-computable. The limits of converging sequences and series are computable. We add as a further variable a modulus e : N → N of convergence and use the representation [νN→ νN ]N(Definition 3.3.13). Theorem 4.3.7 (limit of sequences and series of numbers). For sequences (x0 , x1 , . . .) of real numbers and modulus functions e : N → N, the functions (4.1) L : (x0 , x1 , . . .), e 7→ lim xi and i→∞ X SL : (x0 , x1 , . . .), e 7→ xi (4.2) i∈N where ((x0 , x1 , . . .), e) ∈ dom(L), iff (∀j > i ≥ e(n))|xj − xi | ≤ 2−n , and ((x0 , x1 , . . .), e) ∈ dom(SL), iff (∀j ≥ i ≥ e(n))|xi + . . . + xj | ≤ 2−n , are , ρ)-computable. ([ρ]ω , [νN→ νN]N Proof: 4.1. We generalize the proof of Theorem 4.2.3. It suffices to show that the function is ([ρC ]ω , [νN→ νN]N , ρC )-computable. There is a Type-2 ma chine M which on input hp0 , p1 , . . .i, q , pi = ι(ui0 )ι(ui1 ) . . . ∈ dom(ρC ), e := [νN→ νN]N (q), writes the sequence q := ι(ue(2)2 )ι(ue(3)3 )ι(ue(4)4) . . . . Then fM is a ([ρC ]ω , [νN→ νN ]N, ρC )-realization of L (cf. the proof of Theorem 4.2.3). P 4.2. By Lemma 4.3.6, S : (x0 , x1, . . .) 7→ (y0 , y1 , . . .), yi := m≤i xi , is ([ρ]ω , [ρ]ω )-computable. If for all j ≥ i ≥ e(n), |xi + . . . + xj | ≤ 2−n , then for all j > i ≥ e(n), |yj − yi | = |xi+1 + . . . + xj | ≤ 2−n . Therefore, SL (x0 , x1 , . . .), e = L S(x0 , x1 , . . .), e , L from 4.1 above, if |xi + . . . + xj | ≤ 2−n for all j ≥ i ≥ e(n), and so SL is ([ρ]ω , [νN→ νN]N, ρ)-computable. We apply Theorem 4.3.7 to show that the uniform limit of a fast converging computable sequence of real-valued functions is computable (Fig 4.5). Theorem 4.3.8 (limit of sequences and series of functions). Let δ :⊆ Σ ω → M be a representation, let X ⊆ M . Let (fi )i∈Nwith fi :⊆ M → R and dom(fi ) = X be a sequence of functions such that (i, x) → fi (x) is (νN, δ, ρ)-computable. 1. If there is a computable function e : N → N with |fj (x) − fi (x)| ≤ 2−n for all j > i ≥ e(n) and x ∈ X, then the function f :⊆ M → R, defined by dom(f) = X and f(x) = limi→∞ fi (x), is (δ, ρ)-computable. 2. If there is a computable function e : N → N with |fi (x) + . . . + fj (x)| ≤ 2−n for all j ≥ i ≥ e(n) and x ∈ X,Pthen the function f :⊆ M → R, defined by dom(f) = X and f(x) = i∈Nfi (x), is (δ, ρ)-computable. 4.3 Computable Real Functions f(x) 115 6 f0 f2 f1 c f - x Fig. 4.5. Functions f0 , f1 , f2 . . . uniformly converging to f Proof: 1. Since the function (x, i) 7→ fi (x) is (δ, νN , ρ)-computable, by Theorem 3.3.15.2 the function F : x 7→ (fi (x))i∈Nis (δ, [νN→ ρ]N)-computable and hence (δ, [ρ]ω )-computable by Lemma 3.3.16. We obtain f(x) = L(F (x), e) for all x ∈ X where L is the limit operator from Theorem 4.3.7,4.1. The ]N, ρ)-computable function f is (δ, ρ)-computable, since L is ([ρ]ω , [νN→ νN -computable. and e is [νN→ νN]N 1. This follows correspondingly from Theorem 4.3.7.4.2. Lemma 4.3.6 and Theorems 4.3.7 and 4.3.8 can be generalized straightforwardly from R to Rn. p Every complex number z = x + iy ∈ C has an absolute value √ |z| = x2 + y2 and a norm ||z|| = max(|x|, |y|) satisfying ||z|| ≤ |z| ≤ 2 · ||z||. The set C of complex numbers can be identified with the set R2 of pairs of real numbers, x + iy ↔ (x, y), with standard representation [ρ]2 . Then C n is represented by [[ρ]2 ]n ≡ [ρ]2n ≡ ρ2n (where we assume that the Cartesian product is associative, see Definitions 3.3.3, 4.1.17). We call a point a ∈ C computable, iff it is ρ2 -computable (iff it is (ρ, ρ)-computable), a function f :⊆ C n → C computable, iff it is (ρ2n , ρ2 )-computable etc. . A complexvalued function is computable, iff its real part and its imaginary part are computable (Lemma 3.3.6). Theorem 4.3.9 (computable complex functions). The complex functions z 7→ a (for computable a ∈ C ), (z1 , z2 ) 7→ z1 + z2 , (z1 , z2 ) 7→ z1 · z2 , z 7→ 1/z, z 7→ |z|, z 7→ ||z||, z 7→ Re(z) and z 7→ Im(z) are computable. Furthermore, every complex polynomial function with computable coefficients and the function (j, z) 7→ z j are computable. Proof: Consider the function f : z 7→ 1/z. By Lemma 3.3.6 it suffices to show that the projections Re(f) and Im(f) are (ρ, ρ, ρ)-computable. We have f(x + iy) = x − iy x −y 1 = 2 = 2 +i 2 , x + iy x + y2 x + y2 x + y2 116 4. Computability on the Real Numbers therefore, f is computable √ by Theorem 4.3.2. Computability of |z| follows from computability of x 7→ x for x ∈ R, x ≥ 0, which will be proved below (Example 4.3.13.6). The remaining proofs are left to the reader. Theorem 4.3.10 (sequences of complex numbers). Lemma 4.3.6 and Theorem 4.3.7 hold for sequences of complex numbers accordingly. Every sequence (aj )j∈Nof complex numbers defines a power series with coefficients a0 , a1 , . . . and a function f :⊆ C → C , defined by f(z) := ∞ X aj · z j . j=0 The sum f(z) of the series is defined for all z with |z|p< R and is not defined for all z with |z| > R where R := 1/ lim supj→∞ j |aj | is the radius of convergence. By Cauchy’s estimate for every number r < R there is a constant M such that |aj | ≤ M · r −j for all j ∈ N . Neither the radius R of convergence nor a function h mapping each r < R to an appropriate constant M for Cauchy’s estimate can be computed from (aj )j∈Nin general. For computing f(z) from z and the sequence (aj )j∈Nof coefficients further information about this sequence must be available. We will use a radius r < R and a number M such that |aj | ≤ M · r −j for all j ∈ N. We represent the set of sequences j 7→ aj of complex numbers by [νN→ ρ2 ]N(Definition 3.3.13) or by [ρ2 ]ω (Definition 3.3.3) which are equivalent by Lemma 3.3.16. Theorem 4.3.11 (power series). The function ∞ X P : (aj )j∈N, r, M, z − 7 → aj · z j j=0 defined for arguments with |z| < r and |aj | ≤ M · r −j for all j is [ρ2 ]ω , νQ , νN , ρ2 , ρ2 -computable. Proof: The multi-valued function h :⊆ Q × C Q with graph , [ρ]2 , νQ )-computable. Rh := {(r, z, s) | |z| < s < r} is (νQ Now we show that the following variant Q of P which has a further input parameter s, ∞ X Q : (aj )j∈N, r, s, M, z 7−→ aj · z j j=0 4.3 Computable Real Functions 117 defined for arguments with |z| < s < r and |aj | ≤ M · r −j for all j, is , νQ , νN , ρ2 , ρ2 -computable. [ρ2 ]ω , νQ The function (j, z) 7→ z j is (νN, ρ2 , ρ2 )-computable (Theorem 4.3.9). By the complex generalization of Lemma 4.3.6.1, the function (aj )j∈N, z, k 7→ ak ·z k is ([ρ2 ]ω , ρ2 , νN , ρ2 )-computable. Therefore, by Theorem 3.3.15.2 and Lemma 3.3.16, G : (aj )j∈N, z 7→ (aj · z j )j∈N is ([ρ2 ]ω , ρ2 , [ρ2 ]ω )-computable. Next we determine a modulus of convergence. The function s m r ≤ 2−n · H : (r, s, M, n) 7→ min m ∈ N | M · r r−s (r, s ∈ Q, s < r, M, n ∈ N) is computable, and so by Theorem 3.3.15.2, H 0 : (r, s, M ) 7→ e, e(n) := H(r, s, M, n) , , νQ , νN , [νN→ νN])-computable. For |z| ≤ s < r and k ≥ j ≥ e(n) we is (νQ have k P P |aj · z j + . . . + ak · z k | ≤ k≥j |ak | · |z|k ≤ k≥j M · sr j r = M · sr · r−s ≤ 2−n . Let SL be the complex version of the summation operator from Theorem 4.3.7.4.2. Then ∞ X ai · z i = SL G((aj )j∈N, z), H 0 (r, s, M ) , i=0 if |z| ≤ s < r, and |aj | ≤ M · r −j for all j. Therefore, the function Q is computable. Combining machines for h and Q we can construct a machine computing P . For a computable sequence (aj )j∈Nof complex numbers we obtain the following useful consequences: Theorem 4.3.12. Let (aj )j∈Nbepa computable sequence of complex numbers and let R := 1/ lim supj→∞ j |aj |. P∞ 1. The function f : z 7→ i=0 ai · z i is computable on every closed ball {z ∈ C | |z| ≤ r} with r < R. 2. Let k 7→ rk , and k 7→ Mk (rk ∈ Q, Mk ∈ N) be computable sequences j, k. such that |aj | ≤ Mk · rk−j for Pall ∞ Then the function f : z 7→ i=0 ai · z i is computable on the open ball {z ∈ C | |z| < supk∈Nrk }. 118 4. Computability on the Real Numbers Proof: 1. There is some rational number r0 such that r < r0 < R. There is a Cauchy bound M ∈ N for r 0 . Then for all |z| < r 0 , f(z) = P (aj )j∈N, r 0, M, z , P from Theorem 4.3.11. 2. For input z first find some number k with |z| < rk and then compute f(z) = P ((ai )i∈N, rk , Mk , z), P from Theorem 4.3.11. The above theorems have many applications. Example 4.3.13. 1. If (aj )j∈Nis a computable sequence ofp complex numbers, z0 ∈ C is computable and r < R := 1/ lim supj→∞ j |aj |, then g :⊆ C → C , defined by ∞ X aj · (z − z0 )j , g(z) := j=0 is computable on the disc {z | |z − z0 | ≤ r}. For a proof consider the function f from Theorem 4.3.12. Then g(z) = f(z − z0 ), hence g is computable by Theorem 4.3.9. 2. The exponential function exp : C → C can be defined by the power series exp(z) = ∞ X zj j=0 j! p for all z ∈ C . Since lim supj→∞ j 1/j! = 0, the radius of convergence is R = ∞. By Theorem 4.3.12, for every N ∈ N the exponential function is computable on the disc {z | |z| ≤ N }. This means, for every number N there is a machine MN which computes exp on this disc. There is also a single machine computing exp(z) for all z ∈ C . To show this we apply Theorem 4.3.12.2. Consider N ≥ 1. For j ≤ N we have 1 ≤ 1 ≤ N N−j = N N · N −j , j! and for j > N we have 1 1 1 ≤ ≤ j−N = N N · N −j . j! (N + 1) · (N + 2) · . . . · j N Define rk := k + 1 and Mk := rkrk . By Theorem 4.3.12.2, the exponential function is computable on C . 3. The trigonometric functions sin : C → C and cos : C → C are computable. For a proof use the identities sin(z) = (exp(iz) − exp(−iz))/(2i) and cos(z) = (exp(iz) + exp(−iz))/2 and Example 2. In particular, the real trigonometric functions are computable. 4.3 Computable Real Functions 119 4. For |z| < 1 we have log(1 + z) = ∞ X j=1 (−1)j+1 zj . j The radius of convergence is 1. The function z 7→ log(1+z) is computable on the disc {z | |z| < 1} (Exercise 4.3.12). 5. The real function x 7→ log x is computable on the interval (0; ∞): By Example 4.3.13.4 the number log 2 = log(1 + 1/3) − log(1 − 1/3) is computable. There is a machine M which on input x (more precisely, on input p with ρ(p) = x > 0) first determines some integer d ∈ Z with 1/2 < x · 2d < 3/2 and then computes −d · log 2 + log(x · 2d ). The function fM realizes the function x 7→ log x. (The multi-valued function g :⊆ R Zwith Rg = {(x, d) | 1/2 < x · 2d < 3/2} is (ρ, νZ )-computable )-continuous choice function.) but has no (ρ, νZ 6. The function (x, y) 7→ xy for x, y ∈ R and √ x > 0 is computable: xy = exp(y · log x) . In particular, x 7→ x is computable. 7. For real x with |x| < 1 we have arcsin x = x + 1 · 3 x5 1 · 3 · 5 x7 1 x3 · + · + · +... . 2 3 2·4 5 2·4·6 7 The function arcsin is computable on (−1; 1) (Exercise 4.3.13). 8. Since computable functions map computable elements to computable ones, and since the rational numbers are computable, numbers like √ √ 2 = 21/2 , m n (m, n > 1), e = exp 1, log 2, loga b = log b/ log a (a, b ∈ Q, a, b > 0), π = 6 · arcsin(1/2) and eπ are computable real numbers. Complex functions f :⊆ C → C which can be defined by power series are called analytic [Ahl66]. We will discuss computability of analytic functions in Sect. 6.5. Let f : R → R be a (total) computable real function and let X ⊆ R be a “very complicated” set. Then by definition the restriction fcX is also computable. But fcX has a computable extension with the simple domain R. There is, however, a computable real function with very complicated domain, which has no computable extension. Example 4.3.14 (a computable function with inherent Gδ -domain). Define the function f :⊆ R → R by P −i {2 | µ(i) < x} if x 6∈ Q f(x) := div otherwise, where µhi, j, ki := (i−j)/(1 +k). Let M be a Type-2 machine which on input p = ι(u0 )ι(u1 ) . . . ∈ dom(ρC ) operates in stages i = 0, 1, 2, . . . as follows. Let (v−1 ) = 0. νQ 120 4. Computability on the Real Numbers Stage i: M searches for some m with |um − µ(i)| > 2−m . If no such m exists, then the computation remains in Stage i forever. Otherwise, M prints ι(vi ) where vi = v i−1 + 2−i , if µ(i) < um − 2−m , and vi = vi−1 otherwise. Then, M produces an infinite output q := ι(v0 )ι(v1 ) . . . ∈ dom(ρC ), iff ρC (p) 6∈ Q, and in this case ρC (q) = f ◦ ρC (p). Therefore, fM realizes the function f. The function f has the domain dom(f) = R \ Q which is a Gδ -set, that is, it can be written as an intersection of a sequence of open sets: R \ Q = T (R\{µ(i)}). R\ Q is even a “computable” Gδ -set (Exercise 4.3.17). Since i∈N for each rational number a = ν(k), limx→a+ f(x) − limx→a− f(x) = 2−k , the function f has no proper continuous extension and hence no proper compu table extension. Every continuous partial real function has an extension with Gδ -domain [Kur66]. Every (ρn , ρ)-computable real function has a strongly (ρn , ρ)-computable extension. The domain of each strongly (ρn , ρ)-computable real function is a computable Gδ -set (Exercise 3.1.5 and Exercises 4.3.17 and 18). In Chap. 9 we will discuss several other definitions for computable real functions and compare them with the definitions given here. As a special case of Corollary 3.2.13, every computable or continuous function from Rn to a discrete space is constant. Lemma 4.3.15. Let µ be a notation of a set M , M 6= ∅. If a function f : Rn → M is (ρn , µ)-continuous, then f is a constant function. n n of the admissible representation ρ Proof: The final topology τR of Rn is connected. Apply Corollary 3.2.13. Corollary 4.3.16. 1. Every (ρn , νN )-continuous or -computable function f : Rn → N is constant. )-continuous or -computable function f : Rn → Q is con2. Every (ρn , νQ stant. 3. Every (ρn , δB )-continuous or -computable function f : Rn → B is constant (δB from Definition3.1.2). Proof: The first two statements are immediate. Consider i ∈ N. The function )-continuous, and Hi : h 7→ h(i) is (δB , νN)-computable, hence Hi ◦ f is (ρn , νN so constant. Therefore, f is constant. Exercises 4.3. 1. Let f : R × R → R be a computable function and let c ∈ R be a computable constant. Define g(x) := f(x, c) for all x. Show that g is computable. 4.3 Computable Real Functions 121 2. The Gauß staircase is (ρ, ρ> )-computable. Its restriction to R \ Z is (ρ, ρ)-computable. 3. Use Exercise 3.1.4 to show that ∅ and R are the only ρ-decidable subsets or R. 4. Show that in Theorem 4.3.2 Property 3 follows from Properties 1,2 and 5. 5. Show that the real functions x 7→ |x|, x 7→ ||x||, (x, y) 7→ d(x, y) and (x, y) 7→ de (x, y) for x, y ∈ Rn are computable. 6. Let a0 , b0, . . . , an , bn ∈ Q with a0 < . . . < an . Show that the rational polygon f : R → R, defined by if x < a0 b0 f(x) := bi + (x − ai )(bi+1 − bi )/(ai+1 − ai ) if ai ≤ x < ai+1 bn if an < x , is computable. 7. Show that the function ((xi )i∈N, n) 7→ n Y xi i=0 8. 9. 10. 11. 12. 13. 14. 15. is ([ρ]ω , νN , ρ)-computable. Show that Lemma 4.3.6, Theorem 4.3.7 and Theorem 4.3.8 hold for Rn replacing R (and, in particular, for complex numbers). Let (fi )i∈Nwith fi : R → R be a sequence of real functions with a) (i, x) 7→ fi (x) is (νN, ρ, ρ)-computable, b) there is a computable function e : N2 → N with |fi (x) − fj (x)| ≤ 2−n for all i, j ≥ e(n, k) and |x| < k. Show that the sequence converges to a computable function f : R → R. Complete the proof of Theorem 4.3.9. Let a, b ∈ R, a < b, a right-computable and b left-computable, a and b not computable. Show that there is a real function f :⊆ R → R such that f is strictly increasing, dom(f) = (0; 1), range(f) = (a; b), f and f −1 are computable. The computable function f has a (unique) continuous extension to [0; 1] which is not computable. (Hint: consider Example 4.2.4.3; let f be an infinite polygon.) Prove that z 7→ log(1 + z) is computable on the open disc {z | |z| < 1}. Prove that x 7→ arcsin x is computable on the open interval {x | |x| < 1}. Show that the real exponential function x 7→ ex is (ρ< , ρ< )-computable. (Sorting real numbers) a) Show that the function f : Rn → Rn, defined by f(x1 , . . . , xn ) := (y1 , . . . , yn ) such that {x1 , . . . , xn } = {y1 , . . . , yn } and y1 ≤ y2 ≤ . . . ≤ yn , is computable. b) Show that the multi-valued function f : R2 N, defined by Rf := )-continuous. {((x1 , x2), i) | xi = min(x1 , x2)}, is not (ρ2 , νN 122 4. Computability on the Real Numbers c) Show that the function (x1 , . . . , xn ) 7→ π, xi ∈ R, xi 6= xj for 1 ≤ i, j ≤ n , 16. 17. 18. 19. 20. 21. 22. 23. where π is the permutation of {1, . . . , n} such that xπ(1) < . . . < xπ(n) , is (ρn , ν)-computable (where ν is a canonical notation of the permutations of {1, . . . , n} ). Let 0 < a < b be left-computable real numbers. Show that there is a (νN, νQ )-computable sequence of rational numbers ai with b − a = limi→∞ ai . T S Show thatthere is some r.e. set A ⊆ Σ ∗ × Σ ∗ with R \ Q = u v I1v | (u, v) ∈ A (that is, R \ Q is a “computable” Gδ -set). T S [Wei93] Call X ⊆ R a computable Gδ -set, iff X = u v I1v | (u, v) ∈ A for some r.e. set A ⊆ Σ ∗ × Σ ∗ . a) Show that every computable real function f :⊆ R → R has a strongly (ρ, ρ)-computable extension (Exercise 3.1.5). b) Show that dom(f) is a computable Gδ -set for every strongly (ρ, ρ)computable real function f : R → R. c) Show that for every computable Gδ -set X there is a strongly (ρ, ρ)computable real function f : R → R with X = dom(f). d) Let X ⊆ N be a Π2 -subset, that is, X = {x ∈ N | (∀i)(∃k)(x, i, k) ∈ B} for some decidable set B ⊆ N3. Show that X is a computable Gδ subset of R. (If X is r.e. , then X, N \ X and R \ X are computable Gδ -subsets of R.) For a function f : Rm → Rn, the following properties are equivalent: a) f is (ρm , ρn )-computable, m b) the set {(u, v)S| f[I (u)] ⊆ In (v)} is r.e. , c) f −1 [In (v)] = Im (u) | (u, v) ∈ B for some r.e. set B ⊆ Σ ∗ × Σ ∗ (Theorem 3.2.14). Show that every continuous, (ρn , idΣ ω )-continuous or (ρn , idΣ ω )-computable function f : Rn → Σ ω is constant. Let f : Rn → Rn be computable. Show that the function (n, x) 7→ f n (x) is (νN, ρn , ρn )-computable. Hint: Apply Theorem 3.1.7. For c ∈ C define fc : C → C by fc (z) := z 2 + c. Show that the function , ρ2 , ρ2 )-computable. Hint: Apply Theorem 3.1.7. (n, c) 7→ fcn (0) is (νN Show that every continuous (and hence (ρn , ρ)-continuous) function f : Rn → R with range(f) ⊆ Q is constant.