Read this lesson as text
Program Analysis Limits
Mathematical Logic · Axiom Academy
REAL WORLD Program Analysis Limits Why perfect virus detection is impossible and what we can do about it The Impossible Dream: Perfect Virus Detection Imagine you're developing antivirus software. Your goal: detect every possible virus before it can harm your users. You want to write a function that looks at any program and determines with 100% accuracy whether it's malicious. This seems like a reasonable goal. After all, we have sophisticated static analysis tools, machine learning, and decades of security research. Surely we can build a perfect detector? This isn't a limitation of current technology—it's a fundamental consequence of computability theory. The Halting Problem: The Root of Impossibility To understand why perfect virus detection is impossible, we need to understand the Halting Problem , one of the most famous results in computer science. Can we write a program that determines whether any given program will eventually halt (finish) or run forever? Turing's Answer (1936): No. Such a program cannot exist. Suppose such a program exists. Then we could write: What happens if we run diagonalize(diagonalize)? Think about it: Does diagonalize halt when given itself as input? Rice's Theorem: The Death of Perfect Analysis The Halting Problem is just the beginning. Rice's Theorem (1951) generalizes this impossibility to essentially every interesting property you might want to check about programs.
This is the written version of the interactive lesson above. See the full Mathematical Logic course.