fractal dimension of space-time diagrams and the runtime complexity of small turing machines

18
Box dimension and Turing machines The experiment Demo Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines Joost Joosten, Fernando Soler-Toscano and Hector Zenil [email protected], [email protected], [email protected] MCU 2013, Z ¨ urich September, 2013 Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Upload: hector-zenil

Post on 29-Nov-2014

1.777 views

Category:

Education


0 download

DESCRIPTION

Complexity measures are designed to capture complex behaviour and to quantify how complex that particular behaviour is. If a certain phenomenon is genuinely complex this means that it does not all of a sudden becomes simple by just translating the phenomenon to a different setting or framework with a different complexity value. It is in this sense that we expect different complexity measures from possibly entirely different fields to be related to each other. This work presents our work on a beautiful connection between the fractal dimension of space-time diagrams of Turing machines and their time complexity. Presented at Machines, Computations and Universality (MCU) 2013, Zurich, Switzerland.

TRANSCRIPT

Page 1: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Fractal Dimension of Space-time Diagramsand the Runtime Complexity of Small Turing

Machines

Joost Joosten, Fernando Soler-Toscano and Hector Zenil

[email protected], [email protected], [email protected]

MCU 2013, ZurichSeptember, 2013

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 2: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

The small TuringMachine database

Small Turing machines

We consider Turing machines where the tape extends infinitely inone direction (to the left in the diagrams)Each tape cell contains one symbol (color)We use just two colors: black and whiteA Turing machine starts its computation with the head at the firsttape cell (beginning of the tape)The input of the computation is written at the initial cellsThe computation ends when the machine is at the beginning ofthe tape and moves to the right (out of the tape)The tape configuration upon termination of a computation iscalled the outputThe set of Turing machines with n states and k colors isrepresented by (n, k)We have enumerated the machines in (n, k) from 0 to (2 ·n · k)n·k

−1We present the results of an exhaustive study of (2, 2) and (3, 2)

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 3: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

The small TuringMachine database

Space-time diagrams

A space-time diagram for some computation is the jointcollection of consecutive memory configurations

The top-row of each diagramrepresents the input (1 to 14)The computation starts withthe head of the TM in state 1in the rightmost cellEach lower row represents thetape configuration of a nextstep in the computation

These space-time diagrams define spatial objects by focussingon the black cells. We can measure the geometrical complexity.We wish to see if there is a relation between this geometricalcomplexity and the computational complexity (space or timeusage) of the TM in question.

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 4: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Fractal dimensions

Box dimension

The notion of Box dimension was introduced by Kolmogorov asa simplification of the Hausdorff dimensionSuppose we have a mathematical object S of bounded size. Theidea is to cover S with boxes in Rn and estimate the “volume”V(S) of S as function of the total number of boxes N(S) needed tocover S: V(S) = limr↓0 rdN(S, r)

Definition (Box dimension)Let S be some spatial object that can be embedded in some Rn, letN(S, r) denote the minimal number of boxes of size r needed to fullycover S. The Box dimension of S is denoted by δ(S) and is defined by

δ(S) := limr↓0

log(N(S, r))

log( 1r )

in case this limit is well defined. In all other cases we shall say thatδ(S) is undefined.

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 5: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Fractal dimensions

Box dimension for Space-Time diagrams

We adapt the notion of Box dimension to space-time diagramsClearly, for each input on which the TM halts the correspondingspace-time diagram has dimension 2: it’s a piece of surfaceIt gets interesting when we consider limiting behavior of the TM

Definition (Box dimension of a Turing machine)Let τ be a TM that converges on infinitely many input values x. Incase τ(x) ↓, let N(τ, x) denote the number of black cells in thespace-time diagram of τ on input x and let t(τ, x) denote the numberof steps needed for τ to halt on x.We will define the Box dimension of a TM τ and denote it by d(τ). Incase t(τ, x) is constant from some x onwards, we define d(τ) := 2.Otherwise, we define

d(τ) := lim infx→∞

log(N(τ, x)

)log(t(τ, x)

) .Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 6: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

The Space-Time Theorem and applications

The Space-time Theorem: upper and lower bounds

Theorem (Space-time Theorem: upper bound)Let us, for a given TM τ, denote by s(x) the number of cells visited byτ on input x, and let t(x) denote the number of computation steps ittook τ to terminate on input x.

If lim infx→∞log(s(x))log(t(x)) = n then d(τ) ≤ 1 + n.

Lemma (lower bound)For each TM τ we have that d(τ) ≥ 1.

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 7: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

The Space-Time Theorem and applications

The Upper Bound Conjecture

LemmaIn case a TM τ uses polynomial space, and runs super-polynomialtime we have that d(τ) = 1.More in general, if τ uses space sτ(x) and time tτ(x) on input x then

lim infx→∞

log(sτ(x))

log(tτ(x)) = 0 ⇐⇒ d(τ) = 1.

Conjecture (Upper Bound Conjecture)We conjecture that for each n ∈ ω and each TM τ in (n, 2) space that

d(τ) = 1 + lim infx→∞

log(sτ(x))

log(tτ(x))

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 8: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

The Space-Time Theorem and applications

The Space-Time Theorem and P versus NP

Using the previous Lemma, we can state a separation of P andNP in terms of dimensions:

Let Π be some NP-complete problemIf for each PSPACE Turing machine τ that decides Π we have thatd(τ) = 1, then P , NP.

Clearly, this does not constitute a real strategy since, in general, itis undecidable whether d(τ) = 1

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 9: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Methodology

Slow convergence

Our aim is to use computer experiments to compute the Boxdimension of all TMs τ where d(τ) is not predicted by anytheoretical result.A substantial complication is caused by theoccurrence of logarithms in d(τ)As a consequence, increase in precision ofd(τ) requires exponentially larger inputs

For (2, 2) TM 346 we know that its Box dimension is 2, but we cansee in the picture how slow the rate of convergence isOur way out here is to apply numerical and mathematicalanalysis to the functions involved so that we can retrieve theirlimit behavior.We are interested in three different functions:

tτ(x), number of time-steps needed for τ to halt on input xNτ(x), number of black cells in the space-time diagram of τ oninput xsτ(x), number of tape cells visited by τ on input x

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 10: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Methodology

Steps followed

Each TM in (2, 2) also occurs in (3, 2) so for the final results itsuffices to focus on this data-set. We isolated the TMs for whichthere is no theorem that predicts the corresponding dimension.

Boxes Runtime Space MachinesO(n3) O(n2) O(n) 3358O(n4) O(n3) O(n) 6o(P) o(P) o(P) 14

Per TM τ, we determined its functions sτ(x) (space), tτ(x) (time)and Nτ(x) (black cells). We used FindSequenceFunction andother Mathematica functions. This is the hard work!Per TM τ, we computed its dimension d(τ) asd(τ) = lim infx→∞

log(Nτ(x))log(tτ(x))

Per TM τ, we compared its dimension d(τ) to its theoreticalupper bound 1 + lim infx→∞

log(sτ(x))log(tτ(x))

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 11: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Methodology

Alternating convergent behavior

Some machines have alternating asymptotic behaviorThis is the most extreme example (TM 1,728,529):

For convenience we have changed theorientation of the diagrams so that time‘goes from left to right’ instead of from‘top to bottom’.

In a sense this TM incorporates twodifferent algorithms to compute thisoutput: one in linear time, the other, inexponential time.

We have found alternating sequences of periodicity 2, 3 and 6The periodicity typically reflects either the number of states, thenumber of colors, or a divisor of their product.It is this alternating behavior which complicated the analysis ofthe data set in a straight-forward automated fashion.

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 12: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Most salient results of the experiment

Findings in (2, 2) space

In (2, 2) there was a total of 74 different functions. Only 5 of themwhere computed by some super-linear time TMsIn total, in (2, 2) space, there are only 7 TMs that run insuper-polynomial time. Three of them run in exp-time, allcomputing the tape-identity. The other four (see below) TMscompute different functions (that roughly double the tape input)All these four TMs perform in quadratic time and linear space.The dimension for these functions is 3

2 . This is exactly the upperbound as predicted by the Space-Time Theorem.

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 13: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Most salient results of the experiment

Findings in (3, 2) space

The (3, 2) space contains 2,985,984 many different TMs whichcompute 3,886 different functionsAlmost all TMs used at most linear space for their computationsThe only exception to this was when the TM used exponentialspaceBusy Beaver: we call a TM β a Busy Beaver whenever for eachTM τ, there is some value x0 so that for all x ≥ x0 we havetβ(x) ≥ tτ(x)Twin Machines 599,063 and 666,364 are the Busy Beavers in (3,2)space, running in exponential space and time.

They compute the largest runtime, space and boxes sequences.They also produce the longest output strings. Fractal dim.: 3/2

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 14: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Most salient results of the experiment

The space-time theorem revisited

One of our most important empirical findings is that the upper boundas given by the Space-Time Theorem is actually always attained in(3, 2) space.

Finding 1For all TMs τ in (3,2) space we found that

d(τ) = 1 + lim infx→∞

log(sτ(x))log(tτ(x))

as conjectured in the Upper Bound Conjecture that this holds ingeneral for TMs with a larger number of states.

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 15: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Most salient results of the experiment

Other findings

Finding 2For all TMs τ in (3,2) space we found that d(τ) = 1 if and only if theTM ran in super-polynomial time using polynomial space. Wesuspect that this equivalence holds no longer true in higher spaces,i.e., spaces (n, 2) for n > 3.

Finding 3For all TMs τ in (3,2) space we found that d(τ) = 2 if and only if theTM ran in at most linear time. It is unknown if this equivalence holdstrue in higher spaces (the “if” part holds in general and is proven inprevious lemmas)

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 16: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Most salient results of the experiment

Richness in the (3, 2) space

We have found two symmetric performers for even inputsThis can only occur in machines computing the tape identity andrequires strong conditionsIt’s surprising that such constraints can be met in (3, 2)

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 17: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Demo

We have prepared a demo to visualize the space-time diagramsfor several TMs in (3, 2)It will be published in Wolfram Demonstrations Project, and it’savailable upon request

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines

Page 18: Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small Turing Machines

Box dimension and Turing machines The experiment Demo

Demo

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small TuringMachines