Proofs: Iterative deepening search
These are the human proofs of Iterative deepening search, at full length.
Iterative deepening search returns a path with the fewest actions, and it costs at most b/(b-1) times breadth-first search full
This proof shows: correctness, termination, complexity.
We use the pseudocode of the page and the facts proved for depth-limited search with the check for cycles, for a problem in which each state has finitely many successors.
- (D1) Each run of DEPTH-LIMITED-SEARCH with limit stops.
- (D2) It returns a path if and only if some goal has a path of at most actions from , and then it returns such a path.
- (D3) If it returns failure, no goal can be reached from .
- (D4) If it returns cutoff, some path from that repeats no state has more than actions.
Let be the least number of actions of a path from to a goal, with when no goal can be reached.
Theorem 1 (the result has the fewest actions). If the search returns a path, the path goes from to a goal and has exactly actions.
Proof. Let the loop return a path in the run with limit . By (D2) the path goes from to a goal and has at most actions, so . If , the run with limit came earlier. By (D2) it returned a path, and line L3 returned it, so the loop never reached . Hence , and the path has at most actions. No path to a goal has fewer than actions, so it has exactly .
Theorem 2 (completeness). If a goal can be reached, the search returns a path after the runs with the limits .
Proof. For , no goal has a path of at most actions, so by (D2) the run does not return a path, and by (D3) it does not return failure, because a goal can be reached. So it returns cutoff, and the loop goes on. By (D1) each run stops. The run with returns a path by (D2).
Theorem 3 (failure). If the search returns failure, no goal can be reached. If the state space reachable from is finite and contains no goal, the search returns failure.
Proof. Failure is returned at line L3 only when a run returns failure, and (D3) applies. For the second part, let be the largest number of actions of a path from that repeats no state. It is finite, because a finite space has finitely many such paths. The run with cannot return a path, since no goal is reachable, and it cannot return cutoff by (D4). So it returns failure, and by (D1) each earlier run stops.
Theorem 4 (nodes generated). In a tree in which each node has at most children and the search stops in the run with limit , the search generates fewer than nodes, where .
Proof. A run with limit generates only nodes of depth 1 to , at most of depth , so at most nodes. The total is at most . For ,
because is the same as . So