Regular Expressions and Grammars




CS154

Chris Pollett

Feb. 25, 2013

Outline

Proof that regular implies the language of some regular expression

Converting DFAs to GNFA

Converting GNFAs to Regular expressions

The proof of equivalence of finite automata and regular expressions is due to McNaughton and Yamada (1960).

Corollary

The regular languages are closed under union, `star`, and concatenation.

Proof. The regular languages are precisely those recognized by DFAs. We have shown in turn that the languages recognized by DFAs are precisely those recognized by NFAs, and these in turn are precisely the languages recognized by regular expression. As the languages of regular expressions are trivially closed under these operations, we get the regular languages are closed under these operations.

Quiz Sec 1

Which of the following is true?

  1. Reversing the accepting and rejecting states of a NFA `M` yields a NFA recognizing `bar(L(M))`.
  2. Given two `n` state DFAs, `M_1`, `M_2` there is a DFA recognizing `L(M_1) cup L(M_2)` that has at most `n^2` states.
  3. It is possible for two states in a finite automata to be indistinguishable, yet one is accepting and the other rejecting.

Quiz Sec 3

Which of the following is true?

  1. Our minimization procedure from class for a DFA `M` runs in linear time in the number of states of `M`.
  2. Without change a 5-tuple which matches our definition of being a DFA is a 5-tuple matching our definition of being an NFA.
  3. If DFA `M=(Q,Sigma, delta, q_0, F)` recognizes language `L`, then `M'=(Q, Sigma, delta, q_0, bar{F})` recognizes `bar(L)` because for DFAs `delta^\star` is a function to `Q` not `P(Q)`.

Grammars

Regular Grammars

Equivalence with Regular Languages

Regular implies Regular Grammar

Theorem. If `L` is a regular language, then it is generated by right linear grammar.

Proof. Let `M = (Q, Sigma, delta, q_0, F)` be a DFA for `L`. Assume `Q={q_0, ldots, q_n}` and `Sigma={a_0, ..., a_m}`. Let `G=(V, Sigma, P, S)` be the grammar with `V={q_0, ..., q_n}` and `S= q_0` and where for each transition `delta(q_i, a_j) = q_k` we have the production `q_i -> a_jq_k` and if `q_k` is in `F` we also have the production `q_k -> epsilon`. It is not hard to see that `w` is accepted by `M` iff it is generated by this right linear grammar.

Regular Grammars and the equivalences between their languages and the regular languages is due to Chomsky and Miller. Information and Control. Vol. 1. 1958. pp 91--112.

Classifying Regular Languages

Facts about Star-height