Question

In: Computer Science

Prove by construction that the language An = { ai | i is a multiple of...

Prove by construction that the language An = { ai | i is a multiple of n } is regular.

In other words the language An contains all strings composed of the letter a some multiple of n times

Solutions

Expert Solution

The DFA for the language which is equivalent to saying that "i" is a multiple of "n", works as follows. It keeps track of the remainder of the number of 'a's seen so far when divided by the number 'n'. Each time it sees an 'a', the remainder is increased by 1. When the remainder reaches n-1, it is looped back to 0 on seeing another 'a'. The machine accepts if and only if the remainder is finally 0. Note that "i" is divisible by n if the remainder is 0.

The DFA is the following: where the starting state is because initially there are 0 'a's, hence the remainder is 0 initially.
The transitions are;
, these are the transitions when the remainder is increased.
. This is the transition where the remainder loops back to 0.

The DFA thus constructed accepts the given langauge, as explained above. Comment in case of any doubts.


Related Solutions

Give a CFG and (natural) PDA for the language { ai bj ck ef: i +...
Give a CFG and (natural) PDA for the language { ai bj ck ef: i + j = k + f, i, j, k, f ≥ 0 }
Java language please Problem There are N houses for sale. The i-th house costs Ai dollars...
Java language please Problem There are N houses for sale. The i-th house costs Ai dollars to buy. You have a budget of B dollars to spend. What is the maximum number of houses you can buy? Input The first line of the input gives the number of test cases, T. T test cases follow. Each test case begins with a single line containing the two integers N and B. The second line contains N integers. The i-th integer is...
Is the following language a regular language? ( Prove with pumping Lenma ) L = {...
Is the following language a regular language? ( Prove with pumping Lenma ) L = { o^n 1^n 2^n | n => 0} Define CFL pumping lemma
(i) How will AI impact the economy of a country? (ii) How will AI impact healthcare...
(i) How will AI impact the economy of a country? (ii) How will AI impact healthcare in a country? (iii) How will AI impact social justice globally? (iv) How will AI impact Business and/or Finance?
For each of the following indexed collections of sets {Ai : i ∈ I}, determine ∪i∈I...
For each of the following indexed collections of sets {Ai : i ∈ I}, determine ∪i∈I Ai, ∩i∈I Ai, and whether or not the collection is pairwise disjoint. Prove your claims. (a) I is the set of prime numbers and for each p∈I,Ap ={n∈N: p|n}. (b) I=R≥0 ={r∈R:r≥0} and for each r∈R≥0,Ar ={(x,y)∈R^2 : sqrt(x^2+y^2) =r}
Prove  {0n1n, n≥0} is a computable language
Prove  {0n1n, n≥0} is a computable language
Suppose A and B are regular language. Prove that AB is regular
Suppose A and B are regular language. Prove that AB is regular
(i) How will AI impact Biotechnology? (ii) How will AI impact pandemic prediction globally? (iii) How...
(i) How will AI impact Biotechnology? (ii) How will AI impact pandemic prediction globally? (iii) How will AI impact drug or vaccine discovery and development? (iv) How will AI impact space exploration?
Question 4 Prove that the following language is not regular. ? = { 0 ?1 ?...
Question 4 Prove that the following language is not regular. ? = { 0 ?1 ? | ?, ? ≥ 0, ? ≠ 2? + 1 } Question 5 Prove that the following language is not regular. ? = { ? ∈ { 0, 1, 2} ∗ | #0 (?) + #1 (?) = #2 (?) } where #? (?) denotes the number of occurrences of symbol a in string w.
Prove that {0n1n2n:n≥1} is not a regular language. The decimal notation for a number is the...
Prove that {0n1n2n:n≥1} is not a regular language. The decimal notation for a number is the number written in the usual way, as a string over the alphabet {0,1,⋯9}. For example, the decimal notation for 13 is a string of length 2. In unary notation, only the symbol “I” is used; thus 5 would be represented as IIIII in unary notation. Show that each of the following is or is not a regular language. (For regular languages, write down its...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT