/* * This program illustrates Rice's Theorem, which proves the undecidability * of most properties of programs. Suppose we want to decide if any given * function application F(X) exhibits some behavior B. */ #include using namespace std; bool DoesB (string F, string X) { /* Put your solution of the DoesB problem here */ } void Paradox (string F) { if (DoesB (F, F)) { /* Do the opposite of B */ } else { /* Do B */ } } string paradox = "void Paradox (string F) {" "if (DoesB (F, F)) { /* Do the opposite of B */ }" "else { /* Do B */ }" "}"; // technically paradox has to include the definition of DoesB int main () { Paradox (paradox); return 0; }