Definition
Exactly One of Two Reachable Code Problem
The exactly one of two reachable code problem is a decision problem that asks, for a given program , two input strings , and a label , whether the code with label is executed for exactly one of the two inputs.
Instance: program , strings , label
Question: Does execute the line with label on exactly one of the inputs and ?
Reduction from the Co-Halting Problem
Non-semi-decidability via reduction
We reduce the co-halting problem with non-empty input strings to the exactly one of two reachable code problem.
Let be an instance of the co-halting problem with . Construct a new program and choose a label that does not occur in :
Void Π'(Program Π, String I) if (I ≠ ε) { call Π(I); } L: /* no-op */ return;Set
Then:
- on input , the condition is false, so reaches ;
- on input , the program executes first, so is reached if and only if halts on .
Hence, is reached for exactly one of the two inputs and if and only if does not halt on .
Therefore, a recogniser for the exactly one of two reachable code problem would recognise the co-halting problem with non-empty inputs. Since the co-halting problem with non-empty inputs is not semi-decidable, the exactly one of two reachable code problem is not semi-decidable.
Complement Relation
Co-problem transfer
Based on the reduction above, for any two decision problems and , the following equivalence holds:
Thus, from the reduction
one can use the following construction:
Void Π'(Program Π, String I) if (I = ε) { return; } call Π(I); L: /* no-op */ return;Set
Then the label is reached on only if the input is non-empty, and it is reached on if and only if halts on .
Therefore,
Since the co-halting problem with non-empty inputs is not semi-decidable, the co-exactly one of two reachable code problem is not semi-decidable.