Exercise · Volume 1 · 1.1-9
Exercise 1.1-9
not stated yet in Lean solution written
| Rating | M30 |
|---|---|
| Markers | M (mathematical), recommended |
| Kind | Informal: the exercise has no formal statement, so Lean does not state it from the written solution |
| Section | Section 1.1 of Volume 1. Companion chapter: Algorithms |
The task
Give a set-theoretic definition of "the computational method simulates the method ", such that each computation of appears as a part of a computation of , which may be longer and may keep more information.
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
Think of three maps: one that sends an input of to an input of , one that forgets the extra information of a state of , and one that says how many steps of do one step of .
Hint 2
The forgetting map must commute with the steps, up to the number of steps, and it must send outputs to outputs and non-outputs to non-outputs.
Solution
Show the solution
Let and be as in Section 1.1. Say that simulates if there are three functions
- (the coding of the input),
- (the forgetting of the extra information),
- (the number of steps of for one step of ),
such that these three conditions hold:
- for each .
- for each that is reachable from some . Here means applications of .
- if and only if , for each reachable .
Why this works. Take with computation in . Put and . Then by condition 1. If , condition 2 gives . So by induction for each . The states lie on the computation of that starts at , so passes through states that turns into , with steps from to . By condition 3, exactly when . Thus stops from exactly when reaches an output state from , and then of the output of is the output of . An output state of is fixed by , so a stop of is not missed between and .
An example. Let be a method with the states of Euclid's algorithm. Let have the states with , so that each state keeps the first input. Let , and let the inputs and outputs be those triples whose is an input or an output of . Take for the input , take and . The three conditions hold. A second simulation does the remainder of step E1 by repeated subtraction, and then is the number of subtractions plus the steps of E2 and E3 for that pass. The first example shows why must go from to . A map from to cannot exist, since a state of has forgotten the original input and so it cannot decide the extra components.
Other facts. If simulates with maps , then simulates with and . For the step count, start at and let do simulated steps of , each of steps of . Then is the sum of these values. So the relation is transitive. If the function is bounded, the simulation is slower by at most a fixed factor. Simulation with a bounded is a stronger relation, and it is closer to the idea that two methods are the same algorithm.
Remarks
This is the idea behind the statement that a program implements an algorithm. The Lean model TAOCP.CompMethod of the C1 chapter holds the quadruple , so the definition above can be written in it with the maps , and .
This solution is checked, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.