11.07.2015 Views

Teor´ıa de Autómatas y Lenguajes Formales

Teor´ıa de Autómatas y Lenguajes Formales

Teor´ıa de Autómatas y Lenguajes Formales

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.7. EXPRESIONES REGULARES 59✓✏ε✗✔ ✓✏ ✓✏ ✗✔ ✓✏ ✓✏ ✗✔ ✓✏✲ q ✲ q ✲ q q ✲ q a✲✒✑ 0✖✕ ✒✑ f ✒✑ 0 q✖✕ ✒✑ f ✒✑ 0✖✕ ✒✑ fr = εr = Φr = aFigure 3.19: Expresiones regulares y sus correspondientes autómatasCaso 1: r = (r 1 + r 2 ). Tanto r 1 como r 2 tienen N o menos operadores, por lo tanto, por la hipótesis<strong>de</strong> inducción, existen AFND-ε, M 1 = (Q 1 , Σ 1 , δ 1 , q 1 , {f 1 }) y M 2 = (Q 2 , Σ 2 , δ 2 , q 2 , {f 2 }) con L(r 1 ) =L(M 1 ) y L(r 2 ) = L(M 2 ). Ya que los estados pue<strong>de</strong>n renombrarse, se pue<strong>de</strong> asumir que Q 1 y Q 2 sondisjuntos. Sean q 0 y f 0 nuevos estados. Se construyeM = (Q 1 ∪ Q 2 ∪ {q 0 , f 0 }, Σ 1 ∪ Σ 2 , δ, q 0 , {f 0 })en que δ queda <strong>de</strong>finido por:• δ(q 0 , ε) = {q 1 , q 2 }• δ(q, a) = δ 1 (q, a)• δ(q, a) = δ 2 (q, a)• δ(f 1 , ε) = δ(f 2 , ε) = {f 0 }∀q ∈ Q 1 − {f 1 }, a ∈ Σ 1 ∪ {ε}∀q ∈ Q 2 − {f 2 }, a ∈ Σ 2 ∪ {ε}recuér<strong>de</strong>se que por la hipótesis <strong>de</strong> inducción no hay transiciones que salgan <strong>de</strong> f 1 o f 2 , por lo tantotodas las transiciones <strong>de</strong> M 1 y M 2 están en M. La construcción conduce al diagrama <strong>de</strong> transiciones<strong>de</strong> la Figura 3.20.✓✏ ✓✏✟✯q◗1 M✒✑ 1 f1✒✑ ◗◗◗◗◗◗εε✓✏✟✟✟✟✟✟✛✘✓✏✲ q0f0✒✑ ❍ ✚✙✒✑❍❍❍❍❍ εε ✟✯✓✏ ✓✏❍❥ q2 M f ✟ ✟✟✟✟✟✒✑ 22✒✑Figure 3.20: Diagrama <strong>de</strong> transición correspondiente a la operación + aplicada a expresiones regularesCualquier camino entre q 0 y f 0 <strong>de</strong>be comenzar yendo a q 1 o a q 2 en ε. Si se va a q 1 , <strong>de</strong>be seguir uncamino en M 1 <strong>de</strong> q 1 a f 1 y luego ir a f 0 en ε. Similarmente, los caminos que comienzan yendo a q 2pue<strong>de</strong>n seguir cualquier camino a f 2 en M 2 y luego ir a f 0 en M. Por lo tanto, hay un camino conetiqueta x en M <strong>de</strong> q 0 a f 0 , si y sólo si hay un camino con etiqueta x, <strong>de</strong> q 1 a f 1 en M 1 , o <strong>de</strong> q 2 a f 2en M 2 . Por lo tanto, L(M) = L(M 1 ) ∪ L(M 2 ), como se quería mostrar.Caso 2: r = (r 1 r 2 ). Sean M 1 y M 2 , como en el caso anterior. Se construyeM = (Q 1 ∪ Q 2 , Σ 1 ∪ Σ 2 , δ, q 1 , {f 2 })con δ <strong>de</strong>finido por:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!