November 10, 2025
Learning Objectives for Theoretical Machines
Growth rate comparison
containsGAGA, multiply, and sortWordsPoly captures tractable computation: algorithms with polynomial running time scale reasonably with input size. A problem in Poly can be solved efficiently, making it practical for real-world applications! Wait, can you think of any circumstance in which a Poly algorithm might not be practical?
Poly definition
factor and MCopiesOfCExpo includes intractable problems: algorithms with exponential running time become impractical as input grows. A problem in Expo but not Poly is considered computationally intractable! Wait, is there any case in which we would prefer an Expo over a Poly algorithm? Can you explain why?
Expo definition
Subtle distinctions matter: asking for “all 3-element subsets” versus “all subsets” changes complexity from polynomial to exponential. Also, “shortest path” versus “shortest Hamilton cycle” crosses the Poly/Expo boundary!
Exponential explosion: with 10 elements, All3Sets generates 120 subsets while AllSubsets generates 1024. About the same, right? With 20 elements: 1140 vs over 1 million! The difference becomes astronomical quickly!
All3Sets specification
AllSubsets specification
all3Sets in PythonallSubsets in PythonHamilton cycle constraint is expensive: requiring a path to visit every vertex exactly once transforms a tractable problem into an intractable one. TSP is a famous problem in Expo with no known polynomial algorithm! At least, yet!
TSP problem specification
a,b,3 or b,c,1?TSPPath and ShortestPath problemsTSPPath specification
ShortestPath specification
Exploring complexity class membership that is “obvious”
Understanding the Poly/Expo boundary is crucial: as proofgrammers, we must first prove a problem computable and then recognize which problem variations are tractable and which are not. This guides algorithm design and problem formulation, with small “tweaks” changing tractability!
Poly is the gold standard for efficiency: while not perfect (i.e., some polynomial algorithms are slow), Poly captures the essence of tractable computation. It’s the foundation for understanding computational limits!
Model independence is powerful: whether we analyze algorithms on Turing machines, Python programs, or real computers, Poly remains the same class. This mathematical robustness makes it the right abstraction for tractability!
Understanding Poly and Expo is essential: these complexity classes help proofgrammers reason about computational feasibility and guide algorithm design. Later, we’ll explore NP and the famous “P versus NP” question!
Proofgrammers