Union of two regular languages

Union of two regular languages

In formal language theory, and in particular the theory of nondeterministic finite state machines, it is known that the union of two regular languages is a regular language. This article provides a proof of that statement.

Theorem

For any regular languages L_{1} and L_{2}, language L_{1}cup L_{2} is regular."

"Proof"

Since L_{1} and L_{2} are regular, there exist NFA's N_{1}, N_{2} that recognize

L_{1} and L_{2}.

Let

:: N_{1} = (Q_{1}, Sigma , T_{1}, q_{1}, A_{1})

:: N_{2} = (Q_{2}, Sigma , T_{2}, q_{2}, A_{2}) Construct

:: N = (Q, Sigma , T, q_{0}, A_{1}cup A_{2}) where

::Q = Q_{1}cup Q_{2}cup{q_{0}}

::T(q,x) = left{egin{array}{lll} T_{1}(q,x) & mbox{if} & qin Q_{1} \ T_{2}(q,x) & mbox{if} & qin Q_{2} \ {q_{1}, q_{2}} & mbox{if} & q = q_{0} and x =epsilon\ phi & mbox{if} & q = q_{0} and x eqepsilon end{array} ight.

In the following, we shall use pstackrel{x,T}{ ightarrow}q to denote qin E(T(p,x))

Let w be a string from L_{1}cup L_{2}

win L_{1} or win L_{2}

Assume win L_{1} (Proof would be similar if win L_{2})

Let w = x_{1}x_{2}cdots x_{m} where mgeq 0, x_{i}inSigma

Since N_{1} accepts x_{1}x_{2}cdots x_{m}, there exist r_{0}, r_{1},cdots r_{m}in Q_{1} such that :: q_{1}stackrel{epsilon , T_{1{ ightarrow}r_{0}stackrel{x_{1} , T_{1{ ightarrow}r_{1}stackrel{x_{2} , T_{1{ ightarrow}r_{2}cdots r_{m-1}stackrel{x_{m} , T_{1{ ightarrow}r_{m}, r_{m}in A_{1}

Since T_{1}(q,x) = T(q,x) forall qin Q_{1}forall xinSigma

:: r_{0}in E(T_{1}(q_{1},epsilon ))Rightarrow r_{0}in E(T(q_{1},epsilon ))

:: r_{1}in E(T_{1}(r_{0},x_{1} ))Rightarrow r_{1}in E(T(r_{0},x_{1} ))

:::: vdots

:: r_{m}in E(T_{1}(r_{m-1},x_{m} ))Rightarrow r_{m}in E(T(r_{m-1},x_{m} ))

We can therefore substitute T for T_{1} and rewrite the above path as

q_{1}stackrel{epsilon , T}{ ightarrow}r_{0}stackrel{x_{1} , T}{ ightarrow}r_{1}stackrel{x_{2} , T}{ ightarrow}r_{2}cdots r_{m-1}stackrel{x_{m} , T}{ ightarrow}r_{m}, r_{m}in A_{1}cup A_{2}, r_{0}, r_{1},cdots r_{m}in Q

Furthermore,

:: egin{array}{lcl}T(q_{0}, epsilon) = {q_{1}, q_{2}} & Rightarrow & q_{1}in T(q_{0}, epsilon)\ \ & Rightarrow & q_{1}in E(T(q_{0}, epsilon))\ \ & Rightarrow & q_{0}stackrel{epsilon , T}{ ightarrow}q_{1}end{array}

and

:: q_{0}stackrel{epsilon , T}{ ightarrow}q_{1}stackrel{epsilon , T}{ ightarrow}r_{0}Rightarrow q_{0}stackrel{epsilon , T}{ ightarrow}r_{0}

The above path can be rewritten as

:q_{0}stackrel{epsilon , T}{ ightarrow}r_{0}stackrel{x_{1} , T}{ ightarrow}r_{1}stackrel{x_{2} , T}{ ightarrow}r_{2}cdots r_{m-1}stackrel{x_{m} , T}{ ightarrow}r_{m}, r_{m}in A_{1}cup A_{2}, r_{0}, r_{1},cdots r_{m}in Q

Therefore, N accepts x_{1}x_{2}cdots x_{m} and the proof is complete.

Note: The idea drawn from this mathematical proof for constructing

a machine to recognize L_{1}cup L_{2} is to create an initial state and connect

it to the initial states of L_{1} and L_{2} using epsilon arrows.

References

* Michael Sipser, "Introduction to the Theory of Computation" ISBN 0-534-94728-X. "(See . Theorem 1.22, section 1.2, pg. 59.)"


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Languages of Canada — Languages of Canada[1] Official language(s) English (58%) and French (22%) Indigenous language(s) Abenaki, A …   Wikipedia

  • Languages of Sweden — Languages of country = Sweden caption = official = none unofficial = main = Swedish >90% regional = indigenous = (Unofficial languages / Dialects) Älvdalsmål, Jamtlandic, Scanian minority = (Officially recognised) Finnish, Meänkieli, Romani, Sami …   Wikipedia

  • Regular expression — In computing, a regular expression provides a concise and flexible means for matching (specifying and recognizing) strings of text, such as particular characters, words, or patterns of characters. Abbreviations for regular expression include… …   Wikipedia

  • Regular language — In theoretical computer science, a regular language is a formal language (i.e., a possibly infinite set of finite sequences of symbols from a finite alphabet) that satisfies the following equivalent properties: * it can be accepted by a… …   Wikipedia

  • Union between Sweden and Norway — United Kingdoms of Sweden and Norway Förenade konungarikena Sverige och Norge De forenede Kongeriger Norge og Sverige Personal union ← …   Wikipedia

  • Two by Twos — Prominent early preachers (left to right): William Gill, William Irvine, and George Walker Classification Protestant Polity Episcopal Geographical areas …   Wikipedia

  • Union of Soviet Socialist Republics — a former federal union of 15 constituent republics, in E Europe and W and N Asia, comprising the larger part of the former Russian Empire: dissolved in December 1991. 8,650,069 sq. mi. (22,402,200 sq. km). Cap.: Moscow. Also called Russia, Soviet …   Universalium

  • Indo-European languages — Family of languages with the greatest number of speakers, spoken in most of Europe and areas of European settlement and in much of southwestern and southern Asia. They are descended from a single unrecorded language believed to have been spoken… …   Universalium

  • Educational policies and initiatives of the European Union — In the European Union education is the responsibility of Member States; European Union institutions play a supporting role. According to Art. 149 of the Treaty of Amsterdam, the Community cquote|shall contribute to the development of quality… …   Wikipedia

  • Romance languages — Romance Geographic distribution: Originally Southern Europe and parts of Africa; now also Latin America, Canada, parts of Lebanon and much of Western Africa Linguistic classification: Indo European Italic …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”