Consider the SUCCESS problem that is defined as follows: Input: Program P, nonnegative integer x (an input to program P). Yes/No Question: Does P accept or reject on x? Note that “accept” means P returns yes on the input while “reject” means P returns no on the input. Assume PS is a program that solves SUCCESS. Consider the following incomplete program D: bool main(unsigned int y) { program P = generate(y); if (PS(P,y)) Action A; else Action B; } program generate(unsigned int y); bool PS(program P, unsigned int y); a. What does it mean if PS(P,y) evaluates to true? b. What does it mean if PS(P,y) evaluates to false? c. In order to complete program D, what actions would be appropriate? Choose all those that are applicable among Accept, Reject, Crash, Loop for Action A and Action B respectively: Action A: Action B:
- Consider the SUCCESS problem that is defined as follows:
Input:
Yes/No Question: Does P accept or reject on x?
Note that “accept” means P returns yes on the input while “reject” means P returns no on the input.
Assume PS is a program that solves SUCCESS. Consider the following incomplete program D:
bool main(unsigned int y) {
program P = generate(y);
if (PS(P,y)) Action A; else Action B;
}
program generate(unsigned int y);
bool PS(program P, unsigned int y);
a. What does it mean if PS(P,y) evaluates to true?
b. What does it mean if PS(P,y) evaluates to false?
c. In order to complete program D, what actions would be appropriate?
Choose all those that are applicable among Accept, Reject, Crash, Loop for Action A and Action B respectively:
Action A:
Action B:
d. Justify your answer to part c).
Trending now
This is a popular solution!
Step by step
Solved in 2 steps