TOPICS IN THE THEORY OF COMPUTATION
NORTH-HOLLAND MATHEMATICS STUDIES Annals of Discrete Mathematics(24)
General Edi...
49 downloads
986 Views
9MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
TOPICS IN THE THEORY OF COMPUTATION
NORTH-HOLLAND MATHEMATICS STUDIES Annals of Discrete Mathematics(24)
General Editor: Peter L. HAMMER Rutgers University,New Brunswick, NJ, U.S.A.
Advisory Editors C. BERG6 Universitede Paris, France M. A. HARRISON, University of California, Berkeley, CA, U.S.A. V. KLEE, Universityof Washington, Seattle, WA, U.S.A. J-H. VAN LINT; CaliforniaInstitute of Technology,Pasadena, CA, U.S.A. G.-C.ROTA, Massachusetts Institute of Technology,Cambridge,MA, U.S.A.
NORTH-HOLLAND-AMSTERDAM
0
NEW YORK
OXFORD
102
TOPICS IN THE THEORY OF COMPUTATION SelectedPapers of the International Conferenceon 'Foundations of Computation Theory',FCT '83, Borgholm, Sweden, August21-2z 1983
edited by
Marek KARPlNSKl University of Pittsburgh and
JanVAN LEEUWEN University of Utrecht
1985 NORTH-HOLLAND-AMSTERDAM
NEW YORK
0
OXFORD
0Elsevier Science Publishers B. V., 1985 All rights reserved, No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the copyright owner.
ISBN: 0 444 87647 2
Publishers:
ELSEVIER SCIENCE PUBLISHERS B.V. P.O. BOX 1991 1000 BZ AMSTERDAM THE NETHERLANDS
Sole distributors for the U.S.A.and Canada:
ELSEVIER SCIENCE PUBLISHING COMPANY,INC. 52 VAN DER BILT AVENUE NEW YORK, N.Y. 10017 U.S.A.
Library of Congress Cataloglng I n Pnbllcation Data
International Conference on ”Foundations of Computation Theory” (1983 : Bxgholm, Sweden) Topics In the theory of computation.
(Annals of discrete mathematics ; 24) (NcrthHolland mathematics studies ; 102) 1. Computational complexity-Congresses. 2. Machine theory--Congresses. 3. Electronic data processing-Mathematics--Congresses. I. Karpifiski, Marek, 194811. Leewen. 3. van (Jan van) 111. Title. IV. Series. V. Series: krth-Hol&d mathematics studies ; 102. QA267.156 1983 511 ah-21089 ISBN 0-444-87647-2 (U.S.) PRINTED IN THE NETHERLANDS
V
PREFACE
This Volume of the Annals of Discrete Mathematics contains nine selected papers presented at the International Conference on “Foundation of Computation Theory” held at Borgholm, Sweden, in August 21-27, 1983. The full Conference’s Proceedings have appeared in: M. Karpinski, ed., Lecture Notes in Computer Science, Vol. 158, Springer-Verlag,Berlin-New York, 1983, pp. 1-517. The papers of this Volume are complete and extended versions of the papers presented before this Conference which were selected, and refereed according to the usual high standards of the research journal publications. The topics of nine papers selected by the Editors, should reflect the nature of this Borgholm Conference. They were chosen on the basis of their immediate relevance to the most fundamental aspects of the theory of computation, and the newest developments in this area. The selection foci reflect thematically the idea of the series of ‘Foundational‘ FCT-Conferences initiated in 1977 (LNCS 466, Springer-Verlag). The main areas of Foundations of Computation Theory covered by the Conference, and in part represented in this Volume, fall into eight categories:
* * * * * * * *
Constructive Mathematics in Models of Computation and Programming (Constable); Abstract Calculi and Denotational Semantics (Langmaack, Parikh); Theory of Machines, Computations, and Languages (F reivalds, Trum-Wot schke) ; Nondeterminism, Concurrency, and Distributed Computing (Shmir-Upfal); Abstract Algebras, Logics, and Combinatorics in Computation Theory (Harel, Macintyre); General Computability and Decidability (Harel, Macintyre); Computational and Arithmetic Complexity (Freivalds); Analysis of Algorithms and Feasible Computing (v. Braunmiihl-Verbeek, Freivalds).
vi
We hope that the Volume will further help to promote, as well as advertise the highest quality research in the area of Foundations of Computation Theory.
To ensure timeliness of the production, it was decided to use North-Holland's camera-ready rapid reproduction system. At this place we want to thank heartily Mariele Knepper of the Department of Computer Science, University of Bonn, as well as Nancy Swiantek, Crystal Hamill of the University of Pittsburgh, and Lydia Defilippo of Carnegie-Mellon University for the masterful supervision of all operations during the process of selection, refereeing, and preparation for printing with North-Holland. The number of anonymous referees of the papers in this book deserves special mention, their highest scholarly standards in refereeing were one of the major factors behind the present final shape of publication. It is our great pleasure to thank all authors for the smooth cooperation with the Editors, remarkably, within exceedingly constrained time limits. We hope this Volume succeeded in covering the new and exciting research areas. Marek Karpinski Jan van Leeuwen Editors June I984
vii
C O N F E R E N C E C O M M I T E E S "Foundations of Computation Theory- 1983" Borgholm, Sweden, August 21-27, 1983
Program Committee: K.R. Apt (Paris), G. Ausiello (Rome), A.J. Blikle (Warsaw), E. Borger (Dortmund), W. Brauer (Hamburg), M. Broy (Munich), L. Budach (Berlin), R. Burstall (Edinburgh), P. van Emde Boas (Amsterdam), F. Gecseg, (Szeged), J. Gruska (Bratislava), M.A. Harrison (Berkeley), J. Hartmanis (Ithaca), K. Indermark (Aachen), M. Karpinski (Bonn/ Pittsburgh), D. Kozen (Yorktown Heights), J. van Leeuwen (Utrecht), L. Lovasz (Budapest), A. Mazurkiewicz (Warsaw), G.L. Miller (Cambridge Mass.), P. Mosses (Aarhus), B. Nordstrom (Gothenburg), M. Paterson (Warwick), A. Salomaa (Turku), C.P. Schnorr (Frankfurt), J.W. Thatcher (Yorktown Heights). Program Committee Chairman: Prof. Marek Karpinski Computer Science Department University of Bonn Wegelerstr. 6 D-5300 Bonn 1 W. Germany Organizing Committee: E. Sandewall (Chairman) A. Lingas J. Maluszynski Organizing Secretary: Lillemor Wallgren Program Secretary: Mariele Knepper
viii
Conference committees
The International Conference on "Foundations of Computation Theory" followed thematically the series of the FCT-Conferences founded in 1 9 7 7 in Poznan-Kornik, Poland. The program of the Conference, including invited lectures, and the selected contributions fell into eight categories:
*
*
* *
* I(
*
*
Constructive Mathematics in Models of Computation and Programming Abstract Calculi and Denotational Semantics Theory of Machines, Computations, and Languages Nondeterminism, Concurrency, and Distributed Computing Abstract Algebras, Logics, and Combinatorics in Computation Theory General Computability and Decidability Computational and Arithmetic Complexity Analysis of Algorithms and Feasible Computing
Organized by: The Department of Computer and Information Science, Linkoping University and Institute of Technology With the cooperation of: The Departments of Computer Science and Mathematics, University of Bonn Under the auspices of: The Royal Swedish Academy of Engineering Sciences The European Association for Theoretical Computer Science Gesellschaft fur Informatik e.V., Bonn The Swedish Society for Information Processing Co-sponsors: ASEA Ericsson Information System AB IBM Svenska AB The Swedish Philips Group
TABLE
OF
CONTENTS
M.KARPINSK1, J. VAN LEEUWEN Preface
V
B. v.BRAUNMUEHL, R. VERBEEK, Input-driven Languages are recognized in logn space
1
R.L. CONSTABLE, Constructive mathematics as a programming logic I: Some principles of theory
21
R. FREIVALDS, Space and reversal complexity of probabilistic one-way Turing machines
39
D. HAREL, Recurring dominoes: Making the highly undecidable highly understandable
51
H. LANGMAACK, A new transformational approach to partial correctness proof calculi for algol 68-like programs with finite modes and simple sideeffects
73
A. MACINTYRE, Effective determination of the zeros of p-ADIC exponential functions R. PARIKH,
The logic of games and its applications
10 3 111
E. SHAMIR, E. UPFAL, A fast parallel construction of disjoint paths in networks
141
P. TRUM, D. WOTSCHKE, of Ianov-schemes
155
Author Index
Descriptional complexity for classes
187
This Page Intentionally Left Blank
t
I
0 Elsevier Science Publishers B.V. (North-Holland)
Input Driven Languages are Recognized in
l o g n Space
by Burchard von Braunmuhl Rutger Verbeek University of Bonn
Abstract We show that the class of input driven languages is contained in logn space, an improvement over the previously known bound of log 2 n/loglogn space [Me 801. We also show the power of deterministic and nondeterministic input driven automata is the same and that these automata can recognize e.g. the parenthesis languages and the leftmost Szilard languages (cf. [Me 751, ~ L Y761, [Ig 771). 1.
Introduction
Since the famous algorithm of Lewis, Hartmanis and Stearns [LSH 651 many attempts have been made to determine the exact lower and upper bounds for the recognition of context free languages. It is quite improbable that the
2
log n
upper bound can be improved for general
CFLs because every improvement would improve the bound for the deterministic simulation of nondeterministic Turing machines [ S u 751. Even for deterministic CFLs no better space bound than log 2 n is known. Only the simultaneous time-space bound for DCFLs is much better than in the general case of CFLs: using a black pebbling strategy for the computation graphs of deterministic pushdown automata Cook [Co 791 has shown that DCFLs can be recognized using 2 logn pebbles (i.e. in log n space) and polynomial time simultaneously. The strategy was improved by the authors [BV 8o],[BCMV 831 and shown to be almost optimal (as pebbling strategy) [Ve 811, [Ve 831. On the other hand several important subclasses of DCFLs are known to be recognized in logn space (e.g. Dyck sets [RS 721, parenthesis languages [Me 75],[Ly 761 and leftmost Szilard languages [Ig 771). All these examples are shown to be included in, or are easily (i.e. by a homomorphism) transformable to the class of input driven languages (defined in [Me 80]), which is already known to 2 require a bit less than log n space: according to Mehlhorn [Ke 801
2
B. u. Braunmuehl and R. Verbeek
there is a black pebbling strategy with (log n/ log log n) where every pebble requires only O(log1ogn) space.
pebbles
In this paper we present a logn space algorithm for the recognition of input driven languages. Our algorithm uses a black and white pebbling strategy [CS 7 6 1 for the computation graphs, where we make use of the fact, that the structure of the computation graph of an input driven PDA can be computed by a counter automaton (and hence in logn space). The pebbles are distributed on the graph in such a way that their positions need not to be stored but can be recomputed. In this way our algorithm uses O(1ogn) pebbles, where each pebble requires only bounded space. Our approach gives a simple proof for the space complexity of a larqe subclass of DCFLs. In terms of pebbling complexity the strategy is optimal: it pebbles every n-node computation graph using O(1ogn) pebbles in n steps and there are computation graphs which require n(1ogn) black and white pebbles [Ve 831. Since our aim is to prove a space bound for some DCFLs we shall present the algorithm directly as simulation algorithm for input driven PDAs rather than as black and white pebble game. Unfortunately, there exist some classes of DCFLs that are contained in DSPACE(1ogn) but are not obviously transformable to input driven languages (certainly they all are l o g n - space reducible to any other nontrivial language): counter languages (where the space bound is obvious), the languages recognized by finite minimal stacking PDAs [Ig 7 8 1 (which can be proved to be accepted in logn space via a simple black pebbling strategy with a bounded number of pebbles) and the two sided Dyck sets [LZ 7 7 1 , which is the only known example of a non input driven DCFL in DSPACE(1ogn) for which the space bound is not obvious. In section 2 , we show that parentheses languages are input driven, leftmost Szilard languages are homomorphic transformable to input driven languages and the (nondeterministic) input driven languages are all deterministic (i.e. acceptable by deterministic input driven PDAs) which again proves that parentheses languages are DCFLs. In section 3 , we present the simulation algorithm for input driven languages which uses log n space and n2 time on a Turing machine.
Inputdriven languages are recognized in log n space
3
2. Properties of input driven languages We call a (deterministic or nondeterministic) real-time pushdown automaton (PDA) "input driven", if it reacts to some input symbol always with a push (the stack grows) or always with a pop (the stack falls). The moves of the stack are controlled only by the actual input symbol. The sequence of push and pop, (i.e. the graph of the stack height function h(t) ( 1 2 t 4 n)) is determined by the input and is readable from it. Definition A real-time pushdown automaton ( P D A ) is denoted by P = (CrrrQr#rqotQf,6) where Z,r,Q are finite disjoint sets of input symbols, pushdown symbols and states, # E r (bottom symbol), Qf c_ Q (accepting states), q, E Q (initial state), and 6 is a finite subset of Q
x
r
x
z
x
Q
x
r*.
P is input driven, (idPDA) if 1 is the disjoint union of 2 CorC1,C2 and 6 C Q x r x Ci x Q x Ti ( x E Zo means pop, i=o x E I2 means replace and push)
u
.
A language L 5; I* is input driven some input driven PDA.
(idCFL),
if it is recognized by
A configuration is a pair (q,W) containing the state q and the content of the pushdown store W. For every w E Z*, q,q' E Q, X E r , W,W' E r*, we define -I W inductively by (SfWX) (q,WX)
i:N.ZP:N(i)+Type.((Zx:N(i).P(x))+N)
and for f e P(N).
arity(f) =
i. dom(f) = P and op(f):(Ix:N(i).P(x))~. As in APL there are numerous kinds of vector operation. e.g. prop:IIm:N.IIg:P(N)(m).IIA:
{F:IIj:[l
.ml.N(")-+Type
I = F(i)J.
Vi:Cl.m].dom(P(m)(i)(g))
prop(l)(g.A.p) prop(m)(g.A.p)
= g(p(1))
(lof(g)(p(l)
1, prop(m) (Zof(g), Ai.p(i+l) 1)
To define the p-recursive functions. III. we need C. R, min on P(N). defined. Consider now R. R:IIn:N+.IIg:(f:P(N) R = An.hg.Ah.(n.Am.Ax. where GD is
(arity(f) = n-l].IIh:ff:P(N) Eb:N.GD(m.x)(y).
(arity(f) = n+l).P(N)
Az.lr20f ( 2 ) )
C has been
R.L.Constable
34
where least:Ilk:N.ltg:{f:P(N)
iarity(f) = k+l).ltx:N(k).lIn:N.
.
I l d :( lt j :[ 0.nl dom( g ( j,x)
least(k)(g.x,n.d.m)
= if m
L
.Ilm: 0,nl .N [
n then n = 0 then m
else if g(((m,x).d(m))) e1se 1east (
( g ,x ,n I d .m+ 1
(Actually least is defined by recursion on (n-m).) PR = Ej:N.PR PR(o)
(j) = Ii:N.>P:N(i)+Type.If
:({Ix:N(i).P(x))+N). "f(x)
Ek:Base.(vx:{y:NilP(y)).
PR(n+l) = Ii:N.>P:N(i)+Type.If [:k:PR(n).(op(f)
.
g(x)")
:({Ix:N(i).P(x))+N)). = op(g))
.
v
(m)
ik :N 3:N. i b :PR ( n) Zk :PR(
. = k 6
(arity(h)=m 6 Vi:[l.ml.arity(P(m.i)(g)) dom(f)
- + :k:N .!k:PR -
:L:N
+
dom(C(k)(m)(h,g))
6
f = C(k)(m)(h,g))
V
.ib:PR(n).(arity(g) = k-1 6 arity(h) = k 6 (n) dom(f) = dom(R(n)(g,h)) 6 op(f) = ~p(R(~)(g.h))) V .E$:PR
.(arity(g) (n) op(f) = op(min(g)))l
k+1 6 dom(f)
dom(min(g))
6
Given F = X:N.(N(i)+N) we can define the subset of recursive functions by the condition {f:Fl;k:PR.(l.Zof(g) = lof(f) 6 vn:N.(I,2,2of(g)(n)) 6 1,2,2,20f(g) = Zof(f))). This class will be isomorphic to the class (g :PR 1Vn:N. ( 1 2,Zof (g (n) }/E where .g 1 iff l.2of(g 1 = 1.2of(g & 1.2.2.20f(gl) 1.2.2.20f(g 1. We cat(:Jov2' that these subtypes are coungable whereas F is uncountable. h i s is sensible because the elements of PR represent a very restricted way of building functions from N+N. For example, functions h:A+B for non-numerical types A and B are not used. Nevertheless. from outside the theory we can see that PR does in some sense represent all computable functions.
.
Constructive mathematics as a programming logic I 3.
35
A Note on P a r t i a l R e c u r s i v e F u n c t i o n s
The type PR c a p t u r e s K l e e n e ' s n o t i o n of an a l g o r i t h m i n a c e r t a i n s e n s e . We could a l s o d e f i n e i n a s i m i l a r way t h e n o t i o n of a Turing machine and t h e Turing computable f u n c t i o n s from N t o N . So t y p e t h e o r y . j u s t a s c l a s s i c a l s e t t h e o r y , can i n t e r n a l i z e t h e concept of a n a l g o r i t h m and t h e n o t i o n of a p a r t i a l r e c u r s i v e f u n c t i o n ( s e e a l s o c111). But t h e r e i s a n o t h e r more d i r e c t way i n which t y p e t h e o r y c a p t u r e s t h e concept of a n
m.
Consider t h o s e f u n c t i o n s d e f i n e d on t y p e s such a s Ix:NIB} + N. They can i n v o l v e t h e p o p e r a t o r (and we could a l s o a l l o w a l e a s t f i x e d p o i n t o p e r a t o r , s a y FIX ( a s i n [ 1 1 1 ) ) . In f a c t . f o r e v e r y p - r e c u r s i v e a l g o r i t h m . t h e r e i s some funct i o n f:Ix:NIB) + N. T h e r e f o r e i f we c o n s i d e r t h e set of f u n c t i o n terms t h a t can Indeed a be w r i t t e n i n t y p e t h e o r y . then f o r e a c h a l g o r i t h m t h e r e i s a term. computer system could e x e c u t e any such term on any i n t e g e r i n p u t . and some of t h e r e s u l t i n g computations would d i v e r g e . So i n a s e n s e a l l t h e a l g o r i t h m s a r e p r e s e n t i n t y p e t h e o r y e x a c t l y i n t h e form s e e n i n o r d i n a r y programming languages. The d i f f e r e n c e i s t h a t w e cannot say a n y t h i n g about t h e arguments on which t h e a l g o r i t h m s d i v e r g e . That i s because w e a r e n o t i n t e r e s t e d i n d i s c u s s i n g t h e a l g o r i t h m s on such i n p u t s . CONCLUSION
C o n s t r u c t i v e t y p e t h e o r y has c o n t r i b u t e d t o o u r u n d e r s t a n d i n g of programming languages and l o g i c s ; i t a l s o s u g g e s t s a wide r a n g e of problems, from t h e v e r y t h e o r e t i c a l t o t h e very p r a c t i c a l . The p r e c e d i n g b r i e f d i s c u s s i o n was i n t e n d e d t o r e v e a l t h e dynamics of t h e s u b j e c t and r a i s e some of t h e t h e o r e t i c a l i s s u e s . e s p e c i a l l y t h o s e d e a l i n g w i t h i n f o r m a t i o n h i d i n g . It a l s o shows how t h e concept of a p a r t i a l f u n c t i o n can be accomodated. and i n f a c t w i t h s i m p l e a d d i t i o n s t o C3.13.301, namely t h e p - o p e r a t o r o r t h e f i x e d p o i n t o p e r a t o r , p a r t i a l f u n c t i o n s can be t r e a t e d a s n a t u r a l l y a s i n any o t h e r t h e o r y , s a y c24.341. In a future paper we s h a l l show how t h e c o n c e p t s of r e c u r s i v e d a t a t y p e can be s i m i l a r l y t r e a t e d . e.g. a simple a d d i t i o n of g e n e r a t o r s f o r type e l e m e n t s l e a d s t o a n a t u r a l account of s t r e a m s and o t h e r i m p o r t a n t d a t a t y p e s . ACKNOWLEDGEMENTS I a p p r e c i a t e Per Martin-LGf's a t t e n t i o n t o t h i s work and h i s s h a r i n g of i d e a s w i t h me about t h e p r e s e n t a t i o n of r u l e s . I want t o thank J o s e p h B a t e s f o r h i s p e r c e p t i v e comments on a d r a f t of t h i s paper and S t u a r t A l l e n f o r many stimul a t i n g d i s c u s s i o n s about t y p e t h e o r y . J o e B a t e s and I a r e f i n i s h i n g a d e s c r i p t i o n of t h e t y p e t h e o r y used i n Nu-PFU, t h e document i s t e n t a t i v e l y t i t l e d "The Nearly U l t i m a t e PRL" and w i l l d e s c r i b e how t y p e t h e o r y i s used a s a r e f i n e m e n t s t y l e programming l o g i c .
I a l s o thank Donette I s e n b a r g e r f o r h e r c a r e f u l and p a t i e n t p r e p a r a t i o n of t h i s document under t h e p r e s s u r e of v a r i o u s d e a d l i n e s . FOOTNOTES 'This work was s u p p o r t e d i n p a r t by NSF g r a n t s MCS-80-03349 and MCS-81-04018. programming languages become r i c h e r , and as t h e i r d e f i n i t i o n s become more formal. t h e d i s t i n c t i o n between a programming h n g u g g and a programming l~& may d i s a p p e a r . A t h e o r y such as M-L82 C301 i s i n d i s t i n g u i s h a b l e from t h e a p p l i c a t i v e programming language d e s c r i b e d by Nordstrom C311; t h e t h e o r i e s V 3 C131 and PRL c21 a r e a s much programming languages as t h e y a r e l o g i c s . So t h e s e remarks a p p l y t o s u c h " t h i r d g e n e r a t i o n " programming languages a s w e l l .
'As
R.L.Constable
36
31n 1975 w e c o n s i d e r e d u s i n g a s u b s e t of Algol 6 8 a s t h e b a s i s f o r our programming l o g i c , b u t t h e r e w a s n ' t s u f f i c i e n t l o c a l e x p e r t i s e t o cope w i t h t h e conip l e x i t y of d e f i n i n g and implementing t h e s u b s e t . There was such e x p e r t i s e f o r PL/I. But we d i d u s e Algol 68 l i k e n o t a t i o n i n C151. REFERENCES
c11 Bates, J.L.,
A Logic f o r C o r r e c t Program Development, Ph.D. ment of Computer Science. C o r n e l l U n i v e r s i t y (1979).
T h e s i s . Depart-
CZl Bates. J.L. 82-530.
and Constable, R.L.. P r o o f s a s Programs, T e c h n i c a l Report. TR Dept. of Computer Science. C o r n e l l U n i v e r s i t y . (1982).
C3l
D e f i n i t i o n of Micro-PRL. T e c h n i c a l Report TR B a t e s J. and Constable. R.L.. 82-492. Dept. of Computer S c i e n c e , C o r n e l l U n i v e r s i t y (October 1981).
c 41
Why and How?. ConstrucBeeson, M. , Formalizing C o n s t r u c t i v e Mathematics: t i v e Mathematics, (ed., F. Richman), L e c t u r e Notes i n Computer S c i e n c e (1981) Springer-Verlag. NY, 146-190.
C5l
Bishop, E.,
C6l
Bishop. El Mathematics a s a Numerical Language, i n : Myhill. J. e t a l . ( e d s . ) . I n t u i t i o n i s m and Proof Theory (North-Holland. Amsterdam. 1970).
c71
Boyer. R.S. 1979).
C8l
Constable. R.L.. C o n s t r u c t i v e Mathematics and Automatic Program Writers. Proc. of IFIP Congress, L j u b l j a n a (1971) 229-233.
C 91
Constable. R.L. and Gries. D.. put.. 1:l (March 1972) 66-118.
Foundations of C o n s t r u c t i v e A n a l y s i s (NcGraw H i l l . NY. 1967).
and Moore.
A Computational Logic (Academic P r e s s .
J.S..
NY,
On C l a s s e s of Program Schemata, SIAM J. Com-
Cl03 Constable. R.L., Mathematics A s Programming. Proc. of Workshop on L o g i c s of Programs, L e c t u r e Notes i n Computer S c i e n c e (1983).
Clll Constable. R.L.. 6 t h G.I. (1983).
P a r t i a l F u n c t i o n s i n C o n s t r u c t i v e Formal T h e o r i e s , Proc. of Conference. L e c t u r e Notes i n Computer S c i e n c e , 135. Springer-Verlag
[12] Constable. R.L.. I n t e n s i o n a l A n a l y s i s of F u n c t i o n s and Types. I n t e r n a l Report, CSR-118-82. Dept. of Computer Science. U n i v e r s i t y of Edinburgh pp. 74 ( J u n e 1982). C13] Constable, R.L. and Z l a t i n . D.. Report on t h e Type Theory (V3) of t h e Programming Logic PL/CV3. Logics of Programs. L e c t u r e Notes i n Computer S c i e n c e , 131. Springer-Verlag. NY (1982) 72-93. (To appear i n TOPLAS, Jan. 1984.) C141 Constable, R.L.,
a. gcienCe.
[15] Constable. R.L. b r i d g e , 1978).
"Programs and Types". &QL. Pf IEEE. NY. 1980. pp 118-128. and O'Donnell.
M.J.
,
Ann. Synul. PP Epund. nf
A Programming Logic
(Winthrop.
Cam-
C161 Constable, R.L.. Johnson, S.D. and Eichenlaub, C.D., Introduction t o the PL/CV2 Programming Logic. L e c t u r e Notes i n Computer Science. 135. S p r i n g e r Verlag, NY (1982). [171 Curry, 1968).
H.B.
and Feys.
8..
Combinatory Logic
[18] Curry, H.B., Hindley, J.R. and S e l d i n . J.P.. (North-Holland. Amsterdam, 1972).
(North-Holland,
Combinatory Logic.
Amsterdam. Volume I1
[19] deBruijn. N.G.. A Survey of t h e P r o j e c t AUTOMATH. i n : S e l d i n , J.P. and Hindl e y , J.P. ( e d s . ) , Essays on Combinatory Logic, Lambda Calculue and Formalism (Academic Press. NY. 1980).
Constructive mathematics as a programming logic I
31
C201 Donahue, J.. and A.J. Demers. "Revised Report on Russell". Department of Computer Science Technical Report, TR 79-389. Cornell University. September 1979. [21] Dummett. M. Frege Philosophy of Language, (Duckworth. Oxford, 1973). [22] Feferman. S . . Constructive Theories of Functions and Classes, in: Logic Colloquium '78 (North-Holland. Amsterdam. 1979). C231 Fraenkel. A.A.. and Bar-Hillel. Y.. Foundations of Set Theory (NorthHolland, Amsterdam. 1958). C241 Gordon. M., Milner. R. and Wadsworth. C.. Edinburgh LCF: A Mechanized Logic of Computation, Lecture Notes in Computer Science. 78. Springer-Verlag (1979). C251 Cries. D. The Science of Programming (Springer-Verlag. 1982). C261 Howard. W.A.. The Formulas-As-Types Notion of Construction, in: Seldin, J.P. and Hindley. J.R. (eda.) Essays on Combinatory Logic. Lambda Calculus and Formalism (Academic Press, NY. 1980). C271 Krafft. D.B., AVID: A System for the Interactive Development of Verifiable Correct Programs. Ph.D. Thesis. Dept. of Computer Science, Cornell University (August 1981). C281 Luckham. D.C., Park. M.R. and Paterson. M.S., On Formalized Computer Programs. JCSS, 4 (1970) 220-249. C291 Martin-LEf. P.. An Intuitionistic Theory of Types: Predicative Part. in: Rose, H . E . and Shepherdson. J.C. (eds.). Logic Colloquium. 1973 (NorthHolland, Amsterdam. 1975). 1301 Martin-Lb'f, P.. Constructive Mathematics and Computer Programming, in: 6th International Congress for Logic, Method and Phil. of Science (NorthHolland, Amsterdam. 1982). [31] Nordstrom. B . , Programming in Constructive Set Theory: Some Examples. Proc. 1981 Conf. on Functional Prog. Lang. and Computer Archi, Portsmouth (1981) 141-153. [32] Pratt, T.W., Programming Languages: Design and Implementation (PrenticeHall, Englewood Cliffs. 1975). C33] Russell. B . . Mathematical Logic as Based on a Theory of Types, Am. J. of Math., 30 (1908) 222-262. [34] Scott, D., Data Types as Lattices. SIAM Journal on Computing. 5:3 (September 1976). [35] Scott, D.. Constructive Validity. Symposium on Automatic Demonstration, Lecture Notes in Mathematics, 125. Springer-Verlag (1970) 237-275. [36] Stenlund. S . , Combinators, Lambda-terms. and Proof-Theory. D. Reidel (Dordrecht. 1972). [37] Skolem. T., Begrt'odung der elementzren Arithmetik durch die rekurrierende Denkweise ohne Anwendung scheinbarer Varanderlichen mit unendlichen Ausdehnunggsbereich. Videnskapsselskapets Skrifter 1, Math-Naturv K16 (1924) 3-38, (also in: From Frege to Gb'del. 302-333 and in: Skolem's Selected Works in Logic, Fenstad. J.E. (ed.) Oslo. 1970). [38] Teitelbaum. R. and Reps. T., The Cornell Program Synthesizer: A SyntaxDirected Programming Environment, CACM. 24:9 (September 1981) 563-573.
This Page Intentionally Left Blank
Annals of Discrete Mathematics 24 (1985) 39-50 0 Elsevier Science Publishers B.V.(North-Holland)
39
SI’ACL A N H R E V E R S A L COblPLEX I T Y OF PROBARILISTIC ON I1 - N A Y TURING hIACM 1NE S
RGsinS Freivalds Computing Center Latvian State University Riga, USSR
Probabilistic 1-way Turing machines are proved to be logarithmically more economical in the sense of space complexity for recognition of specific languages. Languages recognizable in o (loglog n) space are proved to be regular. One or two reversals of the head on the work tape of a probabilistic 1-way Turing machine can sometimes be simulated in no less than const n reversals by a deterministic machine. 1.
INTRODUCTION
The problem whether or not probabilistic machines can recognize a language not recognizable by determimistic machines of the same type has arisen in Theoretical Computer Science long ago. If there are no bounds on the computation time or space or on another complexity meaI f the bounds are maximally tight sure then the answer is negative [8! and the machines are equivalent to finite automata then the answer again is negative: every language recognizable by a finite probabilistic automaton with an isolated cut-point is recognizable a l s o by a finite deterministic automaton 191
.
.
We have been able to prove in a series of papers 13-51 for various types of automata and machines intermediate between finite automata and Turing machines without complexity bounds that probabilistic machines can recognize languages not recognizable by deterministic machines of the same type. In particular, when the considered type of the machines is time-bounded Turing machines, i t was proved that probabilistic machines can recognize palindromes2in essentially less time than deterministic machines (nlogn versus n 1 [ 2 , 3 ] . In this paper we consider 1-way Turing machines and two complexity measures for them: space and reversals. 1-Way Turing machines are formally defined in [7!. They have an input tape with a single head on it capable to move only in one direction and one work tape with one head on it. In the second half of Section 2 we consider a l s o 1 way Turing machines with many work tapes. Space complexity is the number of squares in the used part of the work tapes. Reversal complexity is the number of times when the head on a work tape changes the direction of its move. Probabilistic 1-way Turing machines are 1-way Turing machines which can in addition make use at each step of a generator of random numbers with a finite alphabet, yielding its output values with equal
R.Freivalds
40
p r o b a b i l i t i e s and i n a c c o r d a n c e w i t h a R c r n o u l l i d i s t r i b u t i o n , i . c . independently of t h e values yicldcd a t o t h e r i n s t a n t s . We s h a l l s a y t h a t t h e p r o b a b i l i s t i c m a c h i n e r e c o g n i z e s t h e l a n g u a g e L i n space s ( n ) ( o r with r ( n l r e v e r s a l s , r e s p e c t i v e l y ) with probnbil i t y p i f t h e m a c h i n e when w o r k i n g on a n a r b i t r a r y x , 1 ) s t o p s h a v i n g u s e d n o more t h a n s ( n ) s q u a r e s o f t h e work t a p e s ( o r h a v i n g made r ( n ) r e v e r s a l s , r e s p e c t i v e l y ) w i t h p r o b a b i l i t y 1 . 2 ) y i e l d s 1 i f x g L and y i e l d s 0 i f X e L w i t h 3 p r o b a b i l i t y n o t l e s s than p. T h i s d e f i n i t i o n o f t h e complexity measures f o r p r o b a b i l i s t i c machines i s a b i t n o n t r a d i t i o n a l . U s u a l l y i t i s demanded o n l y t h a t t h e p r o b a b i l i t y o f t h e f o l l o w i n g e v e n t s exceeds p : "the machine s t o p s having n o t overused t h e l i m i t e d s p a c e and y i e l d s t h e c o r r e c t answer". hevcrt h e l e s s , a l l o u r p r o b a b i l i s t i c m a c h i n e s s a t i s f y o u r more r e s t r i c t i v e condition. 2 . SPACE COMPLEXITY A l l t h e r e s u l t s i n t h i s S e c t i o n on a d v a n t a g e s o f p r o b a b i l i s t i c m a c h i n e s a r e b a s e d on t h e f o l l o w i n g lemma. I t shows t h a t f o r a n y two n o n e q u a l n a t u r a l numbers N ' and N" , t h e r e a r e many r e a s o n a b l y s m a l l (mod m ) . P r o b a b i l i s t i c a l g o r i t h m s p r i m e modulos m s u c h t h a t N ' + N" i n t h i s S e c t i o n a r e b a s e d on t h e p o s s i b i l i t y t o t a k e s u c h a p r i m e modulo m a t random.
P
11
0g2 Let P 1 ( l ) b e t h e number o f p r i m e s n o t ex e e d ' n g 2 , P3(l,N' ,N") ryogz b e t h e number o f p r i m e s n o t e x c e e d i n g 2 and n o t d i v i d i n g IN'- N f r 1 , a n d P 3 ( l , n ) be t h e maximum o f P 2 ( 1 , N ' , N " ) over a l l N ' < 2", N" < 2 " , N' Z N" .
b
LEMMA 2 . 1 .
(
[3] 1 G i v e n a n y & 7 0 , t h e r e i s a n a t u r a l number c s u c h t h a t 1i m n-t+oo
P3(cn, n) P1 (cn)
&
...,
p k b e a l l t h e p r i m e s t h a t d i v i d e Z = / N -W'\ < PROOF. L e t p l , p 2 , S i n c e Z > k ! , we h a v e k s O ( n / og n ) . By C e b i S e v ' s t h e o r e m o n t h e d e n s i t y o f p r i m e s ( s e e [l] ) , t h e f i r s t [k/c] p r i m e s d o n o t e x c e e d csn f o r a s u i t a b l e constant c
2".
We d e f i n e a l a n g u a g e S c { O , 1 , 2 , 3 , 4 , 5 P . Let b i n ( i ) d e n o t e a s t r i n g r e p r e s e n t i n g i i n t h e b i n a r y n o t a t i o n ( t h e f i r s t symbol o f b i n ( i ) being 1).
We s t a r t t o d e s c r i b e how t h e s t r i n g s i n S c a n b e g e n e r a t e d . An a r b i t r a r y i n t e g e r k i s t a k e n and t h e f o l l o w i n g s t r i n g i s c o n s i d e r e d bin(1) 2 bin(2) 2 bin(3) 2 . 2 bin(2k). bin(2k) N e x t , e v e r y symbol i n t h e s u b s t r i n g s b i n ( k + l ) , b i n ( k + 2 ) , i s p r e c e d e d by o n e a r b i t r a r y symbol f r o m { 3 , 4 ) . I f t h e o b t a i n e d s t r i n g i n { 0 , 1 , 2 , 3 , 4 } * i s d e n o t e d by x t h e n t h e l a n g u a g e S c o n t a i n s t h e s t r i n g x 5 x . E v e r y s t r i n g i n S i s o b t a i n e d by t h i s p r o c e d u r e .
..
...,
THEOREM 2 . 2 . ( 1 ) Given any E > O , t h e r e i s a l o g n-space bounded p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e w h i c h acce t s e v e r y s t r i n g i n S w i t h p r o b a b i l i t y 1 and r e j e c t s e v e r y s t r i n g i n % w i t h p r o b a b i l i t y 1 - & .
41
Complexity of probabilistic one-way Turing machines ( 2 ) E v c r y d e t e r m i n i s t i c l - w a y bring m a c h i n e r e c o g n i z i n g S u s e s a t l e a s t C O I I S ~ . s~p a c e . I’I~OOl~’. ( 1 ) ‘I‘hc h e a d ol‘ s t r i n g w i s i t s i n i t i a l f r a g m e n t u p t o t h e symbol 5. The t a i l o f w i s t h e r e s t o f t h e s t r i n g .
Ihe p r o b a b i l i s t i c machinc performs t h c f o l l o w i n g 1 1 a c t i o n s t o r e cognize w h e t h e r o r n o t t h e g i v e n s t r i n g w i s i n S : I .
1 ) i t c h e c k s w h e t h e r t h e p r o j e c t i o n o f t h e head o f w t o t h e siibalphab e t [ O , l , 2 } i s a s t r i n g o f t h e form bin(1) 2 bin(?) 2 2 bin(2kll
...
f o r an i n t e g e r k , ; 2 ) t checks whether t h e p r o j e c t i o n of t h e t a i l o f w t o t h e subalphai s a s t r i n g o f t h e form bet {O,1,?} bin(1)
2
bin(2)
f o r an i n t e g e r k,; 3 ) t checks w h e t h e r k
2
. ..
2 bin(2k2)
L
= k,; 1 ‘. 4 ) i t c o u n t s t h e number k o f t h e s u b s t r i n g s b i n ( l 1 , b i n ( 2 1 , b i n ( k 3 ) i n t h e h e a d ‘of w w h e r e no s y m b o l s f r o m { 3 , 4 } a r e i n 5 e r tcd;
...
...,
5) it checks whether k,
=
k,;
...
6 ) i t c o u n t s t h e number k 4 o f t h e s u b s t r i n g s b i n ( l ) , b i n ( 2 ) , , , b i n ( k 4 ) i n t h e t a i l of w w h e r e no s y m b o l s f r o m 3 , 4 a r e i n s e r ted;
...
7 ) i t checks whether k 2
=
k4;
c.1
81 u s i n g g e n e r a t o r o f rar.dorn rlumbers i t g e n e r a t e s a s t r i n g i n {0,1} w h e r e c i s t h e c o n s t a n t fromcL m m a 2 . 1 , a n d 1 i s t h e l e n g t h o f b i n e k j ) . The generated s t r i n g m ( l s m $ 2 €1 i s t e s t e d f o r p r i m a l i t y . I f m i s n o t p r i m e , a new s t r i n g b i n ( m ) i s g e n e r a t e d , t e s t e d f o r p r i m a l i t y , a n d s o on; 9 ) i t regards t h e p r o j e c t i o n y, of t h e head of w t o t h e subalphabet 2 ” ” - 1 ) and c a l c u ( 3 , 4 \ a s b i n a r y n o t a t i o n o f a number N ( O L n l s t e s t h e r e m a i n d e r m l o b t a i n e d b y dividing ‘ N 1 t o m ; t o the subalphabet 10) i t r e g a r d s t h e p r o j e c t i o n y 2 o f t h e t a i l o f YY,l (3,4} a s b i n a r y n o t a t i o n o f 3 n u mb er N ( 0 s N 2 < 2 - 1 ) and c a l c u 2 . l a t e s t h e remainder m2 obtained by d i v i d i n g N 2 t o m; 1 1 ) i t c h e c k s w h e t h e r m, = m 2 . The s t r i n g w i s a c c e p t e d i f a l l t h e c h e c k s r e s u l t p o s i t i v e l y . O ’ t h e r wise w i s r e j e c t e d .
-
1 1 ) c a n be p e r f o r m e d i n l o g w s p a c e . Lemma 2 . 1 The a c t i o n s 1 ) l i e s t h e c o r r e c t n e s s of t h e r e s u l t w i t h t h e needed p r o b a b i l i t y .
imp-
( 2 ) I f w e S then i t s projection t o t h e subalphabet {3,4,S} is of t h e f o r m y S y , w h e r e y ~ { 3 , 4 } * a n d I y ( >IWI- - 2 l o g 2 ( w l . H e nc e a l i n e a r s p a c e b o u n d l i n e a r i n Iw\ f o r d e t e r m i n i 2 t i c one -w a y ‘Turing m a c h i n e s i s e v i dent.
The l a n g u a g e way.
5 is
s i m i l a r t o S b u t i t i s d e f i n e d i n a more c o m p l i c a t e
R. Freivalds
42
Let t h e s t r i n g s x = x l x 2
...
xL1 a n d y = y 1 y 2
.. .
y v i n {[),I}'' and
{0,1}' , r e s p e c t i v e l y , be c o n s i d e r e d , and e i t h e r u = v o r u + 1 We u s e j o i n ( x , y ) t o d e n o t e t h e s t r i n g x 1 y 1 x 2 y 2 ... .
=
v.
We d e f i n e a map Z : [ 0 , 1 y-{O,l , 2 , 3 , 4 , 5 ) * . A t f i r s t , t h e g i v e n wa{O,l )* i s t r a n s f o r m e d i n t o w' , s u b s t i t u t i n g e v e r y symbol 0 i n w by 3 a n d e v e r y 1 by 4 . We d e n o t e t h e t o t a l number o f s y m b o l s in t h e s t r i n g s b i n ( t + l ) , b i n ( t + 2 ) , . . , b i n ( 2 t l by s ( t ) . Let 1 b e a n i n t c g c r . z ( w ) c a n be o b t a i n e d from t h c s u c h t h a t s(1-1) 4 [wI ~ s ( 1 ) Then string bin(1) 2 bin(2) 2 bin(3) 2 2 bin(21)
.
...
+i'
i n s e r t i n g s y m b o l s f r o m 3 , 4 , 5 s o t h a t e v e r y symbol i n t h e s u b s t r i n g s , bin(l+Z), , b i n ( 2 1 ) i s p r e c e d e d by o n e symbol from and t h e p r o j e c t i o n o f t h e o b t a i n e d s t r i n g t o t h e s u b a l p h a b e t {3,4,5 bin 1 3 , 4 , 5 e q u a l s t h e w'555 ,
...
...
The l a n g u a g e 5 c o n s i s t s o f a l l p o s s i b l e s t r i n g s o f t h e form z(join(bin[l), bin(2))) 6 z(join(bin(21, bin(3))) 6 z(join(bin(3), 6 z(join(bin(2k-l), bin(2k))). bin(4)))) 6
...
THEOREM 2 . 3 . ( 1 ) G i v e n a n y & P O , t h e r e i s a l o g l o g n - s p a c e bounded p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e w h i c h a c c e p t s e v e r y s t r i n g i n 5 w i t h p r o b a b i l i t y 1 and r e j e c t s e v e r y s t r i n g i n 5 w i t h p r o b a b i l i t 1-& ( 2 ) E v e r y d e t e r m i n i s t i c 1-way T u r i n g m a c h i n e r e c o g n i z i n g uses a t l e a s t const.logn space.
.
-2
PROOF i s s i m i l a r t o t h e p r o o f o f Theorem 2 . 2 . The m a i n a d d i t i o n a l i d e a i n t h e proof of ( 1 ) i s t o perform a l l t h e needed ( p r o b a b i l i s t i c ) comparisons w h e t h e r t h e s u b s t r i n g s b i n ( i ) c o r r e s p o n d one t o a n o t h e r i n t h e fragment 6 z(join(bin(i-11, bin(i))) 6 z(join(bin(i1, bin(i+l))) 6
...
...
i n d e p e n d e n t l y , i . e . by u s i n g a n o t h e r c h o i c e o f a random m o d u l o . I f t h e g i v e n s t r i n g i s i n S t h e n a l l t h e many c o m p a r i s o n s e n d i n p o s i t i ve with p r o b a b i l i t y 1 . I f t h e r e is a t l e a s t one d i s c r e p a n c y t h e n t h e comparisons end i n n e g a t i v e w i t h p r o b a b i l i t y 1-& . 5 I t i s p o s s i b l e t o e x t e n d Theorems 2 . 2 a n d 2 . 3 f o r " n a t u r a l " s p a c c c o m p l e x i t i e s f ( n ) b e t w e e n l o g n a n d l o g l o g n . On t h e o t h e r h a n d , t h e method u s e d a b o v e d o e s n o t p e r m i t t o c o n s t r u c t n o n r e g u l a r l a n g u a g e s r e c o g n i z a b l e by p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e s i n o ( l o g l o g n 1 t i m e . Now we p r o c e e d t o p r o v e Theorem 2 . 7 w h i c h shows t h a t i f a l a n g u a g e L i s r e c o g n i z e d by p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e i n o ( l o g 1 o g n ) s p a c e t h e n L i s r e g u l a r . The r e s u l t may seem t r i v i a l s i n c e T r a k h t e n b r o t [ll] and G i l l [6] have proved theorems showing t h a t det e r m i n i z a t i o n o f p r o b a b i l i s t i c T u r i n g m a c h i n e s i n c r e a s e s p a c e compl e x i t y no more t h a n e x p o n e n t i a l l y , a n d i t i s known f r o m [lo] t h a t i f a l a n g u a g e L i s r e c o g n i z e d b y a d e t e r m i n i s t i c 1-way T u r i n g m a c h i n e i n o(1ogn) space then L i s r e g u l a r . Unfortunately, t h e s i t u a t i o n i s more c o m p l i c a t e s i n c e no f u n c t i o n o ( 1 o g n ) i s s p a c e c o n s t r u c t i b l e by d e t e r m i n i s t i c 1-way T u r i n g m a c h i n e s . Hence t h e a r g u m e n t by T r a k h t e n b r o t a n d G i l l i s n o t a p p l i c a b l e . Our p r o o f i s n o n c o n s t r u c t i v e . We d o n o t p r e s e n t a n a l g o r i t h m f o r d e t e r m i n i z a t i o n o f p r o b a b i l i s t i c 1-way Turing machines. Moreover, an open problem remains. I t w i l l t u r n o u t t o b e e s s e n t i a l t h a t w e c o n s i d e r 1-way T u r i n g m a c h i n e s w i t h many work t a p e s i n t h e r e s t o f t h i s S e c t i o n . Let s ( n ) b e a n y f u n c t i o n o f o ( l o g l o g n ) , a n d L b e a l a n g u a g e r e c o g n i z e d b y a p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e TM w i t h p r o b a b i l i t y p i n
Complexity of probabilistic one-way Turing machines
43
scnl space. lie considcr t h e btyhill-Nerodc equivalence r e l a t i o n u ~ ' v which holdsi f m c l only i f W w j ( t r u e L t = . \ n \ , ~ l . jLet . x , y , z he s t r i n g s such t h a t x z e L , y z e I , . 1.et 11 bc an i n t e g er such t h a t 1xls.n and Iylsn. Lct id , id,, . .. , idr be a l l poss i b l e instantancoiis d e s c r i p t i o n s of t h e content of thE work ta pe s and t h e i n t e r n a l s t a t e of t h e machine under t h c condition t h a t no more thnn s ( n ) squares are used on cvcry work tape. 1st 11 ( i d . ) denotc t h c p r o b a b i l i t y of t h e instantaneous desc r i p t i o n hcing i d . i m n i e d i h l $ :iftcr t h c reading t h e l a s t synil~ol of t h e s t r i n g x from t h c input. L 6 t q i [ z l denote t h e p r o b a b i l i t y of acceptancc of z i f t h e machinc s t a r t s i t s rcading from t h e input w i t h t h e content of work ta pe s and t h e internail s t a t e corresponding t o t h e d e s c r i p t i o n i d . 1
...
.
'The v e c t o r p = ( p ( i d 1 , p ( i d l ' ) , , p ( i d ) ) can be i n t e r p r e t e d as a point in r-dimens ionair u n i t Xcub&. \Yex i n t roducc the'nie t Fic s j)(lix, py)
LIEEL\ 2 . 4 . I'IUIF.
p ( i d l ) \ + ... + p x ( i d r ) Y I f .Y$Y then j ( ~ > ~ >, 3p ~ > - 2~. l
=
Ipxlidll
I
-
xz E I. imp1 i c s
pX [ i d l ' l . q , ( : )
+
px(id2).q2(z) + p x ( i d 3 j . q 3 ( z )
+
yz ET: inipl ics pY ( i d l ) . q l ( z ) + p Y ( i d-, ) . qA, ( z ) + py ( i d 5- ) . q .>- ( z ) + Subtraction r e s u l t s i n
-
p lidr)(.
Y
... 7 p ... c l - p .
...
>2p-1. (px[idl) - p [ i d l ) ) . q z [ z ) + (px(id,) - p (id,l).q 2 (z ) + Y Y For i s r we s u b s t i t u t e (1' ( i d . ) - p ( i d . ) ) by x 1 y 1 \ I ) x [ i d i ) - p ( i d i l l and q i ( z ) by 1 . For i > r we s u b s t i t u t e p ( i d . ) by 0 , q i ( z l by Y Y 1 1 , and p x ( i d r + l l + id,+^) + by 1-p ( s i n c e t h e s t r i n g x is processed using
...
no more space than s [ n ) with p r o b a b i l i t y p ) . 1,I:MCIA 2 . 5 . I f a l a n g u a g e L i s n o n r e g u l a r t h e n t h e r e i s a n i n f i n i t e s t r i n g a s u c h t h a t n o two o f i t s p r e f i x e s x , xu a r e M y h i l l - N e r o d e equivalent x 3 xu. PROOF. Every language L G t * where t i s a f i n i t e a l p h a b e t c a n be r e p r e s e n t e d by a n i n f i n i t e l a b c l l e d t r e e . The e d g e s o f t h e t r e e c o r r e s pond t o t h e symb o l s i n Z , t h e v e r t i c e s c o r r e s p o n d t o t h e s t r i n g s , a n d t h e l a b e l s "0" an d " 1 " a t t h e v e r t i c e s show w h e t h e r o r n o t t h e s t r i n g i s i n t h e language L .
' [ h e l a n g u a g e i s r e g u l a r i f a n d o n l y i f t h e r e i s o n l y f i n i t e number o f e q u i v a l e n c e c l a s s e s . L i s n o t r e g u l a r . Hence t h e r e a r c i n f i n i t e l y many E ' equivalence classes. We f i x o n e o f t h e s h o r t e s t r c p r e s e n t i n g s t r i n g s w f o r e v e r y e q u i v a l e n c e c l a s s . Hence a l l i t s p r e f i x e s a r e i n e q u i v a l e n t ( o r e l s e a s u b s t r i n g c a n b e c u t o u t , an d t h e s t r i n g w i s n o t t h e s h o r t e s t ) . We c o n s i d e r t h e t r e e r e p r e s e n t i n g L an d mark t h e v e r t i c e s c o r r e s p o n d i n g t o a l l s u c h s t r i n g w . By K d n i g ' s lemma f o r i n f i n i t e t r e e s , t h e r e i s a n i n f i n i t e p a t h c o n t a i n i n g i n f i n i t e l y many marked v e r t i c e s . T h i s p a t h d e f i n e s t h e i n f i n i t e s t r i n g w under the q u e s t i o n .
LEMMA 2 . 6 . I f a l a n g u a g e I, i s r e c o g n i z e d by a p r o b a b i l i s t i c 1-way ' T u r i n g m a c h i n e w i t h many work t a p e s w i t h p r o b a b i l i t y p , 2 / 3 i n s ( n ) = ~ ( l o g l o g n )s p a c e t h e n L i s r e g u l a r .
=
PROOF. T h e r e a r e n o mo r e t h a n r = ( c o n s t ) s ( n ) i n s t a n t a n e o u s c l e s c r i p t i o n s o f t h e l e n g t h ,C s ( n ) . Assume t h e c o n t r a r y o f t h e Lemma. We t a k e
R. Freivalds
44
t h e i n f i n i t e s t r i n g w d e s c r i b e d i n t h e Lemma 2 . 5 , a n a r b i t r a r y l a r g e n and c o n s i d e r t h e p o i n t s pw , p w 2 , ... c o r r e s p o n d i n g t o a l l t h e 1 f i r s t n p r e f i x e s o f w . I t f o l l o w s from Lemma 2 . 4 t h a t 3P - 2 P ( P w . l', ,I 9
f o r a n y d i s t i n c t ' i , j! We c o n s i d e r t h e s e p o i n t s p\q. a s t h e c e n t e r s of t h e following bodies 1 3 -2 p ( P w ' Pw.) c 92-
-
1
I t i s e a s y t o s e e t h a t t h e b o d i e s d o n o t i n t e r s c c t . 'The v o l u m e of e a c h o f them i s r
2'&-2) r!
A l l they a r e s i t u a t e d within an r-dimensional cube, t h e length of e d g e o f w h i c h e q u a l s 1 + ( 3 p - 2 ) . Hence t h e t o t a l number o f t h e b o d i e s
does not exceed
0 (rlogr) n.s2 logr bloglogn - logloglogn + const On t h e o t h e r h a n d ,
Hence
logr = s(n)
=
o(1oglogn).
Contradiction.
D
THEOREM 2 . 7 . I f a l a n g u a g e L i s r e c o g n i z e d by a p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e w i t h many work t a p e s w i t h p r o b a b i l i t y p > 1 / 2 i n o(1oglogn) space then L is rcgular.
P R O O F . T h i s i s t h e f i r s t p r o o f i n t h e p a p e r w h e r e we u s e e s s e n t i a l l y our n o n t r a d i t i o n a l d e f i n i t i o n of t h e space complexity f o r p r o b a b i l i s t i c machines. L e t t h e r e b e a " b l a c k box" c o n t a i n i n g a random number g e n e r a t o r w i t h two o u t p u t s y m b o l s 0 a n d 1 s u c h t h a t o n e o f t h e o u t p u t s y m b o l s i s p r o d u c e d w i t h p r o b a b i l i t y no l e s s t h a n p > 1 / 2 b u t we u n i o r t u n a t e l y do n o t know w h i c h symbol h a s t h i s p r o b a b i l i t y . I t i s a s i m p l e c o r o l l a r y from t h e law o f l a r g e numbers t h a t f o r a r b i t r a r y p > 1 / 2 t h e r e i s a c o n s t a n t d ( d e p e n d i n g on p ) s u c h t h a t d i n d e p e n d e n t e x p e r i m e n t s s u f f i c e t o i d e n t i f y t h e p r e v a i l i n g o u t p u t symbol w i t h p r o b a b i l i t y 3/4.
L e t t h e g i v e n T u r i n g m a c h i n e h a v e k work t a p e s . We c o n s i d e r a new m a c h i n e w i t h kd work t a p e s . Each k - t u p l e o f t a p e s i s u s e d t o s i m u l a t e o n e c o p y o f t h e g i v e n p r o b a b i l i s t i c m a c h i n e . The s i m u l a t i o n i s p e r f o r m e d i n d e p e n d e n t l y , p r o v i d i n g o n l y some s y n c h r o n i z a t i o n , n a m e l y , t h e c u r r e n t symbol i s r e a d f r o m t h e i n p u t t a p e o n l y a f t e r a l l t h e k - t u p l e s h a v e f i n i s h e d t h e i r i n d e p e n d e n t s i m u l a t i o n . Our n o n t r a d i t i o n a l d e f i n i t i o n of t h e space complexity p r o v i d e s t h a t e v e r y copy f i n i s h e s t h e s i m u l a t i o n w i t h o u t i n f i n i t e l o o p i n g . The o u t p u t o f t h c new m a c h i n e i s o b t a i n e d from t h e m a j o r i t y o f t h e o u t p u t s o f t h e simul a t e d machines. 'I'he new m a c h i n e r e c o g n i z e s L i n ~ ( l o g l o g n )s p a c e w i t h p r o b a b i l i t y 3 1 4 . I l e n c e , by Lemma 2 . 6 , L i s r e g u l a r .
0
45
Complexity of probabilistic one-way Turing machines
I t i s n o t known w h e t h e r Theorem 2 . 7 h o l d s i f w e o m i t o u r r c s t r i c . t i o n o n t l i c p r o h c l h i l i s t i c m a c h i n e s a n d use t h e t r a d i t i o n a l dc f i n i t i o n o f t lie s p a c c c 0111 j i 1 ex i t y .
OPEN 1'KORI.I:bl.
I \ c r c t u r n t o 1-way T u r i n g m a c h i n e s w i t h o n c work t a p e o n l y . R e v e r s a l c o m p l e x i t y Tor t l i c s c i n a c h i ~ i c swas i n t r o d u c c d a n d i i r s t e x p l o r e d by 11artin;inis [ i ] Ke prove t h a t p r o b a h i l i s t i c m a c h i n c s c a n h a v e a d v a n t i i g e s i n r e v c r s a l c o m p l e x i t y o v c r d c t c r m i n i s t i c o n e s . T h e r e f o r e new high lower hounds o f r e v e r s a l complexity f o r s p e c i f i c languages a r e provccl.
.
The m a i n got11 o f t h e r c s c a r c l i u n d e r l y i n g t h i s S e c t i o n w a s t o f i n d o u t w h e t h e r l a n g u a g e s r e c o g n i z a b l e by p r o b a b i l i s t i c one -w a y T u r i n g m a c h i n e s w i t h c o n s t a n t number o f r e v e r s a l s a r e r e c o g n i z a b l e a s w e l l h y ci e t e rm i ri i s t i c o n e - way l'u r i n g mac h i n e s w i t h ( a n 0 t h e r 1 c o n s t a n t number o f r e v e r s a l s . 'I'hc r e s u l t s b e l o w show t h a t t h e y a r e n o t . How much t h e n e e d e d number o f r e v c r s a l s i n c r e a s e s ' ? We h a v e n o t g o t f i n a l e s t i m a t e s h e r c . V e r y much dcpcnds o n t h e p r o b a b i l i t y o f t h e r i g h t r e s u l t o f t h e p r o b a b i l i s t i c mnchinc. I f a language i s c o n s i d e r e d srich t h a t f o r e v e r y & > O i t c a n h e r e c o g n i z e d w i t h p r o b a b i l i t y 1 - E ( d i f f e r e n t machines f o r d i f f e r e n t & ' s ) t h e n a t l e a s t c o n s t . l o g n rev e r s a l s by d e t e r m i n i s t i c n i a c h i n c s a r e n e e d e d ('l'heorcm 3 . 1 b e l o w ) . I f we c o n s i d e r a s e r i e s o f l a n g u a g e s s u c h t h a t f o r e v e r y E > 0 t h e r e i s a l a n g u a g e i n t h e s e r i e s w h i c h can b e r e c o g n i z e d w i t h p r o b a b i l i t y 1 - & t h e n we h a v e a b e t t e r e s t i m a t e , n a m e l y , c o n s t . r e v e r s a l s by d e t e r m i n i s t i c m a c h i n c s ( T h eo r em 3 . 2 ) . A t l a s t , i f we c o n t e n t w i t h o n e l a n g u a g e r e c o g n i z e d w i t h p r o b a b i l i t y 2 / 3 t h e n no l e s s t h a n c 0 n s t . n r c v c r s a l s by d e t e r m i n i s t i c m a c h i n e s a r e n e e d e d ( T h e o r e m 3 . 3 ) . l h e s e e s t i m a t e s c a n n o t b e i m p r o v e d f o r t h e c o n s i d e r e d l a n g u a g e s . On t h e o t h e r h a n d , we c o n j e c t u r e t h a t l a n g i i a g c s c a n b e c o n s t r u c t e d s u c h t h a t e v e n t h e f i r s t two o f o u r t h r e e e s t i m a t e s become l i n e a r o r a 1 most l i n e a r . I .
I f x i s a s t r i n g t h e n 1 x 1 . i s t h e number o f s y m b o l s i i n x .
Q
={q X,Y
+ , 1 , q
&ll\/o= I y J ,
8.
( X I 1
'JYI1
1x12 = I y I 2 ] .
t h e r e i s a 1 - r e v e r s a l bounded p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e w h i c h a c c e p t s e v e r y s t r i n g i n Q w i t h p r o b a b i l i t y 1 and r c j c c t s e v e r y s t r i n g i n with probability 1-E ( 2 ) E v e r y d e t e r m i n i s t i c 1-way ' T u r i n g m a c h i n e r c c o g n i z i n g Q m a ke s a t l e a s t c o n s t . l o g n r e v e r s a l s . ( 3 ) Given any c > O , t h e r e i s a d c t e r m i n i s t i c 1-way T u r i n g m a c h i n e w h i c h r e c o g n i z e s Q m a k i n g no m ore t h a n c .log11 r e v e r s a l s . l ' t I E O l ~ l 3 15 . 1 .
( 1 ) Given any & > O ,
.
P R O O F . ( 1 ) A t I ' i r s t , t h e m a c h i n e c h o o s e s a random i from a s e t c o n s i s t i n g o f a t l e a s t 3/6 i n t c g c r s . The work t a p e i s u s e d a s a c o u n t e r 2 t o a c c u m u l a t e l.lxl + i . l x l , + i . \ x i 2 and t h e n t o comparc i t w i t h 1 .4 l.Jylo + i . I y I , + I .Jyb. Quadratic equation with a t l e a s t one nonzero
c o e f f i c i e n t h a s a t most two r o o t s . Hence i f x 3 y ~ ( !t h e n no more t h a n 2 d i s t i n c t v a l u e s o f i c a n inakc t h e m a c h i n e t o a c c e p t t h e s t r i n g .
( 2 1 The p r o o f i s s i m i l a r t o t h e p r o o f o f t h e p a r t ( 2 ) o f The ore m 3 . 3 b e1 ow. ( 3 ) The m a c h i n e d e p e n d s o n t h e g i v e n c o n l y by a p p r o p r i a t e c h o i c e o f t h e p a r a m e t e r i . The i n p u t s t r i n g i s r e w r i t t e n o n t h e w ork t a p e .
R. Freiualds
46
Then a f t e r e v e r y r e v e r s a l v e r y many s y m b o l s a r e e r a s e d . Namely, o n l y e v e r y i - t h symbol 0 , e v e r y i - t h symbol 1 a n d e v e r y i - t h sym bol 2 r e m a i n n o t e r a s e d . T h i s e r a s i o n a l l o w s t o c o m p a r e m odulo i t h e number o f r e m a i n i n g symbols 0 , 1 , 2 i n t h e s t r i n g s x and y. A l l t h e symhols a r e e r a s c d i n Llogi 1 x 3 ~ 1 1 r e v e r s a l s . The l a n Next w e c o n s i d e r a s e q u e n c e o f l a n g u a g e s K i n ( 0 , 1 , 2 , 3 ) * . g u a g e I$, c o n s i s t s o f a l l t h e s t r i n g s o f t h 8 form x , 2 x 2 L x 3 2 2xk3xk+12xk+12 2 ~ w h ~e r e k~ > 2 m' , t h e i n t e g e r s 2 , 3 , 4 , ,
...,
...
. . . ...
. ..
.. .
2m+l d o n o t d i v i d c k , x l e { O , l ) * , x z = m i ( x l ) , x 1 = X 3 = "5 = * x2 = x4 = Xh = . = x Z k . (We L I S C m i ( x ) t o d e n o t e t h e
..
= X2k-1,
mirror r e f l e c t i o n of
XI.
-
THEOREM 3 . 2 . ( 1 ) G i v e n a n y m , t h e r e i s a 2 - r e v e r s a l bounde d p r o b a b i l i s t i c 1-way T u r i n g m a c h i n e w h i c h a c c e p t s e v e r y s t r i n g i n II w i t h p r o b a b i l i t y 1 and r e j e c t s e v e r y s t r i n g i n K w i t h p r o b a b i l i v y l - l / m . ( 2 ) E v e r y d e t e r m i n i s t i c 1-way T u r i n g m a c hin? r e c o g n i z i n g K m a ke s a t l e a s t c o n s t F r e v e r s a l s . ( 3 ) G i v e n a n y c 7 0 a n d a n y n a t u r a T number m , t h e r e i s a d e t e r m i n i s t i c 1 -way T u r i n g m a c h i n e w h i c h r e c o g n i z e s It m a k i n g n o more t h a n cv r e v e r s a l s .
m
.. .
P R O O F . We u s e L r (rc{l , 2 , , m}) t o d e n o t e t h e l a n g u a g e r e c o g n i z e d by t h e f o l l o w i n g d e t e r m i n i s t i c 1-way ' l u r i n g m a c h i n e w i t h 2 r e v e r s a l s . The c o n d i t i o n s k >2m a n d i n d i v i s i b i l i t y o f k i s t e s t e d u s i n g o n l y t h e i n t e r n a l memory. A l l t h e o t h e r c o n d i t i o n s a r e t e s t e d d i s p l a y i n g t h c i n p u t s t r i n g o n t h e work t a p e i n t h e f o l l o w i n r way: * * x x1 * x2 1' * mi(x r+1 1 m i ( x k + r ) * m i ( x k t r - l ) *...* mi ( x 2 r + l ) * mi(xZr) * mi(x2r-,) *
... ...
* * 'k+r+ 2 'Zk T h i s d i s p l a y allows t o c o m p a r e x . w i t h m i ( x . 1 i f a n d o n l y i f 1 1 i + j s 2 r + l (mod 2 k ) . O b v i o u s l y , R m c L r . 'k+r+l
*
The p r o b a b i l i s t i c m a c h i n e p i c k s a random r a n d t h e n r e c o g n i z e s t h e language Lr. We p r o c e e d t o p r o v e t h a t u # v i m p l i e s L u l l L v = Km.
Indeed, l e t
...,
z e L u / I Lv a n d s b e a n a r b i t r a r y e l e m e n t o f t h e s e t { O , l ,
k-l}.
m i ( x 1 , 2s+1+2jr2u+l(mod 2k). U 2j S i n c e Z S LV ' t h e r e i s a t ( d i f f e r e n t from s ) such t h a t x Z t t l = m i ( x Z j ) , 2 t + 1 + 2 j P 2 v + l (mod 2 k ) . T h u s f o r t - s s v - u (mod k ) t h e f o l l o w i n g h o l d s Since z E L
X
t h e r e i s a j such t h a t x2s+l
=
2s+l = X 2 t + l '
S i n c e k and v-u a r e r e l a t i v e l y p r i m e , i t c a n be p r o v e d u s i n g o n l y e l e m e n t a r y p r o p e r t i e s o f c o n g r u e n c e s ( e . g . Theorem 1 0 7 i n [l]) t h a t , k-I} can be displayed i n t o a sequence i l , i z , t h e set {0,1,
...,
...
ik s u c h t h a t i l t l
-
... ,
il
HV-u
t le n c e a l l t h e x 2 i + l a r e e q u a l . equal. z E R ~ .
(mod k ) f o r a l l 1 E {l , 2 ,
I t follows t h a t a l l mi(x
2j
.. ., 1 .
) also are
( 2 ) The p r o o f i s s i m i l a r t o t h e p r o o f o f t h e p a r t ( 2 1 o f Theorem 3 . 3 helow.
47
Complexity of probabilistic one-way Turing machines
( 3 ) The m a c h i n e d e p e n d s o n t h e g i v e n c o n l y by a p p r o p r i a t e c h o i c e o f t h e p a r a m e t e r d . Mien r e a d i n g t h e i n p u t , t h e m a c h i n e s t o r e s t h e i n f o r m a t i o n o n a 6 - f l o o r work t a p e . 'The f i r s t 3 f l o o r s a r e f i l l e d u n t i l t h e m a c h i n e h a s r e a d t h e s y mb o l 3 , t h e r e s t 3 f l o o r s a r e f i l l e d a f terwards
.
When r e a d i n g x l , t h e m a c h i n e s t o r e s i t b o t h a t t h e f i r s t a n d t h e s e c o n d f l o o r . Nhen t h c m a c h i n e r e a d s x 2 , t h e h e a d on t h e work t a p e r e t u r n s a n d c h e c k s w h e t h e r o r n o t x2
=
m i ( x l 1 . 'Then o n e m ore r e v e r s a l
i s inacle a n d w h i l e r e a d i n g x - t h e m a c h i n e c h e c k s w h e t h e r x 3
=
x1 and
moves t h e s t r i n g o n t h e s e c o n d f l o o r d s q u a r e s t o t h e r i g h t . W h i l e r e a d i n g x J !and a11 t h e s u b s e q u e n t s u b s t r i n g s ) t h e i n p u t s t r i n g i s c o m p a r e d w i t h t h e s t r i n g o n t h e s e c o n d f l o o r a n d a t t h e same time t h e l a t t e r s t r i n g i s moved d s q u a r e s t o t h e r i g h t . T h i s s e q u e n c e o f c h e c k s a n d moves i s p e r f o r m e d u n t i l t h e s t r i n g o n t h e s e c o n d f l o o r i s moved o f f t h e s t r i n g o n t h e f i r s t f l o o r ( T h i s m e a ns k > ( x 1 / d ) . I f t h i s h a p p e n s t h e n a l l t h e r e s t x . ' s ( u p t o t h e sym bol 3 ) a r E s t o r e d o n t h e t h i r d f l o o r w i t h o u t new I r e v e r s a l s . A f t e r t h e i n p u t s y mb o l 3 t h e h e a d r e t u r n s t o t h e i n i t i a l s q u a r e a n d p r o c e e d s t o f i l l t h e 4 - t h , 5 - t h an d 6 - t h f l o o r s i n t h e same way. When t h e r e a d i n g o f t h e i n p u t i s c o m p l e t e d , i n t h e c a s e i f t h e r e a r e nonempty s t r i n g s on t h e 3 - r d and 6 - t h f l o o r s , t h e m a c h in e sw e e p s and through t h e s e s t r i n g s checking whether a l l t h e s u b s t r i n g s x , . mi(x 1 c o i n s i d e i n t h e f i r s t d symbols, t h e second d syrnbol&:letc. 2j Now we c o u n t t h e r e v e r s a l s . Let 1 d e n o t e t h e l e n g t h o f t h e s u b s t r i n g x 1 a n d u d e n o t e t h e n u mb er o f s u b s t r i n g s x i i n t h e i n p u t s t r i n g . I f t h e i n p u t s t r i n g i s i n R m t h e n u = 2 k . The t o t a l l e n g t h o f t h e s t r i n g e x c e e d s u . 1 . I f u / 2 g l / d t h e n t h e n u mbe r o f r e v e r s a l s i s 2u+Zbconst.(iul. I f u/Z > l / d t h e n t h e r e a r e 2 1 / d r e v e r s a l s b e f o r e t h e t h i r d f l o o r i s u s e d , a n o t h e r 2 1 / d r e v e r s a l s when t h e 4 - t h a nd 5 - t h f l o o r s a r e f i l l e d a n d 2 1 / d r e v e r s a l s when t h e 3 - r d a n d 6 - t h f l o o r s a r e f i n a l l y p r o c e s sed. 6l/d s c 0 n s t . m .
,s)*. p r o j .
. x ) i s t h e s t r i n g o b t a i n e d f r o m x by 11 o m i t t i n g a l l t h e s y m b o l s n o t f r o m { i , j } . We c o n s i d e r t h e l a n g u a g e 'T = T o , U T z 3 U T 4 5 , w h e r e T . . = ( x h y 6 i j ( x y ~ ( 0 , ,l2 , 3 , 4 , 5 ) * & proj..(x)= 13 13 = p r o j i j (yl}.
L e t x E { O , I ,Z , 3 , 4
T I E O R E M 3 . 3 . ( 1 1 'There i s a - r e v e r s a l bounde d o r o b a b i l i s t i c 1-wav 'Turing machine which r e c o g n i z e s T w i t h p r o b a b i l i t y 2 / 3 . ( 2 ) Lvery' d e t e r m i n i s t i c 1-way 'T u r i n g m a c h i n e r e c o g n i z i n g T m a ke s a t l e a s t c 0 n s t . n r e v e r s a l s . ( 3 ) G i v e n a n y c > 0 , t h e r e i s a d e t e r m i n i s t i c 1-way T u r i n g m a c h i n e w h i c h r e c o g n i z e s T m a k i n g n o more t h a n c - n r e v e r s a l s . P R O O F . ( 1 ) The m a c h i n e p i c k s a random i ~ ( 0 , 2 , 4 ) , r e c o g n i z e s w h e t h e r t h e i n p u t s t r i n g z i s i n T 1. 1+1 . and t u r n s s p e c i a l a t t e n t i o n t o t h e
f r a g m e n t a f t e r t h e s e c o n d symbol 6 . I f z e T i i+l then z is accepted. I f i t is i s r e j e c t e d . I f t h e fragment i s of t h e but it is not equal t o ( i , i + l ) then z with probability 1 / 2 .
m
t h i s fragment i s - ( i , i + l ) and ( i , i + l ) and z r T i i + l t h e n z form Cj, j + l ) w i t h j e 0 , 2 , 4 i s accepted o r r e j e c t e i , b o t l
( 2 ) Let be a d e t e r m i n i s t i c 1-way T u r i n g m a c h i n e r e c o g n i z i n g T . We n o t e t h a t u n t i l a s y mb o l 6 i s r e a d f r o m t h e i n p u t t h e m a c h i n e i s t o
48
R. Freiualds
remember p r o j O l ( X I , p r o j . 1, -3( x )
and proj45(x).
Assume f r o m t h e c o n t r a r y t h a t a/f i s m a k i n g o ( lwl 1 r e v e r s a l s f o r a r b i t r a r y i n p u t s t r i n g s w . Wc d e n o t e t h c numbcr o f i n t c r n a l s t a t c s o f by a a n d t h e c a r d i n a l i t y o f t h e work t a p e a l p h a b e t by b .
'In
Let n b e a l a r g e i n t e g e r . P r e c i s e o r d e r o f m a g n i t u d e o r n w i l l b e d e s c r i b e d b e l o w . C o n s i d e r t h e f o l l o w i n g f i n i t e s u b s e t h1 o f t h c l a n g u a g e T . E v e r y s t r i n g w i n h1 i s u n i q u e l y d c t e r m i n c d by t h c s t r i n g s
'The s t r i n g w i s d c f i n e d by a p r o c e d u r c a s f o l l o w s . I t w i l l t u r n o u t t h a t w = x 6 y 6 u ~ P . 1 , p r o j O , ( x J = v O 1 , ~ ) r o j ~ ~ =( x ) projq5(x) = v45. Lct c ( w , i ) d e s c r i b e how many t i m c s t h e h e a d c r o s s e s t h e p o i n t i o n t h c work t a p e . L e t f ( n l b e t h c maximum o f c ( w , i ) o v c r a 1 1 s t r i n g s o f lcngth 4n + 1 6 n a l o g b + 3 a n d o v c r a 1 1 t h e p o i n t s . The a ssum c d contrary implies f ( n l 2 = o ( n ) . The s t r i n g w c o r r e s p o n d i n g t o v O , , v Z 3 , v d 5 b c g i n s w i t h v o , . We s h a l l u s e t h e t c r n i " i n i t i a l zo n c" t o d e n o t e t h e p a r t o f t h e work t a p e u s c d d u r i n g t h e r e a d i n g o f v o , . 'The l e n g t h o f t h c i n i t i a l z o n e d o e s n o t exceed a ( n + f ( n ) j . To d c f i n e t h c s u b s e q u e n t s y m b o l s o f w we l o o k a t processing the s t r i n g w . I f @j' i s g o i n g t o r e a d a symbol from t h c i n p u t a n d t h e hend o f t h c work t a p e i s i n t h e i n i t i a l z o n c t h c n t h e c u r r e n t symbol i s t a k e n f r o m 1123. I f t h e h e a d i s n o t i n t h c i n i t i a l z o n e t h e n t h c c u r When o n e o f t h e s t r i n g s v 2 3 o r v 4 5 i s r e n t s y m b o l i s t a k e n Prom v4 e x h a u s t c d , t h c r e m a i n i n g s y m 8 o l s o f t h e o t h e r s t r i n g a nd t h e sym bol 6 a r e addcd t o w . Then we a g a i n l o o k a t i7/' p r o c e s s i n g w . I f t h e h e a d o f t h e work t a p e i s i n t h e i n i t i a l z o n c t h c n t h c c u r r e n t sym bol i s t a k e n from I f t h e head i s n o t i n t h e i n i t i a l zone t h c n t h e c u r r e n t symbol i s t a k e n from v When o n e o f t h e s t r i n g s v d 5 o r v o l i s c x h a u s t e d , t h e o b t a i n e d s t r ? A i w i s c o m p l c t c d by: 1 ) t h c r e m a i n i n g s y m b o l s o f v 4 5 , t h e s t r i n g v 2 - , t h e s t r i n g 601 ( i f V O , was e x h a u s t c d l , v o l , t h e s t r i n g v Z j , t h e s t r i n g 645 o r 2 ) t h e remaining symbols ( i f v 4 5 was c x h a u s t c d ) .
.
02
Note t h a t i n t h c c a s c 1 1 a l l t h e s y mb o ls 0 , l o f t h e t a i l o f w a r c r e a d w i t h t h e h c a d o f t h e work t a p e n o t i n t h e i n i t i a l z o n e . I n t h e case 2 ) a l l t h e symbols 4 , s o f t h e t a i l o f w a r c r e a d w i t h t h e head i n t h c i n i t i a l zone. Lct bl(vOl, v 4 5 ) d e n o t c t h e s u b s c t o f M c o n s i s t i n g o f a l l w c o r r e s ponding t o t h e g i v e n v o l ? a n d a l l p o s s i b l e v 3 . ~ u c ht h a t i n t h e Let t ( w ) head of w t h e s t r i n g v isv$ihaused before the s f r i n g v d e n o t e t h e l e n g t h o f t t e h e a d o f w up t o t h e l a s t symbo14?rom v45. When &7' p r o c e s s e s s u c h a s t r i n g i n t h e p e r i o d b e t w e e n t h e r e a d i n g o f ( n + l ) - t h and t - t h symbols n R al o g Zb s y m b o ls a r c r e a d w i t h t h e h e a d i n t h c i n i t i a l zonc and l e s s t h a n n symbols w i t h t h c head o u t s i d e , and t h e h e a d c a n u s c n o more t h a n a f ( n 1 + a n new s q u a r e s o n t h e work t a p e ( o t h e r w i s c w would g e t a n s y m b o l s from v ~ ~ ) .
.
W i s t o rcmembcr d i s t i n c t s t r i n g s w e P ' I ( v O 1 , v45) by d i s t i n c t i n s t a n t a n c o u s d e s c r i p t i o n s . Hcncc I M ( v o l , v d 5 ) 1 ,< a . Z ( a n + o ( n ) ) . b
2 ( a n + o( n ) I
49
Complexity of probabilistic one-way Turing machines and f o r a r b i t r a r y p a i r ( v o , , v 4 5 ) t h e r c i s v such t h a t 23 , v4$.
W E bl \ b l ( V O l
I,ct bl
1
d e n o t e t h c f o l l o w i n g s u b s e t o f bl:
f o r every p a i r ( v o l , vdS) a
s t r i n g IV E bl bl(v o l , v a 5 ) i s t a k e n s u c h t h a t p r o j o l ( w ) p"ojJs(w) = v 3 S V4 5 * P l l
=
v 0lVO1 and
211
=
For c v c r y s t r i n g i n M, a l l t h c l e t t e r s 4,s o f t h c head of w are read w i t h t h c hcnd o f t h c work t a p c o u t s i c l c t h e i n i t i a l z o n e . IVc c u t b l l i n t o two s u h s c t s i n a c c o r d a n c e w i t h t h e l a s t sym bol o f w . 'fhc l a r g c s t s u b s c t i s d e n o t e d by bf,. I f t h e l a s t syinhol i s 1 (5, r c s p c c t i v e l y ) , t h c n M 7 i s c u t i n t o s u 6 s c t s i n : ~ c c o r d ~ n cwe i t h p r o j 4 5 ( w ) ( p r o j o 1 ( w ) , r e s p e c f i v e l y ) . The l a r g e s t s u b s e t i s d e n o t e d by b1 blg i s c u t i n t o subsct.s i n accordancc w i t h t h e c r o s s i n g sequence ?showing i n t c r n a l s t a t e s a t t h e c r o s s i n g moments a n d t h e o r d e r o f c r o s s i n g s ) on t h e p a i r o f c n c l - p o i n t s o f t h c i n i t i a l z o n c . The l a r g e s t s u b s e t i s d e n o t e d b y blJ
.
Now wc, niakc p r e c i s e t h a t n s h o u l r l b c l a r g c e n o u g h t o e n s u r e t h i s e s t i m a t c t o c x c c c d 2 . I l en ce 1\14 c o n t a i n s two d i s t i n c t s t r i n g s w 1 a n d w2. ' T h i s a l l o w s LIS t o c o n s t r u c t a t h i r d s t r i n g w 3 6'1' s u c h t h a t @7 c a n n o t t c l l i t from w 1 a n d w ? ,
-
I n d e e d , w c d c f i n c wj a s f o l l o w s . 'The h e a d o f w3 f o p y t h c h e a d o f w , . d c f i n c t h c t a i l o f w we c o n s i d e r t h e p r o c e s s i n g o f w1 a n d w2 by 'l'he t a i l s o f w 1 an d w2 a r e f r a g m e n t c d a c c o r d i n g t o t h c s i t u a t i o n o f t h e h c a d o n t h e work t a p c ( i n s i d e o r o u t s i d e t h e i n i t i a l z o n e ) . The number o f f r a g m e n t s i s t h e same f o r w, a n d w z b e c a u s e t h e c r o s s i n g scquences a t t h e e n d - p o i n t s of t h c i n i t i r i l zone a r e t h e s a m e . I f t h e l a s t s y mb o l o f t h e s t r i n g s i s 1 t h e n w i s made o f t h e fragments of w r e a d i n s i d e t h c i n i t i a l zone ( t h e y i o n o t c o n t a i n l e t t e r s 0 , l b e t o r e t h e second l e t t e r 6 ) a n d o f t h e f r a g m e n t s o f w2 r e a d o u t s i d e t h c i n i t i a l zone ( a l l t h e l e t t e r s 0 , l from t h e t a i l o f t h c s t r i n g a r e c o n c e n t r a t e d i n t h e s e f r a g m e n t s ) . I f t h c l a s t symb o l o f t h e s t r i n g s i s 5 t h e n w - i s made o f t h e f r a g m e n t s o f w 2 r c a d i n s i d c t h c i n i t i a l zone ( a l l t g e l c t t c r s 4 , 5 from t h c t a i l o f t h e s t r i n g a r e c o n c e n t r a t e d i n t h e s e f r a g m e n t s ) and o f t h e f r a g m e n t s of w, r e a d o u t s i d e t h e i n i t i a l zone ( t h e y do n o t c o n t a i n l e t t e r s 4 , s ) . '1'0
.
I f t h e l a s t sy mb o l o f t h e s t r i n g s i s 1 t h e n w 1 a n d w 2 d i f f e r i n p r o j e c t i o n s p r o j o , a n d d o n o t d i f f e r i n p r o j e c t i o n s p r o j 4 a n d i n w ha t t h e m a c h i n e w r i t e s o n t h e work t a p e o u t s i d e t h c i n i t i a ? z o n c u p t o a c c e p t s w 3 h u t p r o j O , ( h e a d ( w 3 ) ) # p r o j O l( t a i l ( w 3 ) ) t h e f i r s t symbol 6 . a n d w 3 r T. I f t h e l a s t s y mb o l o f t h c s t r i n g s i s 5 t h e n w 1 a n d w 2 d i f f e r i n p r o j e c t i o n s p r o j 4 5 and do n o t d i f f e r i n p r o j e c t i o n s p r o j o l and i n what t h e m a c h i n e w r i t e s o n t h e work t a p c i n s i d e t h e i n i t i a l z o n c u p t o t h e f i r s t symbol 6 . m a c c e p t s w b u t p r o j q S ( h e a d ( w 3 1 1 # p r o j 4 5 ( t a i 1 (wj)) a n d w. E T. C o n t r a d i c t i o n . 3
(3) Obvious.
U
50
R. Freivalds
ACKNOWI.EDGEMEN'I
I am g r e a t l y i n d e b t e d t o P e t e r v an Emde Roas ( A m s t e r d a m ) who k i n d l y a n s w e r e d t o my r e q u e s t a n d n o t o n l y p r e s c n t c d my p a p e r ; I t F C ' I ' ' 8 3 b u t a l s o s e n t many p a g e s o f comments t o me. l ' h c s c coiiinients i m p r o v c d t h e j o u r n a l v e r s i o n o f t h i s p a p e r v c r y much. E . g . , t h e p r o o f o f ' l h e o r e m 2 . 7 was t o t a l l y r e s t r u c t e r e d b e c a u s e P . v a n h i d e 1303s f o u n d :I much s t r o n g e r lemma h i d d e n b e h i n d my a r g u m e n t s (now Lcrnma 2 . 5 ) . Ilc g a v e me t h e p e r m i s s i o n t o i n c l u d e i t b u t n o t i c e d t h a t i t c a n e a s i l y be a well known r e s u l t i n t h e f o r m a l l a n g u a g c t h e o r y . It E I: E I1 E N C E S 1
Bukhstah, A . A . ,
Number t h e o r y ( U C p c d g i z , 19hO) ( R u s s i a n ) .
2
F r e i v a l d s , R . F a s t c o r n p u t a t i o n by p r o b a b i l i s t i c T u r i n g m a c h i n e s , U c* e n y e 2a p i s k i La t v i i s k o g o C o s Lid a r S t v e nn o g o Un i v e r s i t e t a , 2 3 3 ( 1 9 7 5 ) 2 0 1 -2 0 5 ( R u s s i a n ) .
3
F r e i v a l d s , I W ) .
(0)
Clause (0) forces the existence of a (possibly cyclic) grid. PT is thus satisfiable iff T satisfies R2. 1
Theorem 4.10 [HPS]: Satisfiability in PDL
+ { aAbaA ) is C:-hard.
Figure 2. Figure 1.
65
Recurring dominoes
-_ Proof: Given T , denoting aA6aA by L and a*b by N , construct PT as the conjunction of
m
[(")*](LRUD
= do).
(3)
Clause (0) forces the existence, in any potential model, of an infinite sequence of the form LY = uba26a3b.. . . Clause (1) associates dominoes from T with those points of 0 that follow u's, and (2) forces the matching of colors, so that cr corresponds to Gf, as illuslrated in Fig. 2. Nole how neighbors from the right and from above are reached using L. Consequently, PT is satisfiable iff T satisfies R2. 1
Remark: As in lhc proof in [NPS] it is possible lo modify this proof slightly and oblain the result for 1'DL i{ aAbA, baaA}. The question of whether PDL { uAba } is decidable or not is still open, cf. [Hl]. ~~
Thcorem 4.11 [HPa]: Satisfiability in PDL is Ci-hard.
+
+ { L } , where L = {a" I i 2 0 } ,
Sk(>tchof Proof [IlPa]: Givm T , construct PT as the conjunction of the following formulas, which involve thc additional predicate symbols Q i , A,, for 0 5 d 5 6 , 0 5 j 5 3.
66
D.Hare1
and
Here the claim is that PT is satisfiable iff T satisfies R3. This is rather difficult to see immediately, and the details of the proof appear in [HPa]. However, to get a feeling for it, clause (0) forces points at c'istances in { 2' 2 j 1 i , j 2 0 ) to form an octant grid as in Fig. 3. There, a parenthesized number is the subscript of that R i forced to be true ah the point. One secs that the element to the right of a point 8 satisfying Ri for i # 3, satislies R(i-l)(m,,d 3 ) and the one abovc it & ( i + l ) ( m o d 3 ) . Moreover, these :we the only two points in G++ a t distances a power of 2 from 8 . Thus, from any point on thc supcrdisgonal portion G++ of this L2 grid, any execution of L leads eilher l o itn neighbors or outside the grid. Clause (3) can be seen to state thc recurrence property of 113, and for it to work it is essential that do occurs in all G ; as in the statement of R3. I
+
-~ Remark: It
is open whether, e.g., PDL { a'' 1 i 2 0}, is undecidable.
+ L, for L = { uia I i 2 0 ) or L =
Thooreat 4.12 [S]: Satisliability in Global Process Logic is Ci-hard.
Recurring dominoes
61
Proof (cf. IS]): Given T , construct PT as thc conjunction of
((RIGHT = c;>[a](LEPT = c;)) A (UP = C; 2 [a]&(DOWN
[ a * ] m (m(LRUD = d o ) ) .
Here the claim is that PT is satisfiable iff 1' satisfies R2. Clause (0) together with the 0 part of (3), forces the existence of an implicit quadrant grid G+ in which point (i,j ) corresponds lo the segment P;,j = ( o i l . . . ,8 ; + j ) of an infinite path p = ( 8 0 , 8 1 , . . .) with (oi,s;+l) E p(a) for c;wh i. In this way, the right neighbor of p;,j is oblained by an (ixecution of a, and the above iteighbor by an execution of a l'ollowed by next. Executions of a* followed by lasi, correspond to arbitrary movement up a column; in this way (3) really asserts the recurrence property of lt2. See Fig. 4. I
Figure 3. Figure 4.
68
D.Hare1
5. Conclusions and Discussions It is hoped that the simplicity and similarity of the proofs in Section 3 and 4 speak for themselves. All lower bounds of NP, PSI’ACE, I:, II: and Ci for satisfiability in logical systems whicli are known to the author have beeii provided with such proofs. It seems that doniino problems, with their “3 tiling” format, are a perfect match I’or satisfiability problems, with their “3 model” format. It is the third class of domino problems, the recurriug ones of [H2], that enable completion of this picture for the various programming logics. Three general additional points are worth making. Since all domino problems owe their complexity to the correspondence with Turing machine computations, and since this correspondence applies to nondeterministic modcls just as well (“3 tiling” corresponds to “3 computation”), cf. [I12], domino problems can apparently not distinguish between deterministic and nondetcrministic classes. Thus, e.g., EXI’TIME-hard satisfiability problems, such as that for PDL [FL], do not admil domino proofs, whereas the above mentioned classes all do (PSPACE does by Savitch’s Theorem [Sa]). Domino problems are existential in nature and do not seem to extend in any natural way to capture altwnation. One additional quantifier can usually be managed, cf. the (relatively cumbersome) formulation of the X i problem U* used in the proof of Theorem 4.4. Thus, while games are good for alternation, dominoes are good for single existentials. Indeed the EXPTIME-hardness of PDI, is proved using EXPTIME = alternating-linear-space, with alternating TM’s, and as noted above cannot be proved using the lcinds of domino problems considered herein. Thc present paper and its companion [I121 make the catie for viewing C: sets as corresponding to cornputable finitely-branching trees with an infinite path containing a recurrence. Call these F-trees. It is a well known f‘nct that C i sets correspond to computable possibly infinitely-branching trees containing some infinite path. Call these Etrees. For example, the set of (notations for) recursive ordinals, of well-founded recursive trees, and of terminating computations of programs with unbounded nondetermillism, etc. are all III-complete (cf. [R, Cn, AP]). The correspondence between these views can easily be visualized by traversing a computable infinitely-branching tree with an NTM which at each stage nondeterministically chooses to either move across to a brother or down to a son, signalling when the latler is chosen. Its computation tree is an F-tree with recurring signal iff the initial tree is an I-tree. Conversely, given a computable finitely brmching treo with a “signal”, an infinitely-brauching treo can be constructed with nodes correspondin!; to liignal nodos in lhe former, and a node’s sons corresponding to all possible signalled descendents of the origin node. In particular, the recursive ordinal correrponding l o a nonrecurring domino set T = { do,. . . ,d, } is that assucialcd with thc following trcc: The root is associated with the 1 x 1 tiling con-
Recurring dominoes
69
sisting of do. The sons of each node are all possible minimal n X n extensions of the tilinl: associated with that node, for any possible n, which contain additional occurreuces of do. This tree is well-founded iff T does not satisfy 111. (Similar constructions clearly exist for othcr recurring domino problems.)
This obscrval ion c-onccrning “ f ~ t and ” “thiu” infinite trees is formalized in [€I%], : ~ n dtht. C ~ - b ~ i r d n c of s s the recur1 ing MTM’s (from which recurring domirtoes are derived) is oblaincd as a corollary. A significant1y stronger correspondence result for inlin~lct r x s , which has applicatious to lair computations a:; well as to richer cases of thc domino problem, will be published separately.
0. References Apt, K.lL arid G.D. Plotkin, Countable Nondeterminism and Random Assignment, Manuscript, 1982. Ucrgcr, It., Tlie Undecidability of the Dominoe Problem, Mem. Arner. Math. S O C . 00 (19titi).
Uuchi, J K , Turing Machines and the Entscheidungsproblem, Math. Ann.
148 (1962), 201-213.
Church, A., A Note on the Entscheidungsproblem, J. Syrnb. Logic 1 (1930), 101-102.
Chandra, R.K., Computable Nondeterministic Functions, 19th IEEE Symp. Found. cornput. Sci., 127-131, 1978. Cook, S.A., The Complexity of Theorem Proving Procedures, 3rd ACM Symp. Theory of Cornput., 151-158, 1971. van Erntle Boas, I)., Dominoes are Forever, 1st GTI Worlcshop, Paderborn, 75-95, 1983. Fischer, M.J. and 11.E. Ladner, Propositional Dyuamic Logic of llegular Programs, J . Cornput. Syst. Sci. 18 (1979), 194-211. C:urevich, Y., The Decision Problem for Standard Classes, J. Symb. Logic 4 1
(197ti), 400-404.
Curevich, Y. and 1.0.Koryakov, Remarks on Berger’s Paper on the Domino Problem, Siberian Math. J. 18 (1972), 319-321. IIarel, I)., Dynamic Logic, In: Handbook of Philosophical Logic 11, Reidel (1984), to appear. IIarcl, D., A Simple 1Iil:hly IJndecidable Domino Problem (or, A Lemma on lniioitc ‘l’reerJ, With Applications), Proc. Logic and Cumputtation Conference. Clayton, Victoria, Australia, Jan. 1984.
D.Harel
70
[HKP]
Harel, D., D. ICozeIi and R. Parikh, Process Logic: Expressiveness, Decidabilily, Completencss, J. Cornput. Syet. Sci. 25 (1982), 144-170.
[HMP] 1Ia1~1,U., A I L Mcyer and V.R. l’ratt, CoIuputibbility and Completeness in Logics ol’ Programs, 9th ACM Symp. Theory of Comput., 261-268, 1977. [HPa]
IIarel, D. and M.S. Patcrson, Undecidability of PDL with L = { a2‘ I i liJ 4006, 10/83, IDM Research, San Jose. Submitted for publication.
[HP]
IIarel, D. and A. Pnueli, Two Dimcnsional Temporal Logic, Manuscript, 1982.
[HPS]
IIarcl, D., A. Pnueli and J. Stavi, Propositional Dynamic Logic of Nonregular Programs, J. Comput. Syst. Sci. 20 (1983), 222-243.
[IW]
IIarel, D. and M. Vardi, PDL with Intersection, Manuscript, 198%.
[HI
IIoare, C.A.R., A r i Axiomatic Basis for Computer Programming, Comm. Asaoc. Comput. Mach. 12 (1969), 670-680, 583.
2 0).
[KMW] ICahr, A.S., E.F. Moore and 11. Wang, Entschcidungsproblem Reduced to the V 3 V Case, Proc. Nat. h a d . Sci. USA, 48, (1962), 385-377. [IC]
Keisler, J., Model Theory for Infinitary Logic, North Holland, 1971.
[La]
Ladner, R., The Computational Complexity of Provability in Systems of Modal Propositional Logic, SZAM J. Comp. 6 (1977), 467-480.
[Ll]
Lewis, II.Ii., Complexily of Solvable Cases of the Decision Problem for the Predicate Calculus, f 9th ZlWE Symp. Found. Cornput. Sci., 35-47, 1978.
[L2]
Lewis, I1.R. ,Unsolvable Claeace of QuantilicationalFormulaa, Addison- Wesley, 1979.
[LP]
Lewis, H.R. and C.H. Papadimitriou, Elements of the Theory of Computation, Prentice-IIall, 1981.
[MP]
Manna, Z. and A. Pnueli, Verification of Concurrent Programs: Temporal Proof Principles, Lect. Notes in Comput. Sci., Vol. 131, Springer-Verlag, 200-262, 1981.
[Me]
Mendelson, E., Introduction t o Mathematical Logic, van Nostrand Reinhold,
[MI
Meyer, AIL, Private Communication, 1077.
[MS]
Meyer, A.R. and L.J. Stockmcycr, Word Problems Requiring Exponential Time, 5th ACM Symp. Theory of Comput., 1-9, 1973.
1964.
[MSM] Mcyer, A.R., 1 1 3 . Strcctt and G . Mirlcowsh, The Dcducibility Problem in I’roposii,ional Dyn:rmic Logic, Lecl. Notes in Comput. Sci., Vol. 126,SpringerVcrlag, 12-22, 1981.
Recurring dominoes
71
Pnueli, A., The Tcmporal Logic of Programs, 18th IEEE Symp. Found. Comput. Sci., 16-57, 1977.
[PI
P r ~ ~ t V.R., t, Sem:mtical Considerations on Floyd-Hoare Logic, 17th IEEE Syilip. P’ound. Colriput. Sci., 109-12 1, 1970. Iteif, J.13. and A.P. Sistla, A Multiproccss Network Logic with Temporal and Sp:itial Modalities, TI1-29-82, Harvard Univ., Computation Lab., 1982. Robinsoxi, U.M., Undecidability and Nonperiodicity for Tilings of the Plane, Inventiones lkdalh.12, (1971), 177-209. Rogers, LI., Theory of llecuraive Functions und ldffective Computability, McCraw-IIiIl, 1907.
[Sa]
Switch, W.J., Ilclatiortships Between Nondeterministic and Ueterministic T a p Complexities, J. Comput. Syst. Sci. 4 (1970), 177-192. Shucnfield, J .It., Mathetn atic al Logic, Addison- Wesley, 19 61. SislJa, A.P. and E.M. Clarkc, Thc Complexity of Propositional Linear Temporal Logics, 14th A C M Syrnp. Theory of Comput., 159-167, 1982. Stockmcyer, L.J., The Polynomial Time Hierarchy, Theoret. Comput. Sci., 3 (1970), 1-22. Strcett, R.S., Global Process Logic is Il:-Complele, Manuscript, 1982.
Tui ing, A.M., On Computable Numbers with an Application to the Entmheidun!;sproblcm, Proc. London Math. SOC.2, 4 2 (1930-7), 230-265, 43 (1937), 544-540. Wang, II., Proving Theorems by Pattern Rccognition 11, Bell Syst. Tech. J. 40, (loon), 1-41. W ~ o g II., , Dotninocs and thc REA Case of the Decision Problem, In: Matheniaiicul Theory of Automata, Polytechnic Press, 1903, 23-55.
This Page Intentionally Left Blank
Annals of Discrete Mathematics 24 (1985) 73-102 0 Elsevier Science Publishers B.V.(North-Holland)
73
A NEW TRANSFORMATIONAL APPROACH TO PARTIAL CORRECTKESS PROOF CALCULI FOR ALGOL 68-LIKE PROGRAMS WITH FINITE MODES AND SIMPLE SIDEEFFECTS*) H. LANGMAACK Institut fiir Informatik u. Praktische Mathematik Christian-Albrechts-Universitat Kiel Olshausenstr. 40, D-2300 Kiel
ABSTRACT : With the help of equivalence transformations known from high level programming language implementation techniques sound and relatively complete partial correctness proof calculi for ALGOL 68-like programs are developed the functions and procedures of which have finite modes and simple sideeffects only. Special consideration is devoted to the relation variable elimination and separation rules and their exchangability. I. INTRODUCTION:
The phrase "programs with finite modes" came up with the algorithmic language ALGOL 68 where the programmer is forced to fully specify all language elements in a program. If necessary he has to do so with the additional help of mode equations. If equations are not needed then we talk about programs with finite modes. Other authors say programs without selfapplication of functions. Whereas ALGOL 68programs have one fixed interpretation we deal with uninterpreted ALGOL 68-like programs with finite modes. Recently there have appeared several papers [ 2 , 1 9 , 8 ] which investigate the existence of sound and relatively complete partial correctness proof calculi for sublanguages of uninterpreted ALGOL 68-like languages Lssd the functions and procedures of which have simple sideeffects only. We allow parameter transmissions by value, by reference or by name and we include functions which have functions as results. We give a comprehensive view and demonstrate how equivalence transformations of programs (Lemma 1 to 3 , 5 to 7 ) in the style of [ 1 1 , 2 , 1 3 1 naturally lead to programs for which sound and relatively complete calculi already exist (Theorem 3 ) 1 1 8 1 . This answers Conjecture 1 in [ I 5 1 with the proviso that we have to admit more general theories Th(1) with relation variables and more general expressive power. It is quite interesting that the same transformation technique leads to a proof that L has uniformly decissd dable divergence problems for finite interpretations (Theorem 1 ) [ I 3 1 such that a theorem of [ 1 6 1 on recursive enumeration of valid Hoare assertions is applicable (Theorem 2 ) . [ 1 9 1 and [ 8 1 introduce a new proof rule, the so called separation rule. We show that this rule is derivable in our calculus (Lemma 81, even exchangable with + ) The p r e s e n t article is t h e f u l l v e r s i o n of t h e FCT-paper
1141
H. Langmaack
14
our relation variable elimination rule (Theorem 4 and 5 ) . The equivalence transformations mentioned before are to a large extent known from and applied in high level programming language compilation and implementation techniques. So normalization is essentially the introduction of functional identifiers for certain expressions, mainly abstractions (Lemma 1). Global variable elimination is often done in order to avoid or at least control sideeffects of functions (Lemma 2), although there is no general mechanism to eliminate global variables (Corollary 2). The simplification process is part of the ALGOL-compilation technique to break down complex expressions (Lemma 3 ) . Decurrying is done to transform higher ALGOL68functionals into ALGOL60-functions with results of ground mode (Lemma 5 ) . Proceduring transforms ALGOL 60 -functions into proper procedures (Lemma 6). It is still an open problem to exchange our "global style" programs rule by a bunch of nice "local style" proof rules. These should be obtainable from the transformations above in a similar manner how we have obtained the relation variable elimination and separation rules from elimination of procedures as parameters (Lemma 7). 11. DEFINITIONS: We start out from ground modes 6 with special ones B for "Boolean" and y for "continuation". ref 6 with 6 y are called reference modes for variables, whose contents (values) are data of mode 6 and 6 with 6 y for parameter positions accepting such variables. are called value modes for formal value parameters with values of mode 6 and for parameter positions accepting actual parameters of mode 6, 3 6 or ref 6. 3 6 and ref 6 are modes of level 0, ground modes 6 , especially B and y , are of level 1; all these modes are simple. We define inductively: If pl,...,pn,pO, nzl, are modes of level v1,...,vn,v0 such that po is no reference nor value mode then is a compound mode of level max {vl+l,...,v + l , v o } I . . . ,pn + p o n and its result mode is . Modes of level 2 1 , i.e. those different from reference or value Rodes, are called name modes. They correspond to functionals in our ALGOL 68-like programs: these functionals never return variables nor value parameters as their results. So we have three disjoint categories of modes corresponding to parameter transmission by name, by reference or by value. We find it convenient to require nrl parameters for compound modes and avoid empty parameter lists ( ) . We assume that every mode p has a countable set Id' of identifiers x of mode p. These sets should be thought to be pairwisely disjoint, at least in case of free program variable identifiers, but in case of bound identifiers we need not be so rigorous since their modes are explicitly written in programs. This eases program manipulations later. Identifiers of reference mode ref 6 are called variable identifiers y, identifiers of mode & 6 are value parameter identifiers v, all othersare collectively called name or functional identifiers f. As opposed to real ALGOL 68 we have variables only for data of ground mode 6 4 y , we have no variables whose contents are functionals, functions or procedures. We have special denotations for functional identifiers in case of special modes: Function identifier when its mode is 6 or p ,..., vn 6 (function mode) , procedure identifier g when its mode is y or
+
\ P I
+
Partial correctness proof calculi for algol68-like programs
75
... ,pn + y (procedure mode). A procedure identifier is a special function identifier and this again is a special functional identifier. We shall see that we can abstain from higher functionals with compound result modes: we can reduce our considerations to functiorEI even to procedures as in ALGOL 60 (see Lemma 4 and 5 ) . Every full uninterpreted ALGOL 68-like programming language LA68 = L with finite modes is fixed by a so called signature C consisting of constants K of ground mode 6 9 y and functors cp of mode All..., 6,,+ 17 with A0 y. Constants and functors are thought to be programming 0 objects given from outside and different from all identifiers whereas identifiers are deliberately introduced by the programmer. L has some standard operators with standard interpretation, namely undefined constant R of mode 6 9 y (for every groundmode Ssy), equal relator = of mode & 6 , &v 6 + B, Boolean constants true and false of mode a , logical functors 1 of mode B B, A , V , =>, C.> of mode val 8, & B -,R, test of mode & B * y , skip and abort of mode y abbreviating test true and test false, assignment := of mode ref 6, 6 y composition : of mode y , y -+ y non-deterministic choice [7 of mode u , u * u conditional operator if then else fi of mode UIl
-+
-+
& R,u,u ul'".'un'uO application
u,
,..., .
-+
abstraction < A
> of mode
(uy-.,un ,..., ) of mode -+
(
+
Po),
-ref 6 i , u . , ~ j l u o po J
with non-formal variable and functional declarations where p are name j modes. Bar denotes a finite, possibly empty list with comma as the separating symbol. 7
-+
We let K also vary over Boolean constants and cp over equal relator and logical functors. Uninterpreted programs are built up from expressions s which are of name mode. When we write su then we express that the mode of s is u . We have the following contextfree-like grammar for expressions s : with ~ = 6 S'::=K 6 IV-va16 IY-ref6
I Ql-l
I fU
sB 1 skipYlabortYlyrefR : = s 6 with p = y
H. Langmaack
16
I
ul,
... run
and xi pairwisely distinct -+
u
in case p i in case pi
(tl,...,tn)
where ti is a variable yi of mode
-refdi = &6i
=
in case p i is a name mode
refsi
ti is an expression s of mode 6i i t i is an expression s of mode pi i
with yi, f. not necessarily pairwisely 7 distinct Remarks 1: When a variable y'ef6 or a value parameter v s 6 is considered as an expression sv then their modes r e f 6 resp. *S are coerced to p = 6 [ 2 0 1 . 1 . 2 . An actual parameter t of an application is transmitted by reor by name otherference if p . = ref6 by value if p i = *6 wise. A calllby refehence parameter positiok of mode ui=lefsi raLO accepts only variables yi as actual parameters, other positions accept beside expressions even variables and value parameters of appropriate mode since these can be considered as expressions also, see 1.1. 1 . 3 . Every expression s has so called final subexpressions of identical mode. In most cases s has exactly one final subexpression, namely s itself. In case s = s 1 ; s2 the final subexpressions of s are those of s2, in case s = sla s 2 or s = if so then s1 else s2 those of s 1 or s2, in case of blocks s = those of so. 1 . 4 . Simple expressions are constants K , variables y, value parameters v or functor applications c p ( . . . ) to simple expressions. Statements are expressions of mode y. Basic statements are test, skip, abort and assignment statements, functional identifiers of mode y and applications of mode y. 1 . 5 . Final subexpressions of statements are basic statements. Final subexpressions of expressions of mode 6$y are simple expressions, functional identifiers or applications of mode 6. Final subexpressions of expressions of compound mode p are functors, functional identifiers or applications of mode p . 1 . 6 . Lists y of non-formal variables and f; of non-formal functional idektifiers in functional declarations must not necessarily be pairwisely distinct. It is sometimes convenient to allow that these lists have identifiers occurring several times and to 1.1.
+
--,=I
Partial correctness proof calculi for algol68-like programs
71
extend the semantics appropriately: The rightmost one of identical identifiers overrides the others, applied occurrences are bound only to this one. 0 An uninterpreted program s is a statement without free functional or value identifiers. Only variables may occur freely and they serve as input-output medium. A semantics II s ll of programs s, i.e. an assignment of (non-deterministic) state transformations to programs s, is uniquely determined by an interpretation I of the signature C with its data doassume that the static scope copy or mains DA4@ for all e-6 write rule underlies the (operational) semantics of programs as fundamentally done in the ALGOL 68-report [ 2 0 ] or in [ 1 9 1 or [81. There is also a denotational or fixed point semantics as presented in [ 2 1 with domains naturally extended to discrete (flat) complete partial orderings which is an equivalent semantics 1 1 7 1 . Two programs sl, s2 are called schematically equivalent iff their semantics are equal, D = B s 2 II , for all interpretations I. If s 1
=-
Remark 2: Since it is our main goal to demonstrate a new transformational approach to a sound and relatively complete proof calculus for ALGOL 68-like programs with finite modes and simple sideeffects we believe it is not so much rewarding to give an explicit definition of the semantics here. It is more rewarding to understand the schematical equivalence transformation techniques in Lemma 1 to 3,5,6 which ALGOL-programmers often perform intuitively. Slightly exaggerated: Every semantics definition anyway has to be formulated such that these equivalence transformation techniques are sound. After normalization (which actually is a part of the semantics definition in the ALGOL 68-report) and simplification in Lemma 1 and 3 we shall present an operational-style semantics for simple-form programs. 0 111. EFFECTIVE EQUIVALENCE TRANSFORMATION FOR PROGRAMS: In order to have an easier access to the behaviour of ALGOL 68-like programs with finite modes we effectively transform them into ALGOL 6 -like programs in several steps. A program s is in normal form iff 1. abstractions occur only as right hand sides s" of functional declarations: 2. calling expressions s" ( s o called callers) of applications s"(tl,...,tn) have length 1, i.e. are functional identifiers f or functors cp only: 3. functors CD occur only as callers s" of applications, nowhere else; 4 . actual parameters s " on name positions of (non-functor) applications s 0 ( . . . , s " , . . . ) are functional identifiers f only. In a normal form program s we call a functional identifier not occurring as a caller or as an actual name parameter of an application a degenerated application. Lemma 1: Every program s can be effectively transformed into a schematically equivalent one sno in normal form. Proof: W.r.0.g. we may assume for s that the whole program, that bodies of abstractions and that bodies of functional declarations are blocks (The body of a functional declaration is either its riaht hand side if this is no abstraction or is the body of its right hand
H. Langmaack
78
side if this is an abstraction). If s is not in normal form then there is a "critical" subexpression s " which is an abstraction, a caller, a functor or an actual parameter such that l., 2 . , 3 . or 4 . is not true. We consider the smallest block sb which contains s " . We introduce a functional declaration funct ps,, f e s " (where s" needs not be enclosed in angle brackets < s " > to become a block) with a new functional identifier f with its appropriate name mode p ,,, replace s" in s by f and add this declaration to those of sh. IfSs" should happen bto be a functor cp of mode ~&6~,..., va16, * 6, then we introduce new pairwisely distinct value parameter identifiers vl,...,vn and replace the functional declaration above by funct P f e <Xvl,.. ,vn.v (v, ,vn)>. cp Since the number of critical subexpressions decreases the transformation process no comes to an end. This normalization technique no to introduce new functidonal declarations is well known to every ALGOL-programmer. 0
.
,.. .
Example 1: The following program s with 'count
= 'out P o = '1 =
f '
u+
= =
1JS =
* & Y
a, w,
=
& &
w
-b -+
+
out 1 ; f)
else
f
fi>,
of mode level 0
ref w
6
w
of mode level 1
a
of mode level 2 has an associated normal form program sno U g = Y + Y
f
fi>>,
which is a PASCAL-like program where formal functions f have no funtions as parameters. The only free variable is out and the semantics over natural numbers N is described by the partially correct Hoare 0 assertion
Partial correctness p r o o f calculi f o r algol68-like programs
{out
=
nl s {out
= 2
-
19
n + 11. o
Global parameters of a functional declaration in a program s are identifiers occurring in that declaration which are either free in s or declared outside the declaration. Since we intend to treat value parameters like reference parameters it is convenient to introduce so called restricted variable identifiers for which we prescribe restricted usage in a program: Every set I d r e f & of variable identifiers is countable. So we think it to be split up into two LI I d s of customary resp. restricdisjoint countable sets I= ted use variable identifiers. We prescribe that restricted use variables are forbidden to be used 1. as formal reference parameters of functional declarations or as actual reference parameters of applications: 2 . left hand variables of an assignment in a functional declaration if the variable is a global parameter of the declaration (global variable). A program s without sideeffects is one ;bere one (and consequently every) associated normal form program s of Lemma 1 has the following property: If a functional declaration has a global variable then the body of that declaration contains no functional identifier and only assignments to local non-formal variables declared in that body or the global variable is of restricted use. Remarks 2: 3.1. In order to define the notion "without sideeffects" we have to make sure that the global variable mentioned above is a "read only variable". This variable may not change its content as long as the functional is called (activated) and not yet terminated. Such change might happen only by an assignment to a global customary variable or to a local formal variable or by a functional call inside the body. 3.2. On the other hand, the notion "without sideeffects" does not necessarily imply that the effect of any called functional in sno is only returning a result without affecting the environment. In general, the environment is indeed affected by assignments to (local) formal variables. But these assignments are "controlled" by parameter transmission whereas assignments to global variables are "uncontrolled". 3 . 3 . It would have been more aesthetic to define the notion "without sideeffects" independently of the normalization process. But this would cause lengthy formulations without savings at other places. 0
A program s with simple sideeffects only is similarly defined as "without sideeffects": We allow additionally that the gloBg1 varior deable in question is totally global, i.e. either free in s clared outside all functional declarations. Supplement of Lemma 1 : A program s has no sideeffects resp. simple ones only iff sno has no sideeffects resp. simple ones only. Lemma 2 : Any program s with simple sideeffects only can be transformed effectively into a schematically equivalent one sws without sideeffects. Proof: Let program s be in normal form, and bound identifier renamings can achieve that s is d i s t i n q u i c , i.e. different defining occurrences of identifiers are denoted differently and no identifier occurs both free and bound. Let yl,...,ym be a list of all pair-
H. Langmaack
80
wisely distinct variable identifiers which occur as totally global customary variables of functional declarations. Let ref 6 1 f . . . f ref 6m be the modes of ylr...,ym. The new modes pEs of identifiers x in s are constructed inductively: ';1-1 is if the old ncde px is value or reference m d e 1-1,
ref G l r ...,ref firn
if px is ground mode ws ws Gm,pl ,...,wn
ref Gl,...,ref
-f
px
+
uy
if p x is compound mode vlf...,pn
+
p0.
The program s itself is transformed from "inside to outside": Every functional application
.
f (tlI . . Itn) is replaced by
.
.
f (Y1I . . rYm, tl I . . Itn). All degenerated applications f of ground mode 6 are replaced by
f(Ylf""Ym). Every functional declaration funct pf f G < Axlf ,xn.s > is replaced by 'Xn'S-ws> funct pTs f e , funct p f f e S where pf is compound and s is no abstraction is replaced by funct uTs f Sws.
...
.. .
..
.
.
*
All other program parts remain unchanged. This transformation technique ws to eliminate global variables is often advocated to and applied by ALGOL-programmers. But it works soundly only if applied tb-totally global-variables, see Example 2 and Corollary 2 . 0 Example 2: The PASCAL-like program sno Example 1 has two global variables namely count and out. = pys Y is ref w, ref w ws and p is ref w, ref w, u Y s + y . s is g >, -+
Partial correctness p r o o f calculi for algol68-like programs
funct
Ws
81
;*
<Xcount,out.out:=count>, 9 count:=^; g(count,out,g)>.
ws We should show that the elimination technique does not work soundly for global variables which are not totally global. Consider the PASCAL-like program -Sno which extends sno
, funct y e out:=count, count:=O; q(q)> such that {out = nlsno{outt = 2.n+11 is partially correct. loc is a global variable of i f but not totally global, namely locally declared in 9. Transformation ws applied to sno and loc yields >, funct vMs i e < X ~ O C. out:=count>, 9 count:=O; 9(loc,9)> W s = p W s = pws = ref w -+ y with pws = ref 0, (ref - w - + y ) + Y, u 9 9 f 9 where {out = nl -no s ws ioutt = 1) is partially correct. Therefore and ws are not schematologically equivalent. It is even so that there does not exist any effective transformation which transforms every finite mode program into onewith simple sideeffects only as we shall see later in Corollary 2. 0
sno
sno
Remarks 4: 4.1. Our notion of programs with simple sideeffects only is such that finite mode programs considered by the authors of [2], [8] and [I91 are among ours. 4.2. Programs in [2] have arbitrary abstraction nesting and mode levels, but no functional declaration nesting, no local nonformal variables, no reference parameters and no assignments in expressions s " (see proof of Lemma 1). 4 . 3 . Programsin [ 8 1 have arbitrary abstraction nesting and mode
H. Langmaack
82
levels, but no functional declaration nesting, no ground mode S+y as result mode, no reference nor value parameters, no local non-formal variables, but assignments to free variables on all abstraction levels. 4.4. In [I91 programs with nested PASCAL-like procedures and blocks are treated, mode levels are $2, the only result mode is y , procedures may have reference and name parameters and simple sideeffects, but no value parameters. Full aliasing is treated, a problem not occurring in [2,8] due to language restrictions.0 A normal form program s is called to be in simple form iff
1. actual value parameters t' in a functional (non-functor) application f(...,t',...) are restricted use variables or formal value parameters: 2. the right-hand side s ' of any assignment y:= s ' is a simple expression or a (degenerated) functional application (of ground mode S$.y); 3 . every subexpression on any other value position is a simple express ion.
Lemma 3 : Every normal form program s can be effectively translated in simple form. Simple into a schematically equivalent one ssl sideeffects remain simple, no sideeffects remain no sideeffects. Proof: W.r.0.g. we may assume that program s and its functional declaration bodies are distinguished blocks. First we consider functional applications f(tl,...,tn) with the actual parameters til, ,ti , i l < funct uf I f C. funct Udc 1 ,...,xn 1 ,xl 2 ,...,x 2 ,...'XI m ,...xm n * f' f' +<xxl ,... ,xr,xl 1 "2 m -
,...,x 1
m ,x2 I . . . ,xl,.-.,xm nm ) "2 1 2 2 In f (tl,.. . ,tnrx ,...,x ,xlI . . . , x I . . . I x1 I . . . , xm nm 1 "1 "2 where -
1
f (xl
2I ,xl
"1
.
. . .
xl,.. ,x 1
1
"1
are new pairwisely distinct identifiers with modes 1
u1
dc
, * . . l u n1l dc , u l2 dc l . . . r u n 2 dc r - - - I u ml dc r . . . r u m dc
2 "m We mention that the new modes of the old identifiers - f", f', x1 , . . . I Xrlf, f,tl,... tn are the decurried modes of the old modes. The new mode of s1Idc and of its final subexpressions ( * ) is 6. All other program parts remain unchanged. This process of decurrying dc works very systematic in case of simple form programs with finite modes and is often advocated to in the discussion around functional (applicative) style programming. The soundness of this technique is obvious if one looks at the way how semantics of simple form programs can be defined. 0 An ALGOL 60-form program has procedures only iff all function identifiers are procedure identifiers (of procedure mode y or u l , Pn Y). Lemma 6: An ALGOL 60-form program s can be effectively translated into a schematically equivalent one sPr with procedures only. Simple sideeffects remain simple and no sideffects remain no sideeffects. Proof: First we apply the process of procedurinq pr to all modes p . ppr is defined to be 1
...'
+
if u is
1-1
ref 6 uy,.
-+
6,
&
6 or y
if u is 6+y
y
. . ,u;:
ref
ref
6+y
if u is ull...lpn
+
6 with 6gy
H.Langmaack
86
..
upr,. , q + y if p is p , , . . . run Y. The program s itself is procedured Pr in this way: Function declarations funct 6 f" + s" with 6 g y or +
funct p f l f ' -+ ~Axl,...,xr.s " > with pfI=pl,...,pr
6, Sgy, are replaced
-+
.
funct 6pr
f" + t ~ y sllPr>
funct ::u
f' -+
resp
,.. . ,xr, y.s"P'>
is a distinguished program in IL. We denote the succes-
93
Partial correctness p r o o f calculi f o r algol68-like programs
'
sive transformation no ws si dc pr lLssd -, rr by . The rule of programs looks as follows: Programs rule
where s is a program E Lssd and s ' is a distinguished program f congruent with str. Unit I s ' has an empty environment. Congruence of expressions results from bound renaming of identifiers. ?4 All other axioms and proof rules deal with units in IL and higher order logical formulas in ILF I LF: Test, skip and abort axioms {s 3 P I E (
test
IF' { B 1
El
skip
El
abort
{
s
{PI, {PI, {
91
Assignment axiom { P I E I y : = s { 3u ( P [ u / y ]Ay=s[ u / y l )
Random assignment axioms
<
. commutes with disjunction
respectively. equivalent
In this the operator ! a ) resea.t:!eE
::a3 ( A
(i.e.
( u > A - < a > B ) and [ a 1 with conjunction.
B!
This can
be
,
is
explained in game theoretic terms by saying that - < a > , 1iE:e a game where player I is the only one who moves; the
only
one
who moves in Cal,
and in
..
and player I 1 i.i
More
general
modalities arising from games where both players move, and [ a ] , of --
monotonicity conjunctive. lacks,
and
is
game
share
the
but cannot be either disjunctive or
It turns out that this is the only property that ( a ) dropping
axiomatisation
of
the
corresponding axiom
from
d
PDL yields a complete axiomatisation
complete of
Game
Logic. 92.
with
Syntax and
the
Sewantics:
We ass~imethat the reader is familiar
syntax and semantics of FDL and
the
appendix I for a brief exposition.) However,
w-calculus.
(See
those f o r Game Logic
c a n be defined independently. We have a finite supply g l , ...,gn
atomic
games
and a finite supply P1,.-.,Pm of
atomic
Then we define games a and formulae A by induction. 1.
Each Pi is a formula.
2.
If A and B are formulae, then
3.
If A is a formula and a is a game, then ( w ) A is a formula.
4.
Each gi is a game.
50
of
formulae.
are A \ . B , -A.
The logic of games
,a*
u a n d fi a r e g a m e s .
If
c a.
,
6.
and a d . If
W e shall w r i t e a 6, of a 6.
and
If
A>.
w r i t e aA for (a)A. Intuitively, the
t h e n so a r e a:/3
Ca*l ar,d C A I r e s p e c t i v e l y f o r t h e d u a l s conf:_ision w i l l n o t r e s u l t t h e n
irlz
shall
~ . g . g l * A i n s t e e d o~ ( , g l * - ) ~ . t h e games c a n b e e x p l a i n e d as f o l l o w s .
is
a:B
player I has the
T h e game a 8 is:
move a n d i n i t h e d e c i d e s w h e t h e r a o r 6 is ta
first
a 6,
is a game.
A'
p l a y a a n d t h e n 8.
game:
(or s i m p l y a B ) ,
H e r e a d is t h e J d a l of a .
A is a f o r m u l a t h e n
* a
115
plai.~-d,
be
a n d t h e n t h e c h o s e n game is p l a y e d .
T h e game a 6 is s i i x i l x e * : c e p t
t h a t p l a y e r I 1 maLes t h e d e c i s i o r l .
In
repeatedly
(perhaps zero t i m e s )
a
* ,
t h e game a i s p l a y e d
until player I decides t o stop.
n e e d n o t d e c l a r e i n a d v a n c e how many t i m e s is a t o b e p l a y e d . is r e q u i r e d
as
p a r t of h i s s t r a t e g y .
Player I may not s t o p i n t h e middle
S i m i l a r l y w i t h t a x ] a n d p l a y e r 11.
s o m e p l a y o f a.
p l a y e r s i n t e r c h a n g e roles. If
but
t o e v e n t u a l l y s t o p a n d p l a y e r I 1 may u s e t h i s f a c t
he
evaluated.
He
A is f a l s e ,
Finally,
w i t h ..A:,
csf
I n ad, t h e t w o
is
t h e formula A
t h e n I loses, o t h e r w i s e w e go on.
(Thus
'A>B is e q u i v a l e n t t o A B.) S i m i l a r l y w i t h C A I a n d 11. a
Formally, worlds,
for
model
each
atomic
for Fs
game l o g i c c o n s i s t s o f
a s u b s e t n ( P ) of
p r i m i t i v e game g a s u b s e t o ( g ) o f W x P ( W ) ,
set o f W.
then
(s,Y)
E
define f 01 1 o w s :
o(g)(XI
n(A)
and
of
W
for
each
w h e r e P(W) is t h e power if
(a,X)
6
p ( g ) . W e s h a l l find it ccnvenient to
of p ( g ) as an o p e r a t o r from F ( W )
formula
a set
and
p ( g ) must s a t i s f y t h e m o n o t o n i c i t y c o n d i t i o n :
p ( g ) and X i Y ,
think
W
= is: ( s , X ) e p ( g )
;.
to itself,
given
by
I t is t h e n m o n o t o n i c i n X.
@ f a ) f o r m o r e complex
formulae
and
garec,
the We
as
R. Parikh
116
We s h a l l have occasion t o use b o t h ways of t h i n k i n g o f map
frcm
we
(s,X)EP(B;Y) teY, ( 5 ,X )
to itself,
P(W)
particular
shall
the
(easily
t h e r e i s a Y such t h a t
iff
Similarly,
(t,X)ep(r). E D (Y)
and a l s o as a subket
need
.
fact
( s , Y ) e p ( R ) and
iff
So f a r we have made no connecti o n w i t h PDL. a
W.YFiW>.
G+
checked)
(s,X)cp(B~*y)
a + s.
:2,
for
all
(s,X)cp(6)
or
However,
given
language o f PDL we can a s s o c i a t e w i t h i t a Game L o g i c where
each
program ai
o f PDL we a s s o c i a t e two games and
take
p()(X)
= Is:3t
(s,t)eRa
implies
tcX!
(s,t)cHa
and t c X !
In
that
Call.
and p ( C a l ) ( X )
and t h e f ormul ae o f PDL can b e
=
to We
:s!Tt
translated
e a s i l y i n t o th ose o f game l o g i c .
Note t h a t i f t h e program a i s t o
be r u n and p l a y e r I wants t o have
A t r u e a f t e r , then
o n l y < a > A needs t o be t r u e .
However,
i f he r u n s a,
i f p l a y e r I 1 i s going t o r u n
t h e program a t h e n CaIA needs t o be t r u e f o r
I t o win i n any case.
Note t h a t i f t h e r e a r e no a-computations b e g i n n i n g at t h e s t a t e s, t h e n p l a y e r I 1 i s unable t o move, I n o t h e r words,
CalA i s t r u e and p l a y e r I w i n s .
u n l i k e t h e s i t u a t i o n i n chess,
a s i t u a t i o n where a
I
p l a y e r i s unable t o move i s regarded as a loss f o r t h a t p l a y e r both
PDL and Game Logic.
t h a n PDL.
However,
Game L o g i c i s more e x p r e s s i v e
The f o r m u l a < C b l * > f a l s e of game l o g i c says
i s no i n f i n i t e computation o f
i n
t h e program b,
that
there
a n o t i o n t h a t can be
117
The logic of gbmes i n S t t - e e t t ' r F D ~ ' b u t n o t i n PEL.
e:-:presseit formula
:'.
.xci...,es t o
vrhich s a y s t h a t p l a y e r I ca.n m a k e "a"
(.:a?: [ b l ! * : : f a l c e ,
1 1 ' s " b " mGives i n s u c h a
p1z.y~:-
~ 1 a ; e r :I
.qill
the
we s c i s p e c t t h a t
way
that
eventually A
5s d e a d l z c k e d , c a n n o t b e e x p r e s c e d i n FDL
either.
(NR. X ~ s % eV a r d i h a s shcwn r e c e n t l y t h a t t h i s is i n d e e d t h e case.! l e t iis shoc h o w w e l l - f o ~ n d e d n e s s c a n S e d e f i n e d i n
Finally,
Game
Logic. Gi%:en a l i n e a r o r d e r i n g R o v e r a set W ,
z : z n s i d e r t h e model
of
Same L o s i c w h e r e g d e n o t e s Cal a n d Ra
is t h e i n v e t - s z
of
R.
t h e f c r m u l a .:.:g*.:false
true.
Ther- R i s w e l l - f o u n d e d Player
over W i f f
I c a n n o t t e r m i n a t e t h e gai7-e a i t h o u t l o s i n g ,
r e q u i r e d t o t e r m i i i a t e t h e game s c ; m e t i m e .
to
is
keep s a y i n g t o p l a y e r
is
([a]*>
-::[a]*:>, is
11,
keep p l a y i n g ,
a
game w h e r e p l a y e r I 1 movEs,
&nd
Dwin
~
hope
that
! t h e sub-;azae Cal c f and i n t h e
r.ain
game
times
p l a y e r I i s o n l y r e s p o n s i b l e f o r d e c i d i n g hsw c a n y
;a1 p l a y e d ) .
is
E'ut h e i z .
T l e o n l y say . h ~C
I 1 d i l l sccinei- or l a t e r b e deadlocLec!.
player
relation
t h e r e are n o i n f i n i t e d e s c e n d i n g
Thus I wins i f f
s e q u e n c e s csf R o n W. However,
game l - ~ l g i cc a n b e t r a n s l a t e d i n t o t h e ! l - c a l c u l u s
(see a p p e n d i : . : I
CKI
decidable. first
CKFZI,
is
T h i s t r a n s l a t i o n i s n o t as o b v i o u s a s m i g h t a p p e a r
at
sight.
relations
The
i n o n e of
u-calculus,
like
PDL,
as (R>. a n d CRI,
t h e s e t w o forms.
However,
a t r a n s l a t i o n as w e claimed above.
where W'
binary
d o n o t know i f
t h e r e is a n e l e m e n t a r y d e c i s i o n
f o r dual-free
a
written
i s a s i i p e r s e t of
This a l l o w s
(See a p p e n d i x
t h e f u l l Game Logic with t h e dual operator.
of
on
i t is t r u e t h a t e v e r y game g
W c a n b e w r i t t e n as -i;a:>Cbl o v e r W '
procedure
based
n o t e v e r y game c a n b e
W a n d i t s s i z e is e x p o n e n t i a l i n t h a t o f W.
We
is
and w h i l e e v e r y b i n a r y r e l a t i o n R c a n b e r e g a r d e d as
game i n t w o w a y s ,
over
and by t h e d e c i s i o n p r o c e d u r e o f
of
UE.
t o gi.de
I1 f a r details.: procedure
f3r
An e l e m e n t a r y d e c i s i c i
G a m e Logic w i l l f o l l o w a s t h e consequence
t h e completeness r e s u l t ,
g i v e n below.
R. Parikh
118 33 C o m p l e t e n e s s :
The following axioms and rules are complete for
the "dual-free" part of game logic.
A
A
=>F
B 2 ) Monotonicity A => B
3)
Bar Induction
()A
The
=> A
soundness
Straightforward.
The
of
these
axioms
completeness
and
rules
proof is similar to
is
that
CKPII and proceeds through four lemmas. lemma I :
(Substitutivity of Equivalents) If kAB and D is
obtained from C by replacing some occurrences of A by B, then F-CD. Proof:
quite
Quite straightforward, using tautologies and rule 2).
in
119
The logic of games To
5haw
tha.t
ejetr?
c n n s i 5 t e r . t fcrmitl
c a n s t r - u c t a m 3 d e l f o r a g i v e n c o n s i s t e n t C:.) the
Fischer-Ladner
Fischer-La.dner
c l o s u r e o f Cc!.
c~D~L!?-E
as
c o n s i s t e n t s o n j u n z t i o n s cf
f o r m u l a s C and of
L e t FL 5,
the
sE-t
the
311
sf
e l e m e n t s c f F i ar;d t h t i r r , f g a t i n n c -
(gi)X#
W> and C,E f o r a r b i t r a r y form-tlae.
C-$D n e a n - % 'C=>IS.kle
D,
atoms
those
-:(A,X):A
Lft W be
k . ~
(as
W e s h a l l ase t h e c o n b e n t i o n t h a t t h e l e t t e r s 6.E' =t*.nd
i n iKF'11).
f o r atoms ( e l e m e n t s of
set
a5 f o l l o w s .
T h i s i s q u i t e simi a r t o
PEL.
ii
satis iatls,
i E
3
F;
,
consistent!.
is
l e t n ( F i j b e as b e f o r e ,
where
d i s j u n c t i c n o f a11 t h e e l e m e n t s Gf
we
Finally
Pi.
For all
Y
C
take
p(gi)
and
W
the
as
is
X#
the
W e g i v e f i r s t t h o p r o c f 40:-
X.
t h s c a s E where a l l t e s t s i r : all g a m e s a r e a t o m i c .
L e m m a 2':
For a l l
is c o n s i s t e n t ,
X Z W,
then
a l l atcmic t e s t games a , i f
AEW,
F; ( a ) X *
(A,X)epiaj.
P r a e f : By i n d u c t i o n on t h e c o m p l e x i t y a f a.
1 ) I f a i s some g i t h e n t h e lemaa h o l d s b y d ~ - ' i n i t i o n 5.f , c i < g + ) . 21 I f
is
i s .:iP>. f o r some F',
ci
consistent,
t h e n b y h y p o t h e s i s s.n3 a.::ior. 5
A 6 X a n d UkF b y d s f i n i t i o r ; of
so
the
A X#
model.
P E.0
(A,X)&p(a).
Then,
3 ) a is 6 , , y .
consistent.
is
consistent.
4)
a
is
Hence
one
(v(6:
consistent,
(y)X#:BeW)
is
say
!A
is
by l e m m a 1 where T
consistent.
Let
Y
=
is
Sa
) = P ( a ) .
t h e n B&Z. T h e n n o t e t h a t f o r a l l B c Z ,
120
R. Parikh
Then
is
it
A
NOW,
iinmediate
:( 8 ) Z#=::.Z#.
hypothesis
( a ) x # is c o n s i s t e n t ,
is c o n s i s t e n t , B.
Then C+* 3:
Lemma
by above,
If
consistent
A
( a ) ~ 'is
dl59
l e m m a 2.
.
a n d so A m u s t b e i n Z .
Thits ' : A , X ! ~ p : c x ) .
a l l a t o m s S si;cC, 5 k s . t
FL t h e n
i-Ff
(ii)
is
t h e l a s t t w 3 case5 a r e e q u i v a l e n t s i n i e A is
an
6
(iii) A
C
Also
(ii)=>-(i)
So a s s u m e ( i ) a n d u s e i n d u c t i o n o n t h e c o m p l e x i t i . of
a. T h e cases w h e r e f o r C+.
irductlcr;
(..:Bx:j Z#=';.7' .
c o n . s i s t e n t , so A 2'
atom a n d e i t h e r ( u ) C or i t s n e g a t i o n occurs i n A. by
by
(n)C
!a)C
iff
315.0,
inductian,
tie a fm-inula e q u i ~ ! a l e n t t o C.
will
Clearly
Proof:
s9
and
by b a r
C i n FL l e t C+ d e n o t e t h e s e t o f
Given
5
C
t h a t CX#=::Z'
Hence,
i s ;:P.-'. or g . or 6 - , u a r e a l l e a s y .
ci
3
1
W e write X
i s a f o r m u l a C1 e q u i v a l e n t t o C.
Then X'
2 ) S u p p o s e a is 8 ; ~ .S i n c e ( A , X ) E p ( a ) t h e r e m u s t e x i s t Y s u c h t h a t ( A , Y ) E P ( G ) a n d f o r a l l BEY,
A$
BEY,
all
for
(6)( y ) X#.
3)
B.
Also
D e f i n e Zg=X
is i n t h e u n i o n o f t h e Zn,
Since
A
By i n d u c t i o n h y p o t h e s i s
Also
(A,Z,-1)~~(6).
take t h e l e a s t m
(on n ) ,
for
a l l BEZ,-~,
axiom
5.
such
:.
that
p.+.. i .:' a .\. ., x #
.
SED.
so A< (.)C.
a l l C i n FL, A
.
i n t h e s i z e of
W,
We s u s p e c t t h a t t h e d e c i s i o n p r o c e d u r e c a n b e . x a d e
deterministic e x p o n e n t i a l
techniques due to Pratt.
(NH.
time
using
the
familiar
CVWI h a v e r e c e n t l y s h o w n t h a t t h i s
is i n d e e d t h e case.)
W e c o n j e c t u r e t h a t t h e a d d i t i o n of t h e f o l l c w i n g axiom scheme r e s u l t s i n a system complete f o r t h e dual operator.
7! ( a d ) A
-(a)-A
R. Parikh
122
44 M s n y p e r s o n g a ~ e - s :Lie n s w c o n a i d e r ;;,an-, p a r s r n &+.msz ; . i t i c h a.:rc,
r a r e ccmple:.: t h a r . k i y i p e r s o r i 3a.7e5.
general,
ia
certain they
aitio.35
...
a r.any
f;lai,ing
~
p,.
E.g.
whether
p1
t h e g a m e may b e ,
L.cLp~cse .-I-
game!
at
c5rtain
B If A i 5 a formula and a is a program, then < = > A is a formula (For
PDLA
only) If
o!
is a program, then
a ) is a formula.
of
135
The logic of games
T h e p r i n c i p a l r e s u l t s a r e t h a t v a l i d i t y i n F'DL is d e c i d a k l e i n DEXPTIME a n d t h a t t h e axioms g i v e n f o r G a m e L o g i c t o g e t h e r w i t h t h e a x i o m - : : a : > ( AB~ ). ' ; = > . : ( u > A . ( a > B a r e c o m p l e t e . . is
the
logic
DEXPTIME, The interest
o f d i s j u n c t i v e games.
PDL!
I n o t h e r Words,
is a l s o
decidable
F'DL in
C V W I b u t n o n i c e set of axiom-s is known. calculus t a k e s a d v a n t a g e of t h e f a c t t h a t c u r p r i m a r y in
p r o g r a m s i s as p r e d i c a t e t r a n z f o r m s ,
and
that
the
R. Parikh
136
It
is known t h a t t h e 1 1 - c a l c u l u s
i n c l u d e s F'DL,
see CKI,
properly
is d e c i d a b l e and
CW21.
Appendix I 1
A T r a n s I a t i o n of
G a m e L o g i c I n t o t h e iA-calcdl.dc:
earliet- t h a t G a m e l o g i c c a n b e t r a n s l a t e d i n t o t h e
We
said but
JA-CdlCLIlU5,
t h e r e is a s l i g h t d i f f i c u l t y w i t h t h i s s t a t e m e n t as i t s t a n d s .
a
mcdel
fratt,
a t l e a s t a s c o n s i d e r e d b y t.':nzen
of t h e !A-calculus, programs
However,
Game
in
relations,
are
binary Logic,
b u t games.
r e l a t i o n s on the
basic
the
objects
state are
zpacz
not
In and
bJ.
binary
T h i s d i s p a r i t y n e e d s t o be r e s o l v e d b e f o r e
w e c a n 5pea.k o f a t r a n s l a t i o n .
O+ Namely,
.:(s7X):
courc-e,
a b i n a r y r e l a t i o r : g i v e s rise tn a
i f R is t h e r e l a t i o n , t h e w e c a n d e f i n e t h e game 5' !3teX) ( ( s 7 t ) 6 R ) 3 .
the prcperty that
However,
(s,X!-'Y)eR'
iff
the
!s,X)&R'
gas?€.
t o tie
game d e f i r , e d t h i s way k,.u~.
or ( s , Y ) e K ' .
In
other
The logic of games
137
I t is c l r a r ncw tl-.at i f a Ea.me L q i c fr.r i
~ o fi z~i z le k t
~
t h e :i-calcitlus mi,et
thei?
it;e
. : ~ ~ l Aa.
a,-.N ~. - ,-
Ths
s i z e k + Z k = Hrwever, the t r a n s : a t i o ?
~ h i , t c ,A+
says
dEC3de FJE
frCWl
it
1 iT;Cde? !?
c a n s e p a r a t e W &.nd
mea.r;s.
-z.L'~!
the
Cs
F!W) i n s i d =
!J
-
p i . - z . r i S i l i t i e s z e e d t o be b i t i l t i n t o t h e s t r u r t u r e of
M i l l
cncdel o f
SE
a f o r m i l a A'
a s p e c i a l !:ind
G w h e r e A' and G'
t h a t t h e given u-calculus
l a n g u a g e of G a n d A'
p i ~ sa new
and t h a t
a Fame L o g i c i o r ! n v . l a A hs.s a
=,,,-%ld k 2 a b l e
.-hi:,
T h i s z,,e~-ic, t h a t
7 , +6. 2 ~ -
calci;?us A,
of
ii t h e t r a n s l a t i o n A+ o f
that
A+.
w i t h a mode:
bE a c o r r e s p o n ~ j i n g f o r m u l a A+ c f
preserve s a t i s f i a b i l i t y i n b n t h d i r e c t i c n c ,
i?',
etc.
then t h z r e w i l l
t r m s l a t e s A in a.
w h i c h dGes nz.t depend
model i z of
t h a t rpfii.a!
;:-
3z
C.ir,d.
w i l l i n c l d d e t h e atozic pre;jica.te.s c i
9
atzmic p r a d i c a t e symbol E ( f o r "is an e l = % s ~ t " I =T b r e r e
is a n a t o m i c p r o g r a - m a i f o r each g a m e 5 . a n d
e (choosing a n e l e m e n t ) . t r a n s l a t i o n of
a IPW
atorric p r m 3 r a m
F i r s t w e d e f i n e G ta b e t h e
~;~-:alc,~.l~is
t h e FDL f x m u l a
Intuitively,
G
says t h a t t h e u n i v e r s e W '
is d i v i d e d i n t o
R. Parikh
138
F i n a l l y we take A+ t o be A’.G. Gqie
Logic
madel
T h e n as w e i n d i c a t e d a h r l i E r ,
M of A c a n b e c o n v e r t e d i n t o a
mad21
of
a-r A’.
C o n v r r - s e l y , a n y m a d e l o f A+ is a model o f G arid h z n c e a l l games :f t h e f o r m .::ai>Cel b e g i n a n d e n d i n t h e e::ts?nc,ian model o f A+,
n!E?
w h i c h is, t h e r e f o r e a m a d e l 3 bath A ’
c o n v e r t e d i n t o a Game L o g i c m o d e l uf A w i t h n!E)
a
sf E.
Tt.*..::
arc! GI
can te
a3 W.
I t fcl:c&.;s
t h a t A is G a m e L o g i c s a t i s f i a b l e i f f A+ is u-calcc.lGs s a t i . s f i a t ~ l e .
CCKSI C h a n d r a , A., k-ozen, D., J o u r . ACM 28, (1981) 114-1ZT.. LEI E h r e n f e u c h t , A., Cosplefene:: Pretlem Zataenatica,
and StocLmeyer.
L.. “ Q l t e - - a c i c n “ .
A p p l i c a t i m of G a m e s Foras1 1 z e J Thearie,-“. 49 (1961) 129-141.
CEPRI S. E v e n ,
A.
”
An
for
P a z a n d M.
Rabin,
tz
t o the Fcndiice~t~
oral communication.
CFLI M. F i s c h e r a n d R. Ladner, “ P r o p o s i t i o n a l Dynamic L o g i c of R e g u l a r P r o g r a m s ” , J. C o n p . and SysteB Science 18 (1979) 194-211.
CGHI G u r e v i c h , Y., and Harringtan, L., “Trees, Automata, G a m e s ” , P r o c . 1 4 t h M M - S T O C S y m p o s i u m , (1982) 60-65.
and
The logic of games
139
This Page Intentionally Left Blank
Annals of Discrete Mathematics 24 (1985) 141-154 0 Elsevier Science Publishers B.V. (North-Holland)
141
institute ol %!athematics a n d Computer Science The Hebrew University. J e r u s a l e m , ISRAEL
Abstract An incremental connection problem
k disjoint p a t h s Trom sa t o i,. netbork
l 0 there are posiliue constants C and D such that SJtsn r' phases n l t h e nlpriihm Di-syoinl_Path(r'). disjoin1 paths are producedJor nll
( z . ~6)R,withprobability 1 - O(n-*). Notice t h a t the total number .ofparallel steps in r' phases is O(lqg%).
5. PROOFDFTHEORFX4.l-ONEPHASE&NALYSIS
At e ach p h as e, whenever t h e procedures BuilhTre e (v) need e dge s t m
149
Disjoint paths in networks extend t h e trees, t h e y evoke t h e function R u n d o m - R c k u p ( u s e b d g e s ( v ), n e w d d g e s (u))
(5.01 The code of this function is d e s g n e d t o give t h e same probability t o dl odtcomes (i.e (n - 1)-'
for r a n d o m g r a p h s o n
tt
vertices) p r o v i d e d t h e size dl
t h e undisclosed s e t new_edges(u) in t h e a r g u m e n t s of (5.0) does not decrease during a c o n c u r r e n t s t e p . This provision holds if only m e u evokes (5.0) during a step. o r il o t h e r evocations d o n o t constrain his cboice (e.g.
In o u r case (because we have r a n d o m
Tor random dlgraph inputs)
u n d m x t e d g r a p h s as inputs) outcome
1~
Tor
'u
a n d outcome v l o r -u lwhen
ju ,v is still a new edge) are mutually exclusive. However w e have
LEMMA 3 . 1 : Assume s e v e r a l v e r t i c e s . but n o t u. invoke (5.0) concurrmtly.
men 1 Pro6 ( t h e a t c o m e of (5.0)is u )2 7l-1
(5.1)
[this means it holds undeT uny f e a s i b l e cmdilioning]
PROOF: Indeed the probability is I
Ya-1
1 + n___.--r-1 T
Ya-1
I
-9-1-s
1 n-1'
2-
where r = I w e h - e d g e s ( v ) I and s is cardinality of the set W of vertices u h i c h invoke ( 5 0 ) and obtain v as new-edge
outcome during t h e con-
c u r r e n t step For nex vertices, like u . in t h e complementary set 07 W t h e relative probability is uniformly distributed i.e. ( n - ~ - l - s ) - I . Another way to explain (5.1) parallel
- distributed
IS
to take a process intertwined with the
algorithm, for generating t h e random graph space. In
t h i s process. if w chooses 21 while v chooses w . a n d after arbitration w wins
then a~ must pick-up a n o t h e r neighbor. l h u s increasing t h e probability df
.
other u ' s h e n c e (5.1]. Clearlyif t h e algorithm is sequential, o r ip weallowed pairs with opposite l r e c t i o n s in o u r d g r a p h s . t h e n t h e probabihtym ( + , I ) is always precisely
-.
1 n-1
Considering t h e instruction ol B u i l L T r e e ( v ] . we see t h a t the iniluence of the previous s t e p s a n d the o t h e r vertices i n t h e c u r r e n t steptoy t h e p a r a ) -
lel algorithm e n t e r s a t two places only.
E. Shamir and E. Upfal
150
(i) efiectlng t h e list used-edges ( v ) (ii) efIectlng the availability of
PI
t o join a t r e e (whether l a t h e r (u) #
4 and
s t a t u s (u)= Tree) T h e design of R a n d o d i c k u p a n d the resulting Lemma 5.1eliminates the influence o€ (i) ( a t least from the analysis). We obviate the innuence o! (ii) by taking t h e worst case estimate on t h e number of available vertices.
Consider a tree,'l rooted a t z a n d define the event
P ( r, where
. B , C) = ir, g'ows
-1 front size
2
c'R2
--
a
in a p h a s e
.JB
(5.2)
8 is a n y feasible event involving t h e ofher trees.
hemma'5.2 : For suitable p o s i t i v e constants C , d' h o b F( r, , G IC)2 d ' (5.3) f r o o f : We introduce a branching process Y = I Y ( j ) { which serves as a stro-
chastic lower bound (i.e worst case) to all the conditioned growth processes
to which (5.2) relates. We have t o compute the distribution o! Y ( j )= n u m b e r
of sons n f an
element v in generation j
(5.41
of t h e p r o c e s s '3 u n d e r t h e worst possible assumption a c r o s s t h e board: all other Znees and
other branches d t h e same t r e e had maximal growth.
How many vertices a r e striked o u t Yrom being sons of v ( v in generationj)? at most 1
aog
1
+n n ~ 2 f + 2
(5.5)
t h e first t e r m accounts for vertices occupied an old p a t h s creded a t previ1
DUS
phases;the second t e r m is obtained il all anz t r e e s grew as qull binary
t r e e s u p tQgeneration j . Thus t o get
Yo) one makes t w o independent
choices with s u c c e s s probability
a n d so
mj=E(Y(j))=2Pj, u f = V M Y ( j ) = 2 P , ( l -Pi)
15.7)
Disioint paths in networks
I5 1
The birthrate OT Y slows down with increasing j . Let X ; be t h e size o! generation k OT Y.
= Y ( k )+ , .
+ Y(k)
(×)
But e a c h Y ( k ) in t h e sum is independent of X; , t h e number of i e r m s m the s u m , hence
For the variance we
Substituting mj a n d
uj
use
t h e formula
from (5.6)- (5.7) I -
&
E ( & + , ) * 2 * ( 1 -2an'iogn)
-1
where b = un*Z?+*.If we t a k e Tor k'
.(I -ia)(~
b - b2 -)(I - -). .. 4
1 the integer n e a r -1ogn
2
(5.9)
-1ogm - 2
then lor R. sufliciently large
E ( + + J > A ym2
*
A
>o.
45.10)
what happens h e r e is that Torj 0 >n
Ths being true Tor t h e stochastic lower bound process Y ( j ) .it is t r u e $or all t h e conditioned t r e e processes, which grove (5.3) (since t h e m a i n I m p in
E. Shamir and E. Upfal
152
BuilLTree ( w ] r e p e a t s log N times) Having proved (5 3), we clearly have Prnb
Ir,
and
a n d this happens up t o 'k
r,
both g r o w front size 2
1 + 1 s -log 2
n
-1
of this f r o n t size d o n o t meet by step 'k
-1 z d'* % a
The probability t h a t
+ 2 of
(5 12)
r,
and
r,
B u i l h T r e e ( v ) is esZimated
by
Combining this with (5.12) we have
if t h e y meet {in B u i l L T r e e (u) 1, t h e n the book-keeping procedure M a r k f a t h ( w ) t h r e a d s a unique p a t h between them. This concludes the
praol oT Theorem 4.1.
6 . CONCLUSION
The contribution oT this article i s twofold: (i) A precise formulation OX a parallel
-
distributed algorithm tor con-
structing disjoint p a t h s between given pairs OT vertices. (ii) A perTormance analysis of this algorithm f o r random inputs.
The algorithm applies to any g r a p h and any imodest) connection request, provided two neighbors p e r vertex are available a n d ewen t ~ h scan b e relaxed.
The core 07 the algorithm is t h e execution of one p h a s e which
constructs some paths. In e a c h particular c a s e we .cannot tell b w many. However under t h e assumption t h a t for pick-up steps (which "drive" t h e algorithm) the outcome is uniformly distributed over all vertices, we carried a branching process analysis and proved that e a c h pair of the request hasa
probability > d
> 0 t o connect
during a phase.
An interesting b u t h a r d question is to evaluate
how well the algorithm
153
Disjoint paths in networks
perrorms (or what modifications wll help) when applied to g r a p h s with strong geometric restrictions E.g when p a t h connections have Lo be l a d o u t onVLSl deslgns
Relereoces 1
S.N.Bhatt. Dn concentration a n d ronneclion networks, TM 196/198J. M.I.T. Cambridge, Mass. 1981.
2
P , Erdos, 7 h e Art nJ Counting - S e l e c t e d W i n g s . J S p e n c e r Ed., The W.1.T. Press. Cambridge 1973.
3
M R Garey a n d D.S J o h n s o n , Computers nnd htracfnbility 31 G u i d e
in
ihe 7 h e q OJ NPCompZefeness.W . H . Freeman and Company. San Ran-
risco. 1979. 4.
E.Shamir a n d E. Upfal. N
-
processors graphs distributively achieve
p e r f e c t matchings in D(IoE*A’) b e a t s
Proc. 0 1Annual AM! Sym on
Ainciples oJ b f r i b u t e d Computing. 1982. 238-241
5. €. S h a m r and E Upfal, One-factor in random g r a p h s based on vertex choice. Ihscr. Math 7 1 (1982).281-286.
6 . E.Shamir and E Upfal. A fast construction of disjoint paths in communication networks. in %Dringpr
L e c f u r e h f e s in Computer Science
158 428-438 (Procerding of the FCT conference 1983)
This Page Intentionally Left Blank
Annals of Discrete Mathematics 24 (1985) 155-186 0 Elsevier Science Publishers B.V. (North-Holland)
155
Descriptional Complexity for Classes of Ianov-Schemes Peter Trum
Detlef Wotschke
Fachbereich Informatik, J. W. Goethe-Universitat Postfach 1 1 1 9 3 2 6000 Frankfurt/Main West Germany
Ab strac t This paper studies the trade-off in economy of description between deterministic and nondeterministic Ianov-Schemes with and without auxiliary variables. The description of control-structures by deterministic Ianov-Schemes with auxiliary variables or nondeterministic Ianov-Schemes without auxiliary variables can be exponentially more succinct than equivalent descriptions by deterministic IanovSchemes without variables. Nondeterministic IanovSchemes with variables can be double-exponentially more succinct than their equivalent deterministic Ianov-Schemes without variables.
I. Introduction One of the main incentives to do research in the area of Program Schemes [ l , 4 , 5 , 6 , 8 , 1 5 , 1 8 , 1 9 , 2 0 1 has always been the interest in the control-structure of a program. In the past, research in this area has primarily concerned itself with questions such as whether certain control-structures can or cannot be simulated by other control-structures regardless of how expensive, awkward or how clumsy such a simulation might turn out to be. With reference to research on conciseness of descriptional complexity in other areas [ 2 , 3 , 7 , 9 , 1 0 , 1 1 , 1 2 , 1 3 , 1 7 , 2 2 , 251 we believe that it is also very
P. Durn and D. Wotschke
156
important to determine whether a control-structure A , if it encompasses another control-structure B, can express or describe certain tasks more economically, or more succinctly than B can, provided of course that B can describe this task to begin with. Let C1 and C 2 be two classes of control-structures with complexity measures sizel and size2. We say that (C, , size1 ) is f (n)-more succinct or more economical than (C2, size2), denoted by (C,, sizel) f (n)(C2, size2), if there exists a se1 quence of control-structures Pn in C1 for n2l such that for every equivalent control-structure Pi in C2: 2 1 size2 (Pn ) >f (sizel(Pn ) ) almost everywhere. We will illustrate the notion of f(n)-succinctness by the following example in the area of formal language theory [221. Let NFA ( D F A ) be the class of nondeterministic (deterministic) finite automata and let the size of a finite automaton be the number of its states. ( N F A , size) is 2"-rnore succinct than ( D F A , size).
-
To our knowledge, questions such as whether a controlstructure A can describe certain tasks more economically, better or shorter than some control-structure B, and if so, by how much, have already been given some attention lvaliant 7 5 1 . We will use the concepts of program schemes [ 5 , 8, 151 to model control-structures. In this paper we will study various classes of Ianov-Schemes. Ianov-Schemes model control-structures of flowchartlike programs by abstracting from specific meanings (interpretations) of single operations (assignment, test etc.) and by replacing them by predicate and function symbols. Thus a Ianov-Scheme characterizes a class of programs. Each program in that class can
Classes of Ianov-schemes
be viewed as a pair (Ianov-Scheme, interpretation) where the Ianov-Scheme describes the control-structure and where the interpretation associates the abstract symbols with specific meanings. Different controlstructures (number of auxiliary variables, nondeterminism, restricted use of goto's) thus give rise to different classes of Ianov-Schemes. In the past, primarily questions of the following nature were investigated: Can any program scheme P 1 of a class C, be translated into some equivalent program scheme P 2 of a class C2? In this paper we will investigate to what extent the availability or usage of certain control-structures can influence the size of a program. The size of a program is the space required to store a program in a computer, e.g., program code generated by a compiler and storage space for variables. We will study and compare the economy of description between the following types of program schemes: Deterministic Ianov-Schemes (IAN), Nondeterministic Ianov-Schemes (NIAN), both with and without auxiliary variables. In Chapter I1 we will review the basic concepts of Ianov-Schemes, interpretation of a scheme, equivalence and execution. Chapter I1 can be skipped by readers familiar with the theory of program schemes. In Chapter I11 we will precisely define our measures v-size, d-size and size, and we will exhibit the economy of description between deterministic and nondeterministic Ianov-Schemes. Chapter IV will deal with the economy of description between Ianov-Schemes with and without auxiliary variables.
157
P. Trum and D.Wotschke
158
We summarize our results in the following chart. The upper triangular matrix shows upper bounds, the lower triangular matrix shows lower bounds on the number of nodes in a Ianov-Scheme. So, the entry a . for i<j indicates the upper bound 11 for converting any scheme of type i into one of type j. Conversely, the entry a. for i>j indicates the 11 lower bound which can occur for converting a scheme of type j into one of type i, where the scheme to be transformed has: n = number of nodes k = number of predicate-symbols t = number of variables s = number of markers An entry consisting of a " ( ? ) " followed by a bound indicates that this particular bound immediately follows from another one and that it might be improved independent of the bound it follows from. In this chart we use the following notation: IAN NIAN IANHK
: deterministic Ianov-Scheme : nondeterministic Ianov-Scheme
deterministic Ianov-Scheme with auxiliary variables NIANHK : nondeterministic Ianov-Scheme with auxiliary variables :
Classes of Ianouschemes
159
Chart A : Trade-offs in economy of description for the number of nodes
11. Preliminaries and notation
In this chapter we will briefly review the various classes of program schemes we want to consider, and recollect some of the well-known results about equivalence and translatability for these classes of program-schemes. For more details the reader is referred to [ 5 , 6 , 8, 191. Definition 2 . 1 Let
(Nondeterministic Ianov-Scheme):
C=F,UPcUF, be an alphabet of instruction symbols. F C , PI, Pc are disjoint sets where F c =If,, ,fn} denotes the set of function symbols, Pc={pl,...,pk} denotes the set of positive predicate symbols and 1 denotes the set of negative symbols. Pc ={p.Ip.EP 1 1 C
...
P. Trum and D.Wotschke
160
A n o n d e t e r m i n i s t i c Ianov-Scheme
( N I A N ) P i s now
d e f i n e d a s a 5 - t u p l e P = ( N , C , n o , F , 6 ) where N i s a f i n i t e s e t o f program n o d e s , C i s a n a l p h a b e t of
i n s t r u c t i o n symbols,
nOEN i s t h e s t a r t n o d e ,
FcN i s a s e t of f i n a l n o d e s and
6 i s a mapping from N x C i n t o P ( N ) ' )
,
which d e f i n e s
a s e t of t r a n s i t i o n s i n P.
Convention: I n t h e s e q u e l a N I A N P w i l l be r e p r e s e n t e d a s a d i r e c t e d l a b e l l e d g r a p h , A t r a n s i t i o n from a node n ,
t o a node n 2 w i t h o E C ( i . e . n 2 f 6 ( n l , o ) ) w i l l b e drawn as:
The s t a r t n o d e w i l l be i n d i c a t e d by a n arrow, and f i n a l nodes w i l l be r e p r e s e n t e d as double circles. Def. 2 . 1 d e s c r i b e s how a N I A N i s r e p r e s e n t e d s y n t a c t i c a l l y . I n o r d e r t o d e f i n e how s u c h a N I A N P models t h e c o n t r o l - s t r u c t u r e o f a program w e have t o d e f i n e what w e mean by a n e x e c u t i o n o f P u n d e r a n i n t e r p r e t a t i o n I o f t h e i n s t r u c t i o n symbols. Definition 2.2 L e t C=F UP C
C
UP,
(Interpretation): b e a n a l p h a b e t of i n s t r u c t i o n symbols.
An i n t e r p r e t a t i o n I of C i s a p a i r I = ( D , h ) , where D
i s a nonempty s e t , c a l l e d t h e domain of I , and h i s
a mapping which a s s i g n s t o each fEFC a t o t a l f u n c t i o n , d e n o t e d by h ( f ) , from D i n t o D , and t o e a c h pEPC a t o t a l p r e d i c a t e , d e n o t e d by h ( p ) , from D i n t o t h e set {O,ll.
~
' ) P ( N ) d e n o t e s t h e power s e t of N .
Classes of Ianov-schemes
Definition 2 . 3
161
(Execution of P under I):
Let P=(N,C,nO,F,R) be a NIAN and I=(D,h) an interpretation of C. 1 ) The execution relation
on NxD is defined
as follows: a) for nl,n2EN, fEFZ and xlED: (n,,xl)
(n2,x2) if n2E6(nl,f) and
h (f)(XI1 =x2 b) for nl,n2EN, pEPz and XED: (n,,x)
(n2,x) if n2E6(nl,p) and
h(p) (x)=I
,
c) for nl,n2EN, FEPC and XED: (nl,x)
(n2,x) if nZE6(nl,p) and
h(p) (x)=O As usual,
.
I-& I--&.
denotes the transitive-reflexive
closure of
2 ) The relation computed by a NIAN P under a particular
interpretation I, denoted by I(P), is defined as: I ( P ) = {(x,y)EDxDI(no,x)
-&t
(n,y), nEF}.
We can now define a deterministic Ianov-Scheme by imposing certain restrictions on the mapping 6 in Def. 2 . 1 such that a deterministic execution becomes possible. Definition 2 . 4
(Deterministic Ianov-Scheme):
A deterministic Ianov-Scheme (IAN) is a NIAN P=(N,C,n0,F,6) with the following restrictions: 1) 6 is a function from NxC into N, 2 ) if nEF then b(n,a) is undefined for all oEC,
3) for all nEN either a) 6(n,o) is defined for at most one oEX, or
P. Trum and D.Wotschke
162
b) if two transitions are defined for a node n, one must be labelled with a positive predicate symbol pEPC and the other with the corresponding negative predicate symbol F€FC. Definition 2.3 applies also to the class of deterministic Ianov-Schemes. Note that for deterministic Ianov-Schemes I(P) always describes a function. In [51 one can also find Ianov-Schemes with one auxiliary variable to which one can assign values from a finite set of markers. Since we want to consider trade-offs between deterministic and nondeterministic Ianov-Schemes with and without auxiliary variables, it seems appropriate to allow more than one auxiliary variable. We therefore extend the existing definition as follows: Definition 2.5 (Extended alphabet): Let H={vl,...,vnl be a finite set of variables, K={a,,...,a,~ a finite set of markers and C=F,UP,UF, an alphabet of instruction symbols. The extended alphabet of instruction symbols CHK is defined as CHK=FHKUPHKUPHK with
F ~ ~ = F , U I ~I~V ~+ E~ H~,a.EKl, 7
PHK=PCU{vi=a./viEH, a .EK}and
-
3
-
3
P ~ ~ = P ~ U { V( . V ~# E~H.a.EKI. , 1
3
3
For the new positive predicate symbol v . = a in P HK 1 1 v.#a denotes the corresponding negative predicate 1 1 symbol in HK’
Classes of Ianou-schemes
163
Definition 2.6 (Ianov-Schemes with auxiliary variables): A nondeterministic (deterministic) Ianov-Scheme with auxiliary variables (NIANHK, respectively IANHK) P is a 5-tuple P=(C,H, K,kO,V) with
H a finite set of variables, K a finite set of markers, kO=(aO1, ... ,aOn) the initial assignment of the variables, where aOiEK denotes the initial assignment of the variable viEH, and V a nondeterministic (deterministic) Ianov-Scheme over the alphabet ZHK. The following definition describes how auxiliary variables influence the flow of control in programs. Definition 2.7: Let P=(C,H,K,kO,V) be a NIANHK or IANHK with H={vl,...,vn}, K=ial,.,.,am} and V=(N,CHK,nO,F,G) and let I=(D,h) be an interpretation of 1. 1 ) Let nl,n2EN, let ai, a;EK
be values of vi for l