Question

In: Computer Science

5 How Many Stacks? An NFA has no stack. It recognizes regular languages. A PDA is...

5 How Many Stacks?

An NFA has no stack. It recognizes regular languages.

A PDA is defined as an NFA with one stack. It recognizes context-free languages.

Prove that a PDA with two stacks recognizes Turing-recognizable languages

Solutions

Expert Solution

A PDA with two-stack is powerful as a Turing Machine. It's simple to assume that we are using the model of TMs that has a tape that's one direction infinite only.

To see the equivalence, just think of the first stack consists of the contents of the tape to the left of the current position, and the second as the contents to the right. You will begin like :

Push the normal "bottom of stack" marks on both stacks.

Push the input to the left stack (use non-determinism to "guess" the end of the input).

Move everything to the right stack (to keep things in the proper order).

Now you can reject the input and do everything on the contents of the stacks . You pop to read and push to write (so you can change the "tape" by pushing something different to what you read). Then we can simulate the TM by popping from the right stack and pushing to the left to move right, and vice versa to move left. If we hit the bottom of the left stack we behave accordingly (halt and reject, or stay where you, depending on the model), if we hit the bottom of the right stack, we just push a blank symbol onto the left.


Related Solutions

For many languages, activation records form a stack at runtime. They are pushed on call and...
For many languages, activation records form a stack at runtime. They are pushed on call and popped on return. How can allocation and deallocation for such a stack of activation records be implemented? ​​​​​​​
(a) How Context Free languages are different from Regular languages. (b) What are the automata accepting...
(a) How Context Free languages are different from Regular languages. (b) What are the automata accepting those languages and how they are different from DFA and NFA. (c) How the grammar of Context Free Languages looks different from those in Regular languages.
Use the pumping lemma to show that the following languages are not regular (c) (5 pts)...
Use the pumping lemma to show that the following languages are not regular (c) (5 pts) Let Σ = {0, 1, −, =} and SUB = {x = y − z | x, y, z are binary integers, and x is the result of the subtraction of z from y}. For example: 1 = 1 − 0, 10 = 11 − 01 are strings in SUB but not 1 = 1 − 1 or 11 = 11 − 10.
Stacking pennies to the moon Estimate how many pennies it would take to stack them from...
Stacking pennies to the moon Estimate how many pennies it would take to stack them from the earth to the moon. Give your answer in 1000s of dollars. How much would all of these pennies weigh? Give your answer in tons. Why did I ask you to estimate instead of giving an exact answer? Be sure to state your assumptions and define your estimations. Include justification for these. Use these facts (do not look up additional facts to help): Moon...
1. The restriction enzyme Sau3AI recognizes the following sequence: 5'-GATC-3'. On average, how often should this...
1. The restriction enzyme Sau3AI recognizes the following sequence: 5'-GATC-3'. On average, how often should this enzyme cleave DNA? In contrast, the restriction enzyme Natl recognizes the following sequence: 5'-GCGGCCGC-3'. On average, how often should this enzyme cleave DNA? Does Natl cleave DNA more frequently than Sau3AI? 2. An uncharacterized plasmid DNA was cleaved using several restriction enzymes individually and in various combinations. The DNA fragment sizes were determined by agarose gel electrophoresis and the restriction enzyme recognition sites were...
How many US pennies (mass 2.5 grams) can you stack on an ice cube having a...
How many US pennies (mass 2.5 grams) can you stack on an ice cube having a mass of 4.20 kg floating in water, before it starts to sink? (let the density of the water be 1000 kg/m3 and the ice cube be 917 kg/m3)
graph theory how many 4-regular graphs of order 7 are there? justify your answer.
graph theory how many 4-regular graphs of order 7 are there? justify your answer.
A boy has 5 red , 2 yellow and 4 green marbles. In how many ways...
A boy has 5 red , 2 yellow and 4 green marbles. In how many ways can the boy arrange the marbles in a line if: a) Marbles of the same color are indistinguishable? b) All marbles have different sizes?
How many electrons are in 2040 Ca+ ? How many moles are in 40.00 oxygen has...
How many electrons are in 2040 Ca+ ? How many moles are in 40.00 oxygen has (O2)? What is the energy in kJ/mol, of a mole of photons with wavelength 494 nm? Particle with a mass 9.1 * 10-31 kg has an uncertainty in position of .54 nm. What is the velocity in km/s? Electron configuration to Co: [Ar] 3d? 4s2. How many unpaired of 3d electrons are there in Co? Which has the greatest effective nuclear charge Se or...
How many mOsmol/L are in 5% Dextrose in 0.45% NaCl?
How many mOsmol/L are in 5% Dextrose in 0.45% NaCl?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT