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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.9.AMBIGÜEDAD INHERENTE 101se agregan producciones para [q 0 , Z 0 , q 0 ]:[q 0 , Z 0 , q 0 ] → 0 [q 0 , X, q 0 ] [q 0 , Z 0 , q 0 ][q 0 , Z 0 , q 0 ] → 0 [q 0 , X, q 1 ] [q 1 , Z 0 , q 0 ]requeridas por δ(q 0 , 0, Z 0 ) = {(q 0 , XZ 0 )} son[q 0 , Z 0 , q 1 ] → 0 [q 0 , X, q 0 ] [q 0 , Z 0 , q 1 ][q 0 , Z 0 , q 1 ] → 0 [q 0 , X, q 1 ] [q 1 , Z 0 , q 1 ]también requeridas por δ(q 0 , 0, Z 0 ) = {(q 0 , XZ 0 )}.Las producciones para las variables y las movidas relevantes <strong>de</strong> M, son:[q 0 , X, q 0 ] → 0 [q 0 , X, q 0 ] [q 0 , X, q 0 ]→ 0 [q 0 , X, q 1 ] [q 1 , X, q 0 ][q 0 , X, q 1 ] → 0 [q 0 , X, q 0 ] [q 0 , X, q 1 ]porque→ 0 [q 0 , X, q 1 ] [q 1 , X, q 1 ]δ(q 0 , 0, X) = {(q 0 , XX)}[q 0 , X, q 1 ] → 1 porque δ(q 0 , 1, X) = {(q 1 , ε)}[q 1 , Z 0 , q 1 ] → ε porque δ(q 1 , ε, Z 0 ) = {(q 1 , ε)}[q 1 , X, q 1 ] → ε porque δ(q 1 , ε, X) = {(q 1 , ε)}[q 1 , X, q 1 ] → 1 porque δ(q 1 , 1, X) = {(q 1 , ε)}Debe notarse que no hay producciones para las restantes variables ( [q 1 , X, q 0 ] y [q 1 , Z 0 , q 0 ] ). Como todaslas producciones para [q 0 , X, q 0 ] y [q 0 , Z 0 , q 0 ] tienen [q 1 , X, q 0 ] o [q 1 , Z 0 , q 0 ] a la <strong>de</strong>recha, ningún string <strong>de</strong>terminales pue<strong>de</strong> <strong>de</strong>rivarse <strong>de</strong> ellas. Eliminando las producciones en que aparecen esas variables, se llega aS → [q 0 , Z 0 , q 1 ][(q 1 , Z 0 , q 1 ] → ε[q 0 , Z 0 , q 1 ] → 0 [q 0 , X, q 1 ] [q 1 , Z 0 , q 1 ] [(q 1 , X, q 1 ] → ε[q 0 , X, q 1 ] → 0 [q 0 , X, q 1 ] [q 1 , X, q 1 ] [(q 1 , X, q 1 ] → 1[q 0 , X, q 1 ] → 1En resumen <strong>de</strong> esta sección, se pue<strong>de</strong> concluir que las siguientes tres aserciones son equivalentes:• L es un lenguaje libre <strong>de</strong> contexto.• L es N(M 1 ) para algún AA, M 1 .• L es L(M 2 ) para algún AA, M 2 .5.9 Ambigüedad InherenteEs muy fácil exhibir gramáticas libres <strong>de</strong> contexto que son ambiguas. Por ejemplo,S → A|BA → aB → aen que el único string <strong>de</strong>l lenguaje (a) tiene dos árboles <strong>de</strong> <strong>de</strong>rivación.Lo que no es tan simple es encontrar un lenguaje libre <strong>de</strong> contexto para el cual toda gramática seaambigua. En esta sección se muestra que en realidad hay lenguajes libres <strong>de</strong> contexto que son inherentementeambiguos. Se mostrará que el lenguajeL = {a N b N c M d M /N ≥ 1, M ≥ 1} ∪ {a N b M c M d N /N ≥ 1, M ≥ 1}es inherentemente ambiguo, probando que el conjunto infinito <strong>de</strong> strings <strong>de</strong> la forma a N b N c N d N (N ≥ 1),<strong>de</strong>ben tener dos <strong>de</strong>rivaciones por la izquierda distintas.✷

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

Saved successfully!

Ooh no, something went wrong!