Given an instance of the halting problem, construct an instance of the correctness problem, where and is defined as follows:
procedure Π': Input: input string I1, output string I2 Output: I2 if Π halts on I1, otherwise no output simulate Π on input I1 if Π halts then return I2 else loop forever
Completeness ( )
If halts on input , then the constructed program also halts on input and outputs . Hence is a positive instance of the correctness problem.
Soundness ( )
If is a positive instance of the correctness problem, then halts on input and outputs . By construction, can only output after has halted on input . Hence is a positive instance of the halting problem.