Stichting Mathematisch Centrum· 2E Boerhaavestraat 49 Amsterdam
Total Page:16
File Type:pdf, Size:1020Kb
zw stichting mathematisch ~ centrum· MC AFDELING ZUIVERE WISKUNDE zw 44/75 JUNE T .M. V. JANSSEN tN ARITHMETIZATION OF VAN WIJNGAARDEN GRAMMAR 7 L 2e boerhaavestraat 49 amsterdam Bl81.10l'~fi!il:{, MATHtMATISCH Cl'Nll/\•i.',li, PJu..n.:ted a..t the Ma..thema.:Uc..a.l Cen:tlie, 49, 2e BoeJihaave1:i.:tJr.aa.t, Am.o.teJidam. The Ma..thema:tic..a.l Cen:tlie, 6ou.n.ded .the 11-.th 06 FebJr..uafl_Y 1946, -loan.on. p1r..06U in..o.tltu.tlon. curn,ln.g a..t .the ph..omotion. 06 pUll.e ma..thema.:UCA an.d w app..Uc.a.:Uon..6. I.t -lo .opon..ooJr..ed by .the Nethe.Jilan.d6 GoveJin.men.:t .thh..ough the Nethe.Jilan.d6 01r..gan.,Lza.:Uon. 6oJr.. .the Advanc.emen.:t 06 PWl.e Re1:,ea1r..c.h (Z.W.O), by .the Mun.,Lupa..uty 06 Am.oteJidam, by .the Un.,lveMUy 06 Am.oteJidam, by the F1r..ee UniveMUy a..t Am.oteJidam, an.d by indU.6.:tluel:i. AMS(MOS) subject classification scheme (1970): 68A30, 02F43, 02F99 An Arithmetization of van Wijngaarden Grammar by T.M.V. Janssen ABSTRACT An arithmetization is given of the concept of a van Wijngaarden grannnar, by means of which it is proved that each van Wijngaarden grammar generates a recursively enumerable language. KEYWORDS & PHRASES: van Wijngaarden grarronar, arithmetization, generative aapaaity, reaursively enwnerable languages. INTRODUCTION Every recursively enumerable language can be generated by a van Wijngaarden grammar. This has been proved by SINTZOFF [9]; an elegant proof has been given by VAN WIJNGAARDEN [12] who showed that only one metanotion is needed to do so. The present report contains a formal proof of the reverse that each van Wijngaarden grammar generates a recursively enumerable language; no such proof has yet been given, as this fact is belied to be obvious by Church's thesis. The method of our proof is sketched as follows. A van Wijngaarden grammar concerns strings of symbols; it generates strings of special symbols and it gives rise to relations between strings (such as string s 1 can be obtained from string s 2 by applying some rule of the grammar). The problem we consider, is the question whether a set of special strings is recursively enumerable. We shall, however, not directly deal with this problem, but rather with a translation of it. We use a 1-1 encoding of strings of symbols in numbers. Relations between strings, become relations between numbers, and the problem becomes the question whether a set of special numbers is recursively enumerable. By solving the translated problem we have indirectly solved the original problem since the encoding is 1-1. This method, which is called arithmetization, is well known in recursion theory. We actually will obtain the result by defining a predicate wordgener ation (X,w,d), where Xis the code number of a van Wijngaarden grammar, w is the code number of a string and d encodes all the information about the derivation of w. From the definition of this predicate it will become clear that this predicate is primitive recursive. Apparently w E L(X) iff 3d[wordgeneration(X,w,d)], thus L(X) is recursively enumerable. The predi cate wordgeneration can actually be shown to be elementary recursive; this shows that the arithmetization is of the same complexity as the well known arithmetizations of Turing machines and of Markov algorithms. 2 FROM FORMAL LANGUAGE THEORY We recall the following from formal language theory; for details see HOPCROFT & ULLMAN [6]. Let V be a finite set. Then V+ is the set of all non empty strings consisting of elements from V, thus V+ = {v1···vn n ~ I, v. EV}. We indicate the empty string with A and put v* = V+ u {A}. 1. For w Ev*, let lwl denote the length of w. We designate a Chomsky grammar ( shortly grammar) by G = (V, E, P, S) where V is a finite set, E c V, SE V-E and Pc V+xv* is a finite set: the rules or productions. If there are no restrictions on P, then G is of Chomsky type O or shortly type-O. If Jul s lvl for each (u,v) E P then G is context-sensitive. If u E V-E for each (u,v) E P then G is context-free. If (u,v) E P and x,y Ev* then xuy Gxvy. We denote by i the transitive, reflexive closure of G" We omit subscripts G when no confusion is likely. The language gener ated by G is L(G) = {w Er* I S ! w}. A A-rule is a rule (u,v) E P with v = A. A homomorphism his a mapping v* • w*, where V and Ware finite sets, and h(xy) = h(x)h(y) for all x,y EV.* FROM RECURSION THEORY We recall the following facts from recursion theory; for details and proofs see DAVIS [3]. (I) The operation composition associates with the functions Ay 1 ••. ym f(y 1, ... ,ym), Ax 1 ••• xn g(x1, ••• ,xn), ••• , Ax 1 ... xn g(x1, •.• ,xn) the function (2) The operation of primitive recursion associates with the given total functions Ax 1 ••. xn f(x 1, ••• ,xn) and Azyx 1 ••• xn g(z,y,x1, ••• ,xn) the function Azx ••• x h(z,x , ••• ,x) where for all z,x , ••• ,x the 1 n 1 n I n following holds: 3 h(O,x1, ••• ,xn) = f(x1, ••• ,xn) , h(z+t,x1, ••• ,xn) = g(z,h(z,x1, ••• ,xn),x1, ••• ,xn). (3) A function is called a primitive reau:t'sive function if it can be obtained by a finite number of applications of the operations of composition and primitive recursion, beginning with functions from the following list: (i) >..x(x+l), (ii) >..x(O), (iii) >..x ••• x (x.). 1 n 1 (4) The following functions are primitive recursive >..xy(x+y) >..xy(xy) (5) Ann-place predicate Pis called a primitive recursive predicate if the characteristic function of the set {(x1, ••• ,xn) I P(x1, ••• ,xn)} is primitive recursive. (6) If P and Qare primitive recursive predicates, then so are the conjunc tion PA Q, the disjunction P v Q, the implication P • Q and the negated predicate 7 P. (7) The predicates<,~,>,~,=,* are primitive recursive. (8) If P(y,x1 , ••• ,xn) is a primitive recursive predicate, then the predicates R(zl ,zz,Xl ' ••• ,xn), meaning 3y[(z1 ~ y :;_ z2 A P(y,x1, ••• ,xn)J and S(z1 ,z2,x1 , ••• ,xn), meaning Vy[(z 1 ~ y ~ z2 • P(y,x1, ••• ,xn)J are again primitive recursive. The usual notation for these two predicates are Zz 3y P(y,x , ••• ,xn) zl 1 and z2 '/Y P(y,xt,···,xn) 1 respectively. 4 (9) We use the ~allowing definition of recursively enumerable set (this definition is equivalent to the one given by DAVIS [3]): A set Sis called recUPsiveZy enumerabZe if there exists a primitive recursive predicate P(x,y) such that S = {x I 3y P(x,y)}. CODING In the sequel we encode sequences of natural numbers in natural numbers; therefore, we need a primitive recursive function from nQO lNn to 1N. For convenience we require this function to be onto. The value of the function for the sequence x 1, .•• ,xn is denoted by tx1, .•. ,xn*· The value for the empty sequence is denoted by f *· We require this function to have the property that for all I$ i $ j $ n holds: f x. , ... , x . * $ t x , ... , x. , ..• , x . , ... , x * . l. J 1 i J n We require the following functions and predicate to be primitive recursive: the function L , which gives the length of an encoded sequence; thus L(fx1, •.. ,xn*) = n; the function( •• )., which gives the i-th element of a sequence; thus l. (tx , ••. ,x *>· = x. for I $ i $ n; 1 n l. l. the function* , which gives the code number of the concatenation of two sequences; thus X*Y = Hx)1,···,<x\(x),<Y)1,····(y\cy)*; the predicate EZem, where EZem(X,x) holds if£ for some i the i-th element in the sequence encoded by X, equals x. We define the primitive recursive function AXY • it(x,y) by { it(x,0) = t * it(x,n+I) = it(x,n) * Ox*). The primitive recursive function AX It(x) is now defined by It(x) = it(x,L(x)). The function It has the following useful! property. Let a= ta1, ..• ,an*' b = {b , ..• , b *• where m $ n, and let b , , •• and b be equal to subsequences of 1 m I m a , ... ,a (with b. = t * for at most one i). Then b $ It(a). We will use 1 n l. this estimate to bound quantifications. 5 There are several codings which have the desired properties and for which the required functions and predicate are primitive recursive. For example, see TROELSTRA [10] (proofs concerning the properties of this code are found in §:Z of KREISEL & TROELSTRA [7]) or VAN WIJNGAARDEN [13]. Tl1e actual choice of this code is, for our aims, arbitrarily. Even the use of an onto coding is not essential (for a code which is not onto see DAVIS [3]), but then one needs a primitive recursive predicate which tells whether a number is the code number of a sequence, and the definitions of the func tions and predicate have to be adjusted in order to remain total. DEFINITIONS CONCERNING VAN WIJNGAARDEN GRAMMARS A van Wijngaarden grammar (W-grammar) is an ordered sixtuple G = (VM,IT,L,PM,PH,S) where the following holds: VM is a finite set, the elements of which are called metavariahles; L is a finite set, the elements of which are called terminal symbols or terminals; IT is a finite set, the elements of which are called protovariables; S is a special symbol in IT, called the start symbol.