Computational Complexity of Space-Bounded Real Numbers

05/07/2018 ∙ by Masaki Nakanishi, et al. ∙ 0

In this work we study the space complexity of computable real numbers represented by fast convergent Cauchy sequences. We show the existence of families of trascendental numbers which are logspace computable, as opposed to algebraic irrational numbers which seem to required linear space. We characterized the complexity of space-bounded real numbers by quantifying the space complexities of tally sets. The latter result introduces a technique to prove the space complexity of real numbers by studying its corresponding tally sets, which is arguably a more natural approach. Results of this work present a new approach to study real numbers whose transcendence is unknown.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

The set of computable real numbers form the basis of a modern theory of computable analysis. Real numbers were originally studied in computational complexity theory in the seminal work of Hartmanis and Stearns

[5], where it was shown that algebraic numbers are polynomial-time computable. Later, Cobham [3] showed that no finite state automaton can compute the digits of algebraic irrational numbers. From those works stemmed what today is known as the Hartmanis-Stearns conjecture, which states that if a real number is real time computable with respect to some natural base, then that number is either rational or trascendental. The Hartamnis-Stearns conjecture has many implications as recounted by Freivalds [4], for example, it implies the no existence of optimal algorithms for integer multiplication and it will solve the transcendence of several real numbers, just to name a few. More recently, Adamczewski and Bugeaud [1] made an important breakthrough towards the Hartmanis-Stearns conjecture where they showed that no algebraic irrational number is computable by a pushdown automaton. Currently, this is the only result where algebraic irrational numbers are not computable even in the presence of some non-constant amount of memory.

Heartmanis and Stearns [5] presented an algorithm that computes any algebraic numbers in polynomial time and linear space. Motivated by this fact, in this work we study real numbers that are computable in bounded-space in order to understand if linear space is a necessary amount of memory for algebraic irrational numbers. First, in Theorem 3.1 of Section 3 we show a space hierarchy theorem for real numbers, which implies that the space complexity of trascendental numbers cannot be bounded, unlike algebraic numbers. In Section 4 we study the space complexity of trascendental numbers and we show general theorems for trascendental numbers with certain natural forms. Contrary to the situation of trascendental numbers where space-efficient algorithms exist, it is very difficult to construct space-efficient algorithms for algebraic irrational numbers.

In order to conduct a study in the theory of space-bounded real numbers, we follow an idea initiated by Ko [6] which relates the polynomial time computability of real numbers to classical computational complexity theory. Yu and Ko [8] initiated a study of logspace computable real numbers where they showed how open problems in the theory of space-bounded tally sets relates to representations of a real number. In Theorem 5.1 we present a characterization of the space complexity of a real number in terms of the space complexity of a tally set representing the same number. With this characterization, if we would like to design a space-efficient algorithm for a real number, it suffices to construct such an algorithm for its corresponding tally set, which is most of the time more natural to work with. In Theorem 6.1 we present a relation between the set of left-cuts representations of a real number and its space complexity. As a result we have that tally sets corresponding to a real number and its left-cuts representations are polynomial-space equivalent. Finally, in Section 7 we show that constant-space machines modeled by finite automata cannot recognize irrational numbers even with the help of advice.

For several cases of the real numbers studied in this work there exist space-efficient algorithms, whereas for algebraic irrational numbers the best algorithm needs to remember all digits previously computed. The results of this work thus suggest a new conjecture for algebraic irrational numbers, namely, that there is no algorithm that computes algebraic irrational numbers using sublinear space.

2 Preliminaries on Computable Numbers and Complexity

2.1 Computable Numbers

We use to denote the set of the natural numbers including 0. In the rest of this paper, we will use multitape Turing machines with blank symbols denoted by .

A dyadic number is a number of the form for integers and with . The binary expansion of a dyadic number is

where and each and are the digits of the integer and binary parts of , respectively. We say that the string represents or is a representation of in base 2.

Given a representation of a dyadic number , we denote by the number of symbols in the representation of and we use to denote the number of symbols to the right of the binary point in . Furthermore, we let and .

Given a function we say that binary converges to a real number if for all , . Thus the sequence is a fast-convergence Cauchy sequence. If binary converges to , we call a Cauchy function of . We denote by the set of all Cauchy functions of ; see Ko [6] for more details.

The function is computable if there exists a Turing machine that on input in unary outputs a representation of . A real number is computable if there exists a computable function .

Given a function over , the time (or space) complexity of a computable real number is bounded by if there exists a Turing machine that on input outputs a representation of a dyadic number such that and uses moves (or memory cells, respectively). As a short-hand we will use and to denote the time and space complexities of , respectively. For any we define the class .

Fact 1

Any rational number can be computed in constant space.

Hartmanis and Stearns [5] present an algorithm for computing algebraic real numbers, which runs in linear space.

Fact 2

Any real algebraic number can be computed in linear space. (App.0.A)

2.2 Oracle Turing Machines and Reducibility

Consider any Turing machine . An oracle is a subrutine that is incorporated in and can be used to ask questions with answers “yes” and “no.” More formally, let be any set and let be a Turing machine that computes with as an oracle. The machine aditionally has one write-only query tape, one query inner state and two answer states, namely the “yes” state and the “no” state . The query tape works like an output tape, that is, it is write-only and everytime a symbol is written, the head over the query tape moves inmediately one cell to the right and can never move left.

In order to make a query to the oracle , first writes a string in the query tape and enters a query state . Then, automatically, changes its state to if the query string belongs to the set , or otherwise. When changes from the query state to one of the answer states, the query string is inmediately deleted and the head is positioned over the first cell from the left. This way, making a query to only takes one step of .

The time complexity of is defined as follows. For any function and any input , the time complexity of , denoted , is if stops within moves on input . Note that the time it takes for to write in the query tape is counted towards its time complexity, whereas each oracle query counts only as one move.

Space complexity is defined similarly. For any function and any input , the space complexity of , denoted , is if the maximum number of work tape cells that uses at any time of its computation is at most on input ; the number of query tape cells used are not counted.

A set is many-one reducible to a set , denoted , if there exists a computable function such that if and only if . The set is Turing reducible to , denoted , if there exists a TM such that computes .

In this work we use and to denote many-one and Turing reductions bounded by space, respectively. Analogously, we use the superscript “” for polynomial-space reductions. We also use to denote equivalence, that is, if and only if and .

3 A Space-Hierarchy Theorem

From Fact 2 we know that any algebraic real number is computable in linear space. In this section, however, we show in Theorem 3.1 that there exists an infinite hierarchy of computable real numbers. Thus, for trascendental numbers there is no such bound.

Before proving the main result of this section, we introduce the following technical lemma.

Lemma 1 (App.0.d)

Let be a Turing machine that computes a real number using space. There exists a machine that on input outputs the -th digit of in space .

Theorem 3.1 (Space-Hierarchy Theorem for Real Numbers)

Let and be two space-constructible functions where and . Then .

Proof

By the space hierarchy theorem of [7], there exists a recursive set A such that the set is computable in space but not computable in space ; in particular, there exists a machine that on input outputs 1 if and outputs 0 if in space , and there is no Turing machine with a unary input that decides A in space .

We will construct a real number from A such that is in and not in . Let , and define if and 0 otherwise.

For the sake of contradiction, assume that , that is, there exists a machine that on input writes on its output tape and .

Now we construct a machine that on input decides if using space, thus contradicting the fact that A is not computable in space .

Since computes in space , from Lemma 1, there exists a TM that on input outputs the -th bit of in space . Thus, the machine simulates on input and outputs whatever outputs, and hence, the set A is computable in space , which is a contradiction.∎

4 Space Complexity of Trascendental Numbers

From the Space-Hierarchy Theorem of the previous section it is understood that there is no space upper-bound on the set of trascendental numbers. There are trascendental numbers, however, with “natural” definitions that can be computed efficiently.

Theorem 4.1

Let be any computable and strictly monotonically increasing function over the natural numbers.

Let

Then the number is computable in space , where is an upper bound on the space complexity of .

Proof (sketch)

We can construct a TM that outputs the representation of in base 10 as follows. For each input symbol (say, the -th input symbol), we compute and store it in the work tape, which needs and space, respectively. Then, we write a 1 in the -th cell of the output tape. Note that the function is strictly monotonically increasing. Thus, the output tape-head never goes back to the left. In order to execute the above procedure, we need to track the positions of the input and the output tapes, which needs and space, respectively. Thus, our algorithm uses space. ∎

See App.0.B for the detailed proof. Immediately we obtain the following corolary.

Corollary 1

Let be any positive integer. Any number of the form

is computable in logspace.

In particular, the number is known to be trascendental, but is still open. Another interesting example is Liouvilles’s constant which is when , and hence, from Theorem 4.1 it follows that Liouville’s constant is in .

From Fact 1 we know that finite automata or constant-space machines can only compute rational numbers. By a slight change in the definition of what it means for a number to be computable it allows finite automata to compute some irrational numbers.

Let be the set and let in be the -ary expansion of , that is, . A real number is -automatic if there exists a finite state automaton that takes as input in radix- and outputs .

Theorem 4.2 (App.0.f)

Any -automatic number is computable in logspace.

5 Space-Bounded Real Numbers and Tally Sets

Tally sets are languages over unary alphabets, that is, singleton alphabets. In this section, we show in Theorem 5.1 that computable real numbers are computationally equivalent to tally sets, thus, establishing a strong connection between space-bounded computational complexity and the theory of computable real numbers.

Before going into the main result of this section in Theorem 5.1, first we present some technical lemmas which are also relevant for the remaining of this paper.

Lemma 2 (Unary simulation lemma)

Let be a TM that computes a function using space with space-constructible. There exists a TM that simulates using space and computes a function with .

Proof

In order for to simulate , we use a “fake tape” trick and exploit the fact that only works with unary inputs. The machine uses a tape pos, initialized in 0, that stores in binary the position of the input head of . Furthermore, will required an additional constant number of work tapes sufficient to run the simulation of .

On input , first initializes pos:=0 and repeats the following procedure until stops its computation. If , simulate one step of with input symbol ; otherwise, simulate one step of with input symbol . In either case, write in the output tape of whatever output symbol generates and update pos according to the move performed by ’s input tape head. Thus, the output of equals the output of .

The space used by the simulation of is and we only require bits to store the input tape position of .∎

Lemma 3

For any given in unary, is computable in space.

Proof

We construct a TM that on input writes on its output tape.

  1. Initialize tapes and in binary.

  2. Compute in binary and store it in number.

  3. Enter loop.

    1. Compute and and store the results in lower-bound and upper-bound, respectively.

    2. If then copy the contents of floor to the output tape and stop;

    3. else increment the contents of floor and ceiling by 1.

The procedure above works by checking in each step of the loop the relation , and since is finite the loop terminates in finite time. Furthermore, tapes floor, ceiling, number, lower-bound and upper-bound use bits of storage. ∎

For any nonnegative integers and , define a pairing function as a bijective function from to given by . A pairing function from to is easily defined inductively as .

Lemma 4

For any nonnegative integers of at most bits, the pairing function and its inverse are computable in space.

Proof

The computation of is clearly computable in space, because we only need to do four additions, one multiplication and one bit shift which can all be done using logspace.

If , we can obtain and using the following procedure. Let , then

(1)
(2)
(3)

The arithmetic operations of multiplication and addition of Eq.(2) and Eq.(3) can be done in logspace. For the square root of Eq.(1), however, all known algorithms use linear space. For the inversion of the pairing function, however, we only need the floor which can be done in logspace by Lemma 3.∎

Theorem 5.1

Let be any space-constructible function such that . A real number is in if and only if the tally set

is computable in space , where denotes the -th bit in a base-2 representation of .

Proof

We construct a machine computing that operates as follows. Given an input , first inverts the pairing function using the length of as a parameter to obtain and in binary. If then accepts , otherwise it rejects . Since is computable in space , we only need to show that all the other steps can be done in space.

In order to invert the pairing function we need to invoque Lemma 4 two times, first to obtain and , and a second time to obtain and from , using space. This proves the first part of the implication.

Now suppose that is computable in space , and we want to prove that is computable in space . By Lemma 2, there exists a machine that computes using space a function defined as if and otherwise, where is the integer number represented by .

A machine for computing works as follows. On input , in a tape post initialized in 0, keep a count in binary of the output tape position of , and in a tape length store in binary. Then using a tape counter initialized in 0, repeat the following procedure. Simulate with counter as input to obtain its single-symbol output, say . If then for some nonnegative integers and by Lemma 4 we can obtain and in logspace. If and , then write in the output tape of , increment pos in one and set counter:=0; otherwise, if or , increment counter in one. Repeat this procedure to obtain the first output bits of . Since runs in space and counter only stores bits, then runs in space.∎

The proposition below presents an application of Theorem 5.1.

Proposition 1

Let A be any subset of and let . If is decidable in space, then is in .

Proposition 1 follows immediately from Theorem 5.1 and Lemma 5.

Lemma 5 (App.0.e)

.

If we let , the set of prime numbers, we have that has a 1 in every prime position and it is clearly not rational. From Proposition 1 it follows that is computable in logspace because the tally set is computable in logspace; we do not know, however, if is algebraic or trascendental for .

6 Space-Bounded Real Numbers and Non-Tally Sets

In the previous section we presented a characterization between tally sets and space-bounded real numbers. In this section we explore relations between space-bounded real numbers and languages whose alphabets are not singletons. Languages representing real numbers were introduced by Ko [6]. Given , for each define the language as the set of strings representing dyadic rational numbers such that with .

Theorem 6.1

Let be any space-constructible function with . If , then is computable in space for some .

Proof

Let be TM that computes in space for some . We construct another machine that on input simulates and checks if is less than or equal to the output generated by .

To make the proof work we need two technical considerations. First, must compares its input against the output of using space . To compare against using space it suffices to remember only one symbol of at a time. Second, in order to avoid simulating using linear space, we make use of the “fake tape” trick of Lemma 2 for , that is, we store the position of the input head of and simulate by feeding it one 0 symbol at a time. Note that here we cannot use Lemma 2 directly, because we need to remember the output of and compare it against the input which would use linear space.

The machine has one tape to simulate , another tape pos to record the position of the input head of , and a tape prec to store the precision of the input.

With no loss of generality, we consider dyadic numbers betweenen 0 and 1. Let be an input for , and let be the output of on input .

The algorithm executed by is the following.

  1. Compute and store it in the tape prec in binary. To do this, first initialize and scan each input symbol after the binary point. For each input symbol after the binary point, increment prec by one until a blank symbol tape is encountered.

  2. Initialize and position the input head of on the first symbol after the binary point.

  3. Enter a loop.

    1. If , simulate one step of with input symbol ; else, simulate one step of with input symbol .

    2. Update the contents of tape pos accordingly, that is, if moved its input head right or left, increment or decrease pos by one, respectively.

    3. If did not generated any output symbol, then do nothing.

    4. Suppose generated an output symbol and let be the current position of the input head of . If , accept; if , reject.

    5. If entered a halting state, then stop the computation and accept.

Tapes pos and prec use at most bits and the simulation of uses bits.∎

Proposition 2

.

Proof

Let . We construct a machine that decides with oracle access to using space.

We use tapes length and pos to store in binary the length of the input and the position of the input head, respectively. For each with and using tapes length and pos, by Lemma 4, the pairing functions and are computable in space. Note that and have bits. Then query and to the oracle to determine the correct bit . If , reject; if accept. After checkin all bits of , accept. ∎

Proposition 3

.

Proof

Suppose with no loss of generality that . We construct a machine that, on input and using as oracle, decides using space.

In a tape called length we store in binary using bits. By Lemma 4, we can invert the pairing function using space. Note that each and also have bits.

The reduction implements the following procedure. Use exhaustive search to find a largest dyadic number such that . If accept , otherwise reject.

Suppose that . Then, using the procedure above we obtain a dyadic number whose first digits agree with . Therefore, and is accepted. Now suppose that . Since we have that . Hence, and is rejected.

To finish the proof, we need to show that the above mentioned procedure can be implemented in polynomial space. The tape length is used as input to invert the pairing function , which suffices with bits. During the exhaustive search procedure, we only need to remember bits, which again there are at most .∎

Corollary 2

.

7 Non-uniform Deterministic Finite Automata

Constant-space machines are modeled by finite automata, and from Fact 1 it is clear that no irrational number is computable by constant-space machines. As a final result of this paper, we show that constant-space machines cannot recognize irrational numbers even in the presence of external aid which we model as advice.

A deterministic finite automaton with advice has a read-only advice tape in which an advice string is written prior to the computation. The advice string is allowed to depend on the length of the input, but not on the input itself.

A deterministic finite automaton with advice is formally defined as a 7-tuple , where is a finite set of states, (resp. ) is a finite input (resp. output) alphabet, is a state transition function, is the initial state, is the set of halting states, and is a set of advice strings. The input is written in the input tape as , and the advice string is written in the advice tape as , where represents the length of the input , and ¢(resp. $) is the left (resp. the right) end-marker. In the initial configuration, the input tape head and the advice tape head scan the left end-markers, and the state is in . Then, at each step of the computation, the automaton changes its state, moves the input and the advice tape heads by one cell, and outputs a symbol (which can be an empty word ) according to the state transition function. When the automaton reaches one of the halting states, it halts.

Note that our definition of deterministic finite automata with advice can be seen as the Mealy machine equipped with an advice tape.

We say that a deterministic finite automaton computes a real number if for any unary input , it outputs .

A (complete) configuration of a deterministic finite automaton with advice is represented as a triple , where is the current state, is the position of the input tape head, and is the position of the advice tape head. We define a partial configuration as a triple where is the current state, is the symbol scanned by the input tape head, and is the position of the advice tape head.

Lemma 6

Let an input string be . We consider the computation of a deterministic finite automaton with constant-sized advice that outputs more than symbols. Then, the output string is of the form where , and .

Proof

Let be the sequence of configurations made in a computation of the automaton for input . Let be a subsequence induced by all the configurations in which the tape head scans the left or the right endmarker. Let be the length of an advice string and let be the set of states of the automaton. We consider the sequence of the first configurations in , . We have the following two cases.

Case 1. There exists () such that the automaton outputs symbols along the transitions from to .

Let be a smallest number that satisfies the condition of Case 1. We consider a sequence of configurations, . Let be the sequence of partial configurations that corresponds to . Then, there exists and () such that since the number of possible partial configurations is a constant while the length of the sequence, , is . We consider the smallest and . Then, . Note that for the partial configurations, , the scanned input symbol is always . Therefore, the transitions of partial configurations from the initial configuration can be written as , i.e. once the automaton reaches the configuration , it repeats the transitions from to until it reads the left or the right end-marker in . This means that the automaton outputs where is generated by the transitions from to , is generated by the iterations of the transitions from to , and is generated from the rest of the transitions that include the transitions after . Note that is bounded above by a constant (). Also, note that for each , the automaton outputs symbols along the transitions from to . As mentioned above, . Thus, . Also, since . Recall that by the condition of Case 1, the automaton outputs symbols along the transitions from to . Thus, .

Case 2. For all (), the automaton outputs symbols along the transitions from to .

In this case, there exists and () such that since the number of possible configurations in which the automaton scans the left or the right endmarker is . Thus, the automaton repeats the transitions from to infinitely. Therefore, the transitions from the initial configuration can be written as , which means that the automaton outputs where is generated by the transitions from to , and is generated by the iterations of the transitions from to . Note that by the condition of Case 2. ∎

Theorem 7.1

If a deterministic finite automaton with constant-sized advice computes a real number , then is represented as , where can be infinite.

Proof

We consider a deterministic finite automaton with constant-sized advice that computes a real number . Let denote the output for the input . Note that by Lemma 6, we can assume that the output of the automaton is of the form where , and . Then, for any input , there exists an input such that for , the automaton outputs where , and . This means that the first symbols of can be written as for some where is a prefix of since the first symbols of to the right of the binary point agree with . Therefore, is represented as for some , where can be infinite. ∎

Theorem 7.1 implies that deterministic finite automata with constant-sized advice cannot compute any irrational numbers.


Acknowledgements. The authors thank Abuzer Yakaryilmaz for useful discussions.

References

  • [1] Adamczewski, B., Bugeaud, Y.: On the complexity of algebraic numbers I. Expansion in integer bases. Annals of Mathematics 165, 547–565 (2007)
  • [2] Chiu, A., Davida, G., Litow, B.: Division in logspace-uniform NC1. RAIRO - Theoretical Informatics and Applications 35(3), 259–275 (2001)
  • [3] Cobham, A.: On the base-dependence of sets of numbers recognizable by finite automata. Mathematical Systems Theory 3, 186–192 (1969)
  • [4] Freivalds, R.: Hartmanis-Stearns conjecture on real time and transcendence. In: Proceedings of Computation, Physics and Beyond – International Workshop on Theoretical Computer Science. LNCS, vol. 7160, pp. 105–119. Springer (2012)
  • [5] Hartmanis, J., Stearns, R.E.: On the computational complexity of algorithms. Transactions of the American Mathematical Society 117, 285–306 (1965)
  • [6] Ko, K.: Complexity Theory of Real Functions. Birkhäuser (1991)
  • [7] Stearns, R.E., Hartmanis, J., Lewis, P.M.: Hierarchies of memory limited computations. In: Proceedings of the 6th Annual Symposium on Switching Circuit Theory and Logical Design (FOCS). pp. 179–190 (1965)
  • [8] Yu, F., Ko, K.: On logarithmic-space computable real numbers. Theoretical Computer Science 469, 127–133 (2013)

Appendix

Appendix 0.A Proof of Fact 2

Since computing the integer parts are trivial, we pick a real algebraic number, say , between 0 and 1. Let be its minimal polynomial. The rational number represents the first -th bit(s) of after the decimal point. We pick a sufficiently big integer such that is the closest root to . Since is minimal either and or vice versa. We can easily determine the case by computing both values. We assume the first case. (We can take for the other case.)

Let be a Turing machine that on input operates as follows. The first bits of are stored in the description of as . If , the machine outputs each bit of up to . In this case, does not use any work tape and constant space suffices to output the first bits.

If the machine operates as follows. First, write in the output tape. Let be different work tapes in . Copy on tape . Starting from repeat the procedure below times.

  1. For each compute and store it on tape .

  2. For each multiply with and store the result in tape .

  3. Add and store the result in tape .

  4. If , write 1 on the output tape and copy it on tape ; this will make

  5. If , write 0 on the output tape; this will make .

  6. Increment in one and if return to step 1.

Each addition and multiplication can be done in logspace. Each work tape , however, stores at most bits; this is because in the last iteration of the algorithm the tape stores .

Appendix 0.B Proof of Theorem 4.1

We construct a machine that outputs the representation of in base 10 as follows. The TM has three main tapes called pos_in, pos_out and res. The pos_in tape will track the position of the input tape-head. The pos_out tape will track the position of the output tape-head. The res tape will store temporary results for the computation of . Besides these three main tapes, the machine will use some extra finite number of tapes that depends on the computation of . All tapes involved will use a binary alphabet.

The algorithm is the following.

  1. If the first symbol under the input tape-head is , then write 0 in the output and stop the computation.

  2. Initialize tapes. Write 1 in pos_in and pos_out. Leave the others blank.

  3. Write ”0.” in the output tape.

  4. Enter a cycle

    1. If the input tape-head scans (i.e., the input tape-head reaches the end of the input), break the loop.

    2. Compute and store the result in res.

    3. Enter cycle

      • If pos_out=res, write 1 in the output tape and break the inner loop.

      • If pos_out res (in this case, pos_out res ), write a 0 in the output tape and move the output tape-head to the right by one cell. At the same time, increment pos_out.

    4. Move the input tape-head to the right, and increment pos_in.

At the start of iteration of the cycle of step 4(c), pos_in=. The algorithm checks if the current tape-head position of the output tape (pos_out) equals the value of res. If pos is not equal to res, the algorithm moves the output tape head by one cell towards res (i.e., to the right) and repeats the cycle. When , the algorithm writes a 1 in the output tape and breaks the inner circle.

We analyze the space complexity. The tape pos_in uses at most cells. In the worst case, the tape pos_out and res store the value of , thus, it uses at most cells. The amount of space to perform the computation of is bounded from above by . Thus, it follows that the total amount of space is . ∎

Appendix 0.C Space Complexity of Arithmetic Operations on Rational numbers

Lemma 7 ([2])

Given any two integer numbers and in binary, the division of by can be done in logspace.

Lemma 8

Any two rational numbers can be multiplied in logspace.

Proof

Let and be two rational numbers. We assume that are given as inputs to a Turing machine in radix-2.

The machine multiplies and and then and , which can be done in logspace. Let where and .∎

Lemma 9

Any two rational numbers can be added in logspace.

Proof

Let and be two rational numbers. We assume that are given as inputs to a Turing machine in radix-2.

The machine operates as follows. First, multiplies in logspace . Then computes , where each addition and multiplication takes logspace.∎

Lemma 10

Any fraction can be transformed to its lowest terms in linear space.

Proof

Let be a rational number. With no loss of generality assume that and that and are given as inputs in radix-2. Then execute the following algorithm.

  1. Let , and .

  2. Repeat until .

    1. Divide and .

    2. If both divisions have residue 0, let and ; else, increment in one.

The procedure above outputs to its lowest terms and it takes linear space because we only need to keep and in memory at all times and division also takes logspace.∎

Corollary 3

Any two rational numbers can be added and multiplied to its lowest terms in linear space.

Appendix 0.D Proof of Lemma 1

We construct a machine that simulates . Let counter and max be two working tapes. First, sets counter:=0 and counts in binary the input size using max. Thus, max stores the input length in binary. Then, sets its input tape head at the beginning of its input tape and starts simulating using its own input tape as input for . Every time generates an output symbol, if then increment counter; otherwise, if , let write the output symbol of on ’s output tape and stop the computation.

The space utilized by is because max and counter tapes use at most space, and the simulation of uses space.∎

Appendix 0.E Proof of Lemma 5

We construct a logspace machine with oracle access to the set . On input , using Lemma 4 compute in logspace the inverse of the pairing function to obtain . Note that each has bits. If and then accept, or if and then also accept; in other cases, reject. The reduction is computable in logspace because of Lemma 4 and the logspace computability of .∎

Appendix 0.F Proof of Theorem 4.2

Let be a -automatic real number and let be a finite-state automaton that computes . We construct a Turing machine that on input outputs .

With no loss of generality, assume that , that is, is in the interval . Let count be tape that keeps a counter in binary. If the input tape is empty, write 0 in the output tape and stop. If the input tape is not emtpy, then for each symbol in the input tape, increment count by one and simulate using the contents of count as input. Thus, for each input symbol that is scanned, write the output of on the output tape of .