Professional Documents
Culture Documents
330 HW 3-Merged
330 HW 3-Merged
Any word in the intersection is already accepted by X, but not all words in C are accepted by
C ∩ R, only the words that also are accepted by X.
Take
C ∩ R → C ∩ (R ∪ C )
C ∩ (R ∪ C ) = C
So C = D
To build any PDA for C ∩ R, just take the cross product of their tuples
4.
For an input w:
FORMAT CHECK
If char at q0 is ‘1’, replace with ’S’ and scan right until ‘<‘
If a blank is encountered before ‘<‘, reject w (rejects empty string and strings missing ‘<‘)
Move right one cell, if the char is ‘1’, replace with ’S’
MAIN LOOP
If cell contains ‘1’, replace with ’S’ and scan left until ’<’ appears
If cell contains ‘1’, replace with ’S’ and scan right until ‘<‘ appears
CANDIDATE
If cell contains ‘0’, replace with ’S’, then scan right until ‘<‘, then scan until ‘1’ or
‘0’ appears, then jump to MAIN LOOP
sREJECT
If ‘1’ or ‘0’ appears, scan right until ‘0’, ‘1’, or ‘_’ appears
ACCEPT
REJECT
My Turing machine works by going back and forth, starting from the right binary, and
checking that the number (1 or 0) at each of the binary numbers’ indices are equal.
If the numbers, or number of indices are unequal, the Turing machine accepts or rejects
based on the appropriate case.
It does this using ’S’ to keep track of numbers that have been verified as equal, and
moving down the list.
If a ‘_’ or ‘<‘ appears, it means the strings are of unequal length and rejects or accepts
based on the case
5.
∑
Create an isomorphism between single tape TM and DFA defined by (Q, , δ, q0,F)
∑
<—> the alphabet
F <—> the symbol ‘$’, written outside the input portion, one cell after the first ‘_’
If the PDA had only one stack, pushing and popping from the stack could be replicated
on the TM by (on a portion outside the input) either shifting each cell one to the left
(losing the first cell), or shifting one right, and ‘popping’ the input into the first cell.
If a PDA had two stacks, then the PDA could mimic pushing and popping in two
directions, like the TM, scans in two directions.
You could follow the arrows of the PDA (acting as the TM’s input), and use the two
stacks like the TM uses memory.