3.3. Closure Properties

In this section we show that the class of linear languages is closed under union, but it is not closed under other regular operations and under other set-theoretical operations.

Theorem 13. The class of linear languages is closed under union, i.e., the union of any two linear languages is also linear.

Proof. The proof is constructive. Let L1 and L2 be linear languages. Let the linear grammars G1 = (N1, T, S1, P1) and G2 = (N2, T, S2, P2) generate the languages L1 and L2 such that N1N2 = ∅ (this can be done by renaming nonterminals of a grammar without affecting the generated language). Then, let

G = (N1N2 ∪ {S}, T, S, P1P2 ∪ {SS1, SS2}),

where SN1N2, is a new symbol. It can be seen that G generates the language L1L2.

QED.

Theorem 14. The class of linear languages is not closed under concatenation and Kleene-star.

Instead of a formal proof we offer a suggestion:

Let us consider the language

L = {anbnn > 0}.

The languages L · L and L* are not linear languages.

Theorem 15. The class of linear languages is not closed under complement and intersection.

Proof. Let us start with the intersection. Observe that both of the languages

L1 = {aj bjckj, k ∈ ℕ} and L2 = {akbjcjj, k ∈ ℕ}

are linear. The intersection of these two languages is

L = L1L2 = {ajbjcjj ∈ ℕ}.

As we will prove it in Example this language is not context-free, and therefore it is not linear. This proves the non closure under intersection.

We are going to prove now that the class is not closed under complement. Consider the following language: {wcww ∈ {a,b}*} over the alphabet {a,b,c}. It is called the language of ''marked-copy''. In Example 43. we prove that this language is not context-free, and thus it is not linear. However, the complement of this language is a linear language.

QED.

Exercise 53. Give a linear grammar that generates the complement of the language of marked-copy. Hints: it can be done as union of linear languages. A word can be in this complement if,

Exercise 54. Give a grammar that generates the union of the languages generated by grammars G1 and G2, where

G1 = ({S1, A1, B1}, {a,b,c}, S1,

{  S1aaS1ccc, 
   S1A1, 
   A1bB1b, 
   B1bB1,
   B1b
})

and

G2 = ({S2, A2, B2, C2}, {a,b,c}, S2,

{  S2cccS2aa, 
   S2bA2,
   A2A2b,
   A2cB2aa, 
   A2C2,
   B2bB2,
   B2baccab,
   C2C2c,
   C2A2
}).