Question

In: Computer Science

Automata Question. Over the alphabet Σ = {a, b}: 1) Give a DFA, M1, that accepts...

Automata Question.

Over the alphabet Σ = {a, b}:

1) Give a DFA, M1, that accepts a Language L1 = { w | w has exactly 2 a’s }

2) Give a DFA, M2, that accepts a Language L2 = { w | w has at least 2 b’s }

3) Give acceptor for L1 intersection L2

4) Give acceptor for L1 - L2

Solutions

Expert Solution

Deterministic Finite Automaton (DFA)

In DFA, for each input symbol, one can determine the state to which the machine will move. Hence, it is called Deterministic Automaton. As it has a finite number of states, the machine is called Deterministic Finite Machine or Deterministic Finite Automaton.

Formal Definition of a DFA

A DFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −

1. A DFA, M1, that accepts a Language L1 = { w | w has exactly 2 a’s }

sol:

Here b's are free to choose.It means there can be any number of b's.

2.A DFA, M2, that accepts a Language L2 = { w | w has at least 2 b’s }

sol:

3.Acceptor for L1 intersection L2

4. Acceptor for L1 - L2

NOTE: Always remember for constructing DFA ,for problems like start,exactly,atmost it will require dead state and no dead state required for end,atleast,contain.

  • Q is a finite set of states.

  • is a finite set of symbols called the alphabet.

  • δ is the transition function where δ: Q × ∑ → Q

  • q0 is the initial state from where any input is processed (q0 ∈ Q).

  • F is a set of final state/states of Q (F ⊆ Q).

  • Graphical Representation of a DFA

  • A DFA is represented by digraphs called state diagram.

  • The vertices represent the states.
  • The arcs labeled with an input alphabet show the transition.
  • The initial state is denoted by an empty single incoming arc.
  • The final state is indicated by double circles.

Related Solutions

1. All questions assume the alphabet Σ = { a , b }. a) Give a...
1. All questions assume the alphabet Σ = { a , b }. a) Give a regular expression representing the language of all strings containing abab as a substring. b) Give a regular expression representing the language of all strings with an even number of a's or an odd number of b's, such as abab or baabaab. c) Give a regular expression representing the language of all strings of the form ambn, where m is even and n is odd....
3. Are the following languages A and B over the alphabet Σ = {a, b, c,...
3. Are the following languages A and B over the alphabet Σ = {a, b, c, d} regular or nonregular? • For a language that is regular, give a regular expression that defines it. • For a nonregular language, using the pumping lemma prove that it is not regular. (a) A = {d 2j+1c k+1 | j ≥ k ≥ 0} · {c r+2b 2s+3 | r ≥ 0 and s ≥ 0} (b) B = {a 2j+2b k+3c j+1...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L = { aib2i : i > 0} 2) Prove the language M is not regular, over the alphabet Σ = {a, b}. M = { wwR : w is an element of Σ* i.e. w is any string, and wR means the string w written in reverse}. In other words, language M is even-length palindromes.
2. Let S be the set of strings over the alphabet Σ = {a, b, c}...
2. Let S be the set of strings over the alphabet Σ = {a, b, c} defined recursively by (1) λ ∈ S and a ∈ S; and (2) if x ∈ S, then bxc ∈ S. Recall that λ denotes the empty string which has no letters and has length 0. List all strings of S which are length at most seven. 3. Prove the following theorem by induction: For every integer n ≥ 1, 1 · 2 +...
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is...
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is finite? How many such languages exist?
Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules...
Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules for L1 are as follows: S → TT S → U T → 0T T → T0 T→ 1 U → 0U00 U → 1 Q → λ P → QU Transform this grammar into Chomsky Normal Form, consistent with the CNF specification in the Quick Reference, and using only Variables { S, T, U, V, W, X }. Implement that CNF grammar in...
Python.Python.Python. Write a functional program over the automata that accepts odd length binary digits and rejects...
Python.Python.Python. Write a functional program over the automata that accepts odd length binary digits and rejects those that are not. It must include a function called q0 ,q1, accept and reject(). CANNOT USE STRING. OR LENTH. 101 accepted (3 binary digits) 10610 rejected (the number 6 is not a binary number) 101111 rejected (6 digit binary number) 11111 accepted (5 binary digits)
Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z,...
Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z, A, B, . . . , Z, 0, 1, . . . , 9} and let L be the language of all regular expressions over Σ: L = {w ∈ Σ ∪ {∅,(,), ∪, ·, * }* | w is a syntactically legal regular expression over Σ} Give an unambiguous context-free grammar that generates L. The grammar should use the following precedence levels, from...
Construct a dfa that accepts strings on {0, 1} if and only if the value of...
Construct a dfa that accepts strings on {0, 1} if and only if the value of the string, interpreted as a binary representation of an integer, is zero modulo five. For example, 0101 and 1111, representing the integers 5 and 15, respectively, are to be accepted.
4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that...
4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that do not begin with an “a”. b. Strings that contain both aa and bb as substrings. 5. Let ? = {? ?? ?? ? | ? > ? + ?}. a. List all strings of length 7. (use power notation: i.e. aabbbbaaaaaaaa is a2b 4a 8 ) b. Use the Pumping Lemma for Regular Languages to prove that L is not regular.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT