Explain the technique for combining two languages in TOC?

Data Structure AlgorithmsComputer ScienceComputers

There are three common ways of creating a new language from two languages −

  • Union

  • Intersection

  • Product

Languages are sets of strings, so they can be combined by the usual set operations of union and intersection.

Intersection

If L1 and L2 are languages over ∑, then L1 ∩ L2 is the language of strings in both L1 and L2 .

For example, If L = {aa, bb, ab} and M = {ab, aabb} then,

The intersection is as follows −

L ∩ M = {ab}

And

Union

If L1 and L2 are languages over the alphabet ∑, then the language L1 ∪ L2 is the language of all strings in at least one of the two languages.

For example, If L = {aa, bb, ab} and M = {ab, aabb} then,

The union is as follows −

L ∪ M = {aa, bb, ab, aabb}.

Where L is M are two languages over an alphabet ∑.

Concatenation − The operation of concatenation of strings places two strings in juxtaposition.

The concatenation of two languages L1 and L2 over the alphabet ∑ is the language L1L2 = { wx ∈ ∑* | w ∈ L1 ∧ x ∈ L2 }

The set of strings that can be split into two pieces − a piece from L1 and a piece from L2. It is similar to the Cartesian product of two sets, with strings.

Example

The concatenation of the two strings aab and ba is the string aabba.

We use the name cat to denote this operation − cat(aab, ba) = aabba.

We can combine two languages L and M by forming the set of all concatenations of strings in L with strings in M, which is called the product of the two languages.

Definition (Product of two languages)

If L and M are languages, then the new language called the product of L and M is defined as L · M (or only LM)

L · M = {cat(s,t) : s ∈ L and t ∈ M}

raja
Published on 15-Jun-2021 11:40:30
Advertisements