Algorithm Search⌘K

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 ℓ\ell stops.
  • (D2) It returns a path if and only if some goal has a path of at most ℓ\ell actions from s0s_0, and then it returns such a path.
  • (D3) If it returns failure, no goal can be reached from s0s_0.
  • (D4) If it returns cutoff, some path from s0s_0 that repeats no state has more than ℓ\ell actions.

Let dd be the least number of actions of a path from s0s_0 to a goal, with d=∞d = \infty when no goal can be reached.

Theorem 1 (the result has the fewest actions). If the search returns a path, the path goes from s0s_0 to a goal and has exactly dd actions.

Proof. Let the loop return a path in the run with limit ℓ\ell. By (D2) the path goes from s0s_0 to a goal and has at most ℓ\ell actions, so d≤ℓd \le \ell. If d<ℓd < \ell, the run with limit dd came earlier. By (D2) it returned a path, and line L3 returned it, so the loop never reached ℓ\ell. Hence d=ℓd = \ell, and the path has at most dd actions. No path to a goal has fewer than dd actions, so it has exactly dd. □\square

Theorem 2 (completeness). If a goal can be reached, the search returns a path after the runs with the limits 0,1,…,d0, 1, \ldots, d.

Proof. For ℓ<d\ell < d, no goal has a path of at most ℓ\ell 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 ℓ=d\ell = d returns a path by (D2). □\square

Theorem 3 (failure). If the search returns failure, no goal can be reached. If the state space reachable from s0s_0 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 LL be the largest number of actions of a path from s0s_0 that repeats no state. It is finite, because a finite space has finitely many such paths. The run with ℓ=L\ell = L 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. □\square

Theorem 4 (nodes generated). In a tree in which each node has at most b≥2b \ge 2 children and the search stops in the run with limit dd, the search generates fewer than bb−1Sd\frac{b}{b-1} S_d nodes, where Sℓ=∑i=1ℓbiS_\ell = \sum_{i=1}^{\ell} b^i.

Proof. A run with limit ℓ\ell generates only nodes of depth 1 to ℓ\ell, at most bib^i of depth ii, so at most SℓS_\ell nodes. The total is at most ∑ℓ=1dSℓ\sum_{\ell=1}^{d} S_\ell. For 1≤ℓ≤d1 \le \ell \le d,

SℓSd=bℓ−1bd−1≤bℓbd,\frac{S_\ell}{S_d} = \frac{b^\ell - 1}{b^d - 1} \le \frac{b^\ell}{b^d},

because (bℓ−1)bd≤(bd−1)bℓ(b^\ell - 1) b^d \le (b^d - 1) b^\ell is the same as bℓ≤bdb^\ell \le b^d. So

∑ℓ=1dSℓ≤Sd∑ℓ=1dbℓ−d=Sd∑j=0d−1b−j<Sd⋅11−1/b=bb−1Sd.■\sum_{\ell=1}^{d} S_\ell \le S_d \sum_{\ell=1}^{d} b^{\ell - d} = S_d \sum_{j=0}^{d-1} b^{-j} < S_d \cdot \frac{1}{1 - 1/b} = \frac{b}{b-1} S_d. \qquad \blacksquare

Back to Iterative deepening search