Discrete Mathematics with Applications 4th Edition

Published by Cengage Learning
ISBN 10: 0-49539-132-8
ISBN 13: 978-0-49539-132-6

Chapter 6 - Set Theory - Exercise Set 6.4 - Page 382: 21

Answer

No such program can exist. Attempting to write one leads to a logical contradiction. This is a classic result related to **self-reference** in computability theory — a key idea behind **Turing’s proof** of the **undecidability of the Halting Problem**.

Work Step by Step

### Problem: **Can there exist a computer program that outputs a list of all programs that do not list themselves in their output?** --- ### ✅ Short Answer: \[ \boxed{\text{No, such a program cannot exist.}} \] --- ### 🧠 Explanation — This is a version of the **Richard/Berry Paradox** and **Russell's Paradox** applied to computer programs. Let’s suppose such a program **P** exists. Let’s say: - P outputs a list of all computer programs that do **not** list themselves in their output. Now ask: > **Does P list itself in its own output?** --- ### ❗ Case 1: P **does** list itself. Then P is **a program that lists itself**, so it **should not** be in the list (because it’s supposed to list only programs that **do not** list themselves). **Contradiction.** --- ### ❗ Case 2: P **does not** list itself. Then P is a program that **does not list itself**, so it **should be** in the list. But it doesn’t list itself. **Contradiction again.** --- ### 🔁 This creates a **logical paradox** — like Russell's paradox for sets or the "liar paradox".
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.