Binary Context-Free Grammars

: A binary grammar is a relational grammar with two nonterminal alphabets, two terminal alphabets, a set of pairs of productions and the pair of the initial nonterminals that generates the binary relation, i.e., the set of pairs of strings over the terminal alphabets. This paper investigates the binary context-free grammars as mutually controlled grammars : two context-free grammars generate strings imposing restrictions on selecting production rules to be applied in derivations. The paper shows that binary context-free grammars can generate matrix languages whereas binary regular and linear grammars have the same power as Chomskyan regular and linear grammars.


Introduction
A "traditional" phrase-structure grammar (also known as a Chomskyan grammar) is a generative computational mechanism that produces strings (words) over some alphabet starting from the initial symbol and sequentially applying production rules that rewrite sequences of symbols [1][2][3]. According to the forms of production rules, phrase-structure grammars and their languages are divided into four families: regular, context-free, context-sensitive, and recursively enumerable [4,5].
Regular and context-free grammars, which have good computational and algorithmic properties, are widely used in modeling and studying of phenomena appearing in linguistics, computer science, artificial intelligence, biology, etc. [6,7]. However, many complex structures such as duplication (ww), multiple agreements (a n b n c n ) and crossed agreements (a n b m c n d m ) found in natural languages, programming languages, molecular biology, and many other areas cannot be represented by context-free grammars [6]. Context-sensitive grammars that can model these and other "non-context-free" structures are too powerful in order to be used in applications [5,8]. In addition many computational problems related to context-sensitive grammars are undecidable, and known algorithms for decidable problems concerning to these grammars have exponential complexities [4][5][6]9].
An approach to overcome this problem is to define "in-between" grammars that are powerful than context-free grammars but have similar computational properties. Regulated grammars are such types of grammars that are defined by adding control mechanisms to underlying context-free grammars in order to select specific strings for their languages [5]. Several variants of regulated grammars, such as matrix, programmed, ordered, context-conditional, random-context, tree-controlled grammars, have been defined according to control mechanisms used with the grammars [5,6,8]. Regulated grammars are classified into two main categories: rule-based regulated grammars that generate their languages under various production-related restrictions, and context-based regulated grammars that produce their languages under different context-related restrictions [10].
Though this type of the classification of regulated grammars allows us to understand the nature of restrictions imposed on the grammars, it does not clarify the role of control mechanisms from the aspect of the computational power. If we observe the control mechanisms used in both categories of regulated grammars, we can see that they consist of two parts [6]: (1) a "regular part", which is represented by a regular language of the labels of production rules (in rule-based case) or a regular language over the nonterminal and/or terminal alphabets (in context-based case) and (2) an "irregular part", which is represented by appearance checking (in rule-based case) and forbidding context (in context-based case), provides an additional power to the regular part.
If a regular part is solely used, the regulated grammars can generate small subsets of context-sensitive languages. On the other hand, if the both of regulations are used, then most regulated grammars generate all context-sensitive languages [6,10]. At this point, we again return to the same computational problems related to context-sensitive grammars, which we discussed early. Thus, we need to consider such regulation mechanisms that can grant to extend the family of context-free languages only to required ranges that cover necessary aspects of modeled phenomena. One of the possibilities to realize this idea can be the combination of several regular control mechanisms. One can consider a matrix of matrices or a matrix conditional context as combined regulation mechanisms. For instance, paper [11] studied simple-semi-conditional versions of matrix grammars with this approach. The problem in this case is that the combinations of such control mechanisms are, firstly, not natural and, secondly, they are too complex.
We propose, as a solution, an idea of imposing multiple regulations on a context-free grammar without combining them. We realize this idea by using relational grammars. A relational grammar is an n-ary grammar, i.e., a system of n terminal alphabets, n nonterminal alphabets, a set of n-tuples of productions and the initial n-tuple of nonterminals that generates the language of relations, i.e., tuples of strings over the terminal alphabets. On the other hand, a relational grammar can be considered of a system of n grammars in which each grammar generates own language using the corresponding productions enclosed in n-tuples. Thus, we can redefine a relational grammar as a system of mutually controlled n grammars where the grammars in relation generate their languages imposing restrictions on the applications of productions of other grammars. If we specify one grammar as the main, the other grammars in the system can be considered to be the regulation mechanisms controlling the generative processes of the main grammar.
This work is a preliminary work in studying mutually controlled grammars. In this paper, we define binary context-free grammars and study their generative power. We show that even mutually controlled two grammars can be as powerful as matrix grammars or other regulated grammars without appearance checking or forbidding context. The paper is organized as follows. Section 2 surveys on regulated, parallel and relational grammars that are related to the introduced grammars. Section 3 contains necessary notions and notations used throughout the paper. Section 4 defines binary strings, languages and grammars Section 5 introduces synchronized normal forms for binary grammars and shows that for any binary context-free (regular, linear) grammar there exists an equivalent binary grammar in synchronized form. Section 6 investigate the generative powers of binary regular, linear and context-free grammars. Section 7 discusses the results of the paper and the power of mutually controlled grammars, and indicates to possible topics for future research.

Regulated, Parallel and Relational Grammars
In this section, we briefly survey some variants of regulated grammars with respect to the control mechanisms associated with them, parallel grammars as well as relational grammars, which are related to the introduced mutually controlled grammars.
The purpose of regulation is to restrict the use of the productions in a context-free grammar to select only specific terminal derivations successful hence to obtain a subset of the context-free language generated in usual way. Various regulation mechanisms used in regulated grammars can be classified into general types by their common features.
Control by prescribed sequences of production rules where the sequence of productions applied in a derivation belong to a regular language associated with the grammar: • matrix grammars [12]-the set of production rules is divided into matrices and if the application of a matrix is started, a second matrix can be started after finishing the application of the first one, as well as the rules have to been applied in the order given a matrix; • vector grammars [13]-in which a new matrix can be started before finishing those which have been started earlier; • regularly controlled grammars [14]-the sequence of production rules applied in a derivation belong to a given regular language associated with the grammar.
Control by computed sequences of production rules where a derivation is accompanied by a computation, which selects the allowed derivations: • programmed grammars [15]-after applying a production rule, the next production rule has to be chosen from its success field, and if the left hand side of the rule does not occur in the sentential form, a rule from its failure field has to be chosen; • valence grammars [16]-where with each sentential form an element of a monoid is associated, which is computed during the derivation and derivations where the element associated with the terminal word is the neutral element of the monoid are accepted.
Control by context conditions where the applicability of a rule depends on the current sentential form and with any rule some restrictions are associated for sentential forms which have to be satisfied in order to apply the rule: • random context grammars [17]-the restriction is the belonging to a regular language associated with the rule; • conditional grammars [18]-the restriction to special regular sets; • semi-conditional grammars [19]-the restriction to words of length one in the permitting and forbidden contexts; • ordered grammars [18]-a production rule can be applied if there is no greater applicable production rule.
Control by memory where with any nonterminal in a sentential form, its derivation is associated: • indexed grammars [20]-the application of production rules gives sentential forms where the nonterminal symbols are followed by sequences of indexes (stack of special symbols), and indexes can be erased only by rules contained in these indexes but erasing of the indexes is done in reverse order of their appearance.
Control by external mechanism where a mechanism used to select derivations does not belong to the grammar: • graph-controlled grammars [21,22]-the sequence of productions applied in a derivation to obtain a string corresponds to a path, whose nodes represent the production rules, in an associated bicolored digraph; • Petri net controlled grammars [23,24]-the sequence of productions used to obtain a string of the language of a grammar corresponds to a firing sequence of transitions, which are labeled by the productions, from the initial marking to a final marking.
Parallelism is another nontraditional approach used with grammars where, instead of rewriting a single symbol in each derivation step, several symbols can be rewritten simultaneously. There are two main variants of parallel mechanisms associated with grammars. The first is total parallelism, which is used in the broad varieties of (Deterministic Extended Tabled Zero-Sided) Lindenmayer systems [5,25] where all symbols of strings including terminals are in each step rewritten by productions. The second is partial parallelism where all or some nonterminal symbols (not terminal symbols) are written in each step of the derivations: • absolutely parallel grammars [26]-all nonterminals of the sentential form are rewritten in one derivation step; • Indian parallel grammars [27]-all occurrences of one letter are replaced (according to one rule); • Russian parallel grammars [28]-which combines the context-free and Indian parallel feature; • scattered context grammars [29]-in which only a fixed number of symbols can be replaced in a step but the symbols can be different; • concurrently controlled grammars [30]-the control over a parallel application of the productions is realized by a Petri net with different parallel firing strategies.
Another perspective in using the notion of parallelism with grammars is a grammar system, which is a system of several phrase-structure grammars with own axioms, symbols and rewriting productions that can work simultaneously and generate own strings. One of such grammar systems is a parallel communicating grammar system [31,32], where the grammars start from separate axioms, work parallelly rewriting their own sentential forms, and also communicate with each other by request. The language of one distinguished grammar in the system is considered the language of the system.
A relational grammar (an n-ary grammar) can be considered to be another type of grammar systems consisting of several grammars that work by applying productions synchronously or asynchronously [33,34]. More precisely, an n-ary grammar (where n is a positive integer) is a system of n terminal alphabets, n nonterminal alphabets, a set of productions and an initial n-tuple of nonterminals. Each production is an n-tuple of common productions or empty places. An n-ary grammar generates the language of relations, i.e., n-tuples of strings over the terminal alphabets. Work [33] showed that classes of languages generated by relational grammars forms a hierarchy between the family of context-free languages and the family of context-sensitive languages. Paper [34] studied closure, projective and other properties of relational grammars, and generalized the Chomsky's classification for n-ary grammars. Several other papers [35][36][37][38][39][40] also investigated the properties of relational grammars and applied in solving problems appeared in natural and visual language processing.
Basic conventions: the inclusion is denoted by ⊆ and the strict (proper) inclusion is denoted by ⊂. The symbol ∅ denotes the empty set. The powerset of a set X is denoted by P (X), while its cardinality is denoted by |X| . An ordered sequence of elements a, b is called a pair and denoted by (a, b). Two pairs (a 1 , a 2 ) and (b 1 , b 2 ) are equal iff a 1 = b 1 and a 2 = b 2 . Let X, Y be sets. The set of all pairs (a, b), where a ∈ X and b ∈ Y, is called the Cartesian product of X and Y, and denoted by X × Y. Then, X × X = X 2 . A binary relation on sets X, Y is a subset of the Cartesian product X × Y.

Strings, Languages and Grammars
We first recall the fundamental concepts of the formal language theory such as an alphabet, a string and a language from [41]: Definition 1. An alphabet is a nonempty set of abstract symbols.

Definition 2.
A string (or a word) over an alphabet Σ is a finite sequence of symbols from Σ. The sequence of zero symbols is called the empty string, and denoted by λ. The set of all strings over Σ is denoted by Σ * . The set Σ * − {λ} is denoted by Σ + .
Definition 4. The number of the occurrences of symbols in w ∈ Σ * is called its length and denoted by |w|. The number of occurrences of a symbol x in a string w is denoted by |w| x . Example 1. Let Σ = {a, b, c} be an alphabet. Then, w = aaabbbcc is a string over Σ where |w| = 8 and |w| a = |w| b = 3, |w| c = 2. We can notice that w belongs to L = {a n b n c m | n ≥ 1, m ≥ 1}, which is a language over Σ.
Next, we cite the definitions of context-free, matrix grammars and related notations which are more detailly given in [4,6].

Definition 5.
A context-free grammar is a quadruple G = (V, Σ, S, R) where V and Σ are disjoint alphabets of nonterminal and terminal symbols, respectively, S ∈ V is the start symbol and R ⊆ V × (V ∪ Σ) * is a finite set of (production) rules. Usually, a rule (A, x) is written as A → x. A rule of the form A → λ is called an erasing rule, and a rule of the form A → x, where x ∈ Σ * , is called terminal.
The families of regular, linear and context-free languages are denoted by L(REG), L(LIN) and L(CF), respectively. Definition 7. Let G = (V, Σ, S, R) be a context-free grammar.
• The string x ∈ (V ∪ Σ) + directly derives y ∈ (V ∪ Σ) * , written as x → y, if and only if there is a rule r = A → α ∈ R such that x = x 1 Ax 2 and y = x 1 αx 2 . • The reflexive and transitive closure of the relation ⇒ is denoted by ⇒ * .
• A derivation using the sequence of rules τ = r 1 r 2 · · · r n is denoted by where R contains the productions: r 0 : S → AB, r 1 : A → aAb, r 2 : A → ab, r 3 : B → cB, r 4 : B → c is a context-free grammar, and it generates the language L in Example 1.

Definition 8.
A matrix grammar is a quadruple G = (V, Σ, S, M) where V, Σ, S are defined as for a context-free grammar, M is a finite set of matrices which are finite strings over a set of context-free rules (or finite sequences of context-free rules). The language generated by a matrix grammar G is defined by L(G) = {w ∈ Σ * | S π = ⇒ w and π ∈ M * }. is a matrix grammar, and it generates the language {a n b n c n | n ≥ 1}.
The family of languages generated by matrix grammars is denoted by L(MAT).
Lastly, we retrieve the notions of a Petri net, a context-free Petri net and a Petri net controlled grammar from [23,24,44].

Definition 9.
A Petri net is a construct N = (P, T, F, φ) where P and T are disjoint finite sets of places and transitions, respectively, A Petri net can be represented by a bipartite directed graph with the node set P ∪ T where places are drawn as circles, transitions as boxes and arcs as arrows with labels φ(p, t) or φ(t, p). If φ(p, t) = 1 or φ(t, p) = 1, the label is omitted. A mapping µ : P → {0, 1, 2, . . .} is called a marking. For each place p ∈ P, µ(p) gives the number of tokens in p.   Figure 1 illustrates a cf Petri net N with respect to the grammar G 1 .

Definition 11.
A Petri net controlled grammar is a tuple G = (V, Σ, S, R, N, γ, M) where V, Σ, S, R are defined as for a context-free grammar and the construct N = (P, T, F, φ, ι) is a Petri net, γ : T → R ∪ {λ} is a labeling function and M is a set of final markings. The language generated by a Petri net controlled grammar G, denoted by L(G), consists of all strings w ∈ Σ * such that there is a derivation S r 1 r 2 ···r k ====⇒ w and an occurrence sequence ν = t 1 t 2 · · · t s which is successful for M such that r 1 r 2 · · · r k = γ(t 1 t 2 · · · t s ).
The family of languages generated by Petri net controlled grammars is denoted by L(PN).
The hierarchical relationships of the language families defined above are summarized as follows. The correctness of inclusions L(REG) ⊂ L(LIN) ⊂ L(CF) was first shown in [1,3]. The proof of the strict inclusion L(CF) ⊂ L(MAT) can be found in [41]. The equality L(MAT) = L(PN) was established in [23]. Moreover, the input place of each transition corresponds to the left-hand side of the associated production and its output places correspond to the nonterminals in the right-hand side of the production. If a transition does not have output places, then the associated production is terminal.

Binary Strings, Languages and Grammars
In this section, we define binary strings, languages and grammars by modifying the n-ary counterparts initially studied in [33,34].

Definition 12.
A pair of strings u 1 , u 2 , is called an binary string over V and denoted by u = (u 1 , u 2 ). The binary empty string is denoted by (λ, λ).
A binary production is a pair (r 1 , r 2 ) where r i , i = 1, 2, is either empty or it is a context-free production, i.e., r i ∈ V i × (V i ∪ Σ i ) * .

Remark 1.
A binary production (r 1 , r 2 ) can be written as u → v where u = (u 1 , For production r i = u i → v i , to indicate its left-hand side and right-hand side, we also use notations lhs(r i ) and rhs(r i ), i.e., lhs(r i ) = u i and rhs(r i ) = v i .

Remark 2.
In Definition 17, if each nonempty r i is regular production, then the grammar G is called regular and if each nonempty r i is linear production, then it is called linear.

Definition 18. Let G be a binary context-free grammar. Let u, v be pairs in
We say that u directly derives v, written as u → v, if there exist pairs x, z ∈ (V 1 ∪ Σ 1 ) * × (V 2 ∪ Σ 2 ) * and a production y → w ∈ R such that u = xyz and v = xwz. The reflexive and transitive closure of → is denoted by → * .
It is not difficult to see that, after n steps, the first production produces the pair (S n+1 1 , a n S 1 ). Then in order to eliminate all S 1 s, we apply the second production n times, and terminate derivation with applying the third production, which generates the pair string (λ, a n b n ). Thus, L(G 2 ) = {(λ, a n b n ) | n > 0}, and L r (G 2 ) = {a n b n | n > 0} ∈ L(CF). where R consists of the productions (S 1 → ABC, S 2 → X), generates the language L(G 3 ) = {(λ, a n b n c n ) | n > 0} where the right language L r (G 3 ) = {a n b n c n | n > 0} / ∈ L(CF).
Example 6 illustrates that binary context-free grammars can generate non-context-free languages, which implies that binary context-free grammars are more powerful than the Chomskyan context-free grammars. Thus, binary context-free grammars can be used in studying non-context-free structures such as cross-serial dependencies appearing in natural and programming languages using "context-free" tools such as parsing (derivation) trees.
We denote the families of binary languages generated by binary grammars with left and right grammars of type X, Y ∈ {REG, LIN, CF} by B(X, Y). We also denote the the families of the left and right languages generated by binary grammars by B(X), X ∈ {REG, LIN, CF}.

Synchronized Forms for Binary Grammars
In a binary grammar, the derivation of a string in the left or right grammar can pause or stop while the other still continues because of the rules of the forms (∅, r 2 ) and (r 1 , ∅). However, we show that the both first and second derivations by binary context-free grammars can be synchronized, i.e., in each derivation step, some pair of nonempty productions is applied and both derivations stop at the same time.

Definition 21.
A binary context-free (regular, linear) grammar G is called synchronized if it does not have any production of the form (∅, r 2 ) or (r 1 , ∅).

Lemma 1.
For every binary context-free grammar, there exist an equivalent synchronized binary context-free grammar.
Proof. Let G = (V 1 × V 2 , Σ 1 × Σ 2 , (S 1 , S 2 ), R) be a binary context-free grammar. Let We define the binary cf grammar where X, S 1 and S 2 are new nonterminals, and Then, the equality L(G) = L(G ) is obvious.
The proof of Lemma 1 cannot be used for showing that there is also a synchronized form for a binary regular or linear grammar. The next lemma illustrates the existence of an equivalent synchronized form for any binary regular grammar too.

Lemma 2.
For every binary regular grammar, there exist an equivalent synchronized binary regular grammar. S 2 ), R) be a binary regular grammar. Let R ∅ = {(r 1 , r 2 ) ∈ R | r 1 = ∅ or r 2 = ∅} and The proof of the lemma consists of two parts. First, we replace all binary productions of the form (A 1 → x 1 , r 2 ) and (r 1 , A 2 → x 2 ) with the productions (A 1 → x 1 E, r 2 ) and (r 1 , A 2 → x 2 E) where E is a new nonterminal, x i ∈ T * 1 ∪ T * 2 and rhs(r i ) ∈ T * 1 ∪ T * 2 , i = 1, 2. By this change, the early stop of one of derivations by the left and right grammars is prevented. Let Second, in order to eliminate empty productions, we replace all binary production rules of the , respectively, where A r s are new nonterminals. Thus, we define the following sets of new productions: where A r s are new nonterminal symbols introduced for each production r = (A 1 → α 1 , ∅) or We define the binary regular grammar G = (V 1 × V 2 , Σ 1 × Σ 2 , (S 1 , S 2 ), R ) as follows: First, we show that L(G) ⊆ L(G ). Consider a derivation (S 1 , S 2 ) = (w 1,0 , w 2,0 ) ⇒ (w 1,1 , w 2,1 ) ⇒ · · · ⇒ (w 1,n , w 2,n ) = (w 1 , For a derivation step (w 1,i−1 , w 2,i−1 ) ⇒ (w 1,i , w 2,i ), 1 ≤ i ≤ n, the following cases are possible: Case 1: the right-hand side is obtained by applying a production from Then, the same rule is also applied in the corresponding step in the simulating derivation of G .
Case 2: the right-hand side is obtained by applying a production of the form r = (∅, A 2 → α 2 ) or r = (A 1 → α 1 , ∅). Then, the production sequence (A 1 → A r , A 2 → A r ), (A r → A 1 , A r → xB 2 ) ∈ R 5 or the production sequence (A 1 → A r , A 2 → A r ), (A r → xB 1 , A r → A 2 ) ∈ R 6 is applied in the corresponding step in the simulating derivation of G .
Case 3: the right-hand side is obtained by applying a rule of the form (A 1 → x 1 , r 2 ), rhs(r 2 ) = ∅ or (r 1 , A 2 → x 2 ), rhs(r 1 ) = ∅. Then, the rule (A 1 → x 1 E, r 2 ) or (r 1 , A 2 → x 2 E) is applied in the corresponding step in the simulating derivation in G , and the derivation terminates with applying (E → ∅, E → ∅).
The inclusion L(G ) ⊆ L(G) is obvious: (1) the application of a rule of the form (A 1 → x 1 E, r 2 ), rhs(r 2 ) = ∅, or (r 1 , A 2 → x 2 E), rhs(r 1 ) = ∅, can be immediately replaced with the pair (A 1 → x 1 , r 2 ) or (r 1 , A 2 → x 2 ), respectively; (2) if a rule of the form (A 1 → A r , A 2 → A r ) or (A 1 → A r , A 2 → A r ) is applied at some derivation step, the only applicable pair of productions then is (A r → A 1 , A r → xB 2 ) or (A r → xB 1 , A r → A 2 ), respectively, since A r is the unique for each pair of productions. Thus, the sequence of pairs of productions ( Using the same arguments of the proof of Lemma 2, one can show that the similar fact also holds for binary linear grammars.

Lemma 3.
For every binary linear grammar, there exist an equivalent synchronized binary linear grammar.

Generative Capacities of Binary Grammars
In this section, we discuss the generative capacities of binary regular, linear and context free grammars.
The following two lemmas immediately follows from the definitions of binary languages.   Proof. Let G = (V, Σ, S, R) be a context-free (regular, linear) grammar. Then, we define the binary context-free (regular, linear) grammar G = (V × V, Σ × Σ, R , (S, S)) by setting, for each production r = A → α ∈ R, the production r = (∅, A → α) in R . Then, it is not difficult to see that L(G) = L r (G ). In the same way, we can also show that L(G) = L l (G ). Now we show that binary regular and linear grammars generate regular and linear languages, respectively.

Lemma 7. B(LIN) ⊆ L(LIN).
Proof. Let G = (V 1 × V 2 , Σ 1 × Σ 2 , (S 1 , S 2 ), R) be a binary linear grammar. Without loss of generality, we can assume that the grammar G is synchronized. We set are new nonterminals, and we define  Next, we show that binary context-free grammars are more powerful than Chomskyan context-free grammars. (1) (S → S, S → AB), Any successful derivation starts with production (1). For each production sequence (i), 2 ≤ i ≤ 4, if the first production is applied, then, the only applicable production in the derivation is the second one. If after (1), production sequence (4) is applied, then the derivation generates the binary string (a, λ). Else, after some steps, the derivation results in (S, wAwB), w ∈ {a, b} + , by applying production sequences (2) or/and (3), and then, it terminates by applying production sequence (4). Thus, Since L r (G 4 ) / ∈ L(CF), we have the strict inclusion L(CF) ⊂ B(CF).
Next, we show that binary context-free grammars are at least as powerful as matrix grammars. . . , r i,k(i) ), 1 ≤ i ≤ n. We set the following sets of new nonterminals We construct the following binary productions (1) the start production: the matrix entry productions: the matrix processing productions: the matrix exit productions: (Z i,k(i) → X, ∅), 1 ≤ i ≤ n. (5) the terminating production: (X → λ, ∅).
be a derivation in G. We construct the derivation D in G that simulates D. The derivation starts with the step: (S 1 , S 2 ) ⇒ (X, S).
Since, m i 1 is the first matrix applied in derivation D, the next step in D is Furthermore, By applying (Z i 1 ,k(i 1 ) → X, ∅), we return X to the derivation, and then, we can continue the simulation of the application of the matrix m i 2 in the same manner. Thus, D simulates D, and L(G) ⊆ L(G ).
Claim 2: L(G) ⊆ L(G ). Any successfully terminating derivation in G starts by applying production (S 1 → X, S 2 → S), followed by applying (X → Y i , ∅) for some 1 ≤ i ≤ n. Then only possible productions to be applied are matrix processing productions of the form (3). When the application of the productions in the currently active sequence starts, the productions of another sequence of the form (3) cannot be applied. In order to switch to another sequence of productions of the form (3), the corresponding production of the form (4) must be applied after finishing the application of all productions in the current sequence in the given order. To successfully terminate the derivation, the productions of the forms (4) and (5) must be applied. By construction, each sequence of productions of the form (3) simulates some matrix from G, any successful derivation in G can be simulated by a successful derivation in G. Thus, L(G ) ⊆ L(G).
The lemma above shows that any matrix language can be generated by a binary grammar where one of its grammars is regular and the other is context-free. Here, the natural question arises whether there is a binary grammar with both grammars are context-free that generates a non-matrix language or not. Next lemma shows that binary context-free grammars can only generate matrix languages even if their both grammars are context-free. Proof. Let G = (V 1 × V 2 , Σ 1 × Σ 2 , (S 1 , S 2 ), R) be a binary context-free grammar. Without loss of generality, we assume that G is in a synchronized form. Let R 2 = {r 2 | (r 1 , r 2 ) ∈ R}. The proof idea is as follows: First, we will construct a context-free Petri net N with respect to G. Second, we define a Petri net controlled grammar G where the underlying right grammar G r = (V 2 , Σ 2 , S 2 , R 2 ) is controlled by the Petri net N. Then we show that L r (G) = L(G ), i.e., B(CF) ⊆ L(PN).
Part 1: We construct the cf Petri net N = (P, T, F, φ, β, γ, ι) with respect to the nonterminals of the left grammar and productions of the grammar G by setting its components in the following way: • (P, T, F, φ) is a Petri net; • the labeling functions β : P → V 1 and γ : T → R are bijections; • there is an arc from place p to transition t if and only if γ(t) = (r 1 , r 2 ) and β(p) = lhs(r 1 ).
When transition t 1 occurs the place in N corresponding to each nonterminal in rhs(r 1,1 ) = w 1,1 receive the tokens whose number is equal to the number of the occurrence of the nonterminal in rhs(r 1,1 ).
We summarize the results obtained above in the following theorem. Funding: This work has been supported by the United Arab Emirates University Start-Up Grant 31T137.