Fall 2023: CSE 435 10/01/2024 Name: Formal Languages and Automata Final Exam Akdeniz University Duration: 90 minutes Student No: P1 [20 points] Let L = {0m w1n | where m, n ≥ 0 and w ∈ {0, 1}∗ and w contains at most m 0s and at most n 1s }. For example, 0011000111 ∈ / L because m can be at most 2 but the rest has more than two 0s. However, 001110111 ∈ L because when m = 2 and n = 3, the middle (w) becomes 1110 has no more than 2 zeros and no more than 3 ones, which obeys the pattern of L. (a) Mark the strings in L: ⃝ 00101011 ⃝ 000110001 ⃝ 010101 ⃝ 1 ⃝ 10 ⃝ 0001 ⃝ ε (b) Prove that L is not context free. P2 [20 points] Let a TM variant RubberBandTM be defined as a Turing machine that starts with a circular tape as long as the input and when the head moves right at the end of the tape it goes to the first cell, and there is also an insert operation where the head can insert a new cell between the cell under it and the next one. Prove that RubberBandTM is equivalently powerful as an ordinary TM. 10 01 0 100 0111 00 0101 P3 [20 points] Let DOUBLES DFA = {⟨D⟩ | D is a DFA that accepts w0 whenever it accepts w}. (So for example, if a DFA D1 accepts 1010 but not 10100, then D1 ∈DOUBLES / DFA ) Prove that DOUBLES DFA is decidable. P4 [20 points] Let DOUBLES TM = {⟨M ⟩ | M is a TM that accepts w0 whenever it accepts w}. Prove that DOUBLES TM is undecidable. P5 [20 points] EQUAL-SUM = {⟨S1 , S2 ⟩ | S1 = {x1 , x2 , . . . , xk } and S2 = {y1 , y2 , . . . , yl }S, there exist P a non-empty P subset of S1 and a non-empty subset of S2 having equal sum}. i.e., ∃I ⊆ S1 , J ⊆ S2 : i∈I xi = j∈J yi }. For example, ⟨{1, 3, 8}{−2, 6, 7}⟩ ∈EQUAL-SUM because I = {1, 3} and J = {−2, 6} both add up to 4. Prove that EQUAL-SUM is NP-complete. [Hint 1: Consider using the fact that SUBSET-SUM is NP-complete. SUBSET-SUM = {⟨S, t⟩ | S = P {x1 , x2 , . . . , xk } and for some {y1 , y2 , . . . , yl } ⊆ S, we have yi = t }.]