Question

In: Computer Science

Automata Theory and Formal Languages Instructions: Draw the DFA (Deterministic Finite Automaton) of the following: DFA...

Automata Theory and Formal Languages

Instructions:

Draw the DFA (Deterministic Finite Automaton) of the following:

  1. DFA for binary number divisible by 2
  2. DFA for binary number divisible by 3
  3. DFA in which set of all strings can be accepted which start with a
  4. DFA in which set of all strings can be accepted which contains ‘a’

Solutions

Expert Solution

DFA for binary number divisible by 2

Consider input :

{0, 01, 10, 11, 100, 101, 110........}

States : q0, q1

Inputs are strings of 0,1

The state q0 is final state and q1 is non-final state. State q0 will be representing all the numbers that are divisible by 2, that is {0, 10, 100, 110…..}.
State q1 will be representing all the numbers that are not divisible by 2, that is {01, 11, 101, ……}

Whenever the number is not divisible by 2 then it will go from state q0 to q1. When the number is divisible by 2, then it will go from state q1 to q0 or if it was initially in q0 then it will accept it.

DFA for binary number divisible by 3

When a number is divided by 3, there are only 3 possibilities. The remainder can be either 0, 1 or 2. Here, state 0 represents that the remainder when the number is divided by 3 is 0. State 1 represents that the remainder when the number is divided by 3 is 1 and similarly state 2 represents that the remainder when the number is divided by 3 is 2. So if a string reaches state 0 in the end, it is accepted otherwise rejected.

DFA in which set of all strings can be accepted which start with a.

DFA in which set of all strings can be accepted which contains ‘a’

L1 = {a, aa, ab, ba, ..............}

DFA, states ‘X’ and ‘Y’ are the initial and final state respectively, it accepts all the strings containing ‘a’ as the substring. Here as we see that on getting input as ‘b’ it remains in the state of ‘X’ itself but on getting ‘a’ as the input it transit to final state ‘Y’ and hence such string is accepted by above DFA.


Related Solutions

Automata Theory and Formal Languages Instructions: Draw the DFA (Deterministic Finite Automaton) of the following: DFA...
Automata Theory and Formal Languages Instructions: Draw the DFA (Deterministic Finite Automaton) of the following: DFA in which set of all strings can be accepted which end with ‘a’ DFA in which set of all strings can be accepted which start with ab DFA in which set of all strings can be accepted which contain ab DFA in which set of all strings can be accepted which ends with ab
DFA Python DFA simulator A deterministic finite automaton (DFA) - also known as deterministic finite state...
DFA Python DFA simulator A deterministic finite automaton (DFA) - also known as deterministic finite state machine - is a finite state machine that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automaton for each input string. Write a DFA simulator using the python programming language. Read your DFA from a textfile. First line contains a list of the final states (as integers), separated by a space. Rest of file contains the transitions...
Description: In this assignment, you will implement a deterministic finite automata (DFA) using C++ programming language...
Description: In this assignment, you will implement a deterministic finite automata (DFA) using C++ programming language to extract all matching patterns (substrings) from a given input DNA sequence string. The alphabet for generating DNA sequences is {A, T, G, C}. Write a regular expression that represents all DNA strings that begin with ‘A’ and end with ‘T’. Note: assume empty string is not a valid string. Design a deterministic finite automaton to recognize the regular expression. Write a program which...
Create a Deterministic finite automaton that takes in binary strings and accepts them which has both...
Create a Deterministic finite automaton that takes in binary strings and accepts them which has both an odd number of zeros and a sum that is divisible by 3 (but no others). For example, 0111 should be accepted, but not 011 or 111.
Provide an informal description and state diagram of pushdown automata for the following languages, with the...
Provide an informal description and state diagram of pushdown automata for the following languages, with the alphabet {a, b} A) {w | w = (a^i)(b^j) where i > j > 0} B) {w | w contains an even number of b's} C) {w | (a^k)bbb(a^k) where k >= 0} D) {w | w=(b^k)a(b^k)(a^j)(b^j) where j, k >= 0}
Formal Languages Give a regular expression for each of the following languages: L2a = {w ?...
Formal Languages Give a regular expression for each of the following languages: L2a = {w ? {0,1}* | w corresponds to the binary encoding of non-negative integers that are evenly divisible by 4 L2b = {w ? {a,b}* | w contains at least one 'a' and exactly two b's} L2c = {w ? {0, 1, 2}* | w starts with a 2, ends with a 1 and contains an even number of 0's}.
Construct NFA of following languages and convert it to equivalent DFA. The set of all binary...
Construct NFA of following languages and convert it to equivalent DFA. The set of all binary strings such that 3th symbol from right end is 0.
Prove that string concatenation cannot be checked by finite automata by showing that the following language...
Prove that string concatenation cannot be checked by finite automata by showing that the following language over Σ = {0, 1} is not regular: L3 = {w1#w2#w1w2 : w1, w2 ∈ Σ ∗ }
Give the finite-state automaton and the regular grammar for the following: (a) (ab v ba)* v...
Give the finite-state automaton and the regular grammar for the following: (a) (ab v ba)* v (ab)* (b) (11*)*(110 v 01) (c) All strings over {0,1} containing the string 010 (d) All strings over {0,1} which do not contain the string 010
Draw an NFA for the following language then convert to a DFA: L = {w :...
Draw an NFA for the following language then convert to a DFA: L = {w : |w| is odd or |w| is a multiple of 4} where Σ = {0, 1}
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT