The Acceptance problem is a decision problem asks if a given machine model can accept a formula. It is decidable for DFAs and NFAs
Problem Specification(s)
Machine Models
Generative Models
Given a CFG
Decidability
The decidability of the problem requires a restructuring. Let be a language given by the TM encodings of and
Then, we need to check if is T-decidable.
DFA Acceptance Problem is decidable ^theorem-dfa
That is,
A_{DFA} = { \langle M,w \rangle \ \vert \ \text{ is a DFA that accepts } } \text{ is T-decidable}
>[!example]- Proof > The following is a proof by [TM simulation](Turing%20Machine%20Simulation.md) > Construct a [multi-tape Turing machine](Multi-tape%20Turing%20Machine.md), $T$, with 2 tapes (1 input and 1 work tape): > > * For any string $s$, first check if $s$ is a valid encoding of the form $\langle M,w \rangle$ and reject if not. > * *Simulate* $M$ using $T$ by: > * Write out the current configuration of $M$ using the work tape. This should record the current state of $M$ and the tape head 'for $M$' (how many characters has $M$ processed). > * Initially this work tape would have $q_{0}0$. Then $q_{1}1$ (assuming in the DFA $M$, the first character of $w$ transitions it to $q_{1}$), etc. > * Use the transition function of $M$ to update the current configuration on the work tape. > * At every iteration, the counter of the tape head will always increase by one > * Eventually, the work tape will have $q_{k} n$ where $n$ is the size of $w$. If $q_{k} \in F_{M}$ (the accept states of $M$), accept. Else, reject.
NFA Acceptance Problem is decidable ^theorem-nfa
That is,
A_{NFA} = { \langle N,w \rangle \ \vert \ \text{ is a NFA that accepts } } \text{ is T-decidable}
>[!example]- Proof > Construct a [multi-tape Turing machine](Multi-tape%20Turing%20Machine.md), $T$, with 2 tapes (1 input and 1 work tape): >We can solve this problem by using a [proof by reduction](Proof%20By%20Reduction.md) to reduce this to the DFA acceptance problem (which is decidable). > >* Again, first pre-process the string to check if it is of the correct form $\langle N,w \rangle$. >* We know there exists an algorithm that converts a [NFA to a DFA](Determinisation%20Of%20NFAs.md). By the [Church-Turing Thesis](Church-Turing%20Thesis.md), this means it can be done on a TM $T$. So we run $T$ first, ensuring we have the input string now in the form $\langle D,w \rangle$ where $D$ is an equivalent DFA. >* Then we use the same procedure as the [DFA version](#^theorem-dfa)
TM Acceptance Problem is undecidable ^theorem-tm
That is:
A_{TM} = { \langle T,w \rangle \ \vert \ \text{ is a TM that accepts } } \text{ is recognisable, but not decidable}
This proof requires the assumption that some languages are unrecognisable. Let be the unrecognisable language constructed previously. Assume that is decidable. Then there exists a Turing machine, that is a decider for it. For any , we have:
Now construct a new Turing machine that simulates , called :
- only takes in one argument, that being a machine code, .
- then simulates on , that is, it uses to check if accepts .
- If accepts, rejects, and vice versa (this makes ) a decider as well.
- So we have:
Then the language of is precisely the same as :
Which is proven to be unrecognisable. Thus, if we tried to feed in to , because is unrecognisable, cannot decide it and thus cannot be a decider for the TM acceptance problem.
Reductions
R1: The TM acceptance problem reduces to the Halting Problem
Proof reduction, we need to show that can construct a decider for given a decider for . Let be the decider for (it takes in and decides if halts on )
Recall that to prove this
We can construct a new decider for as follows:
- takes in the input
- First, it simulates on :
- If rejects, then does not halt on (it runs forever). Obviously this means that cannot accept . So rejects as well.
- If accepts (and being a decider, it can only accept or reject), then always halts on .
- Then, it is now ‘safe’ to simulate on (as we know terminates eventually)
- So accepts if accepts
- And rejects if rejects
Since always halts (is a decider) and decides if accepts , we have constructed a decider for and hence have proved the reduction.
R2: The TM acceptance problem reduces to the TM Emptiness Problem
Proof reduction, we need to show that can construct a decider for given a decider for . Let be the decider for (it takes in and decides if rejects every input)
Recall that to prove this
We can construct a new decider for as follows:
- takes in
- Inside , we construct a new Turing machine that takes in a string simulates independent of input:
- Note that does not depend on . It only depends on and which are ‘fixed’. Meaning, if accepts , then accepts everything. If rejects , rejects everything. Thus:
- Thus:
- Then, we run the emptiness decider on . Since accepts when , this means that either rejects or runs forever (in either case, it does not accept ). If rejects, then so accepts
Thus, we have created a decider (since is a decider) that decides if accepts . So we have proven the reduction.
Applications
- If the TM acceptance problem, was decidable, it would imply that satisfiability in predicate logic would be decidable (since the decider could be converted into an algorithm)
- The TM acceptance problem, is useful in static code analysis, as it can determine if a given program satisfies its specifications (accepts some input strings) without actually running the program. It also helps identify security vulnerabilities and runtime errors.
- This has critical applications in defence and medicine
- Since the DFA acceptance problem, is decidable, any program that can be modelled as an equivalent DFA can be ‘checked’ by a Turing machine.