concurrent turing machines as rewrite theories

12
Concurrent Turing Machines as Rewrite Theories Berndt Farwer, Manfred Kudlek, Heiko R¨ olke University of Hamburg Faculty of Mathematics, Informatics, and Natural Sciences Dept. of Informatics, Vogt-K¨ olln-Str. 30, 22527 Hamburg, Germany {farwer,kudlek,roelke}@informatik.uni-hamburg.de Abstract. We define Concurrent Turing Machines (CTMs) as Turing machines with Petri nets as finite control. This leads to machines with arbitrary many tape heads, thus subsuming any class of (constant) k- head Turing machines. Concurrent Turing machines correspond to a class of multiset rewriting systems. The definition of a CTMs as a rewrite theory avoids the need for encoding multisets as words and using an equivalence relation on configurations. Multiset rewriting lends itself to be used in rewriting systems and tools like the rewriting engine Maude. For the rewriting system, a configuration is given by a varying sequence of strings and multisets. 1 Introduction We introduce a Turing machine model with concurrency and investigate the implications that this extension of the traditional sequential formalism has on issues like computability, decidability, and complexity. In summary, the basic ideas for concurrent Turing machines are: A Petri net replaces the finite automaton as finite control Each token in the Petri net is associated with an individual tape head Tape heads can only be distinguished if they are associated with tokens on different places or have different positions on the tape For the execution of a transition with multiple input tokens, thus involving more than one head, the heads have to occupy the same position on the tape. Other Turing machine formalisms that employ multiple heads or multiple controls are known in the literature (e.g. [2], [5], [6], [7], [8]) but none of them use a concurrent control part. It is known that multi-head TMs are equally powerful as standard TMs. In the conclusion we give some hints on further extensions of the Concurrent Turing Machine model as well as similar extensions of other automata, such as the push down automaton. Proc. CS&P '06 352

Upload: vuonglien

Post on 05-Jan-2017

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Concurrent Turing Machines as Rewrite Theories

Concurrent Turing Machinesas Rewrite Theories

Berndt Farwer, Manfred Kudlek, Heiko Rolke

University of HamburgFaculty of Mathematics, Informatics, and Natural Sciences

Dept. of Informatics, Vogt-Kolln-Str. 30, 22527 Hamburg, Germany{farwer,kudlek,roelke}@informatik.uni-hamburg.de

Abstract. We define Concurrent Turing Machines (CTMs) as Turingmachines with Petri nets as finite control. This leads to machines witharbitrary many tape heads, thus subsuming any class of (constant) k-head Turing machines.

Concurrent Turing machines correspond to a class of multiset rewritingsystems. The definition of a CTMs as a rewrite theory avoids the needfor encoding multisets as words and using an equivalence relation onconfigurations. Multiset rewriting lends itself to be used in rewritingsystems and tools like the rewriting engine Maude. For the rewritingsystem, a configuration is given by a varying sequence of strings andmultisets.

1 Introduction

We introduce a Turing machine model with concurrency and investigate theimplications that this extension of the traditional sequential formalism has onissues like computability, decidability, and complexity.

In summary, the basic ideas for concurrent Turing machines are:

– A Petri net replaces the finite automaton as finite control– Each token in the Petri net is associated with an individual tape head– Tape heads can only be distinguished if they are associated with tokens on

different places or have different positions on the tape– For the execution of a transition with multiple input tokens, thus involving

more than one head, the heads have to occupy the same position on the tape.

Other Turing machine formalisms that employ multiple heads or multiplecontrols are known in the literature (e.g. [2], [5], [6], [7], [8]) but none of themuse a concurrent control part. It is known that multi-head TMs are equallypowerful as standard TMs.

In the conclusion we give some hints on further extensions of the ConcurrentTuring Machine model as well as similar extensions of other automata, such asthe push down automaton.

Proc. CS&P '06

352

Page 2: Concurrent Turing Machines as Rewrite Theories

1.1 Overview

After giving some general remarks on the notation used in this paper, we in-troduce in Section 2 the proposed model of concurrent Turing machines andgive several acceptance conditions in Section 2.1. Section 3 defines complexitymeasures for CTMs and Section 4 gives an example. In Section 5 we introduceCTMs as rewrite theories and give some examples using the Maude rewritingengine. We address tool support and conclude the paper with some remarks onfurther extensions.

1.2 Notation

For any set A define the set of multisets over A by MS(A). Each f ∈ MS(A)is given as f : A → N and is alternatively denoted by f .

A tuple N = (P, T, F ) is called Petri net iff the set of places P and theset of transitions T are disjoint, i.e. P ∩ T = ∅ and the flow relation F ⊆(P×T )∪(T×P ). Some commonly used notations for Petri nets are •y := ( F y)for the pre-set and y • := (y F ) for the post-set of a net element y ∈ P ∪ T .

A P/T-net structure is a tuple N = (P, T,pre,post), such that P is a finiteset of places, T is a finite set of transitions, with P ∩ T = ∅, and pre,post :T →MS(P ) are multiset mappings. A marked P/T net is an P/T-net structure(P, T,pre,post) together with an initial marking m0 ∈MS(P ). The term P/Tnet is used for both the unmarked and the marked case and the meaning willbe obvious from the context. The flow relation F is defined by F := {(p, t) |pre(t)(p) > 0}∪{(t, p) | post(t)(p) > 0}. Alternatively, a P/T net structure canbe denoted by N = (P, T,W ) were P and T have the same meaning as above,and weight : P × T ∪ T × P → N is defined as

W (x, y) :=

{pre(y) if y ∈ T

post(x) otherwise

The set of all possible markings for a net structure N = (P, T, F ) is denoted byMN and is defined by the set of place multisets, MN := MS(P ).

A transition t ∈ T of a P/T net N is enabled in marking m iff ∀p ∈ P :m(p) ≥ pre(t)(p) holds. The successor marking after firing t is defined bym′(p) := m(p) − pre(t)(p) + post(t)(p). Enablement of t in marking m isdenoted by m t−→, firing of t is denoted by m t−→ m′. Using multiset opera-tors m t−→ is equivalent to m ≥ pre(t) and the successor marking is m′ :=m− pre(t) + post(t).

For a finite set of symbols Σ, a symbol x ∈ Σ, and a word w ∈ Σ∗, let |w|be the length of w and let |w|x denote the number of occurrences of x in w.

Part 3: Programming

353

Page 3: Concurrent Turing Machines as Rewrite Theories

2 Concurrent Turing Machines

We enrich traditional Turing machines, that were introduced to provide a math-ematical notion of computability and complexity of algorithms, by a concurrentfinite control. Instead of the finite state transition diagram used in sequentialTuring machines, our concurrent version of the Turing machine facilitates a Petrinet for its control. The marking of the Petri net represents the heads that arecurrently available for the computation and just as Petri nets can consume orproduce tokens, our Turing machine control has the ability to consume or toproduce heads. Before going into some detail concerning the actual computa-tion steps that such a machine can undertake, we give the formal definition of aconcurrent Turing machine.

Definition 1 (Concurrent Turing Machine). A Concurrent Turing Machine(CTM) is a tuple A = (P, T,W,Σ, Γ,G,m0 ,F) where

– P is a finite set of places,– T is a finite set of transitions with P ∩ T = ∅,– W : (P × T ) ∪ (T × P ) → N is the arc weight function,– Σ is a finite set of input symbols,– Γ is a finite set of tape symbols with P ∩ Γ = ∅, Σ ⊂ Γ and # ∈ Γ \Σ,– G : T → Γ × Γ × {R,L,H} is the transition guard function,– m0 ∈MS(P ) is the initial marking,– F ⊆ 2MA = 2MS(P ) is the acceptance condition.

Remark 1. For the sake of simplicity, we require that every transition has atleast one input place, i.e. ∀t ∈ T. •t 6= ∅.

In analogy to sequential Turing machines we define configurations (some-times called instantaneous description, ID) as words over the combined sets oftape symbols and places. A configuration describes the tape inscription and thepositions of all heads that are present at some instant. The computation of aCTM is then defined on the set of its configurations.

Definition 2 (configuration). A configuration of a CTM is given by w ∈(Γ ∪ P )∗. Every sub-word w′ = vxw′′ of w with v ∈ P ∗, x ∈ Γ , and w′′ ∈ Γ ∗

describes a portion of the tape, such that for all q ∈ P there are |v|q headspositioned at the tape cell containing x.

The set of configurations of CTM A is denoted conf(A).

Remark 2. Configurations can contain an arbitrary number of tape head posi-tions. A configuration gives a unique instantaneous description of a CTM. Theconverse, however, is not true, since there is no defined order for the head posi-tions in the configuration, resulting in many configurations referring to the sameinstantaneous description of the CTM.

Proc. CS&P '06

354

Page 4: Concurrent Turing Machines as Rewrite Theories

The remainder of this section is devoted to the definition of the actions that aCTM can perform. Transitions are used to describe actions on the tape as well asstate changes in the finite control. Since the control is a Petri net, a state is in facta marking of the net. Each token is associated with a head, as discussed above.A Petri net transition can be executed (or fire) if all input places are sufficientlymarked, in effect removing the input tokens and producing output tokens in theoutput places with the multiplicity given by the arc-weight function. Here, wealso require that the tape heads associated with all input tokens of a transitionto be executed point to the same tape position.

Definition 3 (computation step relation). Firing a transition t ∈ T causesa state change in the control and a modification of the tape. We write c1

t−→ c2 forc1, c2 ∈ conf(A) to denote the transition from configuration c1 to configurationc2. The following conditions have to hold for c1 and c2 where η ∈ {1, . . . , 5}:

∀p ∈ P.∀x, y, z ∈ Γ.∀v, v′, v, v′ ∈ P ∗.

|v|p ≥ W (p, t) ∧ |v′|p = |v|p −W (p, t) ∧ |v′|p = |v|p + W (t, p) =⇒ (η)

(c1 = w1vxvw2

t−→ w1v′yv′w2 = c2

)⇐⇒ G(t) = (x, y, R) (1)(

c1 = w1vzvxw2t−→ w1v

′zv′yw2 = c2

)⇐⇒ G(t) = (x, y, L) (2)

In the above cases of left or right movement, w1 ∈ (Γ ∪ P )∗Γ and w2 ∈ Γ (Γ ∪P )∗ ∪ {ε}.

If no movement is required by the guard, w1 ∈ (Γ ∪ P )∗Γ ∪ {ε} and w2 ∈Γ (Γ ∪ P )∗ ∪ {ε}:(

c1 = w1vvxw2t−→ w1v

′v′yw2 = c2

)⇐⇒ G(t) = (x, y,H) (3)

For the special cases of movement beyond the current left or right borders ofthe configuration the following conditions are required to hold:(

c1 = w1vxvt−→ w1v

′yv′# = c2

)⇐⇒ G(t) = (x, y,R) (4)(

c1 = vvxw2t−→ v′#v′yw2 = c2

)⇐⇒ G(t) = (x, y, L) (5)

The following example illustrates the firing rule of CTMs.

Example 1. Figure 1 illustrates a configuration of a CTM in Fig. 1(a) and its onlysuccessor configuration (Fig. 1(b)) reached by firing transition t. The exampleillustrates that transitions involving more than one input place require the headof all token used in the firing point to the same tape position. Similarly, alltokens resulting from such firing point to same tape position, as determined bythe transition’s guard. This step can also be written in terms of configurations:p1p2ababab ` Ap2p3babab or equivalently either of the three terms: p2p1ababab `Ap2p3babab, p2p1ababab ` Ap3p2babab, p1p2ababab ` Ap3p2babab.

Part 3: Programming

355

Page 5: Concurrent Turing Machines as Rewrite Theories

p1

p2

p3t

# # a b a b a b # #

a,A,R

(a) Configuration before firing t

p1

p2

p3t

# # A b a b a b # #

a,A,R

(b) Configuration after firing t

Fig. 1. State change in a simple CTM

In order not to have to enumerate all possible equivalent representations ofCTM configurations, we introduce an equivalence relation on configurations andsubsequently work modulo this equivalence.

For a CTM A we denote by words(m) the set of words composed of thesymbols in the multiset m, respecting the multiplicities, i.e. words(m) := {w |w ∈ P ∗ ∧ ∀p ∈ P.m(p) = |p|}.

Definition 4. Let A = (P, T,W,Σ, Γ, G,m0 ,F) be a Concurrent Turing ma-chine. The initial configurations of A are given by words(m0)w.

Definition 5. Let Σ, Γ be finite sets of symbols and let m ∈MS(Γ ). Define

mix(m, Σ) := {z ∈ (Σ ∪ Γ )∗ | m(a) = |z|a}.

In the remainder of this paper we use m ∈ MS(A) to denote an arbitraryword from the set {w ∈ A∗ | ∀a ∈ A.m(a) = |w|a}. To clarify when a word isused in the sense of a multiset we use the notion w for the multiset induced byw.

Definition 6. Let u, v ∈ (Γ ∪ P )∗, then u ≡ v iff

∃k ∈ N.u = u0p1u1 . . . pkuk ∧ v ∈ u0words(p1)u1 . . .words(pk)uk

where u0, . . . , uk ∈ Γ ∗ and p1, . . . , pk ∈ P ∗. Denote by [w]≡ the equivalence classof w, i.e. [w]≡ := {v | v ≡ w}.

Whenever no confusion is to be expected, we use [w] instead of [w]≡.

2.1 Acceptance Conditions

Since the finite control of traditional Turing machines has been replaced by aPetri net, we have to adjust the acceptance condition for CTMs to accommo-date the new model. The theory of Petri nets suggests different possibilities ordefining the end of a computation. The most basic – and drastic – end to aPetri net computation is the arrival at a deadlock, i.e. a marking that enablesno transitions in the net. This leads to deadlock acceptance.

Proc. CS&P '06

356

Page 6: Concurrent Turing Machines as Rewrite Theories

Definition 7. Let A = (P, T,W,Σ, Γ,G,m0 ,F) be a Concurrent Turing ma-chine. A configuration c of A is called deadlock iff ¬∃t ∈ T.∃c′ ∈ conf(A).c t−→ c′.

Definition 8 (deadlock acceptance). Let A = (P, T,W,Σ, Γ,G,m0 ,F) bea Concurrent Turing machine. An input word w ∈ Σ∗ is accepted with deadlockacceptance (D-acceptance) by A iff there exists a finite computation of A froman initial configuration leading to a deadlock.

An alternative to deadlock acceptance is the definition of a set of markingsregarded as goals and called final markings. This is closer to the traditional ac-ceptance of Turing machines and leads to the following definition of final markingacceptance.

Definition 9 (final marking acceptance). Let A = (P, T,W,Σ, Γ,G,m0 ,F) be a Concurrent Turing machine. An input word w ∈ Σ∗ is accepted by A withfinal-marking acceptance (FM-acceptance) iff there exists a finite computationof A from an initial configuration leading to a final marking from the decidableset F , i.e. ∃v ∈ T ∗.∃m ∈ MA.w1

v−→ w2, such that w0 ∈ words(m0)w andw2 ∈ mix(F, Γ ) for some F ∈ F .

Remark 3. If in the preceding definition the set of final markings is allowed to beundecidable, we can use it as a kind of oracle, leading to a model more powerfulthan sequential Turing machines.

Combining Definitions 8 and 9 we get the following acceptance condition.

Definition 10 (final marking deadlock acceptance). Let A = (P, T,W,Σ,Γ, G,m0 ,F) be a Concurrent Turing machine. An input word w ∈ Σ∗ is acceptedby A with final-marking acceptance (FM-acceptance) iff there exists a finitecomputation of A from an initial configuration leading to a final marking from F ,i.e. ∃v ∈ T ∗.∃m ∈ MA.w1

v−→ w2, such that w0 ∈ words(m0)w, w2 ∈ mix(F, Γ )for some F ∈ F and w2 is a deadlock.

3 Complexity Measures for CTMs

We consider space and time as complexity measures for CTMs. For space, we canuse the standard definitions from the theory of sequential Turing machines, i.e.the maximum number of tape cells used in an accepting computation for inputw is denoted space(w). For time we distinguish parallel time (time(w)) and so-called work complexity (work(w)). The latter is given by the minimum numberof transitions used for an accepting computation. The former is derived fromexploiting the potential of nondeterminism, i.e. from all accepting computationswe take the shortest sequence of parallel computation steps.

Remark 4. Note that this does not coincide with facilitating the maximal firingrule, since it is possible that a shorter computation arises from a non-maximalconcurrent step by allowing more parallelism later in the computation.

Part 3: Programming

357

Page 7: Concurrent Turing Machines as Rewrite Theories

p2

t1 t2

t3t5

t6 stop

p1

B,B,Ra,a,R

a,a,Rb,B,R

starth1

#,#,Hb,b,H t4 p3p4

Fig. 2. CTM accepting anbn or anbm (n > m) according to the acceptance condition

Work complexity is defined as work(w) := min{|%| | % ∈ T ∗ and m0w%−→

v where v is an accepting configuration}.In addition to the complexity measures already introduced, we have to take

into account the maximal number of tape heads, i.e. the overall cardinality ofthe controlling Petri net’s marking. We call this head complexity, denoted byhead(w) for input w. The head complexity is essential for a realistic estimationof complexity, since the Petri net control part can otherwise be abused as anadditional storage device.

4 An Example

In this section we study a simple example of a CTM and its accepted languagesfor the different acceptance conditions and estimate the complexity involved.

Example 2. P , T , W , and G are derived from the graphical representation inFigure 2. Σ = {a, b} and Γ = {a, b, B, #}. m0 = p1. Various acceptance condi-tions are possible and lead to different accepted languages.

General Idea The general idea of the machine in Figure 2 is the following: Themachine reads the prefix of the input word that consists of characters “a” andduplicates the head for each “a”. These duplicates go forward on the tape untilthey find a “b”, mark it and wait. The original head passes forward on the tapeand collects the heads one after another. Only if the number of “a” is not smallerthan (or equal to, depending on the acceptance condition) all heads are collectedand the stop marking is reached.

Detailed Description Initially, place p1 is marked with one head pointing to thebeginning of the input word. Transition t1 is enabled, if and only if the inputword starts with an “a”, otherwise the machine is in a deadlock. Execution of t1leads to a step right on the tape while the head is duplicated, i.e. it is returnedto p1 and a copy is placed into p2. This proceeds until no “a” can be read fromthe tape, then a “b” is read (Transition t4) and the head halts while in p3. The

Proc. CS&P '06

358

Page 8: Concurrent Turing Machines as Rewrite Theories

duplicated heads on p2 move to the right of the tape over-reading any “a” or“B” until they find a “b”. Reading this is only possible if the original head inp3 is in the same position. Then t5 is enabled and while moving to the right thehead from p2 is deleted while the symbol “b” is replaced by “B”. If the originalhead in p3 reaches the end of the input word, t6 is enabled. Firing of t6 marksthe final place p4.

Accepted Language(s) The machine accepts different languages depending onthe kind of acceptance condition chosen.

– Deadlock Acceptance: The machine accepts every finite input word.– Final Marking Acceptance: For F = {p4}1 the machine accepts exactly the

words of the form anbn. For F = {p2xp4y | x, y ∈ N} all words of the formanbm with n ≥ m are accepted. This holds also for final marking deadlockacceptance.

For each “a” read from the tape a duplicate of the head from p1 is placedon p2. After a “b” is read, no “a” further can be read. Place p2 can only beemptied if at least as many symbols “b” are read as symbols “a” have been readbefore, otherwise at least one token remains in p2. If the input word containsmore symbols “b” than “a” the machine is in a deadlock with p3 marked. Onlyif the end of the input word is reached by occurrences of t5, Transition t6 canbe executed to reach the required final marking.

5 Concurrent Turing Machines as Rewrite Rules

Concurrent Turing machines correspond to a class of multiset rewriting systems.The definition is similar to that of CTMs in this paper but avoids the need forencoding multisets as words and using an equivalence relation on configurations.

For lack of space we do not give the precise definitions here. Multiset rewritinglends itself to be used in rewriting systems and tools like the rewriting engineMaude. For the rewriting system, a configuration is given by a varying sequenceof strings and multisets. The rewrite rules handle the transitions in a similarway as defined in Section 2.

We have implemented CTMs as rewriting systems in Maude, which is sketchedtowards the end of this section in 5.2. First we give some formal definitions.

5.1 A Formal Theory

A configuration is given by c = w0ν1w1 · · · νrwr with r > 0, w0 ∈ Γ ∗, wi ∈ Γ+

(1 ≤ i ≤ r), and νi ∈ P⊕, ν 6= 0 (1 ≤ i ≤ r).A P/T net N = (P, T, µ0) is a triple with a finite set P of places, a finite set

T ⊆ (P⊕P⊕)×P⊕ of transitions, and an initial marking µ0 ∈ P⊕. The elementsof T can also be considered multiset rewriting rules. A rule t = (α, β) ∈ T can

1 Note, that p4 denotes the multiset containing exactly one instance of p4.

Part 3: Programming

359

Page 9: Concurrent Turing Machines as Rewrite Theories

be applied (a transition t can be fired) on µ ∈ P⊕ if α v µ, and the result isµ′ = (µ α)⊕ β.

The marking of N is µ =⊕r

i=1 νi.A rule (transition) t of a CTM is given by t = (t, x, x′, d), t = (α, β) ∈ T ,

x, x′ ∈ Γ , and d ∈ {L,M,R}.A rule (transition) t = (t, x, x′, d), t = (α, β) ∈ T can be applied on a

configuration c = w0ν1w1 · · · νrwr with r > 0 if ∃ i ∈ {1, · · · , r} : wi =xwi ∧ α v νi.

The result of one (basic) step is given by (ν = νi for some i, b the blanksymbol) :

1. d = M : νx ` ((ν α)⊕ β)x′

2. d = L : yνx ` βy(ν α)x′ νx ` βb(ν α)x′ (left end)3. d = R : νxy ` (ν α)x′βy νx ` (ν α)x′βb (right end)

where any ρσ has to be replaced by ρ⊕ σ.Several modes of rule applications are possible:

a. 1 rule at one step (step semantics)b. arbitrary many possible rules concurrently at one stepc. maximally many possible rules concurrently at one step

In b and c it may happen that more than one rule has to be applied at thesame place. Then different modi of writing are possible like arbitrary, common,or priority for rules or symbols.

Another version is that the marking µ of the underlying vector additionsystem (net) is independent of

⊕ri=1 νi. In this case a rule is applied in the same

way as above.Yet another possibility is that a rule works in parallel on several places of

the tape. Formally, a rule t = (α, β) ∈ T can be applied on a configurationc = w0ν1w1 · · · νrwr if

∃m∃j(1) · · · ∃j(m)∃αj(1) · · ·αj(m)∃βj(1) · · ·βj(m) :(m ≤ r ∧ α =

m⊕s=1

αj(s) ∧ β =m⊕

s=1

βj(s) ∧ α v νj(1) ∧ · · · ∧ αj(m) v νj(m)

)A TM rule t is given by a tuple t = (t, f, d) where f : Σ → Σ and d : Σ →

{L, M,R} are functions depending on t.If wj(s) = xj(s), then in a basic step, xj(s) is replaced by f(xj(s)), according

to one of different modi, and the heads are moved by d(xj(s)).If more than one head is on the same place, several possibilities for writing

a new symbol arise:

a. arbitrayb. commonc. priority among headsd. priority among symbols

Proc. CS&P '06

360

Page 10: Concurrent Turing Machines as Rewrite Theories

5.2 Basics of modelling CTMs with Maude

Listing 1.1 shows a basic Maude theory for the CTM in Figure 2 and does notmake use of any alternative modes discussed in Section 5.1 but rather modelsthe basic behaviour introduced in the Section 2.� �mod CTM i s

sorts Token Marking .subsort Token < Marking .vars T T1 : Token .vars M M1 M2 M3 M4 : Marking .op m−n i l : −> Marking .op , : Marking Marking −> Marking [ assoc comm id : m−n i l ] .

sorts Symbol .vars X X1 X2 X3 : Symbol .

sort PairMaSy .sort PairMaSyList .subsort PairMaSy < PairMaSyList .op p−n i l : −> PairMaSyList .op : Marking Symbol −> PairMaSy .op ; : PairMaSyList PairMaSyList −> PairMaSyList

[ assoc id : p−n i l ] .

ops p1 p2 p3 p4 : −> Token .ops a b B # c : −> Symbol .ops $ : −> PairMaSy .

var x : Symbol .var m : Marking .var i n i t C : PairMaSyList .

∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ The ” F in i t e Control ” net ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗

∗∗∗ t1 : ( p1 ; a ; a ;R; p1 , p2 )r l [ t1 ] : (M, p1 a ) ; (M1 x ) => (M a ) ; ( p1 , p2 ,M1 x ) .r l [ t1$ ] : (M, p1 a ) ; $ => (M a ) ; ( p1 , p2 #) ; $ .

∗∗∗ t2 : ( p2 ;B;B;R; p2 )r l [ t2 ] : (M, p2 B) ; (M1 x ) => (M B) ; (p2 ,M1 x ) .r l [ t2$ ] : (M, p2 B) ; $ => (M B) ; ( p2 #) ; $ .

∗∗∗ t3 : ( p2 ; a ; a ;R; p2 )r l [ t3 ] : (M, p2 a ) ; (M1 x ) => (M a ) ; ( p2 ,M1 x ) .r l [ t3$ ] : (M, p2 a ) ; $ => (M a ) ; ( p2 #) ; $ .

Part 3: Programming

361

Page 11: Concurrent Turing Machines as Rewrite Theories

∗∗∗ t4 : ( p1 ; b ; b ;H; p3 )r l [ t4 ] : (M, p1 b) => (M, p3 b) .

∗∗∗ t5 : ( p2 , p3 ; b ;B;R; p3 )r l [ t5 ] : (M, p2 , p3 b) ; (M1 x ) => (M B) ; (p3 ,M1 x ) .r l [ t5$ ] : (M, p2 , p3 b) ; $ => (M B) ; ( p3 #) ; $ .

∗∗∗ t6 : ( p3 ;#;#;H; p4 )r l [ t6 ] : (M, p3 #) => (M, p4 #) .

endm� �Listing 1.1. CTM as Maude rewriting theory

Acceptance conditions are not modelled in Listing 1.1 but could easily beadded. A transcript of an ‘accepting’ run on the input word ab is shown inListing 1.2. The initial configuration is given by $ ; (p1 a) ; (m-nil b) ; $where $ is used as a delimiter of the portion of the tape that has been used. Thetape cells are separated by semi-colons and each cell contains a pair consistingof a multiset of places (representing tape heads) and a symbol.� �Maude> rew $ ; ( p1 a ) ; (m−n i l b ) ; $ .r ewr i t e in CTM : $ ; ( p1 a ) ; (m−n i l b ) ; $ .r ew r i t e s : 4 in 0ms cpu (0ms r e a l ) (˜ r ew r i t e s / second )r e s u l t PairMaSyList : $ ; (m−n i l a ) ; (m−n i l B) ; ( p4 #) ; $� �

Listing 1.2. Transcript of Maude’s rewriting of ab

Apart from simulating CTMs, Maude can also be used to model check someproperties of a CTM. As usual, one has to make sure the Petri net used in thecontrol part of the CTM is bounded, but in this case the potentially infinitetape inscription is a second factor that can lead to an infinite state space, thusprohibiting the use of Maude’s built-in model checker.

6 Simulation Using Renew

The Reference Net Workshop Renew [3] is an adaptable modelling and simula-tion tool [4] for different kinds of (high-level) Petri nets, especially reference nets.Renew is extendable by plug-ins. For the different kinds of CTMs presented inthis paper we have implemented a prototype plug-in that allows to model andsimulate them. Therefore, it is possible to validate the presented examples viatesting. The plug-in itself is easily extendable to other kinds of CTMs or othertypes of automata.

7 Conclusion and Outlook

We have defined a concurrent version of the Turing machine that makes useof concurrency and has several acceptance conditions. In another paper [1] we

Proc. CS&P '06

362

Page 12: Concurrent Turing Machines as Rewrite Theories

have shown that CTMs are equivalent to sequential TMs with respect to theacceptable languages but may be superior in terms of complexity. Furthermore,CTMs allow the dynamic creation of heads, thus subsuming all classes of k-headTuring machines.

It should be noted that transition fusion – even when allowing to read andwrite words instead of symbols – cannot be allowed in the control, since thiswould imply the need for non-elementary head movements and would possiblydestroy alternative computations. Hence, a theory of abstraction and refinement,constraining that for Petri nets, has to be introduced.

The idea of CTMs can also be applied to PDAs, which is the topic of aforthcoming paper.

References

1. B. Farwer, M. Kudlek, and H. Rolke. Petri-net-controlled machine models.Manuscript, April 2006.

2. A. Hemmerling. Systeme von Turing-Automaten und Zellularraume auf rahm-baren pseudomustermengen. Journal of Information Processing and CyberneticsEIK, 15:47–72, 1979.

3. O. Kummer, F. Wienberg, and M. Duvigneau. Renew – the Reference Net Work-shop. Available at: http://www.renew.de/, June 2004. Release 2.0.

4. O. Kummer, F. Wienberg, M. Duvigneau, J. Schumacher, M. Kohler, D. Moldt,H. Rolke, and R. Valk. An extensible editor and simulation engine for Petri nets: Re-new. In J. Cortadella and W. Reisig, editors, Applications and Theory of Petri Nets2004. 25th International Conference, ICATPN 2004, Bologna, Italy, June 2004.Proceedings, volume 3099 of Lecture Notes in Computer Science, pages 484–493,Heidelberg, June 2004. Springer.

5. K. Wagner and G. Wechsung. Computational Complexity. D. Reidel PublishingCompany, 1986.

6. J. Wiedermann. Parallel Turing machines. Technical Report RUU-CS-84-11, Uni-versity of Utrecht, 1984.

7. J. Wiedermann. Parallel machine models: How they are and where they are going.In SOFSEM’95: Theory and Practice of Informatics, volume 1012 of Lecture Notesin Computer Science, pages 1–30. Springer-Verlag, 1995.

8. T. Worsch. On parallel Turing machines with multi-head control units. TechnicalReport 11/96, Department of Informatics, University of Karlsruhe, 1996.

Part 3: Programming

363