For a string s ∈ {0, 1} let denote the number represented by in the binary * s2 s numeral system. For example 1110 in binary has a value of 14 . Consider the language: L = {u#w | u,w ∈ {0, 1} , u } , * 2 + 1 = w2 meaning it contains all strings u#w such that u + 1 = w holds true in the binary system. For example, 1010#1011 ∈ L and 0011#100 ∈ L . Construct a TM that decides this language. Provide an implementation-level definition of your TM.
Implementation is simple. Given string u#w, we will add 1 to string u( which can be done by flipping rightmost bit from 0 to 1 if rightmost bit is 0 and if rightmost bit is 1 then flip it to 0 and move left and do this same till 0 is not encountered where we will flip 0 to 1). One this is done, then we do bit wise comparison of string u and w from right to left to check if they are equal. If they are equal then accept else reject.
I am assuming that in string u#w , string w does not contains unnecessary 0s at the left end.
//remove useless 0 by putting blank B from the leftmost end of string u, like if u= 0011, then it will make u = 11.
//This happen if u is empty i.e. 0 and hence we will go to q2 to add 1 into it
//Now go to rightmost end of string u
//Move one step left to reach end of string u
//If last bit is 0 then make it 1 and move right
//else make 1 to 0 till 0 is not encountered
//If we reach to blank( this happen if u = 11) then replace blank by 1 and move right
Now that reaching at state q3 means out task of adding 1 to u has been done. Now we will start comparing input u#w which must be equal after 1 has been added into u.
From state q3 we will move to rightmost end of entire string u#w i.e. at blank position
//X is also a symbol
//If q3 reaches blank then move leftward
//X is special symbol which we clarify
//If leftmost end contains 0 then turn it to X and go to state q50
//If leftmost end contains 1 then turn it to X and go to state q51
//simply move to left
Now string u has came
Remember that state is q60 or q61 depends on what was rightmost input in string w that we are matching with in string u
//This means strings are not matched, then reject string and halt
//This means strings are not matched, then reject string and halt
//This means string are matched till now and go to q3 to perform matching of remaining string
// Strings are matched till now
//This means entire string w is matched, now we just need to see if entire string in u is also matched or not
//Simply move left
//this means some input is still there in string u and hence not matched, so reject
//If q7 reached blank then entire string is matched and hence accept
Please comment for any clarification.
For a string s ∈ {0, 1} let denote the number represented by in the binary * s2 s numeral system. For example 1110 in binary has a value of 14 . Consider the language: L = {u#w | u,w ∈ {0, 1} , u } ,...
1. For a string s e 0, î, 2;" and a symbol d e { 0,1,2} let #(s, d) denote the number of times d appears in s. For example, #(0120012, 0)-3. Consider the language: {0, 1, 2. #(11,0) L- #(w, 1), #(11,2) #(w, 2) } . {utfw #(w, 0), #(11, 1) u, w, e For example, 2021 02#0011222 Construct a TM that decides this language. Provide a formal definition of your TM 1. For a string s e 0,...
Problem 3.3: For a string x € {0,1}*, let af denote the string obtained by changing all 0's to l's and all l's to O's in x. Given a language L over the alphabet {0,1}, define FLIP-SUBSTR(L) = {uvFw: Uvw E L, U, V, w € {0, 1}*}. Prove that if L is regular, then FLIP-SUBSTR(L) is regular. (For example, (1011)F = 0100. If 1011011 e L, then 1000111 = 10(110) F11 € FLIP-SUBSTR(L). For another example, FLIP-SUBSTR(0*1*) = 0*1*0*1*.)...