GATE / CS ARCHIVE

GATE CSE 2000 / QUESTION 8(a)

Completing a reverse-matching PDA

Theory of Computation · Pushdown Automata · Full GATE CSE 2000 paper

GATE 2000, Q8(a) Descriptive
Report issue

Pushdown Automata

Question 8(a), GATE 2000: Two states q₀ (initial) and q₁. Existing edges: q₀→q₀ labeled 1,s/1s; q₀→q₁ labeled 2,s/s; q₁→q₁ labeled 1,1s/s. A label d,u/v consumes d and replaces entire stack u by v; s denotes the arbitrary remainder, top at left. Target L={x2xᴿ:x∈{0,1}*}.

Task: Add two appropriately labeled edges to accept L by empty stack.
Question 8(a), GATE 2000: Two states q₀ (initial) and q₁. Existing edges: q₀→q₀ labeled 1,s/1s; q₀→q₁ labeled 2,s/s; q₁→q₁ labeled 1,1s/s. A label d,u/v consumes d and replaces entire stack u by v; s denotes the arbitrary remainder, top at left. Target L={x2xᴿ:x∈{0,1}*}.

Task: Add two appropriately labeled edges to accept L by empty stack.
Question 8(a), GATE 2000: Two states q₀ (initial) and q₁. Existing edges: q₀→q₀ labeled 1,s/1s; q₀→q₁ labeled 2,s/s; q₁→q₁ labeled 1,1s/s. A label d,u/v consumes d and replaces entire stack u by v; s denotes the arbitrary remainder, top at left. Target L={x2xᴿ:x∈{0,1}*}.

Task: Add two appropriately labeled edges to accept L by empty stack.
Tap to enlarge
Shared context

Two states q₀ (initial) and q₁. Existing edges: q₀→q₀ labeled 1,s/1s; q₀→q₁ labeled 2,s/s; q₁→q₁ labeled 1,1s/s. A label d,u/v consumes d and replaces entire stack u by v; s denotes the arbitrary remainder, top at left. Target L={x2xᴿ:x∈{0,1}*}.

Answer & solution

Answer: Add q₀→q₀: 0,s/0s and q₁→q₁: 0,0s/s. Exact formal acceptance requires the caveat below. (no official key was published)

1. The missing push edge is a q₀ self-loop labeled 0,s/0s. The missing matching-pop edge is a q₁ self-loop labeled 0,0s/s. Together with the existing 1 loops these handle both symbols.

2. Before the delimiter, q₀ pushes every input symbol. The sole 2 edge enters q₁ without changing the stack. After it, each input bit must match the top bit and pops it; mismatches have no move.

3. For x=01, the successive configurations are (q₀,01210,ε)→(q₀,1210,0)→(q₀,210,10)→(q₁,10,10)→(q₁,0,0)→(q₁,ε,ε). Thus the intended accepting condition is exhausted input, empty stack, and completed delimiter transition into q₁.

4. Formal defect: under ordinary acceptance by empty stack in ANY state, an initially empty stack accepts ε immediately, although ε∉L. The two requested edges cannot undo this existing accepting run. An initial bottom marker does not alone solve it: none of the displayed or added transitions removes that marker.

5. To formalize the intended construction, require q₁ together with empty stack at input end; alternatively start with bottom marker Z and additionally permit q₁→q₁ labeled ε,Z/ε. The latter is a third added edge and therefore exceeds the literal two-edge request. We report the intended pair without claiming it repairs the original formal specification.

Original paper, page 7