SLD resolution: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
 
en>Ctxppc
Undid revision 578159743 by Ctxppc (talk)
Line 1: Line 1:
I would like to introduce myself to you, I am Jayson Simcox but I don't like when individuals use my complete title. My spouse and I reside in Kentucky. To climb is something she would never give up. For many years she's been working as a journey agent.<br><br>my web-site :: psychic solutions by lynne; [http://ltreme.com/index.php?do=/profile-127790/info/ http://ltreme.com],
 
In [[formal language]] theory, and in particular the theory of [[nondeterministic finite automata]], 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 <math>L_{1}</math> and <math>L_{2}</math>, language <math>L_{1}\cup L_{2}</math> is regular.''
 
''Proof''
 
Since <math>L_{1}</math> and <math>L_{2}</math> are regular, there exist [[Nondeterministic finite automaton|NFAs]] <math>N_{1},\  N_{2}</math> that recognize <math>L_{1}</math> and <math>L_{2}</math>.
 
Let
 
::<math> N_{1} = (Q_{1},\ \Sigma ,\ T_{1},\ q_{1},\ A_{1})</math>
 
::<math> N_{2} = (Q_{2},\ \Sigma ,\ T_{2},\ q_{2},\ A_{2})</math>
 
Construct
 
::<math>N = (Q,\ \Sigma ,\ T,\ q_{0},\ A_{1}\cup A_{2})</math>
where
 
::<math>Q = Q_{1}\cup Q_{2}\cup\{q_{0}\}</math>
 
::<math>T(q,x) = \left\{\begin{array}{lll}
T_{1}(q,x) & \mbox{if} & q\in Q_{1} \\
T_{2}(q,x) & \mbox{if} & q\in Q_{2} \\
\{q_{1}, q_{2}\} & \mbox{if} & q = q_{0}\ and\ x =\epsilon\\
\emptyset & \mbox{if} & q = q_{0}\ and\ x\neq\epsilon
\end{array}\right.
</math>
 
In the following, we shall use <math>p\stackrel{x,T}{\rightarrow}q</math> to denote <math>q\in E(T(p,x))</math>
 
Let <math>w</math> be a string from <math>L_{1}\cup L_{2}</math>. [[Without loss of generality]] assume <math>w\in L_{1}</math>.
 
Let <math>w = x_{1}x_{2}\cdots x_{m}</math> where <math>m\geq 0, x_{i}\in\Sigma</math>
 
Since <math>N_{1}</math>  accepts <math>x_{1}x_{2}\cdots x_{m}</math>, there exist <math>r_{0}, r_{1},\cdots r_{m}\in Q_{1}</math> such that
::<math> q_{1}\stackrel{\epsilon , T_{1}}{\rightarrow}r_{0}\stackrel{x_{1} , T_{1}}{\rightarrow}r_{1}\stackrel{x_{2} , T_{1}}{\rightarrow}r_{2}\cdots r_{m-1}\stackrel{x_{m} , T_{1}}{\rightarrow}r_{m}, r_{m}\in A_{1}
</math>
 
Since <math>T_{1}(q,x) = T(q,x)\ \forall q\in Q_{1}\forall x\in\Sigma</math>
 
:: <math>r_{0}\in E(T_{1}(q_{1},\epsilon ))\Rightarrow r_{0}\in E(T(q_{1},\epsilon ))</math>
 
:: <math>r_{1}\in E(T_{1}(r_{0},x_{1} ))\Rightarrow r_{1}\in E(T(r_{0},x_{1} ))</math>
 
:::: <math>\vdots</math>
 
:: <math>r_{m}\in E(T_{1}(r_{m-1},x_{m} ))\Rightarrow r_{m}\in E(T(r_{m-1},x_{m} ))</math>
 
 
We can therefore substitute <math>T</math> for <math>T_{1}</math> and rewrite the above path as
 
 
<math>q_{1}\stackrel{\epsilon , T}{\rightarrow}r_{0}\stackrel{x_{1} , T}{\rightarrow}r_{1}\stackrel{x_{2} , T}{\rightarrow}r_{2}\cdots r_{m-1}\stackrel{x_{m} , T}{\rightarrow}r_{m}, r_{m}\in A_{1}\cup A_{2}, r_{0}, r_{1},\cdots r_{m}\in Q</math>
 
 
Furthermore,
 
:: <math>
\begin{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}{\rightarrow}q_{1}
\end{array}
</math>
 
and
 
:: <math>q_{0}\stackrel{\epsilon , T}{\rightarrow}q_{1}\stackrel{\epsilon , T}{\rightarrow}r_{0}\Rightarrow q_{0}\stackrel{\epsilon , T}{\rightarrow}r_{0}
</math>
 
 
The above path can be rewritten as
 
 
:<math>q_{0}\stackrel{\epsilon , T}{\rightarrow}r_{0}\stackrel{x_{1} , T}{\rightarrow}r_{1}\stackrel{x_{2} , T}{\rightarrow}r_{2}\cdots r_{m-1}\stackrel{x_{m} , T}{\rightarrow}r_{m}, r_{m}\in A_{1}\cup A_{2}, r_{0}, r_{1},\cdots r_{m}\in Q
</math>
 
 
Therefore, <math>N</math> accepts <math>x_{1}x_{2}\cdots x_{m}</math> and the proof is complete.
 
 
'''Note:'''    The idea drawn from this mathematical proof for constructing a machine to recognize <math>L_{1}\cup L_{2}</math> is to create an initial state and connect it to the initial states of <math>L_{1}</math> and <math>L_{2}</math> using <math>\epsilon</math> arrows.
 
== References ==
* Michael Sipser, ''Introduction to the Theory of Computation'' ISBN 0-534-94728-X. ''(See . Theorem 1.22, section 1.2, pg. 59.)''
 
 
[[Category:Article proofs]]
[[Category:Formal languages]]
[[Category:Automata theory]]

Revision as of 22:09, 21 October 2013

In formal language theory, and in particular the theory of nondeterministic finite automata, 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 L1 and L2, language L1∪L2 is regular.

Proof

Since L1 and L2 are regular, there exist NFAs N1, N2 that recognize L1 and L2.

Let

N1=(Q1, Σ, T1, q1, A1)
N2=(Q2, Σ, T2, q2, A2)

Construct

N=(Q, Σ, T, q0, A1∪A2)

where

Q=Q1∪Q2∪{q0}
T(q,x)={T1(q,x)ifq∈Q1T2(q,x)ifq∈Q2{q1,q2}ifq=q0 and x=ϵ∅ifq=q0 and x≠ϵ

In the following, we shall use p→x,Tq to denote q∈E(T(p,x))

Let w be a string from L1∪L2. Without loss of generality assume w∈L1.

Let w=x1x2⋯xm where m≥0,xi∈Σ

Since N1 accepts x1x2⋯xm, there exist r0,r1,⋯rm∈Q1 such that

q1→ϵ,T1r0→x1,T1r1→x2,T1r2⋯rm−1→xm,T1rm,rm∈A1

Since T1(q,x)=T(q,x) ∀q∈Q1∀x∈Σ

r0∈E(T1(q1,ϵ))⇒r0∈E(T(q1,ϵ))
r1∈E(T1(r0,x1))⇒r1∈E(T(r0,x1))
⋮
rm∈E(T1(rm−1,xm))⇒rm∈E(T(rm−1,xm))


We can therefore substitute T for T1 and rewrite the above path as


q1→ϵ,Tr0→x1,Tr1→x2,Tr2⋯rm−1→xm,Trm,rm∈A1∪A2,r0,r1,⋯rm∈Q


Furthermore,

T(q0,ϵ)={q1,q2}⇒q1∈T(q0,ϵ)⇒q1∈E(T(q0,ϵ))⇒q0→ϵ,Tq1

and

q0→ϵ,Tq1→ϵ,Tr0⇒q0→ϵ,Tr0


The above path can be rewritten as


q0→ϵ,Tr0→x1,Tr1→x2,Tr2⋯rm−1→xm,Trm,rm∈A1∪A2,r0,r1,⋯rm∈Q


Therefore, N accepts x1x2⋯xm and the proof is complete.


Note: The idea drawn from this mathematical proof for constructing a machine to recognize L1∪L2 is to create an initial state and connect it to the initial states of L1 and L2 using ϵ arrows.

References

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