ACM Home Page
Please provide us with feedback. Feedback
On The Ambiguity Problem of Backus Systems
Full text PdfPdf (141 KB)
Source Journal of the ACM (JACM) archive
Volume 9 ,  Issue 4  (October 1962) table of contents
Pages: 477 - 479  
Year of Publication: 1962
ISSN:0004-5411
Author
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 3,   Downloads (12 Months): 29,   Citation Count: 13
Additional Information:

abstract   references   cited by   index terms   peer to peer  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/321138.321145
What is a DOI?

ABSTRACT

Backus [1] has developed an elegant method of defining well-formed formulas for computer languages such as ALGOL. It consists of (our notation is slightly different from that of Backus): A finite alphabet: a1, a2, …, at; Predicates: P1, P2, …, P@@@@; Productions, either of the form (a) ajPi; or of the form (b) Pi2Pi1PitPj. A word is a finite sequence of letters from the alphabet. Then IIIa states that certain words (containing only one letter) belong initially to some of the predicates, and IIIb states that if words W1, W2, …, Wt belong to the predicates Pi1, Pi2, …, Pit respectively, then the concatenation W1W2Wt belongs to Pj. We call this a Backus system. A simple example of such a system is: Alphabet: a, b; Predicates: P, Q, R; Productions: aP, bQ, PQR, QPR; RRR, PRQR, QRPR. Then P and Q contain only the words a and b, respectively, while R contains all words which have the same number of a's and b's. In the above example, abab belongs to R and can be produced in two ways. Namely, as abR and RRR, ababR; also as baR and PRQR, ababR. We call a Backus system ambiguous if one of its predicates contains a word which can be produced in more than one way. As, in practice, the meaning of a word is determined by the way it is produced, an ambiguous Backus System must be avoided. As the following example illustrates, ALGOL 60 [3] is ambiguous: if BC then for I: = 1 step 1 until N do if DE then A[I] : = 0 else K : = K + 1; K : = K - 1 In fact, both for I := 1 step 1 until N do if DE then A[I] := 0 and for I := 1 step 1 until N do if DE then A[I] := 0 else K := K + 1 are valid for statements of ALGOL 60. Combining the first with if BC then … else K = K + 1; or the second with if BC then … gives rise to the above example, and these two methods of construction correspond to the two possible meanings of the example. D. Dahm and H. Trotter, in a private communication, have raised the question: “Does there exist an algorithm to determine whether a Backus system is ambiguous?” We call this the ambiguity problem. The purpose of this paper is to show that no such algorithm exist, i.e., that the ambiguity problem is unsolvable.We first define a normal system. It consists of: A finite alphabet: a1, a2, …, at; A finite collection of ordered pairs: (g1, g1), (g2, g2), …, (gr, gr), where the gi and gi are words. An axiom A which is some fixed word. If U and V are words, we say UV if U is of the form gP and V is of the form Pg where (g,g) is one of the ordered pairs. We also write, in this case, giPPgi. Also, if U1, U2, …, Un are words with UiUi+1, 1 ≦ in-1, then U1Un, and we say Un is derived from U1. The words which may be derived from the axiom A are called theorems. A normal system is called undecidable if there does not exist an algorithm for determining whether a word is a theorem of the system. It is implicit in [2, sec. 6.5] that there exists an undecidable normal system, which we denote by NS, with the property that in each ordered pair (g, g), the words g and g have no common letters. LEMMA. If U and V are words of NS, then U → V, if and only if there exists indices j1, j2, …, jm such that Ugj1gj2gjm = gj1gj2gjmV. PROOF. Suppose the equality holds. As gj1 and gj1 have no common letters, U is of the form gj1R1 ; let U1 = R1gj1. Then we have UU1 and U1gj2gjm = gj2gj3gjmV. Proceeding inductively, we obtain a sequence of words, U, U1, U2, …, Um = V with UU1 → … → Um ; hence UV. Conversely, if UV, then there exist words U0, U1, …, Um with U0 = U and Um = V, and indices j1, j2, …, jm such that Ui-1gji = gjiUi, 1 ≦ im. Then U0gj1 = gj1 U1 or U0gj1gj2 = gj1U1gj2 = gj1gj2U2. By induction the proof is complete. THEOREM. The ambiguity problem is unsolvable. PROOF. We describe certain predicates and Backus systems; to save space we omit the formal definitions. It is easy to construct predicates and systems with the required properties. We use as alphabet the alphabet a1, a2, …, at of NS and in addition the letters b1, b2, …, br, one for each ordered pair (gi, gi) of NS. If A is the axiom of NS, form the predicate P which contains all words of the form bjmbjm-1bj1Agj1gj2gjm; if W is any word on the alphabet a1, a2, …, ar, let Qw be the predicate containing all words of the form bjmbjm-1bj1gj1gj2gjmW. It is possible to construct the predicates P and Qw so that there is no ambiguity in their definition, and we assume that this is done. Then form the Backus system Bw which contains the predicates P, Qw, and Sw, where Sw is defined by PSw and QwSw. Now, in order for Bw to be ambiguous, Bw must contain a predicate which contains a word which comes about in two ways. The predicates P and Qw, and all predicates used in their definition, do not have this property. Thus Bw is ambiguous if and only if Sw contains a word which comes about in two ways. From the definition of Sw, it is clear that Bw is ambiguous if and only if P and Qw have a word in common. Observing the form of the words in P and Qw we see that Bw is ambiguous if and only if there exists indices j1, j2, …, jm such that bjmbj1Agj1gjm = bjmbj1gj1gjmW. By the lemma, this is true if and only if AW. Thus if the ambiguity problem for Backus systems were solvable, then the decision problem for NS would be solvable, which is not the case. Hence the ambiguity problem is unsolvable.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
BACKUS, J.W. ACM-GAMM Conference ICIP, June 1959.
 
2
DAvis, MXR~IN. Computability and unsolvability. New York, 1958.
3

CITED BY  13
 


Peer to Peer - Readers of this Article have also read: