Exercise 3: "Can Compute the Same Thing" vs. "Equally Easy to Reason About" — Possible Solution ==================================================================== WHAT "CAN COMPUTE THE SAME THING" MEANS ------------------------------ This is a claim about raw capability - whether a given control-flow mechanism is powerful enough to express any possible algorithm. This chapter's own verified example demonstrated this directly: the structured version and the goto-simulated version both computed exactly 110 for the same task, confirming that structured programming loses none of goto's raw computational power. This is exactly what the Bohm-Jacopini theorem formally guarantees - the three structured constructs are computationally sufficient for anything a goto-based program could compute. WHAT "EQUALLY EASY TO REASON ABOUT" MEANS ------------------------------ This is a completely different claim - not about what a program CAN express, but about how difficult it is for a human reader to correctly predict or verify what a given piece of code actually does, especially as the program grows larger. This chapter's own explanation identified the specific mechanical reason structured code is easier to reason about: sequence, selection, and iteration each have exactly one entry point and one exit point, so a reader can understand one block completely without needing to track every possible place execution might jump in from or jump out to elsewhere in the program - unlike goto, where any labeled line could be a jump target from anywhere else in the entire program. WHY THESE ARE GENUINELY DIFFERENT PROPERTIES ------------------------------ A tool can have exactly the same raw capability as another tool while being dramatically harder to use safely and correctly - this chapter's own goto-simulated function, even though it computed the correct answer, required an interpreter loop with explicit label-checking logic that is meaningfully harder to read at a glance than the structured version's simple while/if combination, despite both being short, correct, and verified to agree. WHY A COURSE ON ALGORITHMIC PROBLEM-SOLVING CARES MORE ABOUT THE SECOND PROPERTY ------------------------------ This course's entire purpose, established back in Chapter 1, is producing algorithm designs that can be communicated precisely and correctly translated by someone else (or by the same person, later). An algorithm that computes the right answer but that a reader cannot easily verify or reason about defeats that purpose just as much as an algorithm that produces the wrong answer - the whole value of pseudocode as a communication tool depends on the reader being able to follow the logic confidently, which is exactly the property structured programming protects and goto does not. WHY THIS WORKS AS AN ANSWER ------------------------------ The answer defines both properties precisely and distinctly rather than treating them as roughly the same idea, grounds each definition in this chapter's own specific verified example and explanation, and connects the conclusion back to this course's own stated purpose from Chapter 1 rather than treating the preference for structured programming as an arbitrary stylistic rule.