GATE / CS ARCHIVE

SIMILAR QUESTIONS / THEORY OF COMPUTATION

Collapse bounded storage to finite state

2 questions solved the same way, newest first. Back to Theory of Computation

How these are solved

A constant bound on tape/stack storage gives finitely many combined control-storage configurations. The storage models differ; this is a method match, not a strict repeat.

1 mark · MCQ
Report issue

Pushdown automaton with bounded stack

Pushdown Automata

Question 1.7, GATE 2002: A pushdown automaton is restricted to at most 10 stack items. Which class best describes the language it accepts?
(A) Context-free; (B) Regular; (C) Deterministic context-free; (D) Recursive.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step 1: Turn stack contents into finite control.

Step 2: If the stack alphabet has s symbols, at most 1+s+…+s10 stack words are possible. With q control states, at most q(1+s+…+s10) combined configurations are needed, apart from fixed acceptance bookkeeping. Every push/pop transition can be represented between these finite states, so an unbounded-memory PDA advantage is absent.

Conclusion: A fixed finite stack alphabet and maximum stack height 10 allow only finitely many stack strings. Pairing each with the finite control state yields a finite automaton, including epsilon transitions if needed. Hence the language is regular, B; the larger language classes listed are less precise.

Original paper, page 1

5 marks · Descriptive
Report issue

Constant-workspace machines recognize regular languages

Turing Machines

Question 17(a), GATE 1991: Prove that Turing machines with a read-only input tape and constant-size work tape recognize exactly the regular languages. Use the standard single input-head model with endmarkers.
Tap to enlarge
Answer & solution

Answer: Exactly the regular languages: finite workspace folds into finite control, giving a two-way finite automaton, and two-way finite automata recognize regular languages. (no official key was published)

For the easy direction, let L be regular and choose a DFA for L. A Turing machine stores the DFA state in its finite control, scans the read-only input from left to right, and accepts exactly when the simulated DFA ends in an accepting state. It needs no growing work tape, hence satisfies the constant-space requirement.

For the other direction, let the machine use at most c work cells, where c is independent of input length. If the work alphabet is Γ and the finite control has q states, the work contents and work-head location together have at most |Γ|^c·O(c) possibilities. Fold these possibilities into the control state. This gives a finite-state device whose only unbounded feature is the position of its single head on the read-only input. It is a two-way finite automaton, not immediately an ordinary one-way DFA: treating input-head position as a fixed finite state would be an error.

Here is why two-way motion does not add language power. For any finite input block, summarize its behavior by a finite relation recording which control state and side can enter the block and which control state and side can next exit it, together with whether acceptance can be reached before exit. There are finitely many such boundary-state combinations, so only finitely many possible block summaries, regardless of block length. Infinite internal loops yield no exit or acceptance in the summary.

The summary of a concatenation uv is determined solely by the summaries of u and v: connect their touching boundaries and compute reachability through the finite interface graph, allowing repeated crossings. Each symbol has its own summary. A one-way DFA can therefore read symbols from left to right, retaining the accumulated block summary as its state and updating it by this finite composition. With the endmarkers included, its accepting states are exactly the summaries allowing the original initial state to reach acceptance. This constructs a finite recognizer for the same language. For nondeterministic machines use existential reachability in the same summaries; a finite relation still suffices.

Thus the constant-workspace machine cannot recognize any nonregular language, and both containments establish equality. The standard assumptions exclude multiple independent input heads or writable unbounded input cells, which would invalidate this reduction.

Original paper, page 8