/* * 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) does some thing P. */ #include using namespace std; bool DoesP (string F, string X) { /* Put your solution of the DoesP problem here */ } void Q (string F) { if (DoesP (F, F)) { /* Do the opposite of P */ } else { /* Do P */ } } string Qstring = "void Q (string F) {" "if (DoesP (F, F)) { /* Do the opposite of P */ }" "else { /* Do P */ }" "}"; // technically Qstring has to include the definition of DoesP int main () { Q (Qstring); return 0; }