Question

In: Computer Science

give a PDA for the language {a1a2: where the length of a1 equals the length of...

give a PDA for the language {a1a2: where the length of a1 equals the length of a2, a1 contains an odd amount of 0’s and a2 contains an odd amount of 0′s}

a1, a2 ∈ {0, 1}*

Solutions

Expert Solution

since we dont know the middle of the string, we would need a PDA which non-deterministically guesses the middle of string and then counts the number of 0's in the string.

So firstly we keep track of number of 0's before the middle of strings (transition only if it is odd), then we guess the middle of sring and then count the number of 0 in the right half.

The PDA is:

the states are marked even, odd based on numbers of 0 encountered. starting at q0 #0 is 0, if 1 comes we stay at the same state, if 0 comes we move to odd state, we also push 'x' to stack which we would use to match te length of either side of the string. from state q1 we non deterministically guess that it is the middle of string ,so we transition to other part of the PDA which would count the #0 in right half and also checks the length.


Related Solutions

What is Corr[A1, A2] where A1 equals B1 minus B2, and A2 equals B2 minus B3and...
What is Corr[A1, A2] where A1 equals B1 minus B2, and A2 equals B2 minus B3and we are given that Bi ∼ Ber(p) for all i in {1,2}?
Let INFINITE PDA = {<M>|M is a PDA and L(M) is an infinite language}. Show that...
Let INFINITE PDA = {<M>|M is a PDA and L(M) is an infinite language}. Show that INFINITE PDA is decidable.
Construct a pda that accepts the language defined by the grammar S → aSSSab | λ...
Construct a pda that accepts the language defined by the grammar S → aSSSab | λ . This has already been answered using software with no explanation. I am not interested in the answer so much. I just want an explanation. or at least a step by step formula.
Define a PDA that accepts language L3 = { anbm | n > 0 and n...
Define a PDA that accepts language L3 = { anbm | n > 0 and n > m }. Implement that PDA in JFLAP. Must use JFLAP
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x,...
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x, y} where 2 * (# of x's) = 3 * (#y's) That is, if we let nx be the number of x's and ny be the number of y's, then the strings in these language are those where 2nx = 3ny Try to find a PDA that is as simple and elegant as possible (do not convert from CFG). ------------------------------------------------------------------------------------------------------------------ USE Notation between transition:...
V=[(a b), a,b E R+] with (a1 b1)+(a2 b2)=(a1a2 b1b2)and for c E R, c(a b)=(a^c...
V=[(a b), a,b E R+] with (a1 b1)+(a2 b2)=(a1a2 b1b2)and for c E R, c(a b)=(a^c b^c) is a vector space over R. Define T:R^2 to V by T[a b]= (e^a e^b). prove T is a linear transformation from R2 to V.
Write a procedure that accepts a byte string(base address in $a0, length in $ a1) and...
Write a procedure that accepts a byte string(base address in $a0, length in $ a1) and returns its XOR checksum, defined as the exclusive-OR of all its bytes, in $v0. (by MiniMIPS)
Construct an NPDA that accepts the language defined by the given grammar and give the language...
Construct an NPDA that accepts the language defined by the given grammar and give the language in a formal expression (including a regular expression). S -> AA|a, A-> SA|ab
- Recent models of language acquisition now agree that language is innate in human beings. Give...
- Recent models of language acquisition now agree that language is innate in human beings. Give two evidence for innateness hypothesis.  
A four-bit binary number is represented as A3A2A1A0, where A3, A2, A1, and A0 represent the...
A four-bit binary number is represented as A3A2A1A0, where A3, A2, A1, and A0 represent the individual bits and A0 is equal to the LSB. Design a logic circuit that will produce a HIGH output whenever the binary number is greater than 0010 and less than 1000. how can I do this by using sum of product, not K map
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT