![]() |
![]() |
|
accept(or, starts with the
acceptif you want multiple accept-states) to indicate acceptance. Finishing in any other state will be interpreted as rejecting the input. (The tape-contents are irrelevent.)
Note: This is similar to our example of duplicating a string (u to uu) except that the duplicated-bits are all spaces (and then followed by '$').
Note: We use the fact that this machine exists in passing, in the Ch17b slides, writing a non-deterministic decider for composite numbers.
To clarify: The input alphabet for this language is Σ={-,=,1}, and (for example) 111-11111=1∈ L. (That is, are checking just the syntax of unary-subtraction.)
note: This definition allows any/all of x,y,z can have zero 1s.
yaml gotcha: You must include single-quotes around -. (However they are not needed for =.)
Note: Start with a copy of your answer to the previous problem. (Be sure to save that one first!)
tip:If you are decrementing both x and y: Remove a 1 from y before finding a corresponding 1 in x. (That way, in case y has reached zero (ε), you don't need to go back to un-change a decrement to x.)
Furthermore: My solution removed 1s from the right edge of y and z (but the left edge of x). I think this might help keep a solution slightly simpler?
Note: My solution used 4 phases, and each phase had 4 states on average. (However, there is a solution with as few as 9 states.)
Suppose we have a deterministic TM M = (K,Σ,δ,s,Γ,{n,y}),
and q1≠s is one of the states in K
(where as usual: n
and y
are reject and accept states respectively,
␣
indicates the blank/space character,
and machine's read-head initially starts on the space preceding its input).
Consider the logic formulas:
(a) ∀ γ ∈ Γ, δ(s,γ) = (q1,γ,→),
and
(b) ∀ k ∈ K ∖ {s}, δ(k,␣) = (yes,␣,←)
Recall that ∖
is set-subtraction, and γ
is a lower-case gamma.
This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |